diff --git a/Cartfile b/Cartfile index 6a33804..93393ac 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "SVProgressHUD/SVProgressHUD" +github "SVProgressHUD/SVProgressHUD" "master" diff --git a/Cartfile.resolved b/Cartfile.resolved index b60baa2..46eb406 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "SVProgressHUD/SVProgressHUD" "2.2.5" +github "SVProgressHUD/SVProgressHUD" "de1d4dba816a19454329031156b8788692bcfa2c" diff --git a/README.md b/README.md index 9af5437..ce94bd1 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ For more, please read the [wiki page](https://github.com/mssun/passforios/wiki). ## Building Pass for iOS 1. Install Carthage, Go, SwiftLint, and SwiftFormat: `brew install carthage go swiftlint swiftformat`. -2. Install dependencies via Carthage. Therefore, execute `carthage update` and `carthage bootstrap --platform iOS --use-xcframeworks` in the root directory of the project. +2. Install dependencies via Carthage. Therefore, execute `carthage bootstrap --platform iOS --use-xcframeworks` in the root directory of the project. 3. Run `./scripts/gopenpgp_build.sh` to build GopenPGP. 5. Open the `pass.xcodeproj` file in Xcode. 6. Build & Run. diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 06fdcbb..2ebe527 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -94,6 +94,7 @@ platform :ios do scheme: "pass", configuration: "Beta", skip_profile_detection: true, + export_method: "app-store", export_options: { method: "app-store", provisioningProfiles: { diff --git a/pass.xcodeproj/project.pbxproj b/pass.xcodeproj/project.pbxproj index 87a00b6..c663c28 100644 --- a/pass.xcodeproj/project.pbxproj +++ b/pass.xcodeproj/project.pbxproj @@ -1116,9 +1116,9 @@ isa = PBXNativeTarget; buildConfigurationList = A260758F1EEC6F34005DB03E /* Build configuration list for PBXNativeTarget "passKit" */; buildPhases = ( + A26075751EEC6F34005DB03E /* Headers */, A26075731EEC6F34005DB03E /* Sources */, A26075741EEC6F34005DB03E /* Frameworks */, - A26075751EEC6F34005DB03E /* Headers */, A26075761EEC6F34005DB03E /* Resources */, ); buildRules = ( @@ -2811,7 +2811,7 @@ repositoryURL = "https://github.com/krzyzanowskim/ObjectivePGP"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.99.0; + minimumVersion = 0.99.2; }; }; 30A3000C26DA62F4002A734E /* XCRemoteSwiftPackageReference "Base32" */ = { diff --git a/pass.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/pass.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b3dc414..f3e4dfa 100644 --- a/pass.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/pass.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,79 +1,76 @@ { - "object": { - "pins": [ - { - "package": "Base32", - "repositoryURL": "https://github.com/mattrubin/Base32", - "state": { - "branch": "1.1.2+spm", - "revision": "d185e44c8b355d34d5c6c6ad502c60cba4599f69", - "version": null - } - }, - { - "package": "FavIcon", - "repositoryURL": "https://github.com/leonbreedt/FavIcon", - "state": { - "branch": null, - "revision": "5bf16aad3ea543891eaef7e8da2aa2f6bb29e6e4", - "version": "3.1.0" - } - }, - { - "package": "KeychainAccess", - "repositoryURL": "https://github.com/kishikawakatsumi/KeychainAccess", - "state": { - "branch": null, - "revision": "84e546727d66f1adc5439debad16270d0fdd04e7", - "version": "4.2.2" - } - }, - { - "package": "ObjectiveGit", - "repositoryURL": "https://github.com/SimplyDanny/objective-git-swift-package", - "state": { - "branch": "0.17-passforios", - "revision": "553f09c836b4f90e447e0fe26633acc11c37cece", - "version": null - } - }, - { - "package": "ObjectivePGP", - "repositoryURL": "https://github.com/krzyzanowskim/ObjectivePGP", - "state": { - "branch": null, - "revision": "0dc7ca7ffe193095dc37456b0c75be167a2026f4", - "version": "0.99.2" - } - }, - { - "package": "OneTimePassword", - "repositoryURL": "https://github.com/mssun/OneTimePassword", - "state": { - "branch": null, - "revision": "8d59e4abba762d0f1e9aed161081f7b3fe21daa0", - "version": null - } - }, - { - "package": "SwiftyUserDefaults", - "repositoryURL": "https://github.com/sunshinejr/SwiftyUserDefaults", - "state": { - "branch": null, - "revision": "f66bcd04088582c8fbb5cb8554d577e303bae396", - "version": "5.3.0" - } - }, - { - "package": "YubiKit", - "repositoryURL": "https://github.com/Yubico/yubikit-ios", - "state": { - "branch": null, - "revision": "7e75fe8f057acf9bf7ac134d375783a1d409f79e", - "version": "4.1.0" - } + "pins" : [ + { + "identity" : "base32", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattrubin/Base32", + "state" : { + "branch" : "1.1.2+spm", + "revision" : "d185e44c8b355d34d5c6c6ad502c60cba4599f69" } - ] - }, - "version": 1 + }, + { + "identity" : "favicon", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leonbreedt/FavIcon", + "state" : { + "revision" : "5bf16aad3ea543891eaef7e8da2aa2f6bb29e6e4", + "version" : "3.1.0" + } + }, + { + "identity" : "keychainaccess", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kishikawakatsumi/KeychainAccess", + "state" : { + "revision" : "84e546727d66f1adc5439debad16270d0fdd04e7", + "version" : "4.2.2" + } + }, + { + "identity" : "objective-git-swift-package", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SimplyDanny/objective-git-swift-package", + "state" : { + "branch" : "0.17-passforios", + "revision" : "553f09c836b4f90e447e0fe26633acc11c37cece" + } + }, + { + "identity" : "objectivepgp", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzyzanowskim/ObjectivePGP", + "state" : { + "revision" : "0dc7ca7ffe193095dc37456b0c75be167a2026f4", + "version" : "0.99.2" + } + }, + { + "identity" : "onetimepassword", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mssun/OneTimePassword", + "state" : { + "revision" : "8d59e4abba762d0f1e9aed161081f7b3fe21daa0" + } + }, + { + "identity" : "swiftyuserdefaults", + "kind" : "remoteSourceControl", + "location" : "https://github.com/sunshinejr/SwiftyUserDefaults", + "state" : { + "revision" : "f66bcd04088582c8fbb5cb8554d577e303bae396", + "version" : "5.3.0" + } + }, + { + "identity" : "yubikit-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Yubico/yubikit-ios", + "state" : { + "revision" : "7b19be11a362d9e52eac0d76b5d904560b9e5ea7", + "version" : "4.2.0" + } + } + ], + "version" : 2 } diff --git a/passKit/Helpers/DefaultsKeys.swift b/passKit/Helpers/DefaultsKeys.swift index a96b206..3059422 100644 --- a/passKit/Helpers/DefaultsKeys.swift +++ b/passKit/Helpers/DefaultsKeys.swift @@ -9,6 +9,74 @@ import Foundation import SwiftyUserDefaults +// Workaround for Xcode 13: https://github.com/sunshinejr/SwiftyUserDefaults/issues/285 + +extension DefaultsSerializable { + public static var _defaultsArray: DefaultsArrayBridge<[T]> { return DefaultsArrayBridge() } +} +extension Date: DefaultsSerializable { + public static var _defaults: DefaultsObjectBridge { return DefaultsObjectBridge() } +} +extension String: DefaultsSerializable { + public static var _defaults: DefaultsStringBridge { return DefaultsStringBridge() } +} +extension Int: DefaultsSerializable { + public static var _defaults: DefaultsIntBridge { return DefaultsIntBridge() } +} +extension Double: DefaultsSerializable { + public static var _defaults: DefaultsDoubleBridge { return DefaultsDoubleBridge() } +} +extension Bool: DefaultsSerializable { + public static var _defaults: DefaultsBoolBridge { return DefaultsBoolBridge() } +} +extension Data: DefaultsSerializable { + public static var _defaults: DefaultsDataBridge { return DefaultsDataBridge() } +} + +extension URL: DefaultsSerializable { + #if os(Linux) + public static var _defaults: DefaultsKeyedArchiverBridge { return DefaultsKeyedArchiverBridge() } + #else + public static var _defaults: DefaultsUrlBridge { return DefaultsUrlBridge() } + #endif + public static var _defaultsArray: DefaultsKeyedArchiverBridge<[URL]> { return DefaultsKeyedArchiverBridge() } +} + +extension DefaultsSerializable where Self: Codable { + public static var _defaults: DefaultsCodableBridge { return DefaultsCodableBridge() } + public static var _defaultsArray: DefaultsCodableBridge<[Self]> { return DefaultsCodableBridge() } +} + +extension DefaultsSerializable where Self: RawRepresentable { + public static var _defaults: DefaultsRawRepresentableBridge { return DefaultsRawRepresentableBridge() } + public static var _defaultsArray: DefaultsRawRepresentableArrayBridge<[Self]> { return DefaultsRawRepresentableArrayBridge() } +} + +extension DefaultsSerializable where Self: NSCoding { + public static var _defaults: DefaultsKeyedArchiverBridge { return DefaultsKeyedArchiverBridge() } + public static var _defaultsArray: DefaultsKeyedArchiverBridge<[Self]> { return DefaultsKeyedArchiverBridge() } +} + +extension Dictionary: DefaultsSerializable where Key == String { + public typealias T = [Key: Value] + public typealias Bridge = DefaultsObjectBridge + public typealias ArrayBridge = DefaultsArrayBridge<[T]> + public static var _defaults: Bridge { return Bridge() } + public static var _defaultsArray: ArrayBridge { return ArrayBridge() } +} +extension Array: DefaultsSerializable where Element: DefaultsSerializable { + public typealias T = [Element.T] + public typealias Bridge = Element.ArrayBridge + public typealias ArrayBridge = DefaultsObjectBridge<[T]> + public static var _defaults: Bridge { + return Element._defaultsArray + } + public static var _defaultsArray: ArrayBridge { + fatalError("Multidimensional arrays are not supported yet") + } +} + + public var Defaults = DefaultsAdapter(defaults: UserDefaults(suiteName: Globals.groupIdentifier)!, keyStore: DefaultsKeys()) public enum KeySource: String, DefaultsSerializable { diff --git a/scripts/gopenpgp_build.sh b/scripts/gopenpgp_build.sh index f1bac2a..6e53119 100755 --- a/scripts/gopenpgp_build.sh +++ b/scripts/gopenpgp_build.sh @@ -14,15 +14,21 @@ GOPENPGP_PATH="$CHECKOUT_PATH/gopenpgp" mkdir -p "$OUTPUT_PATH" mkdir -p "$CHECKOUT_PATH" -go env -w GO111MODULE=auto -go get golang.org/x/mobile/cmd/gomobile +go install golang.org/x/mobile/cmd/gomobile@latest gomobile init git clone --depth 1 --branch "$GOPENPGP_VERSION" https://github.com/mssun/gopenpgp.git "$GOPENPGP_PATH" -sed -i '' 's/build android/echo "Skipping Android build."/g' "$GOPENPGP_PATH/build.sh" - -(cd "$GOPENPGP_PATH" && ./build.sh) +pushd "$GOPENPGP_PATH" +mkdir -p dist +go mod download github.com/ProtonMail/go-crypto +gomobile bind -tags mobile -target ios -iosversion 12.0 -v -x -ldflags="-s -w" -o dist/Gopenpgp.xcframework \ + github.com/ProtonMail/gopenpgp/v2/crypto \ + github.com/ProtonMail/gopenpgp/v2/armor \ + github.com/ProtonMail/gopenpgp/v2/constants \ + github.com/ProtonMail/gopenpgp/v2/models \ + github.com/ProtonMail/gopenpgp/v2/subtle github.com/ProtonMail/gopenpgp/v2/helper +popd cp -r "$GOPENPGP_PATH/dist/Gopenpgp.xcframework" "$OUTPUT_PATH"