[fenix] changes required for uniffi-ing logins component=

pull/600/head
Sammy Khamis 3 years ago committed by Grisha Kruglov
parent 0913ebfe40
commit 8192f53f08

@ -20,11 +20,11 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import mozilla.appservices.logins.IdCollisionException import mozilla.components.service.sync.logins.IdCollisionException
import mozilla.appservices.logins.InvalidRecordException import mozilla.components.service.sync.logins.InvalidRecordException
import mozilla.appservices.logins.LoginsStorageException import mozilla.components.service.sync.logins.LoginsStorageException
import mozilla.appservices.logins.ServerPassword import mozilla.components.service.sync.logins.ServerPassword
import mozilla.components.concept.storage.Login import mozilla.components.service.sync.logins.toLogin
import mozilla.components.support.migration.FennecLoginsMPImporter import mozilla.components.support.migration.FennecLoginsMPImporter
import mozilla.components.support.migration.FennecProfile import mozilla.components.support.migration.FennecProfile
import org.mozilla.fenix.R import org.mozilla.fenix.R
@ -198,7 +198,7 @@ class MasterPasswordTipProvider(
context.components.core.passwordsStorage.add(it) context.components.core.passwordsStorage.add(it)
} catch (e: InvalidRecordException) { } catch (e: InvalidRecordException) {
// This record was invalid and we couldn't save this login // This record was invalid and we couldn't save this login
Sentry.capture("Master Password migration add login error $e for reason ${e.reason}") Sentry.capture("Master Password migration add login error $e for reason ${e.message}")
} catch (e: IdCollisionException) { } catch (e: IdCollisionException) {
// Nonempty ID was provided // Nonempty ID was provided
Sentry.capture("Master Password migration add login error $e") Sentry.capture("Master Password migration add login error $e")
@ -258,23 +258,6 @@ class MasterPasswordTipProvider(
} }
} }
/**
* Converts an Application Services [ServerPassword] to an Android Components [Login]
*/
fun ServerPassword.toLogin() = Login(
origin = hostname,
formActionOrigin = formSubmitURL,
httpRealm = httpRealm,
username = username,
password = password,
timesUsed = timesUsed,
timeCreated = timeCreated,
timeLastUsed = timeLastUsed,
timePasswordChanged = timePasswordChanged,
usernameField = usernameField,
passwordField = passwordField
)
companion object { companion object {
private const val HALF_OPACITY = .5F private const val HALF_OPACITY = .5F
} }

Loading…
Cancel
Save