Skip to content

Commit

Permalink
Release Authenticator 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrubin authored Dec 22, 2018
2 parents e177e31 + bfd9169 commit 1fdcbd4
Show file tree
Hide file tree
Showing 40 changed files with 807 additions and 172 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ codecov:
ignore:
- AuthenticatorTests

comment: off # Disable coverage comments on pull requests

coverage:
status:
project:
Expand Down
20 changes: 17 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

# Installed Ruby gems
/.bundle

## Build generated
build/
DerivedData/
Expand All @@ -19,7 +22,7 @@ xcuserdata/

## Other
*.moved-aside
*.xcuserstate
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
Expand All @@ -36,6 +39,8 @@ playground.xcworkspace
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/

# CocoaPods
Expand All @@ -45,6 +50,9 @@ playground.xcworkspace
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
Expand All @@ -58,10 +66,16 @@ Carthage/Build
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
# fastlane/screenshots
fastlane/screenshots/screenshots.html
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
25 changes: 25 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
# Configuration for SwiftLint (https://github.com/realm/SwiftLint)

excluded:
- .bundle
- Carthage
- fastlane

opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_first_not_nil
- convenience_type
- discouraged_object_literal
- discouraged_optional_boolean
- empty_count
- empty_string
- empty_xctest_method
- explicit_enum_raw_value
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- first_where
- force_unwrapping
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- legacy_random
- let_var_whitespace
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- multiline_function_chains
- multiline_literal_brackets
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
Expand All @@ -35,12 +45,19 @@ opt_in_rules:
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- static_operator
- switch_case_on_newline
- toggle_bool
- unavailable_function
- untyped_error_in_catch
- unused_import
- unused_private_declaration
- vertical_parameter_alignment_on_call
- yoda_condition

disabled_rules:
- identifier_name
- line_length
Expand All @@ -52,6 +69,14 @@ cyclomatic_complexity:
function_body_length:
warning: 50

line_length:
ignores_function_declarations: true
ignores_interpolated_strings: true

nesting:
type_level:
warning: 2

trailing_comma:
mandatory_comma: true

