2020-12-26 11:57:42 +01:00
|
|
|
//
|
|
|
|
// 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;
|
2020-12-26 11:57:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (EventEmitter *)sharedInstance {
|
|
|
|
return sharedInstance;
|
|
|
|
}
|
|
|
|
|
2022-02-12 18:03:10 +01:00
|
|
|
- (void)removeListeners:(double)count {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-26 11:57:42 +01:00
|
|
|
- (instancetype)init {
|
|
|
|
sharedInstance = [super init];
|
|
|
|
return sharedInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray<NSString *> *)supportedEvents {
|
2024-02-15 16:13:20 +01:00
|
|
|
return @[@"onNotificationReceived",@"openSettings",@"onUserActivityOpen",@"addWalletMenuAction", @"importWalletMenuAction", @"reloadTransactionsMenuAction"];
|
2020-12-26 11:57:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)sendNotification:(NSDictionary *)userInfo
|
|
|
|
{
|
|
|
|
[sharedInstance sendEventWithName:@"onNotificationReceived" body:userInfo];
|
|
|
|
}
|
|
|
|
|
2021-09-25 05:36:08 +02:00
|
|
|
- (void)sendUserActivity:(NSDictionary *)userInfo
|
|
|
|
{
|
|
|
|
[sharedInstance sendEventWithName:@"onUserActivityOpen" body:userInfo];
|
|
|
|
}
|
|
|
|
|
2021-09-26 19:45:50 +02:00
|
|
|
RCT_REMAP_METHOD(getMostRecentUserActivity, resolve: (RCTPromiseResolveBlock)resolve
|
|
|
|
reject:(RCTPromiseRejectBlock)reject)
|
|
|
|
{
|
|
|
|
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.bluewallet.bluewallet"];
|
|
|
|
resolve([defaults valueForKey:@"onUserActivityOpen"]);
|
|
|
|
}
|
|
|
|
|
2020-12-27 01:10:54 +01:00
|
|
|
|
|
|
|
- (void)openSettings
|
|
|
|
{
|
|
|
|
[sharedInstance sendEventWithName:@"openSettings" body:nil];
|
|
|
|
}
|
|
|
|
|
2024-01-11 17:22:06 +01:00
|
|
|
- (void)addWalletMenuAction {
|
|
|
|
[sharedInstance sendEventWithName:@"addWalletMenuAction" body:nil];
|
|
|
|
}
|
2020-12-27 01:10:54 +01:00
|
|
|
|
2024-02-15 16:13:20 +01:00
|
|
|
- (void)importWalletMenuAction {
|
|
|
|
[sharedInstance sendEventWithName:@"importWalletMenuAction" body:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)reloadTransactionsMenuAction {
|
|
|
|
[sharedInstance sendEventWithName:@"reloadTransactionsMenuAction" body:nil];
|
|
|
|
}
|
|
|
|
|
2020-12-26 11:57:42 +01:00
|
|
|
@end
|