Skip to content

Commit

Permalink
Release Authenticator 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrubin committed Dec 9, 2017
2 parents 3627633 + d06df88 commit bfb7c12
Show file tree
Hide file tree
Showing 29 changed files with 262 additions and 207 deletions.
9 changes: 5 additions & 4 deletions Authenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
C9CC09551BA91D1C008C54FE /* TableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09541BA91D1C008C54FE /* TableViewModel.swift */; };
C9D6C83F1906BD68004F0E08 /* SegmentedControlRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C83E1906BD68004F0E08 /* SegmentedControlRow.swift */; };
C9D6C8461906CD54004F0E08 /* TextFieldRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C8451906CD54004F0E08 /* TextFieldRow.swift */; };
C9D6C84C19075044004F0E08 /* OTPProgressRing.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C84B19075044004F0E08 /* OTPProgressRing.swift */; };
C9D6C84C19075044004F0E08 /* ProgressRingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C84B19075044004F0E08 /* ProgressRingView.swift */; };
C9DE02E71ED2234D00D7E01C /* InfoList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DE02E61ED2234D00D7E01C /* InfoList.swift */; };
C9DE02E91ED227D600D7E01C /* InfoListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DE02E81ED227D600D7E01C /* InfoListViewController.swift */; };
C9E3FB9A1E281CBC00EFA8BB /* TokenScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E3FB991E281CBC00EFA8BB /* TokenScanner.swift */; };
Expand Down Expand Up @@ -172,7 +172,7 @@
C9CC09541BA91D1C008C54FE /* TableViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewModel.swift; sourceTree = "<group>"; };
C9D6C83E1906BD68004F0E08 /* SegmentedControlRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegmentedControlRow.swift; sourceTree = "<group>"; };
C9D6C8451906CD54004F0E08 /* TextFieldRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldRow.swift; sourceTree = "<group>"; };
C9D6C84B19075044004F0E08 /* OTPProgressRing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTPProgressRing.swift; sourceTree = "<group>"; };
C9D6C84B19075044004F0E08 /* ProgressRingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressRingView.swift; sourceTree = "<group>"; };
C9D844341D4C576B00D5E343 /* CONTRIBUTING.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = "<group>"; };
C9D844361D4C59D600D5E343 /* CONDUCT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONDUCT.md; sourceTree = "<group>"; };
C9DE02E61ED2234D00D7E01C /* InfoList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoList.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -400,7 +400,7 @@
C9B7328E1C0A8AE60076F77E /* TokenListViewModel.swift */,
C92708AB19CFB0750033128B /* TokenListViewController.swift */,
C98C1C4517D2EDF500A07D3F /* Cells */,
C9D6C84B19075044004F0E08 /* OTPProgressRing.swift */,
C9D6C84B19075044004F0E08 /* ProgressRingView.swift */,
CC46C4701DB3007D00EB4605 /* SearchField.swift */,
);
name = "Token List";
Expand Down Expand Up @@ -669,7 +669,7 @@
C93BD6231C167CD100FFFB8F /* Root.swift in Sources */,
C97CDF2C1BEEC90100D64406 /* QRScanner.swift in Sources */,
C9AAB07F1B917EC3000CE547 /* TokenEditForm.swift in Sources */,
C9D6C84C19075044004F0E08 /* OTPProgressRing.swift in Sources */,
C9D6C84C19075044004F0E08 /* ProgressRingView.swift in Sources */,
C9A1C1A91E501D8B009E65D6 /* Info.swift in Sources */,
C9CC09531BA9133B008C54FE /* FocusCell.swift in Sources */,
C99069D1180CBAC900BAEF53 /* TokenScannerViewController.swift in Sources */,
Expand Down Expand Up @@ -745,6 +745,7 @@
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator.dev;
PRODUCT_NAME = Authenticator;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
25 changes: 5 additions & 20 deletions Authenticator/Resources/Acknowledgements.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,10 @@ <h2><a href="https://github.com/mattrubin/OneTimePassword">
<h2><a href="https://github.com/SVProgressHUD/SVProgressHUD">
SVProgressHUD
</a></h2>
<p>Copyright (c) 2011-2016 Sam Vermette, Tobias Tiemerding and contributors.</p>
<p>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</p>
<p>Copyright (c) 2011-2017 Sam Vermette, Tobias Tiemerding and contributors.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>

