feat: add device authentication, place gates support, and PiP navigation features
This commit is contained in:
@@ -7,7 +7,71 @@ import UIKit
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
let result = super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
|
||||
if let controller = window?.rootViewController as? FlutterViewController {
|
||||
// 1. Device Hardware Channel
|
||||
let deviceChannel = FlutterMethodChannel(
|
||||
name: "com.siro.siro_maps/device_hardware",
|
||||
binaryMessenger: controller.binaryMessenger
|
||||
)
|
||||
deviceChannel.setMethodCallHandler { (call, callback) in
|
||||
if call.method == "getHardwareInfo" {
|
||||
var sysinfo = utsname()
|
||||
uname(&sysinfo)
|
||||
let machine = withUnsafePointer(to: &sysinfo.machine) {
|
||||
$0.withMemoryRebound(to: CChar.self, capacity: 1) { ptr in
|
||||
String(validatingUTF8: ptr)
|
||||
}
|
||||
} ?? UIDevice.current.model
|
||||
|
||||
let vendorId = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
||||
let info: [String: String] = [
|
||||
"hardwareId": vendorId,
|
||||
"brand": "Apple",
|
||||
"manufacturer": "Apple",
|
||||
"model": machine,
|
||||
"device": UIDevice.current.model
|
||||
]
|
||||
callback(info)
|
||||
} else {
|
||||
callback(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Deep Link Channel
|
||||
let deepLinkChannel = FlutterMethodChannel(
|
||||
name: "com.siro.siro_maps/deep_link",
|
||||
binaryMessenger: controller.binaryMessenger
|
||||
)
|
||||
deepLinkChannel.setMethodCallHandler { (call, callback) in
|
||||
if call.method == "getInitialLink" {
|
||||
callback(nil)
|
||||
} else {
|
||||
callback(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
// 3. PiP Channel (Graceful unsupported on iOS)
|
||||
let pipChannel = FlutterMethodChannel(
|
||||
name: "com.siro.siro_maps/pip",
|
||||
binaryMessenger: controller.binaryMessenger
|
||||
)
|
||||
pipChannel.setMethodCallHandler { (call, callback) in
|
||||
switch call.method {
|
||||
case "isPipSupported":
|
||||
callback(false)
|
||||
case "enterPictureInPicture":
|
||||
callback(false)
|
||||
case "setNavigating":
|
||||
callback(true)
|
||||
default:
|
||||
callback(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
|
||||
|
||||
Reference in New Issue
Block a user