Skip to content

Commit 02d100c

Browse files
committed
Merge branch 'release/0.3.3'
2 parents 6042f40 + 78fea13 commit 02d100c

File tree

4 files changed

+134
-25
lines changed

4 files changed

+134
-25
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0920"
4+
version = "2.0">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "E913C8ED1FFFA51D001A83F7"
18+
BuildableName = "Adamant.app"
19+
BlueprintName = "Adamant"
20+
ReferencedContainer = "container:Adamant.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<Testables>
32+
<TestableReference
33+
skipped = "NO">
34+
<BuildableReference
35+
BuildableIdentifier = "primary"
36+
BlueprintIdentifier = "E9EC344320066D4A00C0E546"
37+
BuildableName = "AdamantTests.xctest"
38+
BlueprintName = "AdamantTests"
39+
ReferencedContainer = "container:Adamant.xcodeproj">
40+
</BuildableReference>
41+
</TestableReference>
42+
</Testables>
43+
<MacroExpansion>
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "E913C8ED1FFFA51D001A83F7"
47+
BuildableName = "Adamant.app"
48+
BlueprintName = "Adamant"
49+
ReferencedContainer = "container:Adamant.xcodeproj">
50+
</BuildableReference>
51+
</MacroExpansion>
52+
<AdditionalOptions>
53+
</AdditionalOptions>
54+
</TestAction>
55+
<LaunchAction
56+
buildConfiguration = "Debug"
57+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
58+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
60+
launchStyle = "0"
61+
useCustomWorkingDirectory = "NO"
62+
ignoresPersistentStateOnLaunch = "NO"
63+
debugDocumentVersioning = "YES"
64+
debugServiceExtension = "internal"
65+
allowLocationSimulation = "YES"
66+
showNonLocalizedStrings = "YES"
67+
launchAutomaticallySubstyle = "1">
68+
<BuildableProductRunnable
69+
runnableDebuggingMode = "0">
70+
<BuildableReference
71+
BuildableIdentifier = "primary"
72+
BlueprintIdentifier = "E913C8ED1FFFA51D001A83F7"
73+
BuildableName = "Adamant.app"
74+
BlueprintName = "Adamant"
75+
ReferencedContainer = "container:Adamant.xcodeproj">
76+
</BuildableReference>
77+
</BuildableProductRunnable>
78+
<AdditionalOptions>
79+
</AdditionalOptions>
80+
</LaunchAction>
81+
<ProfileAction
82+
buildConfiguration = "Release"
83+
shouldUseLaunchSchemeArgsEnv = "YES"
84+
savedToolIdentifier = ""
85+
useCustomWorkingDirectory = "NO"
86+
debugDocumentVersioning = "YES">
87+
<BuildableProductRunnable
88+
runnableDebuggingMode = "0">
89+
<BuildableReference
90+
BuildableIdentifier = "primary"
91+
BlueprintIdentifier = "E913C8ED1FFFA51D001A83F7"
92+
BuildableName = "Adamant.app"
93+
BlueprintName = "Adamant"
94+
ReferencedContainer = "container:Adamant.xcodeproj">
95+
</BuildableReference>
96+
</BuildableProductRunnable>
97+
</ProfileAction>
98+
<AnalyzeAction
99+
buildConfiguration = "Debug">
100+
</AnalyzeAction>
101+
<ArchiveAction
102+
buildConfiguration = "Release"
103+
revealArchiveInOrganizer = "YES">
104+
</ArchiveAction>
105+
</Scheme>

Adamant/AppDelegate.swift

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3636
notificationService = container.resolve(NotificationsService.self)
3737

3838

39-
// MARK: 2. Prepare UI
40-
self.window = UIWindow(frame: UIScreen.main.bounds)
41-
self.window!.rootViewController = UITabBarController()
42-
self.window!.rootViewController?.view.backgroundColor = .white
43-
self.window!.makeKeyAndVisible()
39+
// MARK: 2. Init UI
40+
window = UIWindow(frame: UIScreen.main.bounds)
41+
window!.rootViewController = UITabBarController()
42+
window!.rootViewController?.view.backgroundColor = .white
43+
window!.makeKeyAndVisible()
44+
window!.tintColor = UIColor.adamantPrimary
4445

45-
self.window!.tintColor = UIColor.adamantPrimary
46+
47+
// MARK: 3. Show login
4648

4749
guard let router = container.resolve(Router.self) else {
4850
fatalError("Failed to get Router")
4951
}
5052

