Pigeon: Definitions for SessionState handling
- Generated Pigeons for `HostApis` in Android and iOS
This commit is contained in:
parent
925ff7a0dc
commit
73f6818bfb
5 changed files with 300 additions and 0 deletions
|
|
@ -161,6 +161,69 @@ public class HostApis {
|
||||||
callback.reply(null);
|
callback.reply(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void onSessionStarting(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarting", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionStarted(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarted", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionStartFailed(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionEnding(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnding", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionEnded(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnded", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionResuming(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResuming", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionResumed(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumed", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionResumeFailed(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSessionSuspended(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionSuspended", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static Map<String, Object> wrapError(Throwable exception) {
|
private static Map<String, Object> wrapError(Throwable exception) {
|
||||||
Map<String, Object> errorMap = new HashMap<>();
|
Map<String, Object> errorMap = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,14 @@ NSObject<FlutterMessageCodec> *CastFlutterApiGetCodec(void);
|
||||||
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
||||||
- (void)getSessionMessageNamespacesWithCompletion:(void(^)(NSArray<NSString *> *, NSError *_Nullable))completion;
|
- (void)getSessionMessageNamespacesWithCompletion:(void(^)(NSArray<NSString *> *, NSError *_Nullable))completion;
|
||||||
- (void)onCastStateChangedCastState:(NSNumber *)castState completion:(void(^)(NSError *_Nullable))completion;
|
- (void)onCastStateChangedCastState:(NSNumber *)castState completion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionStartingWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionStartedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionStartFailedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionEndingWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionEndedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionResumingWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
||||||
|
|
@ -204,4 +204,94 @@ NSObject<FlutterMessageCodec> *CastFlutterApiGetCodec() {
|
||||||
completion(nil);
|
completion(nil);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
- (void)onSessionStartingWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarting"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionStartedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarted"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionStartFailedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionEndingWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnding"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionEndedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnded"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionResumingWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResuming"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumed"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionSuspended"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,15 @@ abstract class CastFlutterApi {
|
||||||
|
|
||||||
List<String?> getSessionMessageNamespaces();
|
List<String?> getSessionMessageNamespaces();
|
||||||
void onCastStateChanged(int castState);
|
void onCastStateChanged(int castState);
|
||||||
|
void onSessionStarting();
|
||||||
|
void onSessionStarted();
|
||||||
|
void onSessionStartFailed();
|
||||||
|
void onSessionEnding();
|
||||||
|
void onSessionEnded();
|
||||||
|
void onSessionResuming();
|
||||||
|
void onSessionResumed();
|
||||||
|
void onSessionResumeFailed();
|
||||||
|
void onSessionSuspended();
|
||||||
static void setup(CastFlutterApi? api) {
|
static void setup(CastFlutterApi? api) {
|
||||||
{
|
{
|
||||||
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
|
@ -147,5 +156,122 @@ abstract class CastFlutterApi {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionStarting', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionStarting();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionStarted', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionStarted();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionStartFailed();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionEnding', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionEnding();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionEnded', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionEnded();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionResuming', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionResuming();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionResumed', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionResumed();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionResumeFailed();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSessionSuspended', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSessionSuspended();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,16 @@ abstract class CastApi {
|
||||||
abstract class CastFlutterApi {
|
abstract class CastFlutterApi {
|
||||||
List<String> getSessionMessageNamespaces();
|
List<String> getSessionMessageNamespaces();
|
||||||
void onCastStateChanged(int castState);
|
void onCastStateChanged(int castState);
|
||||||
|
|
||||||
|
//region Session State handling
|
||||||
|
void onSessionStarting();
|
||||||
|
void onSessionStarted();
|
||||||
|
void onSessionStartFailed();
|
||||||
|
void onSessionEnding();
|
||||||
|
void onSessionEnded();
|
||||||
|
void onSessionResuming();
|
||||||
|
void onSessionResumed();
|
||||||
|
void onSessionResumeFailed();
|
||||||
|
void onSessionSuspended();
|
||||||
|
//endregion
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue