Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
devinreams committed May 10, 2019
2 parents 2316ea6 + 8f19a37 commit f2778c3
Show file tree
Hide file tree
Showing 23 changed files with 200 additions and 129 deletions.
16 changes: 8 additions & 8 deletions CredentialProvider/Presenter/CredentialItemListPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class ItemListPresenter: BaseItemListPresenter {
view.dismissKeyboard()
}

self.dataStore.get(id)
.take(1)
.subscribe(onNext: { login in
target.dataStore.get(id)
.map { login -> CredentialStatusAction in
if let login = login {
target.dispatcher.dispatch(action: CredentialStatusAction.loginSelected(login: login, relock: false))
return CredentialStatusAction.loginSelected(login: login, relock: false)
} else {
target.dispatcher.dispatch(action: CredentialStatusAction.userCanceled)
return CredentialStatusAction.userCanceled
}
})
.disposed(by: self.disposeBag)
}.asObserver()
}
.subscribe(onNext: { target.dispatcher.dispatch(action: $0) })
.disposed(by: target.disposeBag)
}.asObserver()
}

override var helpTextItems: [LoginListCellConfiguration] { return [LoginListCellConfiguration.SelectAPasswordHelpText] }
Expand Down
12 changes: 4 additions & 8 deletions CredentialProvider/Presenter/CredentialProviderPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@ class CredentialProviderPresenter {
})
.disposed(by: self.disposeBag)

self.dispatcher.dispatch(action: LifecycleAction.foreground)
self.dispatcher.dispatch(action: DataStoreAction.unlock)
self.startTelemetry()
}

