diff --git a/app/build.gradle.kts b/app/build.gradle.kts index aa50c796..e2d95f71 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,8 +17,8 @@ android { defaultConfig { applicationId = "com.twofasapp" - versionName = "5.0.1" - versionCode = 5000004 + versionName = "5.0.2" + versionCode = 5000005 val versionCodeOffset = 5000000 diff --git a/data/services/src/main/java/com/twofasapp/data/services/mapper/ServiceMapper.kt b/data/services/src/main/java/com/twofasapp/data/services/mapper/ServiceMapper.kt index 3e98149a..d07c0ddd 100644 --- a/data/services/src/main/java/com/twofasapp/data/services/mapper/ServiceMapper.kt +++ b/data/services/src/main/java/com/twofasapp/data/services/mapper/ServiceMapper.kt @@ -117,7 +117,6 @@ internal fun List.asBackup(): List { iconCollection = BackupService.IconCollection(id = s.iconCollectionId) ), groupId = s.groupId - ) } } @@ -134,14 +133,14 @@ internal fun BackupService.asDomain( secret = secret, name = name, info = otp.account ?: otp.label, - authType = otp.tokenType?.let { enumValueOf(it) } ?: Service.DefaultAuthType, + authType = otp.tokenType?.let { enumValueOrNull(it) } ?: Service.AuthType.TOTP, link = otp.link, issuer = otp.issuer, period = otp.period, digits = otp.digits, hotpCounter = otp.counter, hotpCounterTimestamp = null, - algorithm = otp.algorithm?.let { enumValueOf(it) }, + algorithm = otp.algorithm?.let { enumValueOrNull(it) }, groupId = groupId, imageType = when (icon?.selected) { BackupService.IconType.Brand -> Service.ImageType.IconCollection @@ -153,11 +152,15 @@ internal fun BackupService.asDomain( iconLight = ServiceIcons.getIcon(iconCollectionId, false), iconDark = ServiceIcons.getIcon(iconCollectionId, true), labelText = icon?.label?.text, - labelColor = icon?.label?.backgroundColor?.let { enumValueOf(it) }, - badgeColor = badge?.color?.let { enumValueOf(it) }, + labelColor = icon?.label?.backgroundColor?.let { enumValueOrNull(it) }, + badgeColor = badge?.color?.let { enumValueOrNull(it) }, isDeleted = false, updatedAt = updatedAt, - source = otp.source?.let { enumValueOf(it) } ?: Service.Source.Manual, + source = when (otp.source?.lowercase()) { + "manual" -> Service.Source.Manual + "link" -> Service.Source.Link + else -> Service.Source.Manual + }, assignedDomains = listOf(), backupSyncStatus = BackupSyncStatus.NOT_SYNCED, tags = emptyList(),