From d3614ccd681fd67b43cff59f388cc77fa8fa9aef Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Sun, 30 Jul 2023 13:28:21 +0530 Subject: [PATCH] Fix debug key store (#645) * remove production staging build flavours * fix: support for debug keystore --- .github/workflows/master-apk-create.yml | 4 +-- .github/workflows/pr-check.yaml | 4 +-- .github/workflows/production.yml | 6 ++-- app/build.gradle.kts | 29 +++--------------- .../res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../mipmap-hdpi/ic_launcher_foreground.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../mipmap-mdpi/ic_launcher_foreground.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../mipmap-xhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../res/values/ic_launcher_background.xml | 0 .../{staging => debug}/res/values/strings.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../mipmap-hdpi/ic_launcher_foreground.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../mipmap-mdpi/ic_launcher_foreground.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../mipmap-xhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../res/values/ic_launcher_background.xml | 0 .../res/values/strings.xml | 0 .../yogeshpaliyal/common/utils/BackupUtils.kt | 2 +- .../common/utils/SharedPreferenceUtils.kt | 2 +- .../common/utils/UserSettingsDataStore.kt | 4 +-- 45 files changed, 16 insertions(+), 35 deletions(-) rename app/src/{production => debug}/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename app/src/{production => debug}/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename app/src/{staging => debug}/res/mipmap-hdpi/ic_launcher.png (100%) rename app/src/{production => debug}/res/mipmap-hdpi/ic_launcher_foreground.png (100%) rename app/src/{staging => debug}/res/mipmap-hdpi/ic_launcher_round.png (100%) rename app/src/{staging => debug}/res/mipmap-mdpi/ic_launcher.png (100%) rename app/src/{production => debug}/res/mipmap-mdpi/ic_launcher_foreground.png (100%) rename app/src/{staging => debug}/res/mipmap-mdpi/ic_launcher_round.png (100%) rename app/src/{staging => debug}/res/mipmap-xhdpi/ic_launcher.png (100%) rename app/src/{production => debug}/res/mipmap-xhdpi/ic_launcher_foreground.png (100%) rename app/src/{staging => debug}/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename app/src/{staging => debug}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename app/src/{production => debug}/res/mipmap-xxhdpi/ic_launcher_foreground.png (100%) rename app/src/{staging => debug}/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename app/src/{staging => debug}/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename app/src/{production => debug}/res/mipmap-xxxhdpi/ic_launcher_foreground.png (100%) rename app/src/{staging => debug}/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) rename app/src/{staging => debug}/res/values/ic_launcher_background.xml (100%) rename app/src/{staging => debug}/res/values/strings.xml (100%) rename app/src/{staging => release}/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename app/src/{staging => release}/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename app/src/{production => release}/res/mipmap-hdpi/ic_launcher.png (100%) rename app/src/{staging => release}/res/mipmap-hdpi/ic_launcher_foreground.png (100%) rename app/src/{production => release}/res/mipmap-hdpi/ic_launcher_round.png (100%) rename app/src/{production => release}/res/mipmap-mdpi/ic_launcher.png (100%) rename app/src/{staging => release}/res/mipmap-mdpi/ic_launcher_foreground.png (100%) rename app/src/{production => release}/res/mipmap-mdpi/ic_launcher_round.png (100%) rename app/src/{production => release}/res/mipmap-xhdpi/ic_launcher.png (100%) rename app/src/{staging => release}/res/mipmap-xhdpi/ic_launcher_foreground.png (100%) rename app/src/{production => release}/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename app/src/{production => release}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename app/src/{staging => release}/res/mipmap-xxhdpi/ic_launcher_foreground.png (100%) rename app/src/{production => release}/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename app/src/{production => release}/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename app/src/{staging => release}/res/mipmap-xxxhdpi/ic_launcher_foreground.png (100%) rename app/src/{production => release}/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) rename app/src/{production => release}/res/values/ic_launcher_background.xml (100%) rename app/src/{production => release}/res/values/strings.xml (100%) diff --git a/.github/workflows/master-apk-create.yml b/.github/workflows/master-apk-create.yml index 742a4b9e..e0d2e398 100644 --- a/.github/workflows/master-apk-create.yml +++ b/.github/workflows/master-apk-create.yml @@ -25,7 +25,7 @@ jobs: uses: ./.github/actions/setup - name: Build APK ⚙️🛠 - run: bash ./gradlew assembleStagingDebug + run: bash ./gradlew assembleDebug - uses: "marvinpinto/action-automatic-releases@latest" @@ -34,4 +34,4 @@ jobs: automatic_release_tag: "latest-master" prerelease: true title: "Staging Build" - files: app/build/outputs/apk/staging/debug/*.apk + files: app/build/outputs/apk/debug/*.apk diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index b5e3b9aa..b9d2d44a 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -32,11 +32,11 @@ jobs: run: ./gradlew test - name: 🏗 Build APK - run: bash ./gradlew assembleProductionDebug + run: bash ./gradlew assembleDebug - name: 🚀 Upload APK to Artifacts 📱 uses: actions/upload-artifact@v3 with: name: app - path: app/build/outputs/apk/production/debug/*.apk + path: app/build/outputs/apk/debug/*.apk retention-days: 3 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 93779c8f..dd4a7621 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -23,13 +23,13 @@ jobs: - name: Build Release AAB id: buildRelease - run: ./gradlew bundleProductionRelease + run: ./gradlew bundleRelease - name: Sign AAB id: sign uses: r0adkll/sign-android-release@fix/bundle-signing with: - releaseDirectory: app/build/outputs/bundle/productionRelease + releaseDirectory: app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} @@ -47,7 +47,7 @@ jobs: with: serviceAccountJson: service_account.json packageName: com.yogeshpaliyal.keypass - releaseFiles: app/build/outputs/bundle/productionRelease/*.aab + releaseFiles: app/build/outputs/bundle/release/*.aab track: production userFraction: 0.01 status: inProgress diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5258a1f9..dcc28fad 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,6 +25,8 @@ android { vectorDrawables { useSupportLibrary = true } + + missingDimensionStrategy("buildTypes", "release") } buildTypes { @@ -35,8 +37,8 @@ android { } debug { - productFlavors.findByName("production")?.signingConfig = signingConfigs.findByName("myDebugConfig") - productFlavors.findByName("staging")?.signingConfig = signingConfigs.findByName("myDebugConfig") + applicationIdSuffix = ".staging" + signingConfig = signingConfigs.getByName("debug") } } @@ -59,20 +61,7 @@ android { flavorDimensions("default") - productFlavors { - create("production") { - } - create("staging") { - applicationIdSuffix = ".staging" - signingConfig = signingConfigs.findByName("myDebugConfig") - } - } - sourceSets { - getByName("main") { - res.srcDirs("src/main/res", "src/staging/res") - } - } composeOptions { kotlinCompilerExtensionVersion = "1.4.4" @@ -84,16 +73,8 @@ android { } namespace = appPackageId - /*sourceSets { - main { - res { - srcDirs 'src\\main\\res', 'src\\staging\\res', '..\\common\\src\\staging\\res' - } - } - }*/ - signingConfigs { - create("myDebugConfig") { + getByName("debug") { storeFile = file("../keystores/debug.keystore") storePassword = "android" keyAlias = "androiddebugkey" diff --git a/app/src/production/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from app/src/production/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/app/src/production/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from app/src/production/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/app/src/staging/res/mipmap-hdpi/ic_launcher.png b/app/src/debug/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/staging/res/mipmap-hdpi/ic_launcher.png rename to app/src/debug/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/production/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/production/res/mipmap-hdpi/ic_launcher_foreground.png rename to app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/app/src/staging/res/mipmap-hdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from app/src/staging/res/mipmap-hdpi/ic_launcher_round.png rename to app/src/debug/res/mipmap-hdpi/ic_launcher_round.png diff --git a/app/src/staging/res/mipmap-mdpi/ic_launcher.png b/app/src/debug/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/staging/res/mipmap-mdpi/ic_launcher.png rename to app/src/debug/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/production/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/production/res/mipmap-mdpi/ic_launcher_foreground.png rename to app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/app/src/staging/res/mipmap-mdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from app/src/staging/res/mipmap-mdpi/ic_launcher_round.png rename to app/src/debug/res/mipmap-mdpi/ic_launcher_round.png diff --git a/app/src/staging/res/mipmap-xhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/staging/res/mipmap-xhdpi/ic_launcher.png rename to app/src/debug/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/production/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/production/res/mipmap-xhdpi/ic_launcher_foreground.png rename to app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/app/src/staging/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from app/src/staging/res/mipmap-xhdpi/ic_launcher_round.png rename to app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/app/src/staging/res/mipmap-xxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/staging/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/debug/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/production/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/production/res/mipmap-xxhdpi/ic_launcher_foreground.png rename to app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/app/src/staging/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/staging/res/mipmap-xxhdpi/ic_launcher_round.png rename to app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/app/src/staging/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from app/src/staging/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/app/src/production/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/production/res/mipmap-xxxhdpi/ic_launcher_foreground.png rename to app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/app/src/staging/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/staging/res/mipmap-xxxhdpi/ic_launcher_round.png rename to app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/app/src/staging/res/values/ic_launcher_background.xml b/app/src/debug/res/values/ic_launcher_background.xml similarity index 100% rename from app/src/staging/res/values/ic_launcher_background.xml rename to app/src/debug/res/values/ic_launcher_background.xml diff --git a/app/src/staging/res/values/strings.xml b/app/src/debug/res/values/strings.xml similarity index 100% rename from app/src/staging/res/values/strings.xml rename to app/src/debug/res/values/strings.xml diff --git a/app/src/staging/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/release/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from app/src/staging/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/release/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/app/src/staging/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/release/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from app/src/staging/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app/src/release/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/app/src/production/res/mipmap-hdpi/ic_launcher.png b/app/src/release/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/production/res/mipmap-hdpi/ic_launcher.png rename to app/src/release/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/staging/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/release/res/mipmap-hdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/staging/res/mipmap-hdpi/ic_launcher_foreground.png rename to app/src/release/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/app/src/production/res/mipmap-hdpi/ic_launcher_round.png b/app/src/release/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from app/src/production/res/mipmap-hdpi/ic_launcher_round.png rename to app/src/release/res/mipmap-hdpi/ic_launcher_round.png diff --git a/app/src/production/res/mipmap-mdpi/ic_launcher.png b/app/src/release/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/production/res/mipmap-mdpi/ic_launcher.png rename to app/src/release/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/staging/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/release/res/mipmap-mdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/staging/res/mipmap-mdpi/ic_launcher_foreground.png rename to app/src/release/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/app/src/production/res/mipmap-mdpi/ic_launcher_round.png b/app/src/release/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from app/src/production/res/mipmap-mdpi/ic_launcher_round.png rename to app/src/release/res/mipmap-mdpi/ic_launcher_round.png diff --git a/app/src/production/res/mipmap-xhdpi/ic_launcher.png b/app/src/release/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/production/res/mipmap-xhdpi/ic_launcher.png rename to app/src/release/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/staging/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/release/res/mipmap-xhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/staging/res/mipmap-xhdpi/ic_launcher_foreground.png rename to app/src/release/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/app/src/production/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/release/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from app/src/production/res/mipmap-xhdpi/ic_launcher_round.png rename to app/src/release/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/app/src/production/res/mipmap-xxhdpi/ic_launcher.png b/app/src/release/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/production/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/release/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/staging/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/release/res/mipmap-xxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/staging/res/mipmap-xxhdpi/ic_launcher_foreground.png rename to app/src/release/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/app/src/production/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/release/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/production/res/mipmap-xxhdpi/ic_launcher_round.png rename to app/src/release/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/app/src/production/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/release/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from app/src/production/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/release/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/app/src/staging/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/release/res/mipmap-xxxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/staging/res/mipmap-xxxhdpi/ic_launcher_foreground.png rename to app/src/release/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/app/src/production/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/release/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/production/res/mipmap-xxxhdpi/ic_launcher_round.png rename to app/src/release/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/app/src/production/res/values/ic_launcher_background.xml b/app/src/release/res/values/ic_launcher_background.xml similarity index 100% rename from app/src/production/res/values/ic_launcher_background.xml rename to app/src/release/res/values/ic_launcher_background.xml diff --git a/app/src/production/res/values/strings.xml b/app/src/release/res/values/strings.xml similarity index 100% rename from app/src/production/res/values/strings.xml rename to app/src/release/res/values/strings.xml diff --git a/common/src/main/java/com/yogeshpaliyal/common/utils/BackupUtils.kt b/common/src/main/java/com/yogeshpaliyal/common/utils/BackupUtils.kt index 6161471c..02248ba2 100644 --- a/common/src/main/java/com/yogeshpaliyal/common/utils/BackupUtils.kt +++ b/common/src/main/java/com/yogeshpaliyal/common/utils/BackupUtils.kt @@ -32,7 +32,7 @@ fun getRandomString(sizeOfRandomString: Int): String { suspend fun Context?.canUserAccessBackupDirectory(): Boolean { if (this != null) { - val backupDirectoryUri = getUri(getUserSettings()?.backupDirectory) + val backupDirectoryUri = getUri(getUserSettings().backupDirectory) if (backupDirectoryUri != null) { val backupDirectory = DocumentFile.fromTreeUri(this, backupDirectoryUri) val listOfConditions = arrayListOf() diff --git a/common/src/main/java/com/yogeshpaliyal/common/utils/SharedPreferenceUtils.kt b/common/src/main/java/com/yogeshpaliyal/common/utils/SharedPreferenceUtils.kt index 5fbf7d30..ccc634f1 100644 --- a/common/src/main/java/com/yogeshpaliyal/common/utils/SharedPreferenceUtils.kt +++ b/common/src/main/java/com/yogeshpaliyal/common/utils/SharedPreferenceUtils.kt @@ -113,7 +113,7 @@ const val BACKUP_KEY_LENGTH = 16 */ suspend fun Context.getOrCreateBackupKey(reset: Boolean = false): Pair { val userSettings = getUserSettings() - return if (userSettings?.backupKey != null && reset.not()) { + return if (userSettings.backupKey != null && reset.not()) { Pair(false, userSettings.backupKey) } else { val randomKey = getRandomString(BACKUP_KEY_LENGTH) diff --git a/common/src/main/java/com/yogeshpaliyal/common/utils/UserSettingsDataStore.kt b/common/src/main/java/com/yogeshpaliyal/common/utils/UserSettingsDataStore.kt index bd1894cb..1da98597 100644 --- a/common/src/main/java/com/yogeshpaliyal/common/utils/UserSettingsDataStore.kt +++ b/common/src/main/java/com/yogeshpaliyal/common/utils/UserSettingsDataStore.kt @@ -7,13 +7,13 @@ import com.yogeshpaliyal.common.data.UserSettings class UserSettingsDataStore(val context: Context) { - private fun getSerializer(context: Context): Serializer { + private fun getSerializer(): Serializer { return UserSettingsSerializer(CryptoManager()) } private val Context.dataStoreSerializer by dataStore( fileName = "user-settings.json", - serializer = getSerializer(context) + serializer = getSerializer() ) fun getDataStore() = context.dataStoreSerializer