Expand Down
16 changes: 16 additions & 0 deletions Authenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
C9A1C1A91E501D8B009E65D6 /* Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A1C1A81E501D8B009E65D6 /* Info.swift */; };
C9A1C1AC1E5021A6009E65D6 /* BackupInfo.html in Resources */ = {isa = PBXBuildFile; fileRef = C9A1C1AA1E502195009E65D6 /* BackupInfo.html */; };
C9A1C1CE1E6CDBFB009E65D6 /* RootTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A1C1CD1E6CDBFB009E65D6 /* RootTests.swift */; };
C9A23F2E2159C28200615846 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A23F2D2159C28200615846 /* Settings.swift */; };
C9A262D01E170BD4004E6CEB /* AuthenticatorScreenshots.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A262CF1E170BD4004E6CEB /* AuthenticatorScreenshots.swift */; };
C9A262D81E170E3A004E6CEB /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A262D71E170E3A004E6CEB /* SnapshotHelper.swift */; };
C9A262DA1E176A18004E6CEB /* Demo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A262D91E176A18004E6CEB /* Demo.swift */; };
Expand All @@ -49,11 +50,14 @@
C9CC09511BA903B7008C54FE /* TokenFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */; };
C9CC09531BA9133B008C54FE /* FocusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09521BA9133B008C54FE /* FocusCell.swift */; };
C9CC09551BA91D1C008C54FE /* TableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09541BA91D1C008C54FE /* TableViewModel.swift */; };
C9CDD1CF209662E100636056 /* DisplayOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CDD1CE209662E100636056 /* DisplayOptions.swift */; };
C9CDD1D12096635300636056 /* DisplayOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CDD1D02096635300636056 /* DisplayOptionsViewController.swift */; };
C9D6C83F1906BD68004F0E08 /* SegmentedControlRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C83E1906BD68004F0E08 /* SegmentedControlRow.swift */; };
C9D6C8461906CD54004F0E08 /* TextFieldRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D6C8451906CD54004F0E08 /* TextFieldRow.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 */; };
C9E11E1121543E2A00C1AA53 /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E11E1021543E2A00C1AA53 /* Menu.swift */; };
C9E3FB9A1E281CBC00EFA8BB /* TokenScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E3FB991E281CBC00EFA8BB /* TokenScanner.swift */; };
C9E3FB9C1E2860DD00EFA8BB /* TokenScannerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E3FB9B1E2860DD00EFA8BB /* TokenScannerTests.swift */; };
C9EB448E1C52A74200ACFA87 /* Component.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EB448D1C52A74200ACFA87 /* Component.swift */; };
Expand Down Expand Up @@ -157,6 +161,7 @@
C9A1C1A81E501D8B009E65D6 /* Info.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = "<group>"; };
C9A1C1AA1E502195009E65D6 /* BackupInfo.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = BackupInfo.html; sourceTree = "<group>"; };
C9A1C1CD1E6CDBFB009E65D6 /* RootTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootTests.swift; sourceTree = "<group>"; };
C9A23F2D2159C28200615846 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
C9A262CD1E170BD4004E6CEB /* AuthenticatorScreenshots.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AuthenticatorScreenshots.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C9A262CF1E170BD4004E6CEB /* AuthenticatorScreenshots.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatorScreenshots.swift; sourceTree = "<group>"; };
C9A262D71E170E3A004E6CEB /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = fastlane/SnapshotHelper.swift; sourceTree = SOURCE_ROOT; };
Expand All @@ -172,13 +177,16 @@
C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenFormViewController.swift; sourceTree = "<group>"; };
C9CC09521BA9133B008C54FE /* FocusCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FocusCell.swift; sourceTree = "<group>"; };
C9CC09541BA91D1C008C54FE /* TableViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewModel.swift; sourceTree = "<group>"; };
C9CDD1CE209662E100636056 /* DisplayOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayOptions.swift; sourceTree = "<group>"; };
C9CDD1D02096635300636056 /* DisplayOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayOptionsViewController.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 /* 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>"; };
C9DE02E81ED227D600D7E01C /* InfoListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoListViewController.swift; sourceTree = "<group>"; };
C9E11E1021543E2A00C1AA53 /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
C9E3FB991E281CBC00EFA8BB /* TokenScanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenScanner.swift; sourceTree = "<group>"; };
C9E3FB9B1E2860DD00EFA8BB /* TokenScannerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenScannerTests.swift; sourceTree = "<group>"; };
C9EB448D1C52A74200ACFA87 /* Component.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Component.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -440,10 +448,13 @@
C9A1C1A71E501D5F009E65D6 /* Info */ = {
isa = PBXGroup;
children = (
C9E11E1021543E2A00C1AA53 /* Menu.swift */,
C9DE02E61ED2234D00D7E01C /* InfoList.swift */,
C9DE02E81ED227D600D7E01C /* InfoListViewController.swift */,
C9A1C1A81E501D8B009E65D6 /* Info.swift */,
C9A1C1A51E501CB2009E65D6 /* InfoViewController.swift */,
C9CDD1CE209662E100636056 /* DisplayOptions.swift */,
C9CDD1D02096635300636056 /* DisplayOptionsViewController.swift */,
);
name = Info;
sourceTree = "<group>";
Expand Down Expand Up @@ -505,6 +516,7 @@
isa = PBXGroup;
children = (
C9F7A8601C4D90B50082E5AE /* TokenStore.swift */,
C9A23F2D2159C28200615846 /* Settings.swift */,
);
name = "Data Store";
sourceTree = "<group>";
Expand Down Expand Up @@ -656,7 +668,10 @@
buildActionMask = 2147483647;
files = (
C93AD15219CD51BE007480E9 /* Colors.swift in Sources */,
C9CDD1D12096635300636056 /* DisplayOptionsViewController.swift in Sources */,
C9CDD1CF209662E100636056 /* DisplayOptions.swift in Sources */,
C9DE02E71ED2234D00D7E01C /* InfoList.swift in Sources */,
C9A23F2E2159C28200615846 /* Settings.swift in Sources */,
C93BD6251C16841D00FFFB8F /* RootViewController.swift in Sources */,
C9919CE01BA721A1006237C1 /* ButtonHeaderView.swift in Sources */,
C9EB44901C52AE4500ACFA87 /* AppController.swift in Sources */,
Expand All @@ -683,6 +698,7 @@
C9D6C83F1906BD68004F0E08 /* SegmentedControlRow.swift in Sources */,
C968D1151CB4C639004ED7BB /* DisplayTime.swift in Sources */,
8B0028B511EB75920092DE18 /* ScannerOverlayView.swift in Sources */,
C9E11E1121543E2A00C1AA53 /* Menu.swift in Sources */,
C9CC09551BA91D1C008C54FE /* TableViewModel.swift in Sources */,
C92708AC19CFB0750033128B /* TokenListViewController.swift in Sources */,
C9A262DA1E176A18004E6CEB /* Demo.swift in Sources */,
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.5</string>
<string>2.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
13 changes: 11 additions & 2 deletions Authenticator/Source/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ import SVProgressHUD

class AppController {
private let store: TokenStore
private let settings: Settings
private var component: Root {
didSet {
updateView()
}
}
private lazy var view: RootViewController = {
let (currentViewModel, nextRefreshTime) = self.component.viewModel(with: self.store.persistentTokens,
at: .currentDisplayTime())
at: .currentDisplayTime(),
digitGroupSize: settings.digitGroupSize)
self.setTimer(withNextRefreshTime: nextRefreshTime)
return RootViewController(
viewModel: currentViewModel,
Expand Down Expand Up @@ -68,6 +70,8 @@ class AppController {
fatalError("Failed to load token store: \(error)")
}

settings = Settings()

// If this is a demo, show the scanner even in the simulator.
let deviceCanScan = QRScanner.deviceCanScan || CommandLine.isDemo
component = Root(deviceCanScan: deviceCanScan)
Expand All @@ -76,7 +80,8 @@ class AppController {
@objc
func updateView() {
let (currentViewModel, nextRefreshTime) = component.viewModel(with: store.persistentTokens,
at: .currentDisplayTime())
at: .currentDisplayTime(),
digitGroupSize: settings.digitGroupSize)
setTimer(withNextRefreshTime: nextRefreshTime)
view.update(with: currentViewModel)
}
Expand Down Expand Up @@ -174,6 +179,10 @@ class AppController {
// Fallback on earlier versions
UIApplication.shared.openURL(url)
}

case let .setDigitGroupSize(digitGroupSize):
settings.digitGroupSize = digitGroupSize
updateView()
}
}

Expand Down
4 changes: 2 additions & 2 deletions 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-2017 Authenticator authors
// Copyright (c) 2014-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 Down Expand Up @@ -36,7 +36,7 @@ extension UIColor {
)
}

private struct OTP {
private enum OTP {
static let darkColor = UIColor(red: 35, green: 35, blue: 50)
static let lightColor = UIColor(red: 250, green: 248, blue: 240)
}
Expand Down
43 changes: 43 additions & 0 deletions Authenticator/Source/DisplayOptions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// DisplayOptions.swift
// Authenticator
//
// Copyright (c) 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
// 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:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 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.
//

struct DisplayOptions {
// MARK: View Model

struct ViewModel {
let digitGroupSize: Int
}

func viewModel(digitGroupSize: Int) -> ViewModel {
return ViewModel(digitGroupSize: digitGroupSize)
}

// MARK: Actions

enum Effect {
case setDigitGroupSize(Int)
case done
}
}
Loading

0 comments on commit 1fdcbd4

Please sign in to comment.