AppDelegate.swift 1.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import Flutter
import UIKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)

    let registrar = self.registrar(forPlugin: "Echo")!
17 18 19 20 21
    let reset = FlutterBasicMessageChannel(
      name: "dev.flutter.echo.reset", binaryMessenger: registrar.messenger())
    reset.setMessageHandler { (input, reply) in
      // noop
    }
22 23 24 25 26 27
    let basicStandard = FlutterBasicMessageChannel(
      name: "dev.flutter.echo.basic.standard", binaryMessenger: registrar.messenger(),
      codec: FlutterStandardMessageCodec.sharedInstance())
    basicStandard.setMessageHandler { (input, reply) in
      reply(input)
    }
28 29 30 31 32 33
    let basicBinary = FlutterBasicMessageChannel(
      name: "dev.flutter.echo.basic.binary", binaryMessenger: registrar.messenger(),
      codec: FlutterBinaryCodec())
    basicBinary.setMessageHandler { (input, reply) in
      reply(input)
    }
34 35 36 37

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}