Added screens in sample app for notification
Summary:
Added a basic communication flows and a button to trigger notification
{F142016937}
Reviewed By: jknoxville
Differential Revision: D10492428
fbshipit-source-id: b65fc46b3be695852f9197771a253d9e8596f328
This commit is contained in:
committed by
Facebook Github Bot
parent
74c1a24b86
commit
12d2af38f7
@@ -8,7 +8,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <FlipperKit/FlipperPlugin.h>
|
||||
|
||||
@protocol FlipperKitExampleCommunicationResponderDelegate
|
||||
- (void)messageReceived:(NSString *)msg;
|
||||
@end
|
||||
|
||||
@interface FlipperKitExamplePlugin : NSObject<FlipperPlugin>
|
||||
@property (weak, nonatomic) id<FlipperKitExampleCommunicationResponderDelegate> delegate;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (void)sendMessage:(NSString *)msg;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#import <FlipperKit/FlipperResponder.h>
|
||||
|
||||
@interface FlipperKitExamplePlugin()
|
||||
@property (strong, nonatomic) NSMutableArray<NSString *> *messagesToDisplay;
|
||||
@property (strong, nonatomic) id<FlipperConnection> connection;
|
||||
@property (nonatomic) NSInteger triggerCount;
|
||||
|
||||
@@ -23,7 +22,6 @@
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_messagesToDisplay = @[].mutableCopy;
|
||||
_triggerCount = 0;
|
||||
}
|
||||
return self;
|
||||
@@ -44,7 +42,8 @@
|
||||
__weak FlipperKitExamplePlugin *weakSelf = self;
|
||||
self.connection = connection;
|
||||
[connection receive:@"displayMessage" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
[weakSelf.messagesToDisplay addObject:params[@"message"]];
|
||||
[weakSelf.delegate messageReceived:params[@"message"]];
|
||||
[responder success:@{@"greeting": @"Hello"}];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user