<h2><a href="https://github.com/jspahrsummers/xcconfigs">
xcconfigs
Expand All @@ -80,6 +65,6 @@ <h2><a href="https://github.com/jspahrsummers/xcconfigs">
<p>Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.</p>
<p>In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p>For more information, please refer to unlicense.org.</p>
<p>For more information, please refer to <a href="https://unlicense.org">unlicense.org</a>.</p>
</body>
</html>
2 changes: 1 addition & 1 deletion Authenticator/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.1</string>
<string>2.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
69 changes: 30 additions & 39 deletions Authenticator/Source/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,24 @@ class AppController {
private let store: TokenStore
private var component: Root {
didSet {
let viewModel = currentViewModel()
// TODO: Fix the excessive updates of bar button items so that the tick can run while they are on screen.
if case .none = viewModel.modal {
if displayLink == nil {
startTick()
}
} else {
if displayLink != nil {
stopTick()
}
}
view.updateWithViewModel(viewModel)
updateView()
}
}
private lazy var view: RootViewController = {
let (currentViewModel, nextRefreshTime) = self.component.viewModel(for: self.store.persistentTokens,
at: .currentDisplayTime())
self.setTimer(withNextRefreshTime: nextRefreshTime)
return RootViewController(
viewModel: self.currentViewModel(),
viewModel: currentViewModel,
dispatchAction: self.handleAction
)
}()
private var refreshTimer: Timer? {
willSet {
// Invalidate the old timer
refreshTimer?.invalidate()
}
}

init() {
do {
Expand All @@ -73,33 +71,26 @@ class AppController {
// If this is a demo, show the scanner even in the simulator.
let deviceCanScan = QRScanner.deviceCanScan || CommandLine.isDemo
component = Root(deviceCanScan: deviceCanScan)

startTick()
}

private func currentViewModel() -> Root.ViewModel {
return component.viewModel(for: store.persistentTokens, at: .currentDisplayTime())
}

// MARK: - Tick

private var displayLink: CADisplayLink?

private func startTick() {
let selector = #selector(tick)
self.displayLink = CADisplayLink(target: self, selector: selector)
self.displayLink?.add(to: RunLoop.main, forMode: .commonModes)
}

private func stopTick() {
self.displayLink?.invalidate()
self.displayLink = nil
@objc
func updateView() {
let (currentViewModel, nextRefreshTime) = component.viewModel(for: store.persistentTokens,
at: .currentDisplayTime())
setTimer(withNextRefreshTime: nextRefreshTime)
view.updateWithViewModel(currentViewModel)
}

@objc
func tick() {
// Update the view with a new view model for the current display time.
view.updateWithViewModel(currentViewModel())
private func setTimer(withNextRefreshTime nextRefreshTime: Date) {
let timer = Timer(fireAt: nextRefreshTime,
interval: 0,
target: self,
selector: #selector(updateView),
userInfo: nil,
repeats: false)
// Add the new timer to the main run loop
RunLoop.main.add(timer, forMode: .commonModes)
refreshTimer = timer
}

// MARK: - Update
Expand Down Expand Up @@ -143,23 +134,23 @@ class AppController {
case let .updatePersistentToken(persistentToken, failure):
do {
try store.updatePersistentToken(persistentToken)
view.updateWithViewModel(currentViewModel())
updateView()
} catch {
handleEvent(failure(error))
}

case let .moveToken(fromIndex, toIndex, failure):
do {
try store.moveTokenFromIndex(fromIndex, toIndex: toIndex)
view.updateWithViewModel(currentViewModel())
updateView()
} catch {
handleEvent(failure(error))
}

case let .deletePersistentToken(persistentToken, failure):
do {
try store.deletePersistentToken(persistentToken)
view.updateWithViewModel(currentViewModel())
updateView()
} catch {
handleEvent(failure(error))
}
Expand Down
6 changes: 5 additions & 1 deletion Authenticator/Source/OTPAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class OTPAppDelegate: UIResponder, UIApplicationDelegate {
let fontAttributes = [NSFontAttributeName: barButtonItemFont]
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .highlighted)
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .selected)

let disabledAttributes = [
NSFontAttributeName: barButtonItemFont,
Expand All @@ -57,6 +56,11 @@ class OTPAppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Ensure the UI is updated with the latest view model whenever the app returns from the background.
app.updateView()
}

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if let token = Token(url: url) {
let message = "Do you want to add a token for “\(token.name)”?"
Expand Down
68 changes: 0 additions & 68 deletions Authenticator/Source/OTPProgressRing.swift

This file was deleted.

Loading

0 comments on commit bfb7c12

Please sign in to comment.