42 lines
1.2 KiB
Objective-C
42 lines
1.2 KiB
Objective-C
#import "UnionAdSsgfEvent.h"
|
|
#import <Flutter/Flutter.h>
|
|
|
|
@interface UnionAdSsgfEvent () <FlutterStreamHandler>
|
|
@property(nonatomic, strong) FlutterEventSink eventSink;
|
|
@end
|
|
|
|
@implementation UnionAdSsgfEvent
|
|
|
|
+ (instancetype)sharedInstance {
|
|
static UnionAdSsgfEvent *myInstance = nil;
|
|
if (myInstance == nil) {
|
|
myInstance = [[UnionAdSsgfEvent alloc] init];
|
|
}
|
|
return myInstance;
|
|
}
|
|
|
|
- (void)initEvent:(NSObject<FlutterPluginRegistrar> *)registrar {
|
|
FlutterEventChannel *eventChannel = [FlutterEventChannel
|
|
eventChannelWithName:@"com.example.union_ad_ssgf/adevent"
|
|
binaryMessenger:[registrar messenger]];
|
|
[eventChannel setStreamHandler:self];
|
|
}
|
|
|
|
- (void)sentEvent:(NSDictionary *)arguments {
|
|
self.eventSink(arguments);
|
|
}
|
|
|
|
#pragma mark - FlutterStreamHandler
|
|
- (FlutterError *_Nullable)onCancelWithArguments:(id _Nullable)arguments {
|
|
self.eventSink = nil;
|
|
return nil;
|
|
}
|
|
|
|
- (FlutterError *_Nullable)onListenWithArguments:(id _Nullable)arguments
|
|
eventSink:
|
|
(nonnull FlutterEventSink)events {
|
|
self.eventSink = events;
|
|
return nil;
|
|
}
|
|
@end
|