Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature support macOS 12. #19

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/portto/blocto-ios-sdk.git",
"state" : {
"revision" : "1443ba05fc6dbb66128d2297945ec9a955a4afef",
"version" : "0.3.8"
"branch" : "feat/support-macos",
"revision" : "7ed2ebdf2da7fb9b4fbc67a7dc353471039c5156"
}
},
{
Expand All @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/portto/flow-swift-sdk.git",
"state" : {
"revision" : "1467c999cd076e7607e3575364a52693613d19f8",
"version" : "0.4.0"
"branch" : "feat/linux",
"revision" : "f5883c85893eb38eb210fa3e71e2aa2f1ebdad43"
}
},
{
Expand All @@ -63,22 +63,13 @@
"version" : "2.2.4"
}
},
{
"identity" : "secp256k1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/portto/secp256k1.git",
"state" : {
"revision" : "6864a2560066cedede330c4b344689432a7300f7",
"version" : "0.0.5"
}
},
{
"identity" : "secp256k1.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/portto/secp256k1.swift",
"location" : "https://github.com/GigaBitcoin/secp256k1.swift.git",
"state" : {
"revision" : "23aa6bab1f60e513297d0d58a863418f68534e56",
"version" : "0.7.4"
"revision" : "39dd39248e769ea88253a0ce300399b402a64529",
"version" : "0.9.2"
}
},
{
Expand All @@ -90,6 +81,15 @@
"version" : "0.0.4"
}
},
{
"identity" : "swift-crypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "d9825fa541df64b1a7b182178d61b9a82730d01f",
"version" : "2.1.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -156,10 +156,10 @@
{
"identity" : "swiftyjson",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftyJSON/SwiftyJSON.git",
"location" : "https://github.com/andrew54068/SwiftyJSON",
"state" : {
"revision" : "2b6054efa051565954e1d2b9da831680026cd768",
"version" : "4.3.0"
"branch" : "fix/linux",
"revision" : "2df349f10abf37be9907735f911afb62b10ea7c2"
}
},
{
Expand Down
7 changes: 4 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let package = Package(
name: "FCL-SDK",
platforms: [
.iOS(.v13),
.macOS(.v10_15)
],
products: [
.library(
Expand All @@ -15,9 +16,9 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/portto/flow-swift-sdk.git", .upToNextMajor(from: "0.4.0")),
.package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "4.0.0"),
.package(url: "https://github.com/portto/blocto-ios-sdk.git", .upToNextMinor(from: "0.3.8")),
.package(url: "https://github.com/portto/flow-swift-sdk.git", branch: "feat/linux"),
.package(url: "https://github.com/andrew54068/SwiftyJSON", branch: "fix/linux"),
.package(url: "https://github.com/portto/blocto-ios-sdk.git", branch: "feat/support-macos"),
],
targets: [
.target(
Expand Down
8 changes: 6 additions & 2 deletions Sources/FCL-SDK/FCL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,21 @@ public class FCL: NSObject {
// Authn
public func authanticate(accountProofData: FCLAccountProofData?) async throws -> Address {
do {
#if canImport(UIKit)
let walletProvider: WalletProvider
if let provider = config.selectedWalletProvider {
walletProvider = provider
} else {
if config.walletProviderCandidates.isEmpty == false {
walletProvider = try await selectionProvider()
fcl.config.selectedWalletProvider = walletProvider

} else {
throw FCLError.walletProviderNotSpecified
}
}
try await walletProvider.authn(accountProofData: accountProofData)
#endif
guard let user = currentUser else {
throw FCLError.userNotFound
}
Expand Down Expand Up @@ -217,6 +220,7 @@ public class FCL: NSObject {
)
}

#if canImport(UIKit)
func getKeyWindow() -> UIWindow? {
UIApplication.shared.connectedScenes
.filter { $0.activationState == .foregroundActive }
Expand Down Expand Up @@ -256,7 +260,7 @@ public class FCL: NSObject {
}
return topController
}

#endif
}

// MARK: ASWebAuthenticationPresentationContextProviding
Expand Down Expand Up @@ -388,7 +392,7 @@ extension FCL {
guard let walletProvider = fcl.config.selectedWalletProvider else {
throw FCLError.walletProviderNotSpecified
}

let items = fcl.config.addressReplacements
let newCadence = items.reduce(cadence) { result, replacement in
result.replacingOccurrences(of: replacement.placeholder, with: replacement.replacement.hexStringWithPrefix)
Expand Down
2 changes: 1 addition & 1 deletion Sources/FCL-SDK/Network/URLSessionExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrew Wang on 2022/7/6.
//

import UIKit
import Foundation

extension URLSession {

Expand Down
1 change: 0 additions & 1 deletion Sources/FCL-SDK/User/Service/Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import Foundation
import SwiftyJSON
import UIKit

public struct Service: Decodable {
let fclType: String?
Expand Down
2 changes: 2 additions & 0 deletions Sources/FCL-SDK/WalletProvider/BloctoWalletProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Andrew Wang on 2022/7/5.
//

#if canImport(UIKit)
import Foundation
import UIKit
import FlowSDK
Expand Down Expand Up @@ -312,3 +313,4 @@ public final class BloctoWalletProvider: WalletProvider {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/FCL-SDK/WalletProviderSelectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
#if canImport(UIKit)
import UIKit

final class WalletProviderSelectionViewController: UIViewController {
Expand Down Expand Up @@ -187,3 +188,4 @@ extension WalletProviderSelectionViewController: UIAdaptivePresentationControlle
}

}
#endif