forked from mozilla-mobile/android-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue mozilla-mobile#10140 - Part 1: Refactor autocomplete extension …
…functions into ext/Login.kt - Moves `Autocomplete.LoginEntry.toLogin()` and `Login.toLoginEntry()` extension functions into `ext/Login.kt` - Remove duplicates of `Autocomplete.LoginEntry.toLogin()` and `Login.toLoginEntry()`.
- Loading branch information
1 parent
c95a60b
commit 7cce63c
Showing
4 changed files
with
37 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...s/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/ext/Login.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.browser.engine.gecko.ext | ||
|
||
import mozilla.components.concept.storage.Login | ||
import org.mozilla.geckoview.Autocomplete | ||
|
||
/** | ||
* Converts a GeckoView [Autocomplete.LoginEntry] to an Android Components [Login]. | ||
*/ | ||
fun Autocomplete.LoginEntry.toLogin() = Login( | ||
guid = guid, | ||
origin = origin, | ||
formActionOrigin = formActionOrigin, | ||
httpRealm = httpRealm, | ||
username = username, | ||
password = password | ||
) | ||
|
||
/** | ||
* Converts an Android Components [Login] to a GeckoView [Autocomplete.LoginEntry]. | ||
*/ | ||
fun Login.toLoginEntry() = Autocomplete.LoginEntry.Builder() | ||
.guid(guid) | ||
.origin(origin) | ||
.formActionOrigin(formActionOrigin) | ||
.httpRealm(httpRealm) | ||
.username(username) | ||
.password(password) | ||
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters