This commit is contained in:
Rafał Kobyłko 2023-11-11 12:53:30 +01:00
commit 3fbbd3e0c8
2 changed files with 11 additions and 8 deletions

View File

@ -17,8 +17,8 @@ android {
defaultConfig { defaultConfig {
applicationId = "com.twofasapp" applicationId = "com.twofasapp"
versionName = "5.0.1" versionName = "5.0.2"
versionCode = 5000004 versionCode = 5000005
val versionCodeOffset = 5000000 val versionCodeOffset = 5000000

View File

@ -117,7 +117,6 @@ internal fun List<Service>.asBackup(): List<BackupService> {
iconCollection = BackupService.IconCollection(id = s.iconCollectionId) iconCollection = BackupService.IconCollection(id = s.iconCollectionId)
), ),
groupId = s.groupId groupId = s.groupId
) )
} }
} }
@ -134,14 +133,14 @@ internal fun BackupService.asDomain(
secret = secret, secret = secret,
name = name, name = name,
info = otp.account ?: otp.label, info = otp.account ?: otp.label,
authType = otp.tokenType?.let { enumValueOf<Service.AuthType>(it) } ?: Service.DefaultAuthType, authType = otp.tokenType?.let { enumValueOrNull<Service.AuthType>(it) } ?: Service.AuthType.TOTP,
link = otp.link, link = otp.link,
issuer = otp.issuer, issuer = otp.issuer,
period = otp.period, period = otp.period,
digits = otp.digits, digits = otp.digits,
hotpCounter = otp.counter, hotpCounter = otp.counter,
hotpCounterTimestamp = null, hotpCounterTimestamp = null,
algorithm = otp.algorithm?.let { enumValueOf<Service.Algorithm>(it) }, algorithm = otp.algorithm?.let { enumValueOrNull<Service.Algorithm>(it) },
groupId = groupId, groupId = groupId,
imageType = when (icon?.selected) { imageType = when (icon?.selected) {
BackupService.IconType.Brand -> Service.ImageType.IconCollection BackupService.IconType.Brand -> Service.ImageType.IconCollection
@ -153,11 +152,15 @@ internal fun BackupService.asDomain(
iconLight = ServiceIcons.getIcon(iconCollectionId, false), iconLight = ServiceIcons.getIcon(iconCollectionId, false),
iconDark = ServiceIcons.getIcon(iconCollectionId, true), iconDark = ServiceIcons.getIcon(iconCollectionId, true),
labelText = icon?.label?.text, labelText = icon?.label?.text,
labelColor = icon?.label?.backgroundColor?.let { enumValueOf<Service.Tint>(it) }, labelColor = icon?.label?.backgroundColor?.let { enumValueOrNull<Service.Tint>(it) },
badgeColor = badge?.color?.let { enumValueOf<Service.Tint>(it) }, badgeColor = badge?.color?.let { enumValueOrNull<Service.Tint>(it) },
isDeleted = false, isDeleted = false,
updatedAt = updatedAt, updatedAt = updatedAt,
source = otp.source?.let { enumValueOf<Service.Source>(it) } ?: Service.Source.Manual, source = when (otp.source?.lowercase()) {
"manual" -> Service.Source.Manual
"link" -> Service.Source.Link
else -> Service.Source.Manual
},
assignedDomains = listOf(), assignedDomains = listOf(),
backupSyncStatus = BackupSyncStatus.NOT_SYNCED, backupSyncStatus = BackupSyncStatus.NOT_SYNCED,
tags = emptyList(), tags = emptyList(),