Skip to content

Commit

Permalink
Release Authenticator 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrubin committed Apr 24, 2018
2 parents bfb7c12 + e02b3ff commit b1dbf00
Show file tree
Hide file tree
Showing 79 changed files with 498 additions and 424 deletions.
30 changes: 26 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,54 @@ excluded:
- Carthage
- fastlane
opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- conditional_returns_on_newline
- contains_over_first_not_nil
- discouraged_object_literal
- discouraged_optional_boolean
- empty_count
- empty_string
- explicit_enum_raw_value
- explicit_init
- extension_access_modifier
- fatal_error_message
- file_header
- first_where
- force_unwrapping
- missing_docs
- nimble_operator
- number_separator
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- let_var_whitespace
- literal_expression_end_indentation
- lower_acl_than_parent
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- private_action
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- single_test_class
- sorted_first_last
- switch_case_on_newline
- vertical_whitespace
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- yoda_condition
disabled_rules:
- identifier_name
- line_length
- todo

cyclomatic_complexity:
warning: 15

function_body_length:
warning: 50

trailing_comma:
mandatory_comma: true

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language: objective-c
xcode_workspace: Authenticator.xcworkspace
xcode_scheme: Authenticator

osx_image: xcode9
osx_image: xcode9.3

env:
- RUNTIME="iOS 9.0" DEVICE="iPhone 4s"
Expand Down
12 changes: 7 additions & 5 deletions Authenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,21 @@
CLASSPREFIX = OTP;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Matt Rubin";
TargetAttributes = {
1D6058900D05DD3D006BFB54 = {
DevelopmentTeam = WD7ETSN9J9;
LastSwiftMigration = 0830;
LastSwiftMigration = 0910;
ProvisioningStyle = Automatic;
};
C9906A2D1812522100BAEF53 = {
LastSwiftMigration = 0830;
LastSwiftMigration = 0910;
TestTargetID = 1D6058900D05DD3D006BFB54;
};
C9A262CC1E170BD4004E6CEB = {
CreatedOnToolsVersion = 8.2.1;
LastSwiftMigration = 0910;
TestTargetID = 1D6058900D05DD3D006BFB54;
};
};
Expand Down Expand Up @@ -763,6 +764,7 @@
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator;
PRODUCT_NAME = Authenticator;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -779,7 +781,7 @@
);
GCC_DYNAMIC_NO_PIC = NO;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -794,7 +796,7 @@
);
GCC_DYNAMIC_NO_PIC = NO;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
22 changes: 17 additions & 5 deletions Authenticator/Resources/Acknowledgements.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2><a href="https://github.com/ekscrypto/Base32">
<h2><a href="https://github.com/mattrubin/OneTimePassword">
OneTimePassword
</a></h2>
<p>Copyright (c) 2013-2017 Matt Rubin and the OneTimePassword authors</p>
<p>Copyright (c) 2013-2018 Matt Rubin and the OneTimePassword authors</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
Expand All @@ -53,10 +53,22 @@ <h2><a href="https://github.com/mattrubin/OneTimePassword">
<h2><a href="https://github.com/SVProgressHUD/SVProgressHUD">
SVProgressHUD
</a></h2>
<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>
<p>Copyright (c) 2011-2018 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 Down
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.2</string>
<string>2.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
12 changes: 6 additions & 6 deletions Authenticator/Source/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// AppController.swift
// Authenticator
//
// Copyright (c) 2016 Authenticator authors
// Copyright (c) 2016-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -37,7 +37,7 @@ class AppController {
}
}
private lazy var view: RootViewController = {
let (currentViewModel, nextRefreshTime) = self.component.viewModel(for: self.store.persistentTokens,
let (currentViewModel, nextRefreshTime) = self.component.viewModel(with: self.store.persistentTokens,
at: .currentDisplayTime())
self.setTimer(withNextRefreshTime: nextRefreshTime)
return RootViewController(
Expand Down Expand Up @@ -75,10 +75,10 @@ class AppController {

@objc
func updateView() {
let (currentViewModel, nextRefreshTime) = component.viewModel(for: store.persistentTokens,
let (currentViewModel, nextRefreshTime) = component.viewModel(with: store.persistentTokens,
at: .currentDisplayTime())
setTimer(withNextRefreshTime: nextRefreshTime)
view.updateWithViewModel(currentViewModel)
view.update(with: currentViewModel)
}

private func setTimer(withNextRefreshTime nextRefreshTime: Date) {
Expand All @@ -97,7 +97,7 @@ class AppController {

private func handleAction(_ action: Root.Action) {
do {
let sideEffect = try component.update(action)
let sideEffect = try component.update(with: action)
if let effect = sideEffect {
handleEffect(effect)
}
Expand All @@ -107,7 +107,7 @@ class AppController {
}

private func handleEvent(_ event: Root.Event) {
let sideEffect = component.update(event)
let sideEffect = component.update(with: event)
if let effect = sideEffect {
handleEffect(effect)
}
Expand Down
2 changes: 1 addition & 1 deletion Authenticator/Source/BarButtonViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BarButtonViewModel.swift
// Authenticator
//
// Copyright (c) 2015 Authenticator authors
// Copyright (c) 2015-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 6 additions & 5 deletions Authenticator/Source/ButtonHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ButtonHeaderView.swift
// Authenticator
//
// Copyright (c) 2015 Authenticator authors
// Copyright (c) 2015-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -58,7 +58,7 @@ class ButtonHeaderView<Action>: UIButton {
private func configureSubviews() {
titleLabel?.textAlignment = .center
setTitleColor(.otpForegroundColor, for: UIControlState.normal)
titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: UIFontWeightLight)
titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .light)

addTarget(self, action: #selector(ButtonHeaderView.buttonWasPressed), for: .touchUpInside)
}
Expand All @@ -68,20 +68,21 @@ class ButtonHeaderView<Action>: UIButton {
convenience init(viewModel: ButtonHeaderViewModel<Action>, dispatchAction: @escaping (Action) -> Void) {
self.init()
self.dispatchAction = dispatchAction
updateWithViewModel(viewModel)
update(with: viewModel)
}

func updateWithViewModel(_ viewModel: ButtonHeaderViewModel<Action>) {
func update(with viewModel: ButtonHeaderViewModel<Action>) {
setTitle(viewModel.title, for: .normal)
buttonAction = viewModel.action
}

static func heightWithViewModel(_ viewModel: ButtonHeaderViewModel<Action>) -> CGFloat {
static func heightForHeader(with viewModel: ButtonHeaderViewModel<Action>) -> CGFloat {
return preferredHeight
}

// MARK: - Target Action

@objc
func buttonWasPressed() {
if let action = buttonAction {
dispatchAction?(action)
Expand Down
2 changes: 1 addition & 1 deletion Authenticator/Source/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Colors.swift
// Authenticator
//
// Copyright (c) 2014-2015 Authenticator authors
// Copyright (c) 2014-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions Authenticator/Source/Component.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Component.swift
// Authenticator
//
// Copyright (c) 2016 Authenticator authors
// Copyright (c) 2016-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,7 +30,7 @@ protocol Component {
// MARK: Update
associatedtype Action
associatedtype Effect
mutating func update(_ action: Action) throws -> Effect?
mutating func update(with action: Action) throws -> Effect?
}

struct ComponentError<C: Component>: Error {
Expand Down
10 changes: 5 additions & 5 deletions Authenticator/Source/Demo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Demo.swift
// Authenticator
//
// Copyright (c) 2016 Authenticator authors
// Copyright (c) 2016-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -106,12 +106,12 @@ extension TokenEntryForm {
static let demoForm: TokenEntryForm = {
// Construct a pre-filled demo form.
var form = TokenEntryForm()
_ = form.update(.issuer("Google"))
_ = form.update(.name("[email protected]"))
_ = form.update(.secret("JBSWY3DPEHPK6PX9"))
_ = form.update(with: .issuer("Google"))
_ = form.update(with: .name("[email protected]"))
_ = form.update(with: .secret("JBSWY3DPEHPK6PX9"))
if UIScreen.main.bounds.height > 550 {
// Expand the advanced options for iPhone 5 and later, but not for the earlier 3.5-inch screens.
_ = form.update(.showAdvancedOptions)
_ = form.update(with: .showAdvancedOptions)
}
return form
}()
Expand Down
8 changes: 2 additions & 6 deletions Authenticator/Source/DisplayTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DisplayTime.swift
// Authenticator
//
// Copyright (c) 2016 Authenticator authors
// Copyright (c) 2016-2018 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,7 +26,7 @@
import Foundation

/// A simple value representing a moment in time, stored as the number of seconds since the epoch.
struct DisplayTime: Equatable {
struct DisplayTime {
let timeIntervalSince1970: TimeInterval

init(date: Date) {
Expand All @@ -37,7 +37,3 @@ struct DisplayTime: Equatable {
return Date(timeIntervalSince1970: timeIntervalSince1970)
}
}

func == (lhs: DisplayTime, rhs: DisplayTime) -> Bool {
return lhs.timeIntervalSince1970 == rhs.timeIntervalSince1970
}
2 changes: 1 addition & 1 deletion Authenticator/Source/FocusCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FocusCell.swift
// Authenticator
//
// Copyright (c) 2015 Authenticator authors
// Copyright (c) 2015-2017 Authenticator authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit b1dbf00

Please sign in to comment.