| 1 | import Flutter |
| 2 | import UIKit |
| 3 | |
| 4 | @main |
| 5 | @objc class AppDelegate |
| 6 | override func application |
| 7 | _ application: UIApplication, |
| 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey |
| 9 | ) -> Bool { |
| 10 | let controller: FlutterViewController = window?.rootViewController |
| 11 | let planePalChannel = FlutterMethodChannel( |
| 12 | name:"com.phantomknight287.planepal/planepal",binaryMessenger |
| 13 | ) |
| 14 | let watchOsDeviceManager = WatchOsDeviceManager.initialize(with |
| 15 | |
| 16 | planePalChannel.setMethodCallHandler{ |
| 17 | (call:FlutterMethodCall, result: |
| 18 | case "getConnectedWearables": DispatchQueue.main |
| 19 | do{ |
| 20 | let devices = watchOsDeviceManager.getConnectedDevices() |
| 21 | result(devices) |
| 22 | } |
| 23 | catch{ |
| 24 | result( |
| 25 | FlutterError( |
| 26 | code:"ERROR", |
| 27 | message: error.localizedDescription, |
| 28 | details: nil |
| 29 | ) |
| 30 | ) |
| 31 | } |
| 32 | } |
| 33 | default: |
| 34 | result(FlutterMethodNotImplemented) |
| 35 | } |
| 36 | } |
| 37 | GeneratedPluginRegistrant.register(with: self |
| 38 | return super.application( |
| 39 | } |
| 40 | } |