ios build

This commit is contained in:
Mikhail Sokolov
2019-02-11 12:19:25 +07:00
parent 7064454507
commit e671d91f4b
23 changed files with 1563 additions and 841 deletions

View File

@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>POSapp Joys</string> <string>POSapp Joys 2</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>

Binary file not shown.

View File

@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -8,6 +8,20 @@
/** /**
BREAKING CHANGES: BREAKING CHANGES:
October 5, 2018:
- Removed FlutterNavigationController.h/.mm
- Changed return signature of `FlutterDartHeadlessCodeRunner.run*` from void
to bool
- Removed HeadlessPlatformViewIOS
- Marked FlutterDartHeadlessCodeRunner deprecated
August 31, 2018: Marked -[FlutterDartProject
initFromDefaultSourceForConfiguration] and FlutterStandardBigInteger as
unavailable.
July 26, 2018: Marked -[FlutterDartProject
initFromDefaultSourceForConfiguration] deprecated.
February 28, 2018: Removed "initWithFLXArchive" and February 28, 2018: Removed "initWithFLXArchive" and
"initWithFLXArchiveWithScriptSnapshot". "initWithFLXArchiveWithScriptSnapshot".
@@ -36,13 +50,16 @@
#include "FlutterAppDelegate.h" #include "FlutterAppDelegate.h"
#include "FlutterBinaryMessenger.h" #include "FlutterBinaryMessenger.h"
#include "FlutterCallbackCache.h"
#include "FlutterChannels.h" #include "FlutterChannels.h"
#include "FlutterCodecs.h" #include "FlutterCodecs.h"
#include "FlutterDartProject.h" #include "FlutterDartProject.h"
#include "FlutterEngine.h"
#include "FlutterHeadlessDartRunner.h" #include "FlutterHeadlessDartRunner.h"
#include "FlutterMacros.h" #include "FlutterMacros.h"
#include "FlutterNavigationController.h" #include "FlutterPlatformViews.h"
#include "FlutterPlugin.h" #include "FlutterPlugin.h"
#include "FlutterPluginAppLifeCycleDelegate.h"
#include "FlutterTexture.h" #include "FlutterTexture.h"
#include "FlutterViewController.h" #include "FlutterViewController.h"

View File

@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -11,11 +11,11 @@
#include "FlutterPlugin.h" #include "FlutterPlugin.h"
/** /**
* UIApplicationDelegate subclass for simple apps that want default behavior. * `UIApplicationDelegate` subclass for simple apps that want default behavior.
* *
* This class provides the following behaviors: * This class implements the following behaviors:
* * Status bar touches are forwarded to the key window's root view * * Status bar touches are forwarded to the key window's root view
* FlutterViewController, in order to trigger scroll to top. * `FlutterViewController`, in order to trigger scroll to top.
* * Keeps the Flutter connection open in debug mode when the phone screen * * Keeps the Flutter connection open in debug mode when the phone screen
* locks. * locks.
* *
@@ -24,22 +24,11 @@
* code as necessary from FlutterAppDelegate.mm. * code as necessary from FlutterAppDelegate.mm.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterAppDelegate : UIResponder<UIApplicationDelegate, FlutterPluginRegistry> @interface FlutterAppDelegate
: UIResponder <UIApplicationDelegate, FlutterPluginRegistry, FlutterAppLifeCycleProvider>
@property(strong, nonatomic) UIWindow* window; @property(strong, nonatomic) UIWindow* window;
// Can be overriden by subclasses to provide a custom FlutterBinaryMessenger,
// typically a FlutterViewController, for plugin interop.
//
// Defaults to window's rootViewController.
- (NSObject<FlutterBinaryMessenger>*)binaryMessenger;
// Can be overriden by subclasses to provide a custom FlutterTextureRegistry,
// typically a FlutterViewController, for plugin interop.
//
// Defaults to window's rootViewController.
- (NSObject<FlutterTextureRegistry>*)textures;
@end @end
#endif // FLUTTER_FLUTTERDARTPROJECT_H_ #endif // FLUTTER_FLUTTERDARTPROJECT_H_

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -11,72 +11,67 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** /**
A message reply callback. * A message reply callback.
*
Used for submitting a binary reply back to a Flutter message sender. Also used * Used for submitting a binary reply back to a Flutter message sender. Also used
in the dual capacity for handling a binary message reply received from Flutter. * in for handling a binary message reply received from Flutter.
*
- Parameters: * @param reply The reply.
- reply: The reply.
*/ */
typedef void (^FlutterBinaryReply)(NSData* _Nullable reply); typedef void (^FlutterBinaryReply)(NSData* _Nullable reply);
/** /**
A strategy for handling incoming binary messages from Flutter and to send * A strategy for handling incoming binary messages from Flutter and to send
asynchronous replies back to Flutter. * asynchronous replies back to Flutter.
*
- Parameters: * @param message The message.
- message: The message. * @param reply A callback for submitting an asynchronous reply to the sender.
- reply: A callback for submitting a reply to the sender.
*/ */
typedef void (^FlutterBinaryMessageHandler)(NSData* _Nullable message, FlutterBinaryReply reply); typedef void (^FlutterBinaryMessageHandler)(NSData* _Nullable message, FlutterBinaryReply reply);
/** /**
A facility for communicating with the Flutter side using asynchronous message * A facility for communicating with the Flutter side using asynchronous message
passing with binary messages. * passing with binary messages.
*
- SeeAlso: * Implementated by:
- `FlutterBasicMessageChannel`, which supports communication using structured * - `FlutterBasicMessageChannel`, which supports communication using structured
messages. * messages.
- `FlutterMethodChannel`, which supports communication using asynchronous * - `FlutterMethodChannel`, which supports communication using asynchronous
method calls. * method calls.
- `FlutterEventChannel`, which supports commuication using event streams. * - `FlutterEventChannel`, which supports commuication using event streams.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterBinaryMessenger<NSObject> @protocol FlutterBinaryMessenger <NSObject>
/** /**
Sends a binary message to the Flutter side on the specified channel, expecting * Sends a binary message to the Flutter side on the specified channel, expecting
no reply. * no reply.
*
- Parameters: * @param channel The channel name.
- channel: The channel name. * @param message The message.
- message: The message.
*/ */
- (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message; - (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message;
/** /**
Sends a binary message to the Flutter side on the specified channel, expecting * Sends a binary message to the Flutter side on the specified channel, expecting
an asynchronous reply. * an asynchronous reply.
*
- Parameters: * @param channel The channel name.
- channel: The channel name. * @param message The message.
- message: The message. * @param callback A callback for receiving a reply.
- callback: A callback for receiving a reply.
*/ */
- (void)sendOnChannel:(NSString*)channel - (void)sendOnChannel:(NSString*)channel
message:(NSData* _Nullable)message message:(NSData* _Nullable)message
binaryReply:(FlutterBinaryReply _Nullable)callback; binaryReply:(FlutterBinaryReply _Nullable)callback;
/** /**
Registers a message handler for incoming binary messages from the Flutter side * Registers a message handler for incoming binary messages from the Flutter side
on the specified channel. * on the specified channel.
*
Replaces any existing handler. Use a `nil` handler for unregistering the * Replaces any existing handler. Use a `nil` handler for unregistering the
existing handler. * existing handler.
*
- Parameters: * @param channel The channel name.
- channel: The channel name. * @param handler The message handler.
- handler: The message handler.
*/ */
- (void)setMessageHandlerOnChannel:(NSString*)channel - (void)setMessageHandlerOnChannel:(NSString*)channel
binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler; binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler;

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -10,372 +10,359 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** /**
A message reply callback. * A message reply callback.
*
Used for submitting a reply back to a Flutter message sender. Also used in * Used for submitting a reply back to a Flutter message sender. Also used in
the dual capacity for handling a message reply received from Flutter. * the dual capacity for handling a message reply received from Flutter.
*
- Parameter reply: The reply. * @param reply The reply.
*/ */
typedef void (^FlutterReply)(id _Nullable reply); typedef void (^FlutterReply)(id _Nullable reply);
/** /**
A strategy for handling incoming messages from Flutter and to send * A strategy for handling incoming messages from Flutter and to send
asynchronous replies back to Flutter. * asynchronous replies back to Flutter.
*
- Parameters: * @param message The message.
- message: The message. * @param callback A callback for submitting a reply to the sender.
- reply: A callback for submitting a reply to the sender.
*/ */
typedef void (^FlutterMessageHandler)(id _Nullable message, FlutterReply callback); typedef void (^FlutterMessageHandler)(id _Nullable message, FlutterReply callback);
/** /**
A channel for communicating with the Flutter side using basic, asynchronous * A channel for communicating with the Flutter side using basic, asynchronous
message passing. * message passing.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterBasicMessageChannel : NSObject @interface FlutterBasicMessageChannel : NSObject
/** /**
Creates a `FlutterBasicMessageChannel` with the specified name and binary * Creates a `FlutterBasicMessageChannel` with the specified name and binary
messenger. * messenger.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
The channel uses `FlutterStandardMessageCodec` to encode and decode messages. * The channel uses `FlutterStandardMessageCodec` to encode and decode messages.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger.
*/ */
+ (instancetype)messageChannelWithName:(NSString*)name + (instancetype)messageChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger; binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
/** /**
Creates a `FlutterBasicMessageChannel` with the specified name, binary * Creates a `FlutterBasicMessageChannel` with the specified name, binary
messenger, * messenger, and message codec.
and message codec. *
* The channel name logically identifies the channel; identically named channels
The channel name logically identifies the channel; identically named channels * interfere with each other's communication.
interfere with each other's communication. *
* The binary messenger is a facility for sending raw, binary messages to the
The binary messenger is a facility for sending raw, binary messages to the * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
Flutter side. This protocol is implemented by `FlutterViewController`. *
* @param name The channel name.
- Parameters: * @param messenger The binary messenger.
- name: The channel name. * @param codec The message codec.
- messenger: The binary messenger.
- codec: The message codec.
*/ */
+ (instancetype)messageChannelWithName:(NSString*)name + (instancetype)messageChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMessageCodec>*)codec; codec:(NSObject<FlutterMessageCodec>*)codec;
/** /**
Initializes a `FlutterBasicMessageChannel` with the specified name, binary * Initializes a `FlutterBasicMessageChannel` with the specified name, binary
messenger, and message codec. * messenger, and message codec.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger. * @param codec The message codec.
- codec: The message codec.
*/ */
- (instancetype)initWithName:(NSString*)name - (instancetype)initWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMessageCodec>*)codec; codec:(NSObject<FlutterMessageCodec>*)codec;
/** /**
Sends the specified message to the Flutter side, ignoring any reply. * Sends the specified message to the Flutter side, ignoring any reply.
*
- Parameter message: The message. Must be supported by the codec of this * @param message The message. Must be supported by the codec of this
channel. * channel.
*/ */
- (void)sendMessage:(id _Nullable)message; - (void)sendMessage:(id _Nullable)message;
/** /**
Sends the specified message to the Flutter side, expecting an asynchronous * Sends the specified message to the Flutter side, expecting an asynchronous
reply. * reply.
*
- Parameters: * @param message The message. Must be supported by the codec of this channel.
- message: The message. Must be supported by the codec of this channel. * @param callback A callback to be invoked with the message reply from Flutter.
- callback: A callback to be invoked with the message reply from Flutter.
*/ */
- (void)sendMessage:(id _Nullable)message reply:(FlutterReply _Nullable)callback; - (void)sendMessage:(id _Nullable)message reply:(FlutterReply _Nullable)callback;
/** /**
Registers a message handler with this channel. * Registers a message handler with this channel.
*
Replaces any existing handler. Use a `nil` handler for unregistering the * Replaces any existing handler. Use a `nil` handler for unregistering the
existing handler. * existing handler.
*
- Parameter handler: The message handler. * @param handler The message handler.
*/ */
- (void)setMessageHandler:(FlutterMessageHandler _Nullable)handler; - (void)setMessageHandler:(FlutterMessageHandler _Nullable)handler;
@end @end
/** /**
A method call result callback. * A method call result callback.
*
Used for submitting a method call result back to a Flutter caller. Also used in * Used for submitting a method call result back to a Flutter caller. Also used in
the dual capacity for handling a method call result received from Flutter. * the dual capacity for handling a method call result received from Flutter.
*
- Parameter result: The result. * @param result The result.
*/ */
typedef void (^FlutterResult)(id _Nullable result); typedef void (^FlutterResult)(id _Nullable result);
/** /**
A strategy for handling method calls. * A strategy for handling method calls.
*
- Parameters: * @param call The incoming method call.
- call: The incoming method call. * @param result A callback to asynchronously submit the result of the call.
- result: A callback to asynchronously submit the result of the call. * Invoke the callback with a `FlutterError` to indicate that the call failed.
Invoke the callback with a `FlutterError` to indicate that the call failed. * Invoke the callback with `FlutterMethodNotImplemented` to indicate that the
Invoke the callback with `FlutterMethodNotImplemented` to indicate that the * method was unknown. Any other values, including `nil`, are interpreted as
method was unknown. Any other values, including `nil`, are interpreted as * successful results.
successful results.
*/ */
typedef void (^FlutterMethodCallHandler)(FlutterMethodCall* call, FlutterResult result); typedef void (^FlutterMethodCallHandler)(FlutterMethodCall* call, FlutterResult result);
/** /**
A constant used with `FlutterMethodCallHandler` to respond to the call of an * A constant used with `FlutterMethodCallHandler` to respond to the call of an
unknown method. * unknown method.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
extern NSObject const* FlutterMethodNotImplemented; extern NSObject const* FlutterMethodNotImplemented;
/** /**
A channel for communicating with the Flutter side using invocation of * A channel for communicating with the Flutter side using invocation of
asynchronous methods. * asynchronous methods.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterMethodChannel : NSObject @interface FlutterMethodChannel : NSObject
/** /**
Creates a `FlutterMethodChannel` with the specified name and binary messenger. * Creates a `FlutterMethodChannel` with the specified name and binary messenger.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
The channel uses `FlutterStandardMethodCodec` to encode and decode method calls * The channel uses `FlutterStandardMethodCodec` to encode and decode method calls
and result envelopes. * and result envelopes.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger.
*/ */
+ (instancetype)methodChannelWithName:(NSString*)name + (instancetype)methodChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger; binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
/** /**
Creates a `FlutterMethodChannel` with the specified name, binary messenger, and * Creates a `FlutterMethodChannel` with the specified name, binary messenger, and
method codec. * method codec.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger. * @param codec The method codec.
- codec: The method codec.
*/ */
+ (instancetype)methodChannelWithName:(NSString*)name + (instancetype)methodChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMethodCodec>*)codec; codec:(NSObject<FlutterMethodCodec>*)codec;
/** /**
Initializes a `FlutterMethodChannel` with the specified name, binary messenger, * Initializes a `FlutterMethodChannel` with the specified name, binary messenger,
and method codec. * and method codec.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger. * @param codec The method codec.
- codec: The method codec.
*/ */
- (instancetype)initWithName:(NSString*)name - (instancetype)initWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMethodCodec>*)codec; codec:(NSObject<FlutterMethodCodec>*)codec;
// clang-format off
/** /**
Invokes the specified Flutter method with the specified arguments, expecting * Invokes the specified Flutter method with the specified arguments, expecting
no results. * no results.
*
- Parameters: * @see [MethodChannel.setMethodCallHandler](https://docs.flutter.io/flutter/services/MethodChannel/setMethodCallHandler.html)
- method: The name of the method to invoke. *
- arguments: The arguments. Must be a value supported by the codec of this * @param method The name of the method to invoke.
channel. * @param arguments The arguments. Must be a value supported by the codec of this
* channel.
*/ */
// clang-format on
- (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments; - (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments;
/** /**
Invokes the specified Flutter method with the specified arguments, expecting * Invokes the specified Flutter method with the specified arguments, expecting
an asynchronous result. * an asynchronous result.
*
- Parameters: * @param method The name of the method to invoke.
- method: The name of the method to invoke. * @param arguments The arguments. Must be a value supported by the codec of this
- arguments: The arguments. Must be a value supported by the codec of this * channel.
channel. * @param callback A callback that will be invoked with the asynchronous result.
- result: A callback that will be invoked with the asynchronous result. * The result will be a `FlutterError` instance, if the method call resulted
The result will be a `FlutterError` instance, if the method call resulted * in an error on the Flutter side. Will be `FlutterMethodNotImplemented`, if
in an error on the Flutter side. Will be `FlutterMethodNotImplemented`, if * the method called was not implemented on the Flutter side. Any other value,
the method called was not implemented on the Flutter side. Any other value, * including `nil`, should be interpreted as successful results.
including `nil`, should be interpreted as successful results.
*/ */
- (void)invokeMethod:(NSString*)method - (void)invokeMethod:(NSString*)method
arguments:(id _Nullable)arguments arguments:(id _Nullable)arguments
result:(FlutterResult _Nullable)callback; result:(FlutterResult _Nullable)callback;
/** /**
Registers a handler for method calls from the Flutter side. * Registers a handler for method calls from the Flutter side.
*
Replaces any existing handler. Use a `nil` handler for unregistering the * Replaces any existing handler. Use a `nil` handler for unregistering the
existing handler. * existing handler.
*
- Parameter handler: The method call handler. * @param handler The method call handler.
*/ */
- (void)setMethodCallHandler:(FlutterMethodCallHandler _Nullable)handler; - (void)setMethodCallHandler:(FlutterMethodCallHandler _Nullable)handler;
@end @end
/** /**
An event sink callback. * An event sink callback.
*
- Parameter event: The event. * @param event The event.
*/ */
typedef void (^FlutterEventSink)(id _Nullable event); typedef void (^FlutterEventSink)(id _Nullable event);
/** /**
A strategy for exposing an event stream to the Flutter side. * A strategy for exposing an event stream to the Flutter side.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterStreamHandler @protocol FlutterStreamHandler
/** /**
Sets up an event stream and begin emitting events. * Sets up an event stream and begin emitting events.
*
Invoked when the first listener is registered with the Stream associated to * Invoked when the first listener is registered with the Stream associated to
this channel on the Flutter side. * this channel on the Flutter side.
*
- Parameters: * @param arguments Arguments for the stream.
- arguments: Arguments for the stream. * @param events A callback to asynchronously emit events. Invoke the
- events: A callback to asynchronously emit events. Invoke the * callback with a `FlutterError` to emit an error event. Invoke the
callback with a `FlutterError` to emit an error event. Invoke the * callback with `FlutterEndOfEventStream` to indicate that no more
callback with `FlutterEndOfEventStream` to indicate that no more * events will be emitted. Any other value, including `nil` are emitted as
events will be emitted. Any other value, including `nil` are emitted as * successful events.
successful events. * @return A FlutterError instance, if setup fails.
- Returns: A FlutterError instance, if setup fails.
*/ */
- (FlutterError* _Nullable)onListenWithArguments:(id _Nullable)arguments - (FlutterError* _Nullable)onListenWithArguments:(id _Nullable)arguments
eventSink:(FlutterEventSink)events; eventSink:(FlutterEventSink)events;
/** /**
Tears down an event stream. * Tears down an event stream.
*
Invoked when the last listener is deregistered from the Stream associated to * Invoked when the last listener is deregistered from the Stream associated to
this channel on the Flutter side. * this channel on the Flutter side.
*
The channel implementation may call this method with `nil` arguments * The channel implementation may call this method with `nil` arguments
to separate a pair of two consecutive set up requests. Such request pairs * to separate a pair of two consecutive set up requests. Such request pairs
may occur during Flutter hot restart. * may occur during Flutter hot restart.
*
- Parameter arguments: Arguments for the stream. * @param arguments Arguments for the stream.
- Returns: A FlutterError instance, if teardown fails. * @return A FlutterError instance, if teardown fails.
*/ */
- (FlutterError* _Nullable)onCancelWithArguments:(id _Nullable)arguments; - (FlutterError* _Nullable)onCancelWithArguments:(id _Nullable)arguments;
@end @end
/** /**
A constant used with `FlutterEventChannel` to indicate end of stream. * A constant used with `FlutterEventChannel` to indicate end of stream.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
extern NSObject const* FlutterEndOfEventStream; extern NSObject const* FlutterEndOfEventStream;
/** /**
A channel for communicating with the Flutter side using event streams. * A channel for communicating with the Flutter side using event streams.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterEventChannel : NSObject @interface FlutterEventChannel : NSObject
/** /**
Creates a `FlutterEventChannel` with the specified name and binary messenger. * Creates a `FlutterEventChannel` with the specified name and binary messenger.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterViewController`.
*
The channel uses `FlutterStandardMethodCodec` to decode stream setup and * The channel uses `FlutterStandardMethodCodec` to decode stream setup and
teardown requests, and to encode event envelopes. * teardown requests, and to encode event envelopes.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger.
- codec: The method codec.
*/ */
+ (instancetype)eventChannelWithName:(NSString*)name + (instancetype)eventChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger; binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
/** /**
Creates a `FlutterEventChannel` with the specified name, binary messenger, * Creates a `FlutterEventChannel` with the specified name, binary messenger,
and method codec. * and method codec.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterViewController`.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger. * @param codec The method codec.
- codec: The method codec.
*/ */
+ (instancetype)eventChannelWithName:(NSString*)name + (instancetype)eventChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMethodCodec>*)codec; codec:(NSObject<FlutterMethodCodec>*)codec;
/** /**
Initializes a `FlutterEventChannel` with the specified name, binary messenger, * Initializes a `FlutterEventChannel` with the specified name, binary messenger,
and method codec. * and method codec.
*
The channel name logically identifies the channel; identically named channels * The channel name logically identifies the channel; identically named channels
interfere with each other's communication. * interfere with each other's communication.
*
The binary messenger is a facility for sending raw, binary messages to the * The binary messenger is a facility for sending raw, binary messages to the
Flutter side. This protocol is implemented by `FlutterViewController`. * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
*
- Parameters: * @param name The channel name.
- name: The channel name. * @param messenger The binary messenger.
- messenger: The binary messenger. * @param codec The method codec.
- codec: The method codec.
*/ */
- (instancetype)initWithName:(NSString*)name - (instancetype)initWithName:(NSString*)name
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
codec:(NSObject<FlutterMethodCodec>*)codec; codec:(NSObject<FlutterMethodCodec>*)codec;
/** /**
Registers a handler for stream setup requests from the Flutter side. * Registers a handler for stream setup requests from the Flutter side.
*
Replaces any existing handler. Use a `nil` handler for unregistering the * Replaces any existing handler. Use a `nil` handler for unregistering the
existing handler. * existing handler.
*
- Parameter handler: The stream handler. * @param handler The stream handler.
*/ */
- (void)setStreamHandler:(NSObject<FlutterStreamHandler>* _Nullable)handler; - (void)setStreamHandler:(NSObject<FlutterStreamHandler>* _Nullable)handler;
@end @end

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -16,76 +16,76 @@ NS_ASSUME_NONNULL_BEGIN
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterMessageCodec @protocol FlutterMessageCodec
/** /**
Returns a shared instance of this `FlutterMessageCodec`. * Returns a shared instance of this `FlutterMessageCodec`.
*/ */
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
/** /**
Encodes the specified message into binary. * Encodes the specified message into binary.
*
- Parameter message: The message. * @param message The message.
- Returns: The binary encoding, or `nil`, if `message` was `nil`. * @return The binary encoding, or `nil`, if `message` was `nil`.
*/ */
- (NSData* _Nullable)encode:(id _Nullable)message; - (NSData* _Nullable)encode:(id _Nullable)message;
/** /**
Decodes the specified message from binary. * Decodes the specified message from binary.
*
- Parameter message: The message. * @param message The message.
- Returns: The decoded message, or `nil`, if `message` was `nil`. * @return The decoded message, or `nil`, if `message` was `nil`.
*/ */
- (id _Nullable)decode:(NSData* _Nullable)message; - (id _Nullable)decode:(NSData* _Nullable)message;
@end @end
/** /**
A `FlutterMessageCodec` using unencoded binary messages, represented as * A `FlutterMessageCodec` using unencoded binary messages, represented as
`NSData` instances. * `NSData` instances.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html) * [BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*
On the Dart side, messages are represented using `ByteData`. * On the Dart side, messages are represented using `ByteData`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterBinaryCodec : NSObject <FlutterMessageCodec> @interface FlutterBinaryCodec : NSObject <FlutterMessageCodec>
@end @end
/** /**
A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages. * A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html) * [StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStringCodec : NSObject <FlutterMessageCodec> @interface FlutterStringCodec : NSObject <FlutterMessageCodec>
@end @end
/** /**
A `FlutterMessageCodec` using UTF-8 encoded JSON messages. * A `FlutterMessageCodec` using UTF-8 encoded JSON messages.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html) * [JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*
Supports values accepted by `NSJSONSerialization` plus top-level * Supports values accepted by `NSJSONSerialization` plus top-level
`nil`, `NSNumber`, and `NSString`. * `nil`, `NSNumber`, and `NSString`.
*
On the Dart side, JSON messages are handled by the JSON facilities of the * On the Dart side, JSON messages are handled by the JSON facilities of the
[`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html) * [`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html)
package. * package.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterJSONMessageCodec : NSObject <FlutterMessageCodec> @interface FlutterJSONMessageCodec : NSObject <FlutterMessageCodec>
@end @end
/** /**
A writer of the Flutter standard binary encoding. * A writer of the Flutter standard binary encoding.
*
See `FlutterStandardMessageCodec` for details on the encoding. * See `FlutterStandardMessageCodec` for details on the encoding.
*
The encoding is extensible via subclasses overriding `writeValue`. * The encoding is extensible via subclasses overriding `writeValue`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardWriter : NSObject @interface FlutterStandardWriter : NSObject
@@ -100,11 +100,11 @@ FLUTTER_EXPORT
@end @end
/** /**
A reader of the Flutter standard binary encoding. * A reader of the Flutter standard binary encoding.
*
See `FlutterStandardMessageCodec` for details on the encoding. * See `FlutterStandardMessageCodec` for details on the encoding.
*
The encoding is extensible via subclasses overriding `readValueOfType`. * The encoding is extensible via subclasses overriding `readValueOfType`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardReader : NSObject @interface FlutterStandardReader : NSObject
@@ -121,8 +121,8 @@ FLUTTER_EXPORT
@end @end
/** /**
A factory of compatible reader/writer instances using the Flutter standard * A factory of compatible reader/writer instances using the Flutter standard
binary encoding or extensions thereof. * binary encoding or extensions thereof.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardReaderWriter : NSObject @interface FlutterStandardReaderWriter : NSObject
@@ -131,36 +131,29 @@ FLUTTER_EXPORT
@end @end
/** /**
A `FlutterMessageCodec` using the Flutter standard binary encoding. * A `FlutterMessageCodec` using the Flutter standard binary encoding.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html) * [StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*
Supported messages are acyclic values of these forms: * Supported messages are acyclic values of these forms:
*
- `nil` or `NSNull` * - `nil` or `NSNull`
- `NSNumber` (including their representation of Boolean values) * - `NSNumber` (including their representation of Boolean values)
- `NSString` * - `NSString`
- `FlutterStandardTypedData` * - `FlutterStandardTypedData`
- `NSArray` of supported values * - `NSArray` of supported values
- `NSDictionary` with supported keys and values * - `NSDictionary` with supported keys and values
*
On the Dart side, these values are represented as follows: * On the Dart side, these values are represented as follows:
*
- `nil` or `NSNull`: null * - `nil` or `NSNull`: null
- `NSNumber`: `bool`, `int`, or `double`, depending on the contained value. * - `NSNumber`: `bool`, `int`, or `double`, depending on the contained value.
- `NSString`: `String` * - `NSString`: `String`
- `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` * - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List`
- `NSArray`: `List` * - `NSArray`: `List`
- `NSDictionary`: `Map` * - `NSDictionary`: `Map`
Support for `FlutterStandardBigInteger` has been deprecated on 2018-01-09 to be
made unavailable four weeks after this change is available on the Flutter alpha
branch. `FlutterStandardBigInteger` were needed because the Dart 1.0 `int` type
had no size limit. With Dart 2.0, the `int` type is a fixed-size, 64-bit signed
integer. If you need to communicate larger integers, use `NSString` encoding
instead.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardMessageCodec : NSObject <FlutterMessageCodec> @interface FlutterStandardMessageCodec : NSObject <FlutterMessageCodec>
@@ -173,39 +166,37 @@ FLUTTER_EXPORT
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterMethodCall : NSObject @interface FlutterMethodCall : NSObject
/** /**
Creates a method call for invoking the specified named method with the * Creates a method call for invoking the specified named method with the
specified arguments. * specified arguments.
*
- Parameters: * @param method the name of the method to call.
- method: the name of the method to call. * @param arguments the arguments value.
- arguments: the arguments value.
*/ */
+ (instancetype)methodCallWithMethodName:(NSString*)method arguments:(id _Nullable)arguments; + (instancetype)methodCallWithMethodName:(NSString*)method arguments:(id _Nullable)arguments;
/** /**
The method name. * The method name.
*/ */
@property(readonly, nonatomic) NSString* method; @property(readonly, nonatomic) NSString* method;
/** /**
The arguments. * The arguments.
*/ */
@property(readonly, nonatomic, nullable) id arguments; @property(readonly, nonatomic, nullable) id arguments;
@end @end
/** /**
Error object representing an unsuccessful outcome of invoking a method * Error object representing an unsuccessful outcome of invoking a method
on a `FlutterMethodChannel`, or an error event on a `FlutterEventChannel`. * on a `FlutterMethodChannel`, or an error event on a `FlutterEventChannel`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterError : NSObject @interface FlutterError : NSObject
/** /**
Creates a `FlutterError` with the specified error code, message, and details. * Creates a `FlutterError` with the specified error code, message, and details.
*
- Parameters: * @param code An error code string for programmatic use.
- code: An error code string for programmatic use. * @param message A human-readable error message.
- message: A human-readable error message. * @param details Custom error details.
- details: Custom error details.
*/ */
+ (instancetype)errorWithCode:(NSString*)code + (instancetype)errorWithCode:(NSString*)code
message:(NSString* _Nullable)message message:(NSString* _Nullable)message
@@ -227,12 +218,12 @@ FLUTTER_EXPORT
@end @end
/** /**
Type of numeric data items encoded in a `FlutterStandardDataType`. * Type of numeric data items encoded in a `FlutterStandardDataType`.
*
- FlutterStandardDataTypeUInt8: plain bytes * - FlutterStandardDataTypeUInt8: plain bytes
- FlutterStandardDataTypeInt32: 32-bit signed integers * - FlutterStandardDataTypeInt32: 32-bit signed integers
- FlutterStandardDataTypeInt64: 64-bit signed integers * - FlutterStandardDataTypeInt64: 64-bit signed integers
- FlutterStandardDataTypeFloat64: 64-bit floats * - FlutterStandardDataTypeFloat64: 64-bit floats
*/ */
typedef NS_ENUM(NSInteger, FlutterStandardDataType) { typedef NS_ENUM(NSInteger, FlutterStandardDataType) {
FlutterStandardDataTypeUInt8, FlutterStandardDataTypeUInt8,
@@ -242,186 +233,173 @@ typedef NS_ENUM(NSInteger, FlutterStandardDataType) {
}; };
/** /**
A byte buffer holding `UInt8`, `SInt32`, `SInt64`, or `Float64` values, used * A byte buffer holding `UInt8`, `SInt32`, `SInt64`, or `Float64` values, used
with `FlutterStandardMessageCodec` and `FlutterStandardMethodCodec`. * with `FlutterStandardMessageCodec` and `FlutterStandardMethodCodec`.
*
Two's complement encoding is used for signed integers. IEEE754 * Two's complement encoding is used for signed integers. IEEE754
double-precision representation is used for floats. The platform's native * double-precision representation is used for floats. The platform's native
endianness is assumed. * endianness is assumed.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardTypedData : NSObject @interface FlutterStandardTypedData : NSObject
/** /**
Creates a `FlutterStandardTypedData` which interprets the specified data * Creates a `FlutterStandardTypedData` which interprets the specified data
as plain bytes. * as plain bytes.
*
- Parameter data: the byte data. * @param data the byte data.
*/ */
+ (instancetype)typedDataWithBytes:(NSData*)data; + (instancetype)typedDataWithBytes:(NSData*)data;
/** /**
Creates a `FlutterStandardTypedData` which interprets the specified data * Creates a `FlutterStandardTypedData` which interprets the specified data
as 32-bit signed integers. * as 32-bit signed integers.
*
- Parameter data: the byte data. The length must be divisible by 4. * @param data the byte data. The length must be divisible by 4.
*/ */
+ (instancetype)typedDataWithInt32:(NSData*)data; + (instancetype)typedDataWithInt32:(NSData*)data;
/** /**
Creates a `FlutterStandardTypedData` which interprets the specified data * Creates a `FlutterStandardTypedData` which interprets the specified data
as 64-bit signed integers. * as 64-bit signed integers.
*
- Parameter data: the byte data. The length must be divisible by 8. * @param data the byte data. The length must be divisible by 8.
*/ */
+ (instancetype)typedDataWithInt64:(NSData*)data; + (instancetype)typedDataWithInt64:(NSData*)data;
/** /**
Creates a `FlutterStandardTypedData` which interprets the specified data * Creates a `FlutterStandardTypedData` which interprets the specified data
as 64-bit floats. * as 64-bit floats.
*
- Parameter data: the byte data. The length must be divisible by 8. * @param data the byte data. The length must be divisible by 8.
*/ */
+ (instancetype)typedDataWithFloat64:(NSData*)data; + (instancetype)typedDataWithFloat64:(NSData*)data;
/** /**
The raw underlying data buffer. * The raw underlying data buffer.
*/ */
@property(readonly, nonatomic) NSData* data; @property(readonly, nonatomic) NSData* data;
/** /**
The type of the encoded values. * The type of the encoded values.
*/ */
@property(readonly, nonatomic) FlutterStandardDataType type; @property(readonly, nonatomic) FlutterStandardDataType type;
/** /**
The number of value items encoded. * The number of value items encoded.
*/ */
@property(readonly, nonatomic) UInt32 elementCount; @property(readonly, nonatomic) UInt32 elementCount;
/** /**
The number of bytes used by the encoding of a single value item. * The number of bytes used by the encoding of a single value item.
*/ */
@property(readonly, nonatomic) UInt8 elementSize; @property(readonly, nonatomic) UInt8 elementSize;
@end @end
/** /**
An arbitrarily large integer value, used with `FlutterStandardMessageCodec` * An arbitrarily large integer value, used with `FlutterStandardMessageCodec`
and `FlutterStandardMethodCodec`. * and `FlutterStandardMethodCodec`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
FLUTTER_DEPRECATED( FLUTTER_UNAVAILABLE("Unavailable on 2018-08-31. Deprecated on 2018-01-09. "
"Deprecated on 2018-01-09 to be made unavailable four weeks after the " "FlutterStandardBigInteger was needed because the Dart 1.0 int type had no "
"deprecation is available on the flutter/flutter alpha branch. " "size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed "
"FlutterStandardBigInteger was needed because the Dart 1.0 int type had no " "integer. If you need to communicate larger integers, use NSString encoding "
"size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed " "instead.")
"integer. If you need to communicate larger integers, use NSString encoding "
"instead.")
@interface FlutterStandardBigInteger : NSObject @interface FlutterStandardBigInteger : NSObject
/**
Creates a `FlutterStandardBigInteger` from a hexadecimal representation.
- Parameter hex: a hexadecimal string.
*/
+ (instancetype)bigIntegerWithHex:(NSString*)hex;
/**
The hexadecimal string representation of this integer.
*/
@property(readonly, nonatomic) NSString* hex;
@end @end
/** /**
A codec for method calls and enveloped results. * A codec for method calls and enveloped results.
*
Method calls are encoded as binary messages with enough structure that the * Method calls are encoded as binary messages with enough structure that the
codec can extract a method name `NSString` and an arguments `NSObject`, * codec can extract a method name `NSString` and an arguments `NSObject`,
possibly `nil`. These data items are used to populate a `FlutterMethodCall`. * possibly `nil`. These data items are used to populate a `FlutterMethodCall`.
*
Result envelopes are encoded as binary messages with enough structure that * Result envelopes are encoded as binary messages with enough structure that
the codec can determine whether the result was successful or an error. In * the codec can determine whether the result was successful or an error. In
the former case, the codec can extract the result `NSObject`, possibly `nil`. * the former case, the codec can extract the result `NSObject`, possibly `nil`.
In the latter case, the codec can extract an error code `NSString`, a * In the latter case, the codec can extract an error code `NSString`, a
human-readable `NSString` error message (possibly `nil`), and a custom * human-readable `NSString` error message (possibly `nil`), and a custom
error details `NSObject`, possibly `nil`. These data items are used to * error details `NSObject`, possibly `nil`. These data items are used to
populate a `FlutterError`. * populate a `FlutterError`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterMethodCodec @protocol FlutterMethodCodec
/** /**
Provides access to a shared instance this codec. * Provides access to a shared instance this codec.
*
- Returns: The shared instance. * @return The shared instance.
*/ */
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
/** /**
Encodes the specified method call into binary. * Encodes the specified method call into binary.
*
- Parameter methodCall: The method call. The arguments value * @param methodCall The method call. The arguments value
must be supported by this codec. * must be supported by this codec.
- Returns: The binary encoding. * @return The binary encoding.
*/ */
- (NSData*)encodeMethodCall:(FlutterMethodCall*)methodCall; - (NSData*)encodeMethodCall:(FlutterMethodCall*)methodCall;
/** /**
Decodes the specified method call from binary. * Decodes the specified method call from binary.
*
- Parameter methodCall: The method call to decode. * @param methodCall The method call to decode.
- Returns: The decoded method call. * @return The decoded method call.
*/ */
- (FlutterMethodCall*)decodeMethodCall:(NSData*)methodCall; - (FlutterMethodCall*)decodeMethodCall:(NSData*)methodCall;
/** /**
Encodes the specified successful result into binary. * Encodes the specified successful result into binary.
*
- Parameter result: The result. Must be a value supported by this codec. * @param result The result. Must be a value supported by this codec.
- Returns: The binary encoding. * @return The binary encoding.
*/ */
- (NSData*)encodeSuccessEnvelope:(id _Nullable)result; - (NSData*)encodeSuccessEnvelope:(id _Nullable)result;
/** /**
Encodes the specified error result into binary. * Encodes the specified error result into binary.
*
- Parameter error: The error object. The error details value must be supported * @param error The error object. The error details value must be supported
by this codec. * by this codec.
- Returns: The binary encoding. * @return The binary encoding.
*/ */
- (NSData*)encodeErrorEnvelope:(FlutterError*)error; - (NSData*)encodeErrorEnvelope:(FlutterError*)error;
/** /**
Deccodes the specified result envelope from binary. * Deccodes the specified result envelope from binary.
*
- Parameter error: The error object. * @param envelope The error object.
- Returns: The result value, if the envelope represented a successful result, * @return The result value, if the envelope represented a successful result,
or a `FlutterError` instance, if not. * or a `FlutterError` instance, if not.
*/ */
- (id _Nullable)decodeEnvelope:(NSData*)envelope; - (id _Nullable)decodeEnvelope:(NSData*)envelope;
@end @end
/** /**
A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result * A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result
envelopes. * envelopes.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html) * [JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*
Values supported as methods arguments and result payloads are * Values supported as methods arguments and result payloads are
those supported as top-level or leaf values by `FlutterJSONMessageCodec`. * those supported as top-level or leaf values by `FlutterJSONMessageCodec`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterJSONMethodCodec : NSObject <FlutterMethodCodec> @interface FlutterJSONMethodCodec : NSObject <FlutterMethodCodec>
@end @end
/** /**
A `FlutterMethodCodec` using the Flutter standard binary encoding. * A `FlutterMethodCodec` using the Flutter standard binary encoding.
*
This codec is guaranteed to be compatible with the corresponding * This codec is guaranteed to be compatible with the corresponding
[StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html) * [StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html)
on the Dart side. These parts of the Flutter SDK are evolved synchronously. * on the Dart side. These parts of the Flutter SDK are evolved synchronously.
*
Values supported as method arguments and result payloads are those supported by * Values supported as method arguments and result payloads are those supported by
`FlutterStandardMessageCodec`. * `FlutterStandardMessageCodec`.
*/ */
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterStandardMethodCodec : NSObject <FlutterMethodCodec> @interface FlutterStandardMethodCodec : NSObject <FlutterMethodCodec>

View File

@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -9,40 +9,61 @@
#include "FlutterMacros.h" #include "FlutterMacros.h"
/**
* A set of Flutter and Dart assets used by a `FlutterEngine` to initialize execution.
*/
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterDartProject : NSObject @interface FlutterDartProject : NSObject
/**
* Initializes with a specific
*/
- (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER; - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER;
/**
* Initializes with a specific set of Flutter Assets, with a specified location of
* main() and Dart packages.
*/
- (instancetype)initWithFlutterAssets:(NSURL*)flutterAssetsURL - (instancetype)initWithFlutterAssets:(NSURL*)flutterAssetsURL
dartMain:(NSURL*)dartMainURL dartMain:(NSURL*)dartMainURL
packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER; packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER;
/**
* Initializes from a specific set of Flutter Assets.
*/
- (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)initFromDefaultSourceForConfiguration; /**
* Unavailable - use `init` instead.
*/
- (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead.");
/** /**
Returns the file name for the given asset. * Returns the file name for the given asset.
The returned file name can be used to access the asset in the application's main bundle. * The returned file name can be used to access the asset in the application's main bundle.
*
- Parameter asset: The name of the asset. The name can be hierarchical. * @param asset The name of the asset. The name can be hierarchical.
- Returns: the file name to be used for lookup in the main bundle. * @return the file name to be used for lookup in the main bundle.
*/ */
+ (NSString*)lookupKeyForAsset:(NSString*)asset; + (NSString*)lookupKeyForAsset:(NSString*)asset;
/** /**
Returns the file name for the given asset which originates from the specified package. * Returns the file name for the given asset which originates from the specified package.
The returned file name can be used to access the asset in the application's main bundle. * The returned file name can be used to access the asset in the application's main bundle.
*
- Parameters: * @param asset The name of the asset. The name can be hierarchical.
- asset: The name of the asset. The name can be hierarchical. * @param package The name of the package from which the asset originates.
- package: The name of the package from which the asset originates. * @return the file name to be used for lookup in the main bundle.
- Returns: the file name to be used for lookup in the main bundle.
*/ */
+ (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
/**
* Returns the default identifier for the bundle where we expect to find the Flutter Dart
* application.
*/
+ (NSString*)defaultBundleIdentifier;
@end @end
#endif // FLUTTER_FLUTTERDARTPROJECT_H_ #endif // FLUTTER_FLUTTERDARTPROJECT_H_

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -7,27 +7,53 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "FlutterBinaryMessenger.h"
#include "FlutterDartProject.h" #include "FlutterDartProject.h"
#include "FlutterEngine.h"
#include "FlutterMacros.h" #include "FlutterMacros.h"
/** /**
The FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer, * A callback for when FlutterHeadlessDartRunner has attempted to start a Dart
and no native drawing surface. It is appropriate for use in running Dart * Isolate in the background.
code e.g. in the background from a plugin. *
*/ * @param success YES if the Isolate was started and run successfully, NO
FLUTTER_EXPORT * otherwise.
@interface FlutterHeadlessDartRunner : NSObject */
typedef void (^FlutterHeadlessDartRunnerCallback)(BOOL success);
/** /**
Runs a Dart function on an Isolate that is not the main application's Isolate. * The FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer,
The first call will create a new Isolate. Subsequent calls will reuse that * and no native drawing surface. It is appropriate for use in running Dart
Isolate. The Isolate is destroyed when the FlutterHeadlessDartRunner is * code e.g. in the background from a plugin.
destroyed. *
* Most callers should prefer using `FlutterEngine` directly; this interface exists
* for legacy support.
*/
FLUTTER_EXPORT
FLUTTER_DEPRECATED("FlutterEngine should be used rather than FlutterHeadlessDartRunner")
@interface FlutterHeadlessDartRunner : FlutterEngine
- Parameter entrypoint: The name of a top-level function from the same Dart /**
library that contains the app's main() function. * Iniitalize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
*/ *
- (void)runWithEntrypoint:(NSString*)entrypoint; * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
* the project in a default location.
*
* A newly initialized engine will not run the `FlutterDartProject` until either
* `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
*
* @param labelPrefix The label prefix used to identify threads for this instance. Should
* be unique across FlutterEngine instances
* @param projectOrNil The `FlutterDartProject` to run.
*/
- (instancetype)initWithName:(NSString*)labelPrefix
project:(FlutterDartProject*)projectOrNil NS_DESIGNATED_INITIALIZER;
/**
* Not recommended for use - will initialize with a default label ("io.flutter.headless")
* and the default FlutterDartProject.
*/
- (instancetype)init;
@end @end

View File

@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -21,19 +21,19 @@
#endif // defined(NS_ASSUME_NONNULL_BEGIN) #endif // defined(NS_ASSUME_NONNULL_BEGIN)
/** /**
Indicates that the API has been deprecated for the specifed reason. Code that * Indicates that the API has been deprecated for the specified reason. Code
uses the deprecated API will continue to work as before. However, the API will * that uses the deprecated API will continue to work as before. However, the
soon become unavailable and users are encouraged to immediately take the * API will soon become unavailable and users are encouraged to immediately take
appropriate action mentioned in the deprecation message and the BREAKING * the appropriate action mentioned in the deprecation message and the BREAKING
CHANGES section present in the Flutter.h umbrella header. * CHANGES section present in the Flutter.h umbrella header.
*/ */
#define FLUTTER_DEPRECATED(msg) __attribute__((__deprecated__(msg))) #define FLUTTER_DEPRECATED(msg) __attribute__((__deprecated__(msg)))
/** /**
Indicates that the previously deprecated API is now unavailable. Code that * Indicates that the previously deprecated API is now unavailable. Code that
uses the API will not work and the declaration of the API is only a stub meant * uses the API will not work and the declaration of the API is only a stub
to display the given message detailing the actions for the user to take * meant to display the given message detailing the actions for the user to take
immediately. * immediately.
*/ */
#define FLUTTER_UNAVAILABLE(msg) __attribute__((__unavailable__(msg))) #define FLUTTER_UNAVAILABLE(msg) __attribute__((__unavailable__(msg)))

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -6,65 +6,85 @@
#define FLUTTER_FLUTTERPLUGIN_H_ #define FLUTTER_FLUTTERPLUGIN_H_
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <UserNotifications/UNUserNotificationCenter.h>
#include "FlutterBinaryMessenger.h" #include "FlutterBinaryMessenger.h"
#include "FlutterChannels.h" #include "FlutterChannels.h"
#include "FlutterCodecs.h" #include "FlutterCodecs.h"
#include "FlutterPlatformViews.h"
#include "FlutterTexture.h" #include "FlutterTexture.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol FlutterPluginRegistrar; @protocol FlutterPluginRegistrar;
/** /**
Implemented by the iOS part of a Flutter plugin. * Implemented by the iOS part of a Flutter plugin.
*
Defines a set of optional callback methods and a method to set up the plugin * Defines a set of optional callback methods and a method to set up the plugin
and register it to be called by other application components. * and register it to be called by other application components.
*/ */
@protocol FlutterPlugin <NSObject> @protocol FlutterPlugin <NSObject>
@required @required
/** /**
Registers this plugin. * Registers this plugin using the context information and callback registration
* methods exposed by the given registrar.
- Parameters: *
- registrar: A helper providing application context and methods for * The registrar is obtained from a `FlutterPluginRegistry` which keeps track of
registering callbacks * the identity of registered plugins and provides basic support for cross-plugin
* coordination.
*
* The caller of this method, a plugin registrant, is usually autogenerated by
* Flutter tooling based on declared plugin dependencies. The generated registrant
* asks the registry for a registrar for each plugin, and calls this method to
* allow the plugin to initialize itself and register callbacks with application
* objects available through the registrar protocol.
*
* @param registrar A helper providing application context and methods for
* registering callbacks.
*/ */
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar; + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar;
@optional @optional
/** /**
Called if this plugin has been registered to receive `FlutterMethodCall`s. * Called if this plugin has been registered to receive `FlutterMethodCall`s.
*
- Parameters: * @param call The method call command object.
- call: The method call command object. * @param result A callback for submitting the result of the call.
- result: A callback for submitting the result of the call.
*/ */
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result; - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `NO` if this plugin vetoes application launch. * @return `NO` if this plugin vetoes application launch.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions; didFinishLaunchingWithOptions:(NSDictionary*)launchOptions;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
* @return `NO` if this plugin vetoes application launch.
*/
- (BOOL)application:(UIApplication*)application
willFinishLaunchingWithOptions:(NSDictionary*)launchOptions;
/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
- (void)applicationDidBecomeActive:(UIApplication*)application; - (void)applicationDidBecomeActive:(UIApplication*)application;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
- (void)applicationWillResignActive:(UIApplication*)application; - (void)applicationWillResignActive:(UIApplication*)application;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
- (void)applicationDidEnterBackground:(UIApplication*)application; - (void)applicationDidEnterBackground:(UIApplication*)application;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
- (void)applicationWillEnterForeground:(UIApplication*)application; - (void)applicationWillEnterForeground:(UIApplication*)application;
@@ -74,185 +94,250 @@ NS_ASSUME_NONNULL_BEGIN
- (void)applicationWillTerminate:(UIApplication*)application; - (void)applicationWillTerminate:(UIApplication*)application;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)application:(UIApplication*)application - (void)application:(UIApplication*)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;
#pragma GCC diagnostic pop
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/ */
- (void)application:(UIApplication*)application - (void)application:(UIApplication*)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary*)userInfo didReceiveRemoteNotification:(NSDictionary*)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
*/
- (void)application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification;
- Returns: `YES` if this plugin handles the request. /**
*/ * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks.
*/
- (void)userNotificationCenter:(UNUserNotificationCenter*)center
willPresentNotification:(UNNotification*)notification
withCompletionHandler:
(void (^)(UNNotificationPresentationOptions options))completionHandler
API_AVAILABLE(ios(10));
/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
* @return `YES` if this plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
openURL:(NSURL*)url openURL:(NSURL*)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options; options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url; - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
openURL:(NSURL*)url openURL:(NSURL*)url
sourceApplication:(NSString*)sourceApplication sourceApplication:(NSString*)sourceApplication
annotation:(id)annotation; annotation:(id)annotation;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem
completionHandler:(void (^)(BOOL succeeded))completionHandler completionHandler:(void (^)(BOOL succeeded))completionHandler
API_AVAILABLE(ios(9.0)); API_AVAILABLE(ios(9.0));
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
handleEventsForBackgroundURLSession:(nonnull NSString*)identifier handleEventsForBackgroundURLSession:(nonnull NSString*)identifier
completionHandler:(nonnull void (^)())completionHandler; completionHandler:(nonnull void (^)(void))completionHandler;
/** /**
Called if this plugin has been registered for `UIApplicationDelegate` callbacks. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
- Returns: `YES` if this plugin handles the request. * @return `YES` if this plugin handles the request.
*/ */
- (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application
performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*
* @return `YES` if this plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
continueUserActivity:(NSUserActivity*)userActivity
restorationHandler:(void (^)(NSArray*))restorationHandler;
@end @end
/** /**
Registration context for a single `FlutterPlugin`. *Registration context for a single `FlutterPlugin`, providing a one stop shop
*for the plugin to access contextual information and register callbacks for
*various application events.
*
*Registrars are obtained from a `FlutterPluginRegistry` which keeps track of
*the identity of registered plugins and provides basic support for cross-plugin
*coordination.
*/ */
@protocol FlutterPluginRegistrar <NSObject> @protocol FlutterPluginRegistrar <NSObject>
/** /**
Returns a `FlutterBinaryMessenger` for creating Dart/iOS communication * Returns a `FlutterBinaryMessenger` for creating Dart/iOS communication
channels to be used by the plugin. * channels to be used by the plugin.
*
- Returns: The messenger. * @return The messenger.
*/ */
- (NSObject<FlutterBinaryMessenger>*)messenger; - (NSObject<FlutterBinaryMessenger>*)messenger;
/** /**
Returns a `FlutterTextureRegistry` for registering textures * Returns a `FlutterTextureRegistry` for registering textures
provided by the plugin. * provided by the plugin.
*
- Returns: The texture registry. * @return The texture registry.
*/ */
- (NSObject<FlutterTextureRegistry>*)textures; - (NSObject<FlutterTextureRegistry>*)textures;
/** /**
Publishes a value for external use of the plugin. * Registers a `FlutterPlatformViewFactory` for creation of platfrom views.
*
* Plugins expose `UIView` for embedding in Flutter apps by registering a view factory.
*
* @param factory The view factory that will be registered.
* @param factoryId A unique identifier for the factory, the Dart code of the Flutter app can use
* this identifier to request creation of a `UIView` by the registered factory.
*/
- (void)registerViewFactory:(NSObject<FlutterPlatformViewFactory>*)factory
withId:(NSString*)factoryId;
Plugins may publish a single value, such as an instance of the /**
plugin's main class, for situations where external control or * Publishes a value for external use of the plugin.
interaction is needed. *
* Plugins may publish a single value, such as an instance of the
The published value will be available from the `FlutterPluginRegistry`. * plugin's main class, for situations where external control or
Repeated calls overwrite any previous publication. * interaction is needed.
*
- Parameter value: The value to be published. * The published value will be available from the `FlutterPluginRegistry`.
* Repeated calls overwrite any previous publication.
*
* @param value The value to be published.
*/ */
- (void)publish:(NSObject*)value; - (void)publish:(NSObject*)value;
/** /**
Registers the plugin as a receiver of incoming method calls from the Dart side * Registers the plugin as a receiver of incoming method calls from the Dart side
on the specified `FlutterMethodChannel`. * on the specified `FlutterMethodChannel`.
*
- Parameters: * @param delegate The receiving object, such as the plugin's main class.
- delegate: The receiving object, such as the plugin's main class. * @param channel The channel
- channel: The channel
*/ */
- (void)addMethodCallDelegate:(NSObject<FlutterPlugin>*)delegate - (void)addMethodCallDelegate:(NSObject<FlutterPlugin>*)delegate
channel:(FlutterMethodChannel*)channel; channel:(FlutterMethodChannel*)channel;
/** /**
Registers the plugin as a receiver of `UIApplicationDelegate` calls. * Registers the plugin as a receiver of `UIApplicationDelegate` calls.
*
- Parameters delegate: The receiving object, such as the plugin's main class. * @param delegate The receiving object, such as the plugin's main class.
*/ */
- (void)addApplicationDelegate:(NSObject<FlutterPlugin>*)delegate; - (void)addApplicationDelegate:(NSObject<FlutterPlugin>*)delegate;
/** /**
Returns the file name for the given asset. * Returns the file name for the given asset.
The returned file name can be used to access the asset in the application's main bundle. * The returned file name can be used to access the asset in the application's main bundle.
*
- Parameter asset: The name of the asset. The name can be hierarchical. * @param asset The name of the asset. The name can be hierarchical.
- Returns: the file name to be used for lookup in the main bundle. * @return the file name to be used for lookup in the main bundle.
*/ */
- (NSString*)lookupKeyForAsset:(NSString*)asset; - (NSString*)lookupKeyForAsset:(NSString*)asset;
/** /**
Returns the file name for the given asset which originates from the specified package. * Returns the file name for the given asset which originates from the specified package.
The returned file name can be used to access the asset in the application's main bundle. * The returned file name can be used to access the asset in the application's main bundle.
*
- Parameters: *
- asset: The name of the asset. The name can be hierarchical. * @param asset The name of the asset. The name can be hierarchical.
- package: The name of the package from which the asset originates. * @param package The name of the package from which the asset originates.
- Returns: the file name to be used for lookup in the main bundle. * @return the file name to be used for lookup in the main bundle.
*/ */
- (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
@end @end
/** /**
A registry of Flutter iOS plugins. * A registry of Flutter iOS plugins.
*
Plugins are identified by unique string keys, typically the name of the * Plugins are identified by unique string keys, typically the name of the
plugin's main class. * plugin's main class. The registry tracks plugins by this key, mapping it to
* a value published by the plugin during registration, if any. This provides a
* very basic means of cross-plugin coordination with loose coupling between
* unrelated plugins.
*
* Plugins typically need contextual information and the ability to register
* callbacks for various application events. To keep the API of the registry
* focused, these facilities are not provided directly by the registry, but by
* a `FlutterPluginRegistrar`, created by the registry in exchange for the unique
* key of the plugin.
*
* There is no implied connection between the registry and the registrar.
* Specifically, callbacks registered by the plugin via the registrar may be
* relayed directly to the underlying iOS application objects.
*/ */
@protocol FlutterPluginRegistry <NSObject> @protocol FlutterPluginRegistry <NSObject>
/** /**
Returns a registrar for registering a plugin. * Returns a registrar for registering a plugin.
*
- Parameter pluginKey: The unique key identifying the plugin. * @param pluginKey The unique key identifying the plugin.
*/ */
- (NSObject<FlutterPluginRegistrar>*)registrarForPlugin:(NSString*)pluginKey; - (NSObject<FlutterPluginRegistrar>*)registrarForPlugin:(NSString*)pluginKey;
/** /**
Returns whether the specified plugin has been registered. * Returns whether the specified plugin has been registered.
*
- Parameter pluginKey: The unique key identifying the plugin. * @param pluginKey The unique key identifying the plugin.
- Returns: `YES` if `registrarForPlugin` has been called with `pluginKey`. * @return `YES` if `registrarForPlugin` has been called with `pluginKey`.
*/ */
- (BOOL)hasPlugin:(NSString*)pluginKey; - (BOOL)hasPlugin:(NSString*)pluginKey;
/** /**
Returns a value published by the specified plugin. * Returns a value published by the specified plugin.
*
- Parameter pluginKey: The unique key identifying the plugin. * @param pluginKey The unique key identifying the plugin.
- Returns: An object published by the plugin, if any. Will be `NSNull` if * @return An object published by the plugin, if any. Will be `NSNull` if
nothing has been published. Will be `nil` if the plugin has not been * nothing has been published. Will be `nil` if the plugin has not been
registered. * registered.
*/ */
- (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey; - (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey;
@end @end
/**
* Implement this in the `UIAppDelegate` of your app to enable Flutter plugins to register
* themselves to the application life cycle events.
*/
@protocol FlutterAppLifeCycleProvider
- (void)addApplicationLifeCycleDelegate:(NSObject<FlutterPlugin>*)delegate;
@end
NS_ASSUME_NONNULL_END; NS_ASSUME_NONNULL_END;
#endif // FLUTTER_FLUTTERPLUGIN_H_ #endif // FLUTTER_FLUTTERPLUGIN_H_

View File

@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -13,12 +13,12 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterTexture<NSObject> @protocol FlutterTexture <NSObject>
- (CVPixelBufferRef _Nullable)copyPixelBuffer; - (CVPixelBufferRef _Nullable)copyPixelBuffer;
@end @end
FLUTTER_EXPORT FLUTTER_EXPORT
@protocol FlutterTextureRegistry<NSObject> @protocol FlutterTextureRegistry <NSObject>
- (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture; - (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture;
- (void)textureFrameAvailable:(int64_t)textureId; - (void)textureFrameAvailable:(int64_t)textureId;
- (void)unregisterTexture:(int64_t)textureId; - (void)unregisterTexture:(int64_t)textureId;

View File

@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@@ -10,45 +10,147 @@
#include "FlutterBinaryMessenger.h" #include "FlutterBinaryMessenger.h"
#include "FlutterDartProject.h" #include "FlutterDartProject.h"
#include "FlutterEngine.h"
#include "FlutterMacros.h" #include "FlutterMacros.h"
#include "FlutterPlugin.h"
#include "FlutterTexture.h" #include "FlutterTexture.h"
FLUTTER_EXPORT @class FlutterEngine;
@interface FlutterViewController : UIViewController<FlutterBinaryMessenger, FlutterTextureRegistry>
- (instancetype)initWithProject:(FlutterDartProject*)project /**
* A `UIViewController` implementation for Flutter views.
*
* Dart execution, channel communication, texture registration, and plugin registration
* are all handled by `FlutterEngine`. Calls on this class to those members all proxy
* through to the `FlutterEngine` attached FlutterViewController.
*
* A FlutterViewController can be initialized either with an already-running `FlutterEngine`,
* or it can be initialized with a `FlutterDartProject` that will be used to spin up
* a new `FlutterEngine`. Developers looking to present and hide FlutterViewControllers
* in native iOS applications will usually want to maintain the `FlutterEngine` instance
* so as not to lose Dart-related state and asynchronous tasks when navigating back and
* forth between a FlutterViewController and other `UIViewController`s.
*/
FLUTTER_EXPORT
@interface FlutterViewController
: UIViewController <FlutterBinaryMessenger, FlutterTextureRegistry, FlutterPluginRegistry>
/**
* Initializes this FlutterViewController with the specified `FlutterEngine`.
*
* The initialized viewcontroller will attach itself to the engine as part of this process.
*
* @param engine The `FlutterEngine` instance to attach to.
* @param nibNameOrNil The NIB name to initialize this UIViewController with.
* @param nibBundleOrNil The NIB bundle.
*/
- (instancetype)initWithEngine:(FlutterEngine*)engine
nibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
/**
* Initializes a new FlutterViewController and `FlutterEngine` with the specified
* `FlutterDartProject`.
*
* @param projectOrNil The `FlutterDartProject` to initialize the `FlutterEngine` with.
* @param nibNameOrNil The NIB name to initialize this UIViewController with.
* @param nibBundleOrNil The NIB bundle.
*/
- (instancetype)initWithProject:(FlutterDartProject*)projectOrNil
nibName:(NSString*)nibNameOrNil nibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
- (void)handleStatusBarTouches:(UIEvent*)event; - (void)handleStatusBarTouches:(UIEvent*)event;
/** /**
Returns the file name for the given asset. * Registers a callback that will be invoked when the Flutter view has been rendered.
The returned file name can be used to access the asset in the application's main bundle. * The callback will be fired only once.
*
* Replaces an existing callback. Use a `nil` callback to unregister the existing one.
*/
- (void)setFlutterViewDidRenderCallback:(void (^)(void))callback;
- Parameter asset: The name of the asset. The name can be hierarchical. /**
- Returns: the file name to be used for lookup in the main bundle. * Returns the file name for the given asset.
* The returned file name can be used to access the asset in the application's
* main bundle.
*
* @param asset The name of the asset. The name can be hierarchical.
* @return The file name to be used for lookup in the main bundle.
*/ */
- (NSString*)lookupKeyForAsset:(NSString*)asset; - (NSString*)lookupKeyForAsset:(NSString*)asset;
/** /**
Returns the file name for the given asset which originates from the specified package. * Returns the file name for the given asset which originates from the specified
The returned file name can be used to access the asset in the application's main bundle. * package.
* The returned file name can be used to access the asset in the application's
- Parameters: * main bundle.
- asset: The name of the asset. The name can be hierarchical. *
- package: The name of the package from which the asset originates. * @param asset The name of the asset. The name can be hierarchical.
- Returns: the file name to be used for lookup in the main bundle. * @param package The name of the package from which the asset originates.
* @return The file name to be used for lookup in the main bundle.
*/ */
- (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
/** /**
Sets the first route that the Flutter app shows. The default is "/". * Sets the first route that the Flutter app shows. The default is "/".
* This method will guarnatee that the initial route is delivered, even if the
- Parameter route: The name of the first route to show. * Flutter window hasn't been created yet when called. It cannot be used to update
* the current route being shown in a visible FlutterViewController (see pushRoute
* and popRoute).
*
* @param route The name of the first route to show.
*/ */
- (void)setInitialRoute:(NSString*)route; - (void)setInitialRoute:(NSString*)route;
/**
* Instructs the Flutter Navigator (if any) to go back.
*/
- (void)popRoute;
/**
* Instructs the Flutter Navigator (if any) to push a route on to the navigation
* stack. The setInitialRoute method should be prefered if this is called before the
* FlutterViewController has come into view.
*
* @param route The name of the route to push to the navigation stack.
*/
- (void)pushRoute:(NSString*)route;
/**
* The `FlutterPluginRegistry` used by this FlutterViewController.
*/
- (id<FlutterPluginRegistry>)pluginRegistry;
/**
* Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first
* frame rendered by the Flutter application might not immediately appear when theFlutter view is
* initially placed in the view hierarchy. The splash screen view will be used as
* a replacement until the first frame is rendered.
*
* The view used should be appropriate for multiple sizes; an autoresizing mask to
* have a flexible width and height will be applied automatically.
*/
@property(strong, nonatomic) UIView* splashScreenView;
/**
* Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the
* main bundle's `Info.plist` file. This method will not change the value of `splashScreenView`
* if it cannot find a default one from a storyboard or nib.
*
* @return `YES` if successful, `NO` otherwise.
*/
- (BOOL)loadDefaultSplashScreenView;
/**
* Controls whether the created view will be opaque or not.
*
* Default is `YES`. Note that setting this to `NO` may negatively impact performance
* when using hardware acceleration, and toggling this will trigger a re-layout of the
* view.
*/
@property(nonatomic, getter=isViewOpaque) BOOL viewOpaque;
@end @end
#endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_ #endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_

View File

@@ -20,10 +20,6 @@
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>8.0</string> <string>8.0</string>
</dict> </dict>

View File

@@ -2,8 +2,6 @@
FLUTTER_ROOT=/Users/dinect/projects/flutter FLUTTER_ROOT=/Users/dinect/projects/flutter
FLUTTER_APPLICATION_PATH=/Users/dinect/projects/checker FLUTTER_APPLICATION_PATH=/Users/dinect/projects/checker
FLUTTER_TARGET=lib/main.dart FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_MODE=release
FLUTTER_BUILD_DIR=build FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release FLUTTER_FRAMEWORK_DIR=/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release
PREVIEW_DART_2=true

View File

@@ -18,20 +18,20 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- DropDown - DropDown
- Flutter (from `/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release`) - Flutter (from `/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release`)
- image_picker (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.2/ios`) - image_picker (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/ios`)
- path_provider (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`) - path_provider (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.1/ios`)
- sqflite (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.9/ios`) - sqflite (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.12.2+1/ios`)
- ZXingObjC (~> 3.2.2) - ZXingObjC (~> 3.2.2)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: /Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release :path: /Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release
image_picker: image_picker:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.2/ios :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/ios
path_provider: path_provider:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.1/ios
sqflite: sqflite:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.9/ios :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.12.2+1/ios
SPEC CHECKSUMS: SPEC CHECKSUMS:
DropDown: 7f87abecc28f9b4edad810fe1211c5c018c257e5 DropDown: 7f87abecc28f9b4edad810fe1211c5c018c257e5
@@ -39,7 +39,7 @@ SPEC CHECKSUMS:
FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa
image_picker: ee00aab0487cedc80a304085219503cc6d0f2e22 image_picker: ee00aab0487cedc80a304085219503cc6d0f2e22
path_provider: 09407919825bfe3c2deae39453b7a5b44f467873 path_provider: 09407919825bfe3c2deae39453b7a5b44f467873
sqflite: d1612813fa7db7c667bed9f1d1b508deffc56999 sqflite: 801b6b0983f722fa29baf00d1476e4556ada6de4
ZXingObjC: 2c95a0dc52daac69b23ec78fad8fa2fec05f8981 ZXingObjC: 2c95a0dc52daac69b23ec78fad8fa2fec05f8981
PODFILE CHECKSUM: baa4624c0ec28db303cae71ed9281db645edae37 PODFILE CHECKSUM: baa4624c0ec28db303cae71ed9281db645edae37

View File

@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.23</string> <string>1.0.25</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>29</string> <string>31</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>

File diff suppressed because it is too large Load Diff

View File

@@ -9,16 +9,36 @@
<key>orderHint</key> <key>orderHint</key>
<integer>14</integer> <integer>14</integer>
</dict> </dict>
<key>Crypto INT.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>16</integer>
</dict>
<key>Crypto copy.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>16</integer>
</dict>
<key>Dinect INT.xcscheme_^#shared#^_</key> <key>Dinect INT.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<key>Dinect copy.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>15</integer>
</dict>
<key>Dinect-Crypto.xcscheme_^#shared#^_</key> <key>Dinect-Crypto.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
<key>Dinect-OTE.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>15</integer>
</dict>
<key>Dinect.xcscheme_^#shared#^_</key> <key>Dinect.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>

View File

@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.23</string> <string>1.0.25</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>29</string> <string>31</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>