-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
android/src/main/java/eu/sndr/fluttermdnsplugin/handlers/ServiceLostHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package eu.sndr.fluttermdnsplugin.handlers; | ||
|
||
import java.util.Map; | ||
|
||
import io.flutter.plugin.common.EventChannel; | ||
|
||
public class ServiceLostHandler implements EventChannel.StreamHandler { | ||
|
||
EventChannel.EventSink sink; | ||
@Override | ||
public void onListen(Object o, EventChannel.EventSink eventSink) { | ||
sink = eventSink; | ||
} | ||
|
||
@Override | ||
public void onCancel(Object o) { | ||
|
||
} | ||
|
||
public void onServiceLost(Map<String, Object> serviceInfoMap){ | ||
sink.success(serviceInfoMap); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Created by brouwer on 23-11-18. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Flutter/Flutter.h> | ||
|
||
@interface ServiceLostHandler : NSObject <FlutterStreamHandler> | ||
- (void)onServiceLost:(NSDictionary *)serviceInfoMap; | ||
|
||
- (BOOL)isReady; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Created by brouwer on 23-11-18. | ||
// | ||
|
||
#import "ServiceLostHandler.h" | ||
|
||
@implementation ServiceLostHandler { | ||
FlutterEventSink _eventSink; | ||
} | ||
|
||
- (FlutterError *_Nullable)onListenWithArguments:(id _Nullable)arguments eventSink:(FlutterEventSink)events { | ||
_eventSink = events; | ||
return nil; | ||
} | ||
|
||
- (FlutterError *_Nullable)onCancelWithArguments:(id _Nullable)arguments { | ||
return nil; | ||
} | ||
|
||
- (void) onServiceLost:(NSDictionary *)serviceInfoMap { | ||
_eventSink(serviceInfoMap); | ||
} | ||
|
||
- (BOOL) isReady { | ||
return nil != _eventSink; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters