BlueWallet/ios/EventEmitter.m

55 lines
1.1 KiB
Mathematica
Raw Normal View History

//
// EventEmitter.m
// BlueWallet
//
// Created by Marcos Rodriguez on 12/25/20.
// Copyright © 2020 BlueWallet. All rights reserved.
//
#import "EventEmitter.h"
static EventEmitter *sharedInstance;
@implementation EventEmitter
RCT_EXPORT_MODULE();
+ (BOOL)requiresMainQueueSetup {
2024-07-06 01:30:18 +02:00
return YES;
}
2024-11-08 04:29:26 +01:00
+ (instancetype)sharedInstance {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
2022-02-12 18:03:10 +01:00
- (void)removeListeners:(double)count {
}
- (instancetype)init {
2024-11-09 02:07:35 +01:00
self = [super init];
return self;
}
- (NSArray<NSString *> *)supportedEvents {
2024-11-09 00:12:14 +01:00
return @[@"onUserActivityOpen"];
}
- (void)sendUserActivity:(NSDictionary *)userInfo
{
2024-11-09 02:07:35 +01:00
[self sendEventWithName:@"onUserActivityOpen" body:userInfo];
}
2024-11-09 02:07:35 +01:00
RCT_EXPORT_METHOD(getMostRecentUserActivity:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
2024-11-09 02:07:35 +01:00
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.bluewallet.bluewallet"];
resolve([defaults valueForKey:@"onUserActivityOpen"]);
}
@end