2026-04-09 06:47:03 +00:00
|
|
|
import Flutter
|
|
|
|
|
import UIKit
|
|
|
|
|
|
2026-04-27 04:28:43 +00:00
|
|
|
@main
|
|
|
|
|
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
|
|
|
|
|
private let deviceChannelName = "cb_prestige_qr/device"
|
|
|
|
|
|
|
|
|
|
override func application(
|
|
|
|
|
_ application: UIApplication,
|
|
|
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
2026-04-09 06:47:03 +00:00
|
|
|
) -> Bool {
|
|
|
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-27 04:28:43 +00:00
|
|
|
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
|
|
|
|
|
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
|
|
|
|
|
|
|
|
|
|
let channel = FlutterMethodChannel(
|
|
|
|
|
name: deviceChannelName,
|
|
|
|
|
binaryMessenger: engineBridge.binaryMessenger
|
|
|
|
|
)
|
|
|
|
|
channel.setMethodCallHandler { call, result in
|
|
|
|
|
switch call.method {
|
|
|
|
|
case "getDeviceId":
|
|
|
|
|
if let identifier = UIDevice.current.identifierForVendor?.uuidString,
|
|
|
|
|
!identifier.isEmpty {
|
|
|
|
|
result(identifier)
|
|
|
|
|
} else {
|
|
|
|
|
result(
|
|
|
|
|
FlutterError(
|
|
|
|
|
code: "device_id_unavailable",
|
|
|
|
|
message: "Unable to retrieve device ID.",
|
|
|
|
|
details: nil
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
result(FlutterMethodNotImplemented)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|