Skip to content

Commit 41e8d79

Browse files
committed
Added fastlane
Added database version to backup file
1 parent 8cee8ad commit 41e8d79

File tree

21 files changed

+97
-48
lines changed

21 files changed

+97
-48
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
applicationId "com.yogeshpaliyal.keypass"
1717
minSdkVersion 22
1818
targetSdkVersion 30
19-
versionCode 2
20-
versionName "1.1"
19+
versionCode 3
20+
versionName "1.3"
2121

2222
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2323
}
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.yogeshpaliyal.keypass.data
2+
3+
import com.google.gson.annotations.Expose
4+
import com.google.gson.annotations.SerializedName
5+
6+
7+
/*
8+
* @author Yogesh Paliyal
9+
* techpaliyal@gmail.com
10+
* https://techpaliyal.com
11+
* created on 23-02-2021 20:48
12+
*/
13+
data class BackupData(
14+
@SerializedName("version")
15+
@Expose
16+
val version : Int,
17+
@SerializedName("data")
18+
@Expose
19+
val data : List<AccountModel> ) {
20+
}

app/src/main/java/com/yogeshpaliyal/keypass/db_helper/DbBackupRestore.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.room.withTransaction
88
import com.google.gson.Gson
99
import com.yogeshpaliyal.keypass.AppDatabase
1010
import com.yogeshpaliyal.keypass.data.AccountModel
11+
import com.yogeshpaliyal.keypass.data.BackupData
1112
import com.yogeshpaliyal.keypass.utils.getOrCreateBackupKey
1213
import com.yogeshpaliyal.keypass.utils.logD
1314
import kotlinx.coroutines.Dispatchers
@@ -29,8 +30,8 @@ import javax.crypto.SecretKey
2930
suspend fun AppDatabase.createBackup(key: String,contentResolver : ContentResolver,fileUri: Uri?) = withContext(Dispatchers.IO){
3031
fileUri ?: return@withContext false
3132
val data = getDao().getAllAccounts().first()
32-
val json = Gson().toJson(data)
3333

34+
val json = Gson().toJson(BackupData(this@createBackup.openHelper.readableDatabase.version, data))
3435
val fileStream = contentResolver.openOutputStream(fileUri)
3536
EncryptionHelper.doCryptoEncrypt(key,json, fileStream)
3637

@@ -47,12 +48,12 @@ suspend fun AppDatabase.restoreBackup(key: String,contentResolver : ContentResol
4748
e.printStackTrace()
4849
return@withContext false
4950
}
50-
val data = Gson().fromJson(restoredFile, Array<AccountModel>::class.java).toList()
51-
data.forEach {
51+
val data = Gson().fromJson(restoredFile, BackupData::class.java)
52+
data.data.forEach {
5253
it.id = null
5354
}
5455
withTransaction {
55-
getDao().insertOrUpdateAccount(data.toList())
56+
getDao().insertOrUpdateAccount(data.data)
5657
}
5758
return@withContext true
5859
}

app/src/main/java/com/yogeshpaliyal/keypass/ui/settings/MySettingsFragment.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ class MySettingsFragment : PreferenceFragmentCompat() {
173173
)
174174

175175
lifecycleScope.launch {
176-
context?.contentResolver?.let { AppDatabase.getInstance().createBackup(keyPair.second,
176+
context?.contentResolver?.let {
177+
AppDatabase.getInstance().createBackup(keyPair.second,
177178
it,
178179
tempFile?.uri
179180
)

app/src/main/java/com/yogeshpaliyal/keypass/utils/ByteUtil.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

fastlane/metadata/android/en-US/changelogs/1.txt

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
New Features*
2+
Backup & Restore your credentials (Fully Encrypted)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added database version to backup file
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The modern password manager does not store your credentials on servers so your passwords are in your hands, no need to worry.
2+
3+
1. Fully Offline
4+
2. Without Ads
5+
3. Open source (you can view source code)
6+
4. Backup & Restore your credentials
7+
8+
https://github.com/yogeshpaliyal/KeyPass

0 commit comments

Comments
 (0)