51-
if let tabbar = self.window!.rootViewController as? UITabBarController {
53+
let login = router.get(scene: AdamantScene.Login.login)
54+
window!.rootViewController?.present(login, animated: false, completion: nil)
55+
56+
// MARK: 4. Async prepare pages
57+
if let tabbar = window?.rootViewController as? UITabBarController {
5258
let accountRoot = router.get(scene: AdamantScene.Account.account)
5359
let account = UINavigationController(rootViewController: accountRoot)
5460
account.tabBarItem.title = String.adamantLocalized.tabItems.account
@@ -64,21 +70,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6470
settings.tabBarItem.title = String.adamantLocalized.tabItems.settings
6571
settings.tabBarItem.image = #imageLiteral(resourceName: "settings_tab")
6672

67-
6873
account.tabBarItem.badgeColor = UIColor.adamantPrimary
6974
chatList.tabBarItem.badgeColor = UIColor.adamantPrimary
7075
settings.tabBarItem.badgeColor = UIColor.adamantPrimary
7176

7277
tabbar.setViewControllers([account, chatList, settings], animated: false)
7378
}
74-
75-
76-
// MARK: 3. Initiate login
77-
let login = router.get(scene: AdamantScene.Login.login)
78-
self.window!.rootViewController?.present(login, animated: false, completion: nil)
79-
8079

81-
// MARK: 4 Autoupdate
80+
// MARK: 5 Autoupdate
8281
repeater = RepeaterService()
8382
if let chatsProvider = container.resolve(ChatsProvider.self),
8483
let transfersProvider = container.resolve(TransfersProvider.self),
@@ -91,7 +90,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
9190
}
9291

9392

94-
// MARK: 4. Notifications
93+
// MARK: 6. Notifications
9594
if let service = container.resolve(NotificationsService.self) {
9695
if service.notificationsEnabled {
9796
UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
@@ -109,7 +108,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
109108
}
110109

111110

112-
// MARK: 5. Logout reset
111+
// MARK: 7. Logout reset
113112
NotificationCenter.default.addObserver(forName: Notification.Name.adamantUserLoggedOut, object: nil, queue: OperationQueue.main) { [weak self] _ in
114113
// On logout, pop all navigators to root.
115114
guard let tbc = self?.window?.rootViewController as? UITabBarController, let vcs = tbc.viewControllers else {

Adamant/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.3.2</string>
20+
<string>0.3.3</string>
2121
<key>CFBundleVersion</key>
22-
<string>18</string>
22+
<string>19</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSCameraUsageDescription</key>

Adamant/Stories/Login/LoginViewController.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class LoginViewController: FormViewController {
121121
// MARK: Properties
122122
private var hideNewPassphrase: Bool = true
123123
private var generatedPassphrases = [String]()
124-
124+
private var firstTimeActive: Bool = true
125125

126126
// MARK: Lifecycle
127127

@@ -277,16 +277,12 @@ class LoginViewController: FormViewController {
277277
})
278278

279279
section.append(row)
280-
281-
if accountService.useBiometry {
282-
loginWithBiometry()
283-
}
284280
}
285281

286282

287283
// MARK: tableView position tuning
288284
if let row: PasswordRow = form.rowBy(tag: Rows.passphrase.tag) {
289-
NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextFieldTextDidBeginEditing, object: row.cell.textField, queue: nil) { [weak self] _ in
285+
NotificationCenter.default.addObserver(forName: Notification.Name.UITextFieldTextDidBeginEditing, object: row.cell.textField, queue: nil) { [weak self] _ in
290286
guard let tableView = self?.tableView, let indexPath = self?.form.rowBy(tag: Rows.loginButton.tag)?.indexPath else {
291287
return
292288
}
@@ -296,6 +292,15 @@ class LoginViewController: FormViewController {
296292
}
297293
}
298294
}
295+
296+
// MARK: Requesting biometry onActive
297+
NotificationCenter.default.addObserver(forName: Notification.Name.UIApplicationDidBecomeActive, object: nil, queue: OperationQueue.main) { [weak self] _ in
298+
if let firstTimeActive = self?.firstTimeActive, firstTimeActive,
299+
let accountService = self?.accountService, accountService.hasStayInAccount, accountService.useBiometry {
300+
self?.loginWithBiometry()
301+
self?.firstTimeActive = false
302+
}
303+
}
299304
}
300305
}
301306

0 commit comments

Comments
 (0)