Skip to content

Commit

Permalink
Merge branch 'release/v5.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
adocyn committed Apr 29, 2024
2 parents 95ea151 + f1578f4 commit 3cb0af8
Show file tree
Hide file tree
Showing 197 changed files with 6,686 additions and 349 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ TwoFAS/Content/Sources/ServiceDefinitionDatabaseImpl+Database7.swift filter=git-
TwoFAS/Content/Sources/ServiceDefinitionDatabaseImpl+Database8.swift filter=git-crypt diff=git-crypt
TwoFAS/Content/Sources/ServiceDefinitionDatabaseImpl+Database9.swift filter=git-crypt diff=git-crypt
TwoFAS/Content/Assets/Assets.car filter=git-crypt diff=git-crypt
TwoFAS/Content/AssetsWatch/Assets.car filter=git-crypt diff=git-crypt
TwoFAS/TwoFAS/Other/Guides/** filter=git-crypt diff=git-crypt
30 changes: 30 additions & 0 deletions TwoFAS/Base32/Base32Watch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// This file is part of the 2FAS iOS app (https://github.com/twofas/2fas-ios)
// Copyright © 2023 Two Factor Authentication Service, Inc.
// Contributed by Zbigniew Cisiński. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
//

#import <Foundation/Foundation.h>

//! Project version number for Base32.
FOUNDATION_EXPORT double Base32VersionNumber;

//! Project version string for Base32.
FOUNDATION_EXPORT const unsigned char Base32VersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <Base32/PublicHeader.h>

#import "MF_Base32Additions.h"
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
}
},
"idiom" : "universal"
},
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.137",
"green" : "0.110",
"red" : "0.898"
}
},
"idiom" : "watch"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
}
},
"idiom" : "universal"
},
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x28",
"green" : "0x24",
"red" : "0x23"
}
},
"idiom" : "watch"
}
],
"info" : {
Expand Down
22 changes: 22 additions & 0 deletions TwoFAS/Common/Sources/Colors/TintColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//

import UIKit
#if os(watchOS)
import SwiftUI
#endif

public enum TintColor: String, Hashable, CaseIterable, Codable {
case `default`
Expand Down Expand Up @@ -108,6 +111,7 @@ public extension TintColor {
}
}

#if os(iOS)
var color: UIColor {
let bundle = Bundle(for: CountdownTimer.self)
switch self {
Expand All @@ -124,4 +128,22 @@ public extension TintColor {
case .brown: return UIColor(named: "tintBrownColor", in: bundle, compatibleWith: nil)!
}
}
#elseif os(watchOS)
var color: Color {
let bundle = Bundle(for: CoreDataStack.self)
switch self {
case .`default`: return Color("tintDefaultColor", bundle: bundle)
case .lightBlue: return Color("tintLightBlueColor", bundle: bundle)
case .indigo: return Color("tintIndigoColor", bundle: bundle)
case .purple: return Color("tintPurpleColor", bundle: bundle)
case .turquoise: return Color("tintTurquoiseColor", bundle: bundle)
case .green: return Color("tintGreenColor", bundle: bundle)
case .red: return Color("tintRedColor", bundle: bundle)
case .orange: return Color("tintOrangeColor", bundle: bundle)
case .yellow: return Color("tintYellowColor", bundle: bundle)
case .pink: return Color("tintPinkColor", bundle: bundle)
case .brown: return Color("tintBrownColor", bundle: bundle)
}
}
#endif
}
43 changes: 43 additions & 0 deletions TwoFAS/Common/Sources/Models/CloudState.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// This file is part of the 2FAS iOS app (https://github.com/twofas/2fas-ios)
// Copyright © 2024 Two Factor Authentication Service, Inc.
// Contributed by Zbigniew Cisiński. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
//

import Foundation

public enum CloudState: Equatable {
public enum NotAvailableReason: Equatable {
case overQuota
case disabledByUser
case error(error: NSError?)
case useriCloudProblem
case other
case newerVersion
case incorrectService(serviceName: String)
case cloudEncrypted
}

public enum Sync: Equatable {
case syncing
case synced
}

case unknown
case disabledNotAvailable(reason: NotAvailableReason)
case disabledAvailable
case enabled(sync: Sync)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import Foundation

public enum PINType: CaseIterable {
public enum PINType: CaseIterable, Codable, Hashable {
case digits4
case digits6
}
Expand Down
2 changes: 2 additions & 0 deletions TwoFAS/Common/Sources/Models/TypeAliases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public typealias ServiceTypeID = UUID
public typealias IconTypeID = UUID
public typealias SectionID = UUID
public typealias DeviceName = String
public typealias CloudStateListenerID = String
public typealias CloudStateListener = (CloudState) -> Void

public typealias Secret = String
public typealias TokenValue = String
Expand Down
9 changes: 7 additions & 2 deletions TwoFAS/CommonUIKit/ServiceIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
//

import UIKit
#if os(iOS)
import Common
import Content
#elseif os(watchOS)
import CommonWatch
import ContentWatch
#endif

// swiftlint:disable convenience_type
public final class ServiceIcon {
Expand All @@ -28,7 +33,7 @@ public final class ServiceIcon {
public static func `for`(iconTypeID: IconTypeID) -> UIImage {
if let img = UIImage(
named: iconTypeID.uuidString,
in: Content.IconDescriptionDatabaseImpl.bundle,
in: IconDescriptionDatabaseImpl.bundle,
with: nil
) {
return img
Expand All @@ -38,7 +43,7 @@ public final class ServiceIcon {
// assert(false, "Can't find icon for service \(iconTypeID.uuidString)")
return UIImage(
named: IconTypeID.default.uuidString,
in: Content.IconDescriptionDatabaseImpl.bundle,
in: IconDescriptionDatabaseImpl.bundle,
with: nil
)!
}
Expand Down
Binary file modified TwoFAS/Content/Assets/Assets.car
Binary file not shown.
Binary file added TwoFAS/Content/AssetsWatch/Assets.car
Binary file not shown.
4 changes: 4 additions & 0 deletions TwoFAS/Content/Sources/IconDescriptionDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
//

import UIKit
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

public protocol IconDescriptionDatabase: AnyObject {
func name(for iconTypeID: IconTypeID) -> String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
//

import Foundation
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

// swiftlint:disable all
final class IconDescriptionDatabaseGenerated {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions TwoFAS/Content/Sources/ServiceDefinitionDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
//

import UIKit
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

public protocol ServiceDefinitionDatabase: AnyObject {
func listAll() -> [ServiceDefinition]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
//

import UIKit
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

// swiftlint:disable all
final class ServiceDefinitionDatabaseGenerated {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions TwoFAS/Data/Extensions/String+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
//

import Foundation
#if os(iOS)
import Base32
#elseif os(watchOS)
import Base32Watch
#endif

extension String {
func dataFromBase32String() -> Data? {
Expand Down
4 changes: 4 additions & 0 deletions TwoFAS/Data/External/OneTimePassword/Crypto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

import Foundation
import CommonCrypto
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

func HMAC(algorithm: Algorithm, key: Data, data: Data) -> Data {
let (hashFunction, hashLength) = algorithm.hashInfo
Expand Down
4 changes: 4 additions & 0 deletions TwoFAS/Data/External/OneTimePassword/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
//

import Foundation
#if os(iOS)
import Common
#elseif os(watchOS)
import CommonWatch
#endif

/// A `Generator` contains all of the parameters needed to generate a one-time password.
struct Generator: Equatable {
Expand Down
1 change: 1 addition & 0 deletions TwoFAS/Data/Interactors/LogUploadingInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import Foundation
import Sync
import Storage
import Common

public enum LogUploadingInteractorError: Error {
case notExists
Expand Down
3 changes: 0 additions & 3 deletions TwoFAS/Data/MainRepository/MainRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import Common
import NetworkStack
@_implementationOnly import PushNotifications

typealias CloudStateListenerID = String
typealias CloudStateListener = (CloudState) -> Void

protocol MainRepository: AnyObject {
// MARK: - Security
var isPINSet: Bool { get }
Expand Down
Loading

0 comments on commit 3cb0af8

Please sign in to comment.