func extensionConfigurationRequested() {
self.dispatcher.dispatch(action: LifecycleAction.foreground)

self.dataStore.locked
.bind { [weak self] locked in
if locked {
Expand All @@ -104,8 +101,6 @@ class CredentialProviderPresenter {
}

func credentialProvisionRequested(for credentialIdentity: ASPasswordCredentialIdentity) {
self.dispatcher.dispatch(action: LifecycleAction.foreground)

self.dataStore.locked
.take(1)
.bind { [weak self] locked in
Expand All @@ -123,8 +118,6 @@ class CredentialProviderPresenter {
}

func credentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
self.dispatcher.dispatch(action: LifecycleAction.foreground)

self.dataStore.locked
.asDriver(onErrorJustReturn: true)
.drive(onNext: { [weak self] locked in
Expand Down Expand Up @@ -154,7 +147,10 @@ extension CredentialProviderPresenter {
return
}

self.dataStore.get(id)
self.dataStore.locked
.filter { !$0 }
.take(1)
.flatMap { _ in self.dataStore.get(id) }
.bind { [weak self] login in
guard let login = login else {
self?.cancelWith(.credentialIdentityNotFound)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
<constraints>
<constraint firstAttribute="width" constant="280" id="WcY-qh-pBg"/>
</constraints>
<string key="text">Firefox Lockbox lets you access passwords you've already saved to Firefox. To view your entries here, you'll need to sign in and sync with Firefox for desktop.</string>
<string key="text">Firefox Lockbox lets you access passwords youve already saved to Firefox. To view your entries here, youll need to sign in and sync with Firefox for desktop.</string>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" red="0.45098039215686275" green="0.45098039215686275" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -224,7 +224,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="299.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To see more entries here, you'll need to save them to Firefox for desktop." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JpV-eG-grp">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To see more entries here, youll need to save them to Firefox for desktop." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JpV-eG-grp">
<rect key="frame" x="47.5" y="56" width="280" height="31.5"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="gFp-Ms-L2p"/>
Expand Down
4 changes: 2 additions & 2 deletions LockboxXCUITests/LockboxXCUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ class LockboxXCUITests: BaseTestCase {
// There should be the correct number of matches
let aMatches = app.tables.cells.count
if iPad() {
XCTAssertEqual(aMatches, 111)
XCTAssertEqual(aMatches, 110)
} else {
XCTAssertEqual(aMatches, 108)
XCTAssertEqual(aMatches, 107)
}
// There should be less number of matches
searchTextField.typeText("cc")
Expand Down
14 changes: 7 additions & 7 deletions Shared/Common/Resources/BaseConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ class Constant {
}

class string {
static let enablingAutofill = NSLocalizedString("autofill.enabling", value: "Updating AutoFill...", comment: "Text displayed while autofill credentials are being populated, caps-case AutoFill is intentional to match Apple's marketing word")
static let completedEnablingAutofill = NSLocalizedString("autofill.finished_enabling", value: "Finished updating autofill", comment: "Accesibility notification when autofill is done being enabled")
static let unlockPlaceholder = NSLocalizedString("unlock_placeholder", value: "This will unlock the app.", comment: "Placeholder text when the user's email is unavailable while unlocking Lockbox, shown in Touch ID and passcode prompts")
static let signInRequired = NSLocalizedString("autofill.signInRequired", value: "Sign in Required", comment: "Title for alert dialog explaining that a user must be signed in to use autofill")
static let signInRequiredBody = NSLocalizedString("autofill.signInRequiredBody", value: "You must be signed in to %@ before AutoFill will allow you to add passwords from %@. Once you have signed in, your entries will start appearing in AutoFill.", comment: "Body for alert dialog explaining that a user must be signed in to use autofill")
static let enablingAutofill = NSLocalizedString("autofill.enabling", value: "Updating AutoFill", comment: "Text displayed while AutoFill credentials are being populated. AutoFill should be localized to match the proper name for Apple’s system feature")
static let completedEnablingAutofill = NSLocalizedString("autofill.finished_enabling", value: "Finished updating AutoFill", comment: "Accesibility notification when AutoFill is done being enabled")
static let unlockPlaceholder = NSLocalizedString("unlock_placeholder", value: "This will unlock the app.", comment: "Placeholder text when the users email is unavailable while unlocking Lockbox, shown in Touch ID and passcode prompts")
static let signInRequired = NSLocalizedString("autofill.signInRequired", value: "Sign in Required", comment: "Title for alert dialog explaining that a user must be signed in to use AutoFill.")
static let signInRequiredBody = NSLocalizedString("autofill.signInRequiredBody", value: "You must be signed in to %@ before AutoFill will allow you to add passwords from %@. Once you have signed in, your entries will start appearing in AutoFill.", comment: "Body for alert dialog explaining that a user must be signed in to use AutoFill. AutoFill should be localized to match the proper name for Apple's system feature. %1$@ and %2$@ will be replaced with the application name")
static let ok = NSLocalizedString("ok", value: "OK", comment: "Ok button title")
static let productName = NSLocalizedString("firefoxLockbox", value: "Firefox Lockbox", comment: "Product Name")
static let signIn = NSLocalizedString("signIn", value: "Sign In", comment: "Sign in button text")
static let cancel = NSLocalizedString("cancel", value: "Cancel", comment: "Cancel button title")
static let usernamePlaceholder = NSLocalizedString("username_placeholder", value: "(no username)", comment: "Placeholder text when there is no username")
static let usernamePlaceholder = NSLocalizedString("username_placeholder", value: "(no username)", comment: "Placeholder text when there is no username. String should include appropriate open/close parenthetical or similar symbols to indicate this is a placeholder, not a real username.")
static let searchYourEntries = NSLocalizedString("search.placeholder", value: "Search your entries", comment: "Placeholder text for search field")
static let emptyListPlaceholder = NSLocalizedString("list.empty", value: "%@ lets you access passwords you've already saved to Firefox. To view your entries here, you'll need to sign in and sync with Firefox for desktop.", comment: "Label shown when there are no logins to list")
static let emptyListPlaceholder = NSLocalizedString("list.empty", value: "%@ lets you access passwords youve already saved to Firefox. To view your entries here, youll need to sign in and sync with Firefox for desktop.", comment: "Label shown when there are no logins to list. %@ will be replaced with the application name")
}
}

Expand Down
2 changes: 1 addition & 1 deletion Shared/Presenter/BaseItemListPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ extension BaseItemListPresenter {
}
.distinctUntilChanged()
.map { (latest: LoginListTextSort) -> [ItemSectionModel] in
if (latest.syncState == .Syncing || latest.syncState == .ReadyToSync) && latest.logins.isEmpty {
if latest.syncState == .Syncing && latest.logins.isEmpty {
return self.syncPlaceholderItems
}

Expand Down
33 changes: 17 additions & 16 deletions Shared/Store/BaseDataStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@ enum SyncError: Error {
}

enum SyncState: Equatable {
case NotSyncable, ReadyToSync, Syncing, Synced, Error(error: SyncError)
case Syncing, Synced

public static func ==(lhs: SyncState, rhs: SyncState) -> Bool {
switch (lhs, rhs) {
case (NotSyncable, NotSyncable):
return true
case (ReadyToSync, ReadyToSync):
return true
case (Syncing, Syncing):
return true
case (Synced, Synced):
return true
case (Error, Error):
return true
default:
return false
}
Expand Down Expand Up @@ -167,7 +161,10 @@ class BaseDataStore {
self.lifecycleStore.lifecycleEvents
.filter { $0 == .foreground }
.subscribe(onNext: { [weak self] _ in
self?.initializeLoginsStorage()
guard let _ = self?.loginsStorage else {
self?.initializeLoginsStorage()
return
}
})
.disposed(by: self.disposeBag)

Expand All @@ -193,12 +190,18 @@ class BaseDataStore {
}

public func get(_ id: String) -> Observable<LoginRecord?> {
return self.listSubject
.map { items -> LoginRecord? in
return items.filter { item in
return item.id == id
}.first
}
return Observable.create({ [weak self] observer -> Disposable in
self?.queue.async {
do {
let login = try self?.loginsStorage?.get(id: id)
observer.onNext(login)
} catch let error {
observer.onError(error)
}
}

return Disposables.create()
})
}

public func initialized() {
Expand Down Expand Up @@ -264,7 +267,6 @@ extension BaseDataStore {
extension BaseDataStore {
private func setupAutolock() {
self.lifecycleStore.lifecycleEvents
.distinctUntilChanged()
.filter { $0 == .background }
.flatMap { _ in self.storageState }
.take(1)
Expand All @@ -276,7 +278,6 @@ extension BaseDataStore {
.disposed(by: disposeBag)

self.lifecycleStore.lifecycleEvents
.distinctUntilChanged()
.filter { $0 == .foreground }
.flatMap { _ in self.storageState }
.take(1)
Expand Down
3 changes: 1 addition & 2 deletions Shared/Store/BaseItemDetailStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ class BaseItemDetailStore {
internal var dispatcher: Dispatcher
internal var disposeBag = DisposeBag()

internal var _itemDetailId = ReplaySubject<String>.create(bufferSize: 1)
internal var _itemDetailId = BehaviorRelay<String>.init(value: "")

lazy private(set) var itemDetailId: Observable<String> = {
return self._itemDetailId.asObservable()
}()

init(dispatcher: Dispatcher = Dispatcher.shared) {
self.dispatcher = dispatcher
self._itemDetailId.onNext("")
}
}
6 changes: 3 additions & 3 deletions Shared/Store/NetworkStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import RxSwift
import RxCocoa
import Reachability

class NetworkStore {
open class NetworkStore {
static let shared = NetworkStore()

private var reachability: ReachabilityProtocol?
Expand All @@ -16,11 +16,11 @@ class NetworkStore {

// not using this Observable anywhere yet, but it will be handy to have
// if we do any further work around offline mode
public var connectedToNetwork: Observable<Bool> {
open var connectedToNetwork: Observable<Bool> {
return _connectedToNetwork.asObservable()
}

public var isConnectedToNetwork: Bool {
open var isConnectedToNetwork: Bool {
return _connectedToNetwork.value
}

Expand Down
2 changes: 1 addition & 1 deletion Shared/Storyboard/Base.lproj/ItemList.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<rect key="frame" x="0.0" y="0.0" width="1024" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To see more entries here, you'll need to save them to Firefox for desktop." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JpV-eG-grp">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To see more entries here, youll need to save them to Firefox for desktop." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JpV-eG-grp">
<rect key="frame" x="372" y="56" width="280" height="31.5"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="gFp-Ms-L2p"/>
Expand Down
2 changes: 1 addition & 1 deletion Shared/Storyboard/Base.lproj/SpinnerAlert.xib
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="mO2-mg-hqg">
<rect key="frame" x="70.5" y="20" width="37" height="37"/>
</activityIndicatorView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Syncing your entries..." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Mj-QY-mDP">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Syncing your entries" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Mj-QY-mDP">
<rect key="frame" x="26" y="67" width="126.5" height="16"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="16" id="VeA-Jt-1TX"/>
Expand Down
4 changes: 2 additions & 2 deletions Shared/Storyboard/en.lproj/SpinnerAlert.strings
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

/* Class = "UILabel"; text = "Syncing your entries..."; ObjectID = "1Mj-QY-mDP"; */
"1Mj-QY-mDP.text" = "Syncing your entries...";
/* Class = "UILabel"; text = "Syncing your entries"; ObjectID = "1Mj-QY-mDP"; */
"1Mj-QY-mDP.text" = "Syncing your entries";
15 changes: 15 additions & 0 deletions docs/localization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Localization for Lockwise iOS

## Exporting Strings
1. Fork of [lockwiseios-l10n](http://github.com/mozilla-l10n/lockwiseios-l10n) to make PRs from
2. Clone the [ios-l10n-scripts]( https://github.com/mozilla-mobile/ios-l10n-scripts) repo so it is a sibling of [lockwise-ios](https://github.com/mozilla-lockwise/lockwise-ios).
3. `cd lockwise-ios`
4. `../ios-l10n-scripts/export-locales-lockwise.sh`
- Note: at this time the `lockwise` script only exists at https://github.com/joeyg/ios-l10n-scripts/tree/add-lockwise-export-script
5. `git remote add <your username> git@github.com:<your username>/lockwiseios-l10n.git`
6. `git push <your username> <branch name>` The script automatically creates the branch for you. You just need to grab its name to push in this step.
7. Create a PR of your l10n changes and submit it

## Adding Locales

## Importing Strings
Loading

0 comments on commit f2778c3

Please sign in to comment.