mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 20:49:36 +01:00
code reformatting
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
08f5274af9
commit
cd44de757c
@ -265,12 +265,16 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
|
|||||||
val database = object : SqlCipherDatabaseSource(
|
val database = object : SqlCipherDatabaseSource(
|
||||||
this,
|
this,
|
||||||
Models.DEFAULT,
|
Models.DEFAULT,
|
||||||
this.resources.getString(R.string.nc_app_product_name).lowercase(Locale.getDefault())
|
this
|
||||||
.replace(" ", "_").trim { it <= ' ' } + ".sqlite",
|
.resources
|
||||||
|
.getString(R.string.nc_app_product_name)
|
||||||
|
.lowercase(Locale.getDefault())
|
||||||
|
.replace(" ", "_")
|
||||||
|
.trim { it <= ' ' } +
|
||||||
|
".sqlite",
|
||||||
this.getString(R.string.nc_talk_database_encryption_key),
|
this.getString(R.string.nc_talk_database_encryption_key),
|
||||||
DatabaseModule.DB_VERSION
|
DatabaseModule.DB_VERSION
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
checkAndUpdateCipherMigrationStatus(newVersion, appPreferences)
|
checkAndUpdateCipherMigrationStatus(newVersion, appPreferences)
|
||||||
super.onUpgrade(db, oldVersion, newVersion)
|
super.onUpgrade(db, oldVersion, newVersion)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
*
|
|
||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
|
* @author Andy Scherzinger
|
||||||
* @author Mario Danic
|
* @author Mario Danic
|
||||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
|
* 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
|
||||||
@ -44,24 +45,33 @@ public class DatabaseModule {
|
|||||||
@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), DB_VERSION);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user