flutter_cast_framework_modern/example/ios/Runner/AppDelegate.swift
gianlucaparadise 9dc03055de iOS: Initial CAF setup;
CastState handling;
CastButton press handling;
2019-11-19 06:10:10 +01:00

35 lines
1.1 KiB
Swift

import UIKit
import Flutter
import GoogleCast
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate, GCKLoggerDelegate {
let kReceiverAppID = kGCKDefaultMediaReceiverApplicationID
let kDebugLoggingEnabled = true
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
let criteria = GCKDiscoveryCriteria(applicationID: kReceiverAppID)
let options = GCKCastOptions(discoveryCriteria: criteria)
GCKCastContext.setSharedInstanceWith(options)
// Enable logger.
GCKLogger.sharedInstance().delegate = self
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
// MARK: - GCKLoggerDelegate
func logMessage(_ message: String,
at level: GCKLoggerLevel,
fromFunction function: String,
location: String) {
if (kDebugLoggingEnabled) {
print(function + " - " + message)
}
}
}