Skip to content

Commit

Permalink
Handling older iOS manually
Browse files Browse the repository at this point in the history
  • Loading branch information
megakoko committed May 4, 2023
1 parent a02bf79 commit 77569a2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ios/Classes/SwiftTangemSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import Flutter
import UIKit
import TangemSdk

@available(iOS 13.0, *)
public class SwiftTangemSdkPlugin: NSObject, FlutterPlugin {
private lazy var sdk: TangemSdk = {
let sdk = TangemSdk()
return sdk
}()
private var _sdk: Any?

@available(iOS 13, *)
private var sdk: TangemSdk {
if _sdk == nil {
_sdk = TangemSdk()
}
return _sdk as! TangemSdk
}

public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "tangemSdk", binaryMessenger: registrar.messenger())
Expand All @@ -31,6 +35,10 @@ public class SwiftTangemSdkPlugin: NSObject, FlutterPlugin {
}

private func runJSONRPCRequest(_ args: Any?, _ completion: @escaping FlutterResult) throws {
guard #available(iOS 13, *) else {
throw FlutterError.iosTooOld
}

guard let request: String = getArg(for: .request, from: args) else {
throw FlutterError.missingRequest
}
Expand Down

0 comments on commit 77569a2

Please sign in to comment.