Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MYID Public Code
MyID Flutter SDK
Commits
7998a3e1
Commit
7998a3e1
authored
Jul 24, 2023
by
Javohir Savriy
Browse files
Add iOS module
parent
52262fce
Changes
26
Hide whitespace changes
Inline
Side-by-side
images/screen04.jpg
0 → 100644
View file @
7998a3e1
36.7 KB
ios/Classes/MyIdSdk.swift
View file @
7998a3e1
import
Foundation
import
Foundation
// import Onfido
import
MyIdSDK
//
// public class AppearancePublic: NSObject {
public
class
AppearancePublic
:
NSObject
{
//
// public let primaryColor: UIColor
public
let
primaryColor
:
UIColor
?
// public let primaryTitleColor: UIColor
public
let
secondaryColor
:
UIColor
?
// public let primaryBackgroundPressedColor: UIColor
public
let
errorColor
:
UIColor
?
// public let supportDarkMode: Bool
public
let
primaryButtonColor
:
UIColor
?
//
public
let
primaryButtonColorDisabled
:
UIColor
?
// public init(
public
let
primaryButtonTextColor
:
UIColor
?
// primaryColor: UIColor,
public
let
primaryButtonTextColorDisabled
:
UIColor
?
// primaryTitleColor: UIColor,
public
let
buttonCornerRadius
:
Int
?
// primaryBackgroundPressedColor: UIColor,
// supportDarkMode: Bool = true) {
public
init
(
// self.primaryColor = primaryColor
primaryColor
:
UIColor
?,
// self.primaryTitleColor = primaryTitleColor
secondaryColor
:
UIColor
?,
// self.primaryBackgroundPressedColor = primaryBackgroundPressedColor
errorColor
:
UIColor
?,
// self.supportDarkMode = supportDarkMode
primaryButtonColor
:
UIColor
?,
// }
primaryButtonColorDisabled
:
UIColor
?,
// }
primaryButtonTextColor
:
UIColor
?,
//
primaryButtonTextColorDisabled
:
UIColor
?,
// public func loadAppearance(config: NSDictionary) throws -> AppearancePublic? {
buttonCornerRadius
:
Int
?
//
)
{
// if let jsonResult = config as? Dictionary<String, AnyObject> {
self
.
primaryColor
=
primaryColor
// let primaryColor: UIColor = (jsonResult["onfidoPrimaryColor"] == nil)
self
.
secondaryColor
=
secondaryColor
// ? UIColor.primaryColor : UIColor.from(hex: jsonResult["onfidoPrimaryColor"] as! String)
self
.
errorColor
=
errorColor
// let primaryTitleColor: UIColor = (jsonResult["onfidoPrimaryButtonTextColor"] == nil)
self
.
primaryButtonColor
=
primaryButtonColor
// ? UIColor.white : UIColor.from(hex: jsonResult["onfidoPrimaryButtonTextColor"] as! String)
self
.
primaryButtonColorDisabled
=
primaryButtonColorDisabled
// let primaryBackgroundPressedColor: UIColor = (jsonResult["onfidoPrimaryButtonColorPressed"] == nil)
self
.
primaryButtonTextColor
=
primaryButtonTextColor
// ? UIColor.primaryButtonColorPressed : UIColor.from(hex: jsonResult["onfidoPrimaryButtonColorPressed"] as! String)
self
.
primaryButtonTextColorDisabled
=
primaryButtonTextColorDisabled
// let supportDarkMode: Bool = (jsonResult["onfidoIosSupportDarkMode"] == nil)
self
.
buttonCornerRadius
=
buttonCornerRadius
// ? true : jsonResult["onfidoIosSupportDarkMode"] as! Bool
}
//
}
//
// let appearancePublic = AppearancePublic(
public
func
loadAppearance
(
config
:
NSDictionary
)
throws
->
AppearancePublic
?
{
// primaryColor: primaryColor,
if
let
jsonResult
=
config
as?
Dictionary
<
String
,
AnyObject
>
{
// primaryTitleColor: primaryTitleColor,
let
primaryColor
=
(
jsonResult
[
"primaryColor"
]
==
nil
)
// primaryBackgroundPressedColor: primaryBackgroundPressedColor,
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"primaryColor"
]
as!
String
)
// supportDarkMode: supportDarkMode
// )
let
secondaryColor
=
(
jsonResult
[
"secondaryColor"
]
==
nil
)
// return appearancePublic
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"secondaryColor"
]
as!
String
)
// } else {
// return nil
let
errorColor
=
(
jsonResult
[
"errorColor"
]
==
nil
)
// }
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"errorColor"
]
as!
String
)
// }
//
let
primaryButtonColor
=
(
jsonResult
[
"primaryButtonColor"
]
==
nil
)
// public func loadAppearanceFromConfig(config: NSDictionary) throws -> Appearance {
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"primaryButtonColor"
]
as!
String
)
// let appearancePublic = try loadAppearance(config: config)
//
let
primaryButtonColorDisabled
=
(
jsonResult
[
"primaryButtonColorDisabled"
]
==
nil
)
// if let appearancePublic = appearancePublic {
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"primaryButtonColorDisabled"
]
as!
String
)
// return Appearance(
// primaryColor: appearancePublic.primaryColor,
let
primaryButtonTextColor
=
(
jsonResult
[
"primaryButtonTextColor"
]
==
nil
)
// primaryTitleColor: appearancePublic.primaryTitleColor,
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"primaryButtonTextColor"
]
as!
String
)
// primaryBackgroundPressedColor: appearancePublic.primaryBackgroundPressedColor,
// supportDarkMode: appearancePublic.supportDarkMode
let
primaryButtonTextColorDisabled
=
(
jsonResult
[
"primaryButtonTextColorDisabled"
]
==
nil
)
// )
?
nil
:
UIColor
.
from
(
hex
:
jsonResult
[
"primaryButtonTextColorDisabled"
]
as!
String
)
// } else {
// return Appearance.default;
let
buttonCornerRadius
:
Int
?
=
(
jsonResult
[
"buttonCornerRadius"
]
==
nil
)
?
nil
:
8
// }
// }
let
appearancePublic
=
AppearancePublic
(
//
primaryColor
:
primaryColor
,
// public func buildOnfidoConfig(config:NSDictionary, appearance: Appearance) throws -> Onfido.OnfidoConfigBuilder {
secondaryColor
:
secondaryColor
,
// let sdkToken:String = config["sdkToken"] as! String
errorColor
:
errorColor
,
// let flowSteps:NSDictionary? = config["flowSteps"] as? NSDictionary
primaryButtonColor
:
primaryButtonColor
,
// let captureDocument:NSDictionary? = flowSteps?["captureDocument"] as? NSDictionary
primaryButtonColorDisabled
:
primaryButtonColorDisabled
,
// let captureFace:NSDictionary? = flowSteps?["captureFace"] as? NSDictionary
primaryButtonTextColor
:
primaryButtonTextColor
,
//
primaryButtonTextColorDisabled
:
primaryButtonTextColorDisabled
,
// var onfidoConfig = OnfidoConfig.builder()
buttonCornerRadius
:
buttonCornerRadius
// .withSDKToken(sdkToken)
)
// .withAppearance(appearance)
return
appearancePublic
//
}
else
{
//
return
nil
// if flowSteps?["welcome"] as? Bool == true {
}
// onfidoConfig = onfidoConfig.withWelcomeStep()
}
// }
//
public
func
loadAppearanceFromConfig
(
config
:
NSDictionary
)
throws
->
MyIdAppearance
{
// if let docType = captureDocument?["docType"] as? String, let countryCode = captureDocument?["countryCode"] as? String {
let
appearancePublic
=
try
loadAppearance
(
config
:
config
)
// switch docType {
// case "PASSPORT":
if
let
appearancePublic
=
appearancePublic
{
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .passport(config: PassportConfiguration()))
let
appearance
=
MyIdAppearance
()
// case "DRIVING_LICENCE":
appearance
.
primaryColor
=
appearancePublic
.
primaryColor
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .drivingLicence(config: DrivingLicenceConfiguration(country: countryCode)))
appearance
.
secondaryColor
=
appearancePublic
.
secondaryColor
// case "NATIONAL_IDENTITY_CARD":
appearance
.
errorColor
=
appearancePublic
.
errorColor
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .nationalIdentityCard(config: NationalIdentityConfiguration(country: countryCode)))
appearance
.
primaryButtonColor
=
appearancePublic
.
primaryButtonColor
// case "RESIDENCE_PERMIT":
appearance
.
primaryButtonColorDisabled
=
appearancePublic
.
primaryButtonColorDisabled
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .residencePermit(config: ResidencePermitConfiguration(country: countryCode)))
appearance
.
primaryButtonTextColor
=
appearancePublic
.
primaryButtonTextColor
// case "VISA":
appearance
.
primaryButtonTextColorDisabled
=
appearancePublic
.
primaryButtonTextColorDisabled
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .visa(config: VisaConfiguration(country: countryCode)))
// case "WORK_PERMIT":
if
let
buttonCornerRadius
=
appearancePublic
.
buttonCornerRadius
{
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .workPermit(config: WorkPermitConfiguration(country: countryCode)))
appearance
.
buttonCornerRadius
=
Float
(
buttonCornerRadius
)
// case "GENERIC":
}
// onfidoConfig = onfidoConfig.withDocumentStep(ofType: .generic(config: GenericDocumentConfiguration(country: countryCode)))
// default:
return
appearance
// throw NSError(domain: "Unsupported document type", code: 0)
}
else
{
// }
return
MyIdAppearance
()
// } else if captureDocument != nil {
}
// onfidoConfig = onfidoConfig.withDocumentStep()
}
// }
//
public
func
buildMyIdConfig
(
// if let faceVariant = captureFace?["type"] as? String {
config
:
NSDictionary
,
// if faceVariant == "VIDEO" {
appearance
:
MyIdAppearance
// onfidoConfig = onfidoConfig.withFaceStep(ofVariant: .video(withConfiguration: VideoStepConfiguration(showIntroVideo: true, manualLivenessCapture: false)))
)
throws
->
MyIdConfig
{
// } else if faceVariant == "PHOTO" {
let
clientId
=
config
[
"clientId"
]
as?
String
??
""
// onfidoConfig = onfidoConfig.withFaceStep(ofVariant: .photo(withConfiguration: nil))
let
passportData
=
config
[
"passportData"
]
as?
String
??
""
// } else {
let
dateOfBirth
=
config
[
"dateOfBirth"
]
as?
String
??
""
// throw NSError(domain: "Invalid or unsupported face variant", code: 0)
let
sdkHash
=
config
[
"sdkHash"
]
as?
String
??
""
// }
let
externalId
=
config
[
"externalId"
]
as?
String
??
""
// }
// return onfidoConfig;
let
threshold
=
config
[
"threshold"
]
as?
Float
??
0.6
// }
//
let
buildModeKey
=
config
[
"buildMode"
]
as?
String
??
""
// @objc(OnfidoSdk)
var
buildMode
=
MyIdBuildMode
.
PRODUCTION
// class OnfidoSdk: NSObject {
if
(
buildModeKey
==
"DEBUG"
)
{
//
buildMode
=
MyIdBuildMode
.
DEBUG
// @objc static func requiresMainQueueSetup() -> Bool {
}
// return false
// }
let
entryTypeKey
=
config
[
"entryType"
]
as?
String
??
""
//
var
entryType
=
MyIdEntryType
.
AUTH
// @objc func start(_ config: NSDictionary, result: @escaping FlutterResult) -> Void {
if
(
entryTypeKey
==
"FACE"
)
{
// DispatchQueue.main.async {
entryType
=
MyIdEntryType
.
FACE
// let withConfig = config["config"] as! NSDictionary
}
// let withAppearance = config["appearance"] as! NSDictionary
// self.run(withConfig: withConfig, withAppearance: withAppearance, result: result)
let
residencyKey
=
config
[
"residency"
]
as?
String
??
""
// }
var
residency
=
MyIdResidency
.
RESIDENT
// }
if
(
residencyKey
==
"USER_DEFINED"
)
{
//
residency
=
MyIdResidency
.
USER_DEFINED
// private func run(withConfig config: NSDictionary, withAppearance appearanceConfig: NSDictionary, result: @escaping FlutterResult) {
}
else
if
(
residencyKey
==
"NON_RESIDENT"
)
{
//
residency
=
MyIdResidency
.
NON_RESIDENT
// do {
}
// let appearance = try loadAppearanceFromConfig(config: appearanceConfig)
// let onfidoConfig = try buildOnfidoConfig(config: config, appearance: appearance)
let
localeKey
=
config
[
"locale"
]
as?
String
??
""
// let builtOnfidoConfig = try onfidoConfig.build()
var
locale
=
MyIdLocale
.
UZ
//
if
(
localeKey
==
"RUS"
)
{
// // Copy the face varient from the config since it is not contained in the response:
locale
=
MyIdLocale
.
UZ
// let flowSteps:NSDictionary? = config["flowSteps"] as? NSDictionary
}
else
if
(
localeKey
==
"ENG"
)
{
// let captureFace:NSDictionary? = flowSteps?["captureFace"] as? NSDictionary
locale
=
MyIdLocale
.
EN
// let faceVariant = captureFace?["type"] as? String
}
//
// let onfidoFlow = OnfidoFlow(withConfiguration: builtOnfidoConfig)
let
cameraShapeKey
=
config
[
"cameraShape"
]
as?
String
??
""
// .with(responseHandler: { [weak self] response in
var
cameraShape
=
MyIdCameraShape
.
CIRCLE
// guard let `self` = self else { return }
if
(
cameraShapeKey
==
"ELLIPSE"
)
{
// switch response {
cameraShape
=
MyIdCameraShape
.
ELLIPSE
// case let .error(error):
}
// result(FlutterError(code: "error", message: "Encountered an error: \(error)", details: nil))
// return;
let
resolutionKey
=
config
[
"resolution"
]
as?
String
??
""
// case let .success(results):
var
resolution
=
MyIdResolution
.
RESOLUTION_480
// result(createResponse(results, faceVariant: faceVariant))
if
(
resolutionKey
==
"RESOLUTION_720"
)
{
// return;
resolution
=
MyIdResolution
.
RESOLUTION_720
// case .cancel:
}
// result(FlutterError(code: "cancel", message: "User canceled flow", details: nil))
// return;
let
withPhoto
=
config
[
"withPhoto"
]
as?
Bool
??
false
// default:
// result(FlutterError(code: "error", message: "Unknown error has occured", details: nil))
let
organizationDetailsDict
=
config
[
"organizationDetails"
]
as?
NSDictionary
// return;
let
organizationDetails
=
MyIdOrganizationDetails
()
// }
organizationDetails
.
phoneNumber
=
organizationDetailsDict
?[
"phone"
]
as?
String
??
""
// })
//
let
config
=
MyIdConfig
()
// let onfidoRun = try onfidoFlow.run()
config
.
clientId
=
clientId
// UIApplication.shared.windows.first?.rootViewController?.present(onfidoRun, animated: true)
config
.
passportData
=
passportData
// } catch let error as NSError {
config
.
dateOfBirth
=
dateOfBirth
// result(FlutterError(code: "error", message: error.domain, details: nil))
config
.
sdkHash
=
sdkHash
// return;
config
.
externalId
=
externalId
// } catch {
config
.
threshold
=
threshold
// result(FlutterError(code: "error", message: "Error running Onfido SDK", details: nil))
config
.
buildMode
=
buildMode
// return;
config
.
entryType
=
entryType
// }
config
.
residency
=
residency
// }
config
.
locale
=
locale
// }
config
.
cameraShape
=
cameraShape
//
config
.
resolution
=
resolution
// extension UIColor {
config
.
withPhoto
=
withPhoto
//
config
.
appearance
=
appearance
// static var primaryColor: UIColor {
config
.
organizationDetails
=
organizationDetails
// return decideColor(light: UIColor.from(hex: "#353FF4"), dark: UIColor.from(hex: "#3B43D8"))
// }
return
config
//
}
// static var primaryButtonColorPressed: UIColor {
// return decideColor(light: UIColor.from(hex: "#232AAD"), dark: UIColor.from(hex: "#5C6CFF"))
@objc
(
MyIdSdk
)
// }
class
MyIdSdk
:
NSObject
,
MyIdClientDelegate
{
//
// private static func decideColor(light: UIColor, dark: UIColor) -> UIColor {
private
var
flutterResult
:
FlutterResult
?
=
nil
// #if XCODE11
// guard #available(iOS 13.0, *) else {
func
onSuccess
(
result
:
MyIdResult
)
{
// return light
if
let
fResult
=
flutterResult
{
// }
fResult
(
createResponse
(
result
))
// return UIColor { (collection) -> UIColor in
}
// return collection.userInterfaceStyle == .dark ? dark : light
}
// }
// #else
func
onError
(
exception
:
MyIdException
)
{
// return light
if
let
fResult
=
flutterResult
{
// #endif
fResult
(
FlutterError
(
code
:
"error"
,
message
:
"
\(
exception
.
code
??
"101"
)
-
\(
exception
.
message
??
"Unexpected error starting MyID"
)
"
,
details
:
nil
))
// }
}
//
}
// static func from(hex: String) -> UIColor {
//
func
onUserExited
()
{
// let hexString = hex.trimmingCharacters(in: .whitespacesAndNewlines)
if
let
fResult
=
flutterResult
{
// let scanner = Scanner(string: hexString)
fResult
(
FlutterError
(
code
:
"cancel"
,
message
:
"User canceled flow"
,
details
:
nil
))
//
}
// if hexString.hasPrefix("#") {
}
// scanner.scanLocation = 1
// }
@objc
static
func
requiresMainQueueSetup
()
->
Bool
{
//
return
false
// var color: UInt32 = 0
}
// scanner.scanHexInt32(&color)
//
@objc
func
start
(
// let mask = 0x000000FF
_
config
:
NSDictionary
,
// let redInt = Int(color >> 16) & mask
result
:
@escaping
FlutterResult
// let greenInt = Int(color >> 8) & mask
)
->
Void
{
// let blueInt = Int(color) & mask
flutterResult
=
result
//
// let red = CGFloat(redInt) / 255.0
DispatchQueue
.
main
.
async
{
// let green = CGFloat(greenInt) / 255.0
let
withConfig
=
config
[
"config"
]
as!
NSDictionary
// let blue = CGFloat(blueInt) / 255.0
let
withAppearance
=
config
[
"appearance"
]
as!
NSDictionary
//
self
.
run
(
withConfig
:
withConfig
,
withAppearance
:
withAppearance
,
result
:
result
)
// return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
}
// }
}
// }
//
private
func
run
(
// extension Appearance {
withConfig
config
:
NSDictionary
,
//
withAppearance
appearanceConfig
:
NSDictionary
,
// static let `default` = Appearance(
result
:
@escaping
FlutterResult
// primaryColor: UIColor.primaryColor,
)
{
// primaryTitleColor: UIColor.white,
do
{
// primaryBackgroundPressedColor: UIColor.primaryButtonColorPressed)
let
appearance
=
try
loadAppearanceFromConfig
(
config
:
appearanceConfig
)
// }
let
myidConfig
=
try
buildMyIdConfig
(
config
:
config
,
appearance
:
appearance
)
MyIdClient
.
start
(
withConfig
:
myidConfig
,
withDelegate
:
self
)
}
catch
let
error
as
NSError
{
result
(
FlutterError
(
code
:
"error"
,
message
:
error
.
domain
,
details
:
nil
))
return
;
}
catch
{
result
(
FlutterError
(
code
:
"error"
,
message
:
"Unexpected error starting MyID"
,
details
:
nil
))
return
;
}
}
}
extension
UIColor
{
static
func
from
(
hex
:
String
)
->
UIColor
{
let
hexString
=
hex
.
trimmingCharacters
(
in
:
.
whitespacesAndNewlines
)
let
scanner
=
Scanner
(
string
:
hexString
)
if
hexString
.
hasPrefix
(
"#"
)
{
scanner
.
scanLocation
=
1
}
var
color
:
UInt32
=
0
scanner
.
scanHexInt32
(
&
color
)
let
mask
=
0x000000FF
let
redInt
=
Int
(
color
>>
16
)
&
mask
let
greenInt
=
Int
(
color
>>
8
)
&
mask
let
blueInt
=
Int
(
color
)
&
mask
let
red
=
CGFloat
(
redInt
)
/
255.0
let
green
=
CGFloat
(
greenInt
)
/
255.0
let
blue
=
CGFloat
(
blueInt
)
/
255.0
return
UIColor
(
red
:
red
,
green
:
green
,
blue
:
blue
,
alpha
:
1.0
)
}
}
extension
MyIdAppearance
{
static
let
`
default
`
=
MyIdAppearance
()
}
ios/Classes/Response.swift
View file @
7998a3e1
import
Foundation
import
Foundation
// import Onfido
import
MyIdSDK
//
// func createResponse(_ results: [OnfidoResult], faceVariant: String?) -> [String: [String: Any]] {
func
createResponse
(
_
result
:
MyIdResult
)
->
[
String
:
String
]
{
// var jsonResponse = [String: [String: Any]]()
var
jsonResponse
=
[
String
:
String
]()
//
// let document: [OnfidoResult]? = results.filter({ result in
if
let
code
=
result
.
code
{
// if case OnfidoResult.document = result { return true }
jsonResponse
[
"code"
]
=
code
// return false;
}
// });
if
let
comparison
=
result
.
comparisonValue
{
//
jsonResponse
[
"comparison"
]
=
comparison
// let onfidoResult: OnfidoResult? = document?.first
}
//
if
let
image
=
result
.
image
{
// let face: OnfidoResult? = results.filter({ result in
if
let
base64
=
image
.
jpegData
(
compressionQuality
:
1.0
)?
.
base64EncodedString
()
{
// if case OnfidoResult.face = result { return true }
jsonResponse
[
"base64"
]
=
base64
// return false
}
// }).first
}
//
// if let documentUnwrapped = onfidoResult, case OnfidoResult.document(let documentResponse) = documentUnwrapped {
return
jsonResponse
// jsonResponse["document"] = ["front": ["id": documentResponse.front.id]]
}
//
// if let back = documentResponse.back {
// jsonResponse["document"]?["back"] = ["id": back.id]
// }
// }
//
// if let faceUnwrapped = face, case OnfidoResult.face(let faceResponse) = faceUnwrapped {
// jsonResponse["face"] = ["id": faceResponse.id, "variant": faceVariant!]
// }
//
// return jsonResponse
// }
ios/Classes/SwiftMyIdPlugin.swift
View file @
7998a3e1
...
@@ -3,6 +3,8 @@ import UIKit
...
@@ -3,6 +3,8 @@ import UIKit
public
class
SwiftMyIdPlugin
:
NSObject
,
FlutterPlugin
{
public
class
SwiftMyIdPlugin
:
NSObject
,
FlutterPlugin
{
private
let
myidSdk
=
MyIdSdk
()
public
static
func
register
(
with
registrar
:
FlutterPluginRegistrar
)
{
public
static
func
register
(
with
registrar
:
FlutterPluginRegistrar
)
{
let
channel
=
FlutterMethodChannel
(
name
:
"myid"
,
binaryMessenger
:
registrar
.
messenger
())
let
channel
=
FlutterMethodChannel
(
name
:
"myid"
,
binaryMessenger
:
registrar
.
messenger
())
let
instance
=
SwiftMyIdPlugin
()
let
instance
=
SwiftMyIdPlugin
()
...
@@ -10,24 +12,9 @@ public class SwiftMyIdPlugin: NSObject, FlutterPlugin {
...
@@ -10,24 +12,9 @@ public class SwiftMyIdPlugin: NSObject, FlutterPlugin {
}
}
public
func
handle
(
_
call
:
FlutterMethodCall
,
result
:
@escaping
FlutterResult
)
{
public
func
handle
(
_
call
:
FlutterMethodCall
,
result
:
@escaping
FlutterResult
)
{
result
(
"iOS "
+
UIDevice
.
current
.
systemVersion
)
if
(
call
.
method
.
elementsEqual
(
"startSdk"
)){
let
config
=
call
.
arguments
as!
NSDictionary
myidSdk
.
start
(
config
,
result
:
result
)
}
}
}
}
}
// @available(iOS 11.0, *)
// public class SwiftFlutterOnfidoPlugin: NSObject, FlutterPlugin {
// private let onfidoSdk = OnfidoSdk()
//
// public static func register(with registrar: FlutterPluginRegistrar) {
// let channel = FlutterMethodChannel(name: "flutter_onfido", binaryMessenger: registrar.messenger())
// let instance = SwiftFlutterOnfidoPlugin()
// registrar.addMethodCallDelegate(instance, channel: channel)
// }
//
// public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
// if(call.method.elementsEqual("start")){
// let config = call.arguments as! NSDictionary
// onfidoSdk.start(config, result: result)
// }
// }
// }
ios/myid.podspec
View file @
7998a3e1
...
@@ -5,19 +5,20 @@
...
@@ -5,19 +5,20 @@
Pod
::
Spec
.
new
do
|
s
|
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
'myid'
s
.
name
=
'myid'
s
.
version
=
'0.0.1'
s
.
version
=
'0.0.1'
s
.
summary
=
'A new Flutter plugin
project
.'
s
.
summary
=
'A new Flutter plugin.'
s
.
description
=
<<-
DESC
s
.
description
=
<<-
DESC
A new Flutter plugin
project
.
A new Flutter plugin.
DESC
DESC
s
.
homepage
=
'http://
example.com
'
s
.
homepage
=
'http
s
://
pub.dev/packages/myid
'
s
.
license
=
{
:file
=>
'../LICENSE'
}
s
.
license
=
{
:file
=>
'../LICENSE'
}
s
.
author
=
{
'Your Company'
=>
'email@example.com'
}
s
.
author
=
{
'Your Company'
=>
'email@example.com'
}
s
.
source
=
{
:path
=>
'.'
}
s
.
source
=
{
:path
=>
'.'
}
s
.
source_files
=
'Classes/**/*'
s
.
source_files
=
'Classes/**/*'
s
.
dependency
'Flutter'
s
.
dependency
'Flutter'
s
.
platform
=
:ios
,
'9.0'
s
.
dependency
'MyId'
s
.
platform
=
:ios
,
'11.0'
# Flutter.framework does not contain a i386 slice.
# Flutter.framework does not contain a i386 slice.
Only x86_64 simulators are supported.
s
.
pod_target_xcconfig
=
{
'DEFINES_MODULE'
=>
'YES'
,
'
EXCLUDE
D_ARCHS[sdk=iphonesimulator*]'
=>
'
i386
'
}
s
.
pod_target_xcconfig
=
{
'DEFINES_MODULE'
=>
'YES'
,
'
VALI
D_ARCHS[sdk=iphonesimulator*]'
=>
'
x86_64
'
}
s
.
swift_version
=
'5.0'
s
.
swift_version
=
'5.0'
end
end
pubspec.yaml
View file @
7998a3e1
...
@@ -2,7 +2,7 @@ name: myid
...
@@ -2,7 +2,7 @@ name: myid
description
:
MyID SDK plugin for Flutter. Package supports iOS and Android to verify users identity.
description
:
MyID SDK plugin for Flutter. Package supports iOS and Android to verify users identity.
version
:
1.0.5
version
:
1.0.5
homepage
:
https://pub.dev/packages/myid
homepage
:
https://pub.dev/packages/myid
repository
:
https://
gitlab.myid.uz/myid/mobile/myid-sample-flutter
repository
:
https://
pub.dev/packages/myid
issue_tracker
:
https://gitlab.myid.uz/myid/mobile/myid-sample-flutter/-/issues
issue_tracker
:
https://gitlab.myid.uz/myid/mobile/myid-sample-flutter/-/issues
environment
:
environment
:
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment