mirror of
https://github.com/yogeshpaliyal/KeyPass.git
synced 2026-02-19 10:18:30 -06:00
Fixed crash for some devices when creating backup
This commit is contained in:
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="JDK" />
|
||||
|
||||
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@@ -4,6 +4,9 @@
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../../../layout/custom_preview.xml" value="0.20833333333333334" />
|
||||
<entry key="..\:/Users/paliy/StudioProjects/KeyPass/app/src/main/res/drawable/ic_twotone_content_copy_24.xml" value="0.10989583333333333" />
|
||||
<entry key="..\:/Users/paliy/StudioProjects/KeyPass/app/src/main/res/layout/item_accounts.xml" value="0.1" />
|
||||
<entry key="..\:/Users/paliy/StudioProjects/KeyPass/app/src/staging/res/drawable/ic_twotone_content_copy_24.xml" value="0.21614583333333334" />
|
||||
<entry key="app/src/main/res/layout/activity_dashboard.xml" value="0.19322916666666667" />
|
||||
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.19322916666666667" />
|
||||
<entry key="app/src/main/res/layout/item_accounts.xml" value="0.19322916666666667" />
|
||||
@@ -11,7 +14,7 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
10
.idea/runConfigurations.xml
generated
10
.idea/runConfigurations.xml
generated
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -4,19 +4,12 @@ plugins {
|
||||
id 'kotlin-kapt'
|
||||
id 'androidx.navigation.safeargs.kotlin'
|
||||
id("dagger.hilt.android.plugin")
|
||||
id('com.localazy.gradle')
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
def appPackageId = 'com.yogeshpaliyal.keypass'
|
||||
def versionMajor = 1
|
||||
def versionMinor = 3
|
||||
def versionPatch = 5
|
||||
def appVersion = "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
def appVersionCode = versionMajor * 1000 + versionMinor * 100 + versionPatch
|
||||
|
||||
|
||||
android {
|
||||
@@ -27,8 +20,8 @@ android {
|
||||
applicationId appPackageId
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 30
|
||||
versionCode 1307
|
||||
versionName "1.3.7"
|
||||
versionCode 1308
|
||||
versionName "1.3.8"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -74,21 +67,7 @@ android {
|
||||
|
||||
}
|
||||
|
||||
localazy {
|
||||
readKey "a8585039528314004437-93bb583478538d638f0264fde335214df735ed022d2e0402513997eccc9ad9de"
|
||||
writeKey "a8585039528314004437-d2f4d2808ebe867cf24aceaaea58be99055fcb39bcac32c74b0e983b147acc5c"
|
||||
|
||||
injection {
|
||||
dontCheckInternetPermission true
|
||||
}
|
||||
|
||||
upload {
|
||||
files {
|
||||
exclude "*/font_certs.xml"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ abstract class DbDao {
|
||||
@Query("SELECT * FROM account ORDER BY title ASC")
|
||||
abstract fun getAllAccounts(): LiveData<List<AccountModel>>
|
||||
|
||||
@Query("SELECT * FROM account ORDER BY title ASC")
|
||||
abstract fun getAllAccountsList(): List<AccountModel>
|
||||
|
||||
@Query("SELECT * FROM account WHERE CASE WHEN :tag IS NOT NULL THEN tags = :tag ELSE 1 END AND ((username LIKE '%'||:query||'%' ) OR (title LIKE '%'||:query||'%' ) OR (notes LIKE '%'||:query||'%' )) ORDER BY title ASC")
|
||||
abstract fun getAllAccounts(query: String?, tag: String?): LiveData<List<AccountModel>>
|
||||
|
||||
|
||||
@@ -22,11 +22,10 @@ import kotlinx.coroutines.withContext
|
||||
suspend fun AppDatabase.createBackup(key: String, contentResolver: ContentResolver, fileUri: Uri?) =
|
||||
withContext(Dispatchers.IO) {
|
||||
fileUri ?: return@withContext false
|
||||
val data = getDao().getAllAccounts().value
|
||||
val data = getDao().getAllAccountsList()
|
||||
data ?: return@withContext false
|
||||
|
||||
val json =
|
||||
Gson().toJson(BackupData(this@createBackup.openHelper.readableDatabase.version, data))
|
||||
val json = Gson().toJson(BackupData(this@createBackup.openHelper.readableDatabase.version, data))
|
||||
val fileStream = contentResolver.openOutputStream(fileUri)
|
||||
EncryptionHelper.doCryptoEncrypt(key, json, fileStream)
|
||||
|
||||
@@ -47,18 +46,21 @@ suspend fun AppDatabase.restoreBackup(
|
||||
e.printStackTrace()
|
||||
return@withContext false
|
||||
}
|
||||
val data = Gson().fromJson(restoredFile, BackupData::class.java)
|
||||
if (data.version == 3) {
|
||||
for (datum in data.data) {
|
||||
datum.uniqueId = getRandomString()
|
||||
|
||||
return@withContext Gson().fromJson(restoredFile, BackupData::class.java)?.let{ data ->
|
||||
if (data.version == 3) {
|
||||
for (datum in data.data) {
|
||||
datum.uniqueId = getRandomString()
|
||||
}
|
||||
}
|
||||
}
|
||||
data.data.forEach {
|
||||
it.id = null
|
||||
}
|
||||
withTransaction {
|
||||
getDao().insertOrUpdateAccount(data.data)
|
||||
}
|
||||
return@withContext true
|
||||
data.data.forEach {
|
||||
it.id = null
|
||||
}
|
||||
withTransaction {
|
||||
getDao().insertOrUpdateAccount(data.data)
|
||||
}
|
||||
true
|
||||
} ?: false
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M8,7h11v14H8z"
|
||||
android:strokeAlpha="0.3"
|
||||
android:fillAlpha="0.3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
|
||||
</vector>
|
||||
@@ -22,7 +22,6 @@ buildscript {
|
||||
|
||||
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||
classpath "com.localazy:gradle:1.5.3"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
1
fastlane/metadata/android/en-US/changelogs/1307.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/1307.txt
Normal file
@@ -0,0 +1 @@
|
||||
Fixed crash for some devices when creating backup
|
||||
@@ -1,11 +1 @@
|
||||
added multiple language support
|
||||
Arabic
|
||||
French
|
||||
German
|
||||
Hindi
|
||||
Japanese
|
||||
Portuguese
|
||||
Russian
|
||||
Simplified Chinese
|
||||
Spanish
|
||||
Tamil
|
||||
Fixed crash for some devices when creating backup
|
||||
Reference in New Issue
Block a user