From 95de8d56f5d39fa73aaf2538f9d8462dc602c12d Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Thu, 7 Nov 2024 23:29:26 -0400 Subject: [PATCH] wip --- ios/EventEmitter.m | 6 +++++- ios/MenuElementsEmitter/MenuElementsEmitter.h | 3 ++- ios/MenuElementsEmitter/MenuElementsEmitter.m | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ios/EventEmitter.m b/ios/EventEmitter.m index b23bf21fc..ccc55d09e 100644 --- a/ios/EventEmitter.m +++ b/ios/EventEmitter.m @@ -18,7 +18,11 @@ RCT_EXPORT_MODULE(); return YES; } -+ (EventEmitter *)sharedInstance { ++ (instancetype)sharedInstance { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[self alloc] init]; + }); return sharedInstance; } diff --git a/ios/MenuElementsEmitter/MenuElementsEmitter.h b/ios/MenuElementsEmitter/MenuElementsEmitter.h index 871844a17..4254af071 100644 --- a/ios/MenuElementsEmitter/MenuElementsEmitter.h +++ b/ios/MenuElementsEmitter/MenuElementsEmitter.h @@ -22,5 +22,6 @@ - (void)addWalletMenuAction; - (void)importWalletMenuAction; - (void)reloadTransactionsMenuAction; +- (NSArray *)supportedEvents; -@end \ No newline at end of file +@end diff --git a/ios/MenuElementsEmitter/MenuElementsEmitter.m b/ios/MenuElementsEmitter/MenuElementsEmitter.m index 99977c268..b79bd3b49 100644 --- a/ios/MenuElementsEmitter/MenuElementsEmitter.m +++ b/ios/MenuElementsEmitter/MenuElementsEmitter.m @@ -19,9 +19,10 @@ RCT_EXPORT_MODULE(); } + (instancetype)sharedInstance { - if (!sharedInstance) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ sharedInstance = [[self alloc] init]; - } + }); return sharedInstance; } @@ -58,4 +59,4 @@ RCT_EXPORT_MODULE(); [self sendEventWithName:@"reloadTransactionsMenuAction" body:nil]; } -@end \ No newline at end of file +@end