mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Merge pull request #1850 from nextcloud/dependabot/gradle/net.zetetic-android-database-sqlcipher-4.5.1
Bump android-database-sqlcipher from 3.5.9 to 4.5.1
This commit is contained in:
commit
db5ba9763f
@ -230,7 +230,7 @@ dependencies {
|
|||||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||||
implementation 'io.requery:requery:1.6.1'
|
implementation 'io.requery:requery:1.6.1'
|
||||||
implementation 'io.requery:requery-android:1.6.1'
|
implementation 'io.requery:requery-android:1.6.1'
|
||||||
implementation 'net.zetetic:android-database-sqlcipher:3.5.9'
|
implementation 'net.zetetic:android-database-sqlcipher:4.5.1'
|
||||||
kapt 'io.requery:requery-processor:1.6.1'
|
kapt 'io.requery:requery-processor:1.6.1'
|
||||||
implementation "org.parceler:parceler-api:$parcelerVersion"
|
implementation "org.parceler:parceler-api:$parcelerVersion"
|
||||||
implementation 'net.orange-box.storebox:storebox-lib:1.4.0'
|
implementation 'net.orange-box.storebox:storebox-lib:1.4.0'
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
*
|
* Nextcloud Talk application
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
@ -9,18 +8,18 @@
|
|||||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* at your option) any later version.
|
* at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.application
|
package com.nextcloud.talk.application
|
||||||
|
|
||||||
@ -51,6 +50,7 @@ import com.facebook.cache.disk.DiskCacheConfig
|
|||||||
import com.facebook.drawee.backends.pipeline.Fresco
|
import com.facebook.drawee.backends.pipeline.Fresco
|
||||||
import com.facebook.imagepipeline.core.ImagePipelineConfig
|
import com.facebook.imagepipeline.core.ImagePipelineConfig
|
||||||
import com.nextcloud.talk.BuildConfig
|
import com.nextcloud.talk.BuildConfig
|
||||||
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils
|
||||||
import com.nextcloud.talk.dagger.modules.BusModule
|
import com.nextcloud.talk.dagger.modules.BusModule
|
||||||
import com.nextcloud.talk.dagger.modules.ContextModule
|
import com.nextcloud.talk.dagger.modules.ContextModule
|
||||||
@ -61,6 +61,7 @@ import com.nextcloud.talk.dagger.modules.ViewModelModule
|
|||||||
import com.nextcloud.talk.jobs.AccountRemovalWorker
|
import com.nextcloud.talk.jobs.AccountRemovalWorker
|
||||||
import com.nextcloud.talk.jobs.CapabilitiesWorker
|
import com.nextcloud.talk.jobs.CapabilitiesWorker
|
||||||
import com.nextcloud.talk.jobs.SignalingSettingsWorker
|
import com.nextcloud.talk.jobs.SignalingSettingsWorker
|
||||||
|
import com.nextcloud.talk.models.database.Models
|
||||||
import com.nextcloud.talk.utils.ClosedInterfaceImpl
|
import com.nextcloud.talk.utils.ClosedInterfaceImpl
|
||||||
import com.nextcloud.talk.utils.DeviceUtils
|
import com.nextcloud.talk.utils.DeviceUtils
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
@ -74,12 +75,17 @@ import com.vanniktech.emoji.EmojiManager
|
|||||||
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
||||||
import de.cotech.hw.SecurityKeyManager
|
import de.cotech.hw.SecurityKeyManager
|
||||||
import de.cotech.hw.SecurityKeyManagerConfig
|
import de.cotech.hw.SecurityKeyManagerConfig
|
||||||
|
import io.requery.android.sqlcipher.SqlCipherDatabaseSource
|
||||||
|
import net.sqlcipher.database.SQLiteDatabase
|
||||||
|
import net.sqlcipher.database.SQLiteDatabaseHook
|
||||||
|
import net.sqlcipher.database.SQLiteOpenHelper
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.conscrypt.Conscrypt
|
import org.conscrypt.Conscrypt
|
||||||
import org.webrtc.PeerConnectionFactory
|
import org.webrtc.PeerConnectionFactory
|
||||||
import org.webrtc.voiceengine.WebRtcAudioManager
|
import org.webrtc.voiceengine.WebRtcAudioManager
|
||||||
import org.webrtc.voiceengine.WebRtcAudioUtils
|
import org.webrtc.voiceengine.WebRtcAudioUtils
|
||||||
import java.security.Security
|
import java.security.Security
|
||||||
|
import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
@ -113,6 +119,17 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
|
|||||||
lateinit var okHttpClient: OkHttpClient
|
lateinit var okHttpClient: OkHttpClient
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
val hook: SQLiteDatabaseHook = object : SQLiteDatabaseHook {
|
||||||
|
override fun preKey(database: SQLiteDatabase) {
|
||||||
|
// unused atm
|
||||||
|
}
|
||||||
|
override fun postKey(database: SQLiteDatabase) {
|
||||||
|
Log.i("TalkApplication", "DB cipher_migrate START")
|
||||||
|
database.rawExecSQL("PRAGMA cipher_migrate;")
|
||||||
|
Log.i("TalkApplication", "DB cipher_migrate END")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//region private methods
|
//region private methods
|
||||||
private fun initializeWebRtc() {
|
private fun initializeWebRtc() {
|
||||||
try {
|
try {
|
||||||
@ -153,6 +170,8 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
|
|||||||
|
|
||||||
componentApplication.inject(this)
|
componentApplication.inject(this)
|
||||||
|
|
||||||
|
checkAndUpgradeDbCypher()
|
||||||
|
|
||||||
Coil.setImageLoader(buildDefaultImageLoader())
|
Coil.setImageLoader(buildDefaultImageLoader())
|
||||||
setAppTheme(appPreferences.theme)
|
setAppTheme(appPreferences.theme)
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
@ -241,10 +260,52 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
|
|||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkAndUpgradeDbCypher() {
|
||||||
|
if (appPreferences.isDbCypherToUpgrade) {
|
||||||
|
val database = object : SqlCipherDatabaseSource(
|
||||||
|
this,
|
||||||
|
Models.DEFAULT,
|
||||||
|
this
|
||||||
|
.resources
|
||||||
|
.getString(R.string.nc_app_product_name)
|
||||||
|
.lowercase(Locale.getDefault())
|
||||||
|
.replace(" ", "_")
|
||||||
|
.trim { it <= ' ' } +
|
||||||
|
".sqlite",
|
||||||
|
this.getString(R.string.nc_talk_database_encryption_key),
|
||||||
|
DatabaseModule.DB_VERSION
|
||||||
|
) {
|
||||||
|
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
checkAndUpdateCipherMigrationStatus(newVersion, appPreferences)
|
||||||
|
super.onUpgrade(db, oldVersion, newVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
val field = SQLiteOpenHelper::class.java.getDeclaredField("mHook")
|
||||||
|
field.isAccessible = true
|
||||||
|
field.set(database, hook)
|
||||||
|
} catch (e: NoSuchFieldException) {
|
||||||
|
Log.e("SqlCipherDatabaseSource", "Error accessing mHook field")
|
||||||
|
} catch (e: IllegalAccessException) {
|
||||||
|
Log.e("SqlCipherDatabaseSource", "Error setting mHook field")
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAndUpdateCipherMigrationStatus(database.writableDatabase.version, appPreferences)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkAndUpdateCipherMigrationStatus(version: Int, appPreferences: AppPreferences) {
|
||||||
|
if (version >= CIPHER_V4_MIGRATION && appPreferences.isDbCypherToUpgrade) {
|
||||||
|
appPreferences.isDbCypherToUpgrade = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = NextcloudTalkApplication::class.java.simpleName
|
private val TAG = NextcloudTalkApplication::class.java.simpleName
|
||||||
const val FIFTY_PERCENT = 0.5
|
const val FIFTY_PERCENT = 0.5
|
||||||
const val HALF_DAY: Long = 12
|
const val HALF_DAY: Long = 12
|
||||||
|
const val CIPHER_V4_MIGRATION: Int = 7
|
||||||
//region Singleton
|
//region Singleton
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* Nextcloud Talk application
|
* @author Andy Scherzinger
|
||||||
|
* @author Mario Danic
|
||||||
|
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
|
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||||
*
|
*
|
||||||
* @author Mario Danic
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is distributed in the hope that it will be useful,
|
||||||
* it under the terms of the GNU General Public License as published by
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* at your option) any later version.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* You should have received a copy of the GNU General Public License
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.dagger.modules;
|
package com.nextcloud.talk.dagger.modules;
|
||||||
|
|
||||||
@ -39,28 +40,38 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
@Module
|
@Module
|
||||||
public class DatabaseModule {
|
public class DatabaseModule {
|
||||||
|
public static final int DB_VERSION = 7;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public SqlCipherDatabaseSource provideSqlCipherDatabaseSource(@NonNull final Context context) {
|
public SqlCipherDatabaseSource provideSqlCipherDatabaseSource(@NonNull final Context context) {
|
||||||
return new SqlCipherDatabaseSource(context, Models.DEFAULT,
|
return new SqlCipherDatabaseSource(
|
||||||
context.getResources().getString(R.string.nc_app_product_name).toLowerCase()
|
context,
|
||||||
.replace(" ", "_").trim() + ".sqlite",
|
Models.DEFAULT,
|
||||||
context.getString(R.string.nc_talk_database_encryption_key), 6);
|
context
|
||||||
|
.getResources()
|
||||||
|
.getString(R.string.nc_app_product_name)
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(" ", "_")
|
||||||
|
.trim()
|
||||||
|
+ ".sqlite",
|
||||||
|
context.getString(R.string.nc_talk_database_encryption_key),
|
||||||
|
DB_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public ReactiveEntityStore<Persistable> provideDataStore(@NonNull final SqlCipherDatabaseSource sqlCipherDatabaseSource) {
|
public ReactiveEntityStore<Persistable> provideDataStore(
|
||||||
|
@NonNull final SqlCipherDatabaseSource sqlCipherDatabaseSource) {
|
||||||
final Configuration configuration = sqlCipherDatabaseSource.getConfiguration();
|
final Configuration configuration = sqlCipherDatabaseSource.getConfiguration();
|
||||||
return ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
|
return ReactiveSupport.toReactiveStore(new EntityDataStore<>(configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public AppPreferences providePreferences(@NonNull final Context poContext) {
|
public AppPreferences providePreferences(@NonNull final Context poContext) {
|
||||||
AppPreferences p = StoreBox.create(poContext, AppPreferences.class);
|
AppPreferences preferences = StoreBox.create(poContext, AppPreferences.class);
|
||||||
p.removeLinkPreviews();
|
preferences.removeLinkPreviews();
|
||||||
return p;
|
return preferences;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,6 +281,13 @@ public interface AppPreferences {
|
|||||||
@KeyByResource(R.string.nc_settings_theme_key)
|
@KeyByResource(R.string.nc_settings_theme_key)
|
||||||
@UnregisterChangeListenerMethod
|
@UnregisterChangeListenerMethod
|
||||||
void unregisterThemeChangeListener(OnPreferenceValueChangedListener<String> listener);
|
void unregisterThemeChangeListener(OnPreferenceValueChangedListener<String> listener);
|
||||||
|
|
||||||
|
@KeyByString("db_cypher_v4_upgrade")
|
||||||
|
@DefaultValue(R.bool.value_true)
|
||||||
|
boolean getIsDbCypherToUpgrade();
|
||||||
|
|
||||||
|
@KeyByString("db_cypher_v4_upgrade")
|
||||||
|
void setIsDbCypherToUpgrade(boolean value);
|
||||||
|
|
||||||
@KeyByResource(R.string.nc_settings_phone_book_integration_key)
|
@KeyByResource(R.string.nc_settings_phone_book_integration_key)
|
||||||
@RegisterChangeListenerMethod
|
@RegisterChangeListenerMethod
|
||||||
|
@ -252,11 +252,11 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (eventOverallWebSocketMessage.getEventMap().get("type").equals("join")) {
|
} else if (eventOverallWebSocketMessage.getEventMap().get("type").equals("join")) {
|
||||||
List<HashMap<String, Object>> joinEventMap = (List<HashMap<String, Object>>) eventOverallWebSocketMessage.getEventMap().get("join");
|
List<HashMap<String, Object>> joinEventList = (List<HashMap<String, Object>>) eventOverallWebSocketMessage.getEventMap().get("join");
|
||||||
HashMap<String, Object> internalHashMap;
|
HashMap<String, Object> internalHashMap;
|
||||||
Participant participant;
|
Participant participant;
|
||||||
for (int i = 0; i < joinEventMap.size(); i++) {
|
for (int i = 0; i < joinEventList.size(); i++) {
|
||||||
internalHashMap = joinEventMap.get(i);
|
internalHashMap = joinEventList.get(i);
|
||||||
HashMap<String, Object> userMap = (HashMap<String, Object>) internalHashMap.get("user");
|
HashMap<String, Object> userMap = (HashMap<String, Object>) internalHashMap.get("user");
|
||||||
participant = new Participant();
|
participant = new Participant();
|
||||||
String userId = (String) internalHashMap.get("userid");
|
String userId = (String) internalHashMap.get("userid");
|
||||||
|
@ -1 +1 @@
|
|||||||
174
|
173
|
@ -1,2 +1,2 @@
|
|||||||
DO NOT TOUCH; GENERATED BY DRONE
|
DO NOT TOUCH; GENERATED BY DRONE
|
||||||
<span class="mdl-layout-title">Lint Report: 2 errors and 122 warnings</span>
|
<span class="mdl-layout-title">Lint Report: 2 errors and 123 warnings</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user