Skip to content

Commit 6df6189

Browse files
committed
setup everything in setBridge method
1 parent df457bd commit 6df6189

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

ios/MMKVStorage.mm

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@ - (dispatch_queue_t)methodQueue
3939
return RCTGetMethodQueue();
4040
}
4141

42-
- (id)init
43-
{
44-
self = [super init];
45-
if (self) {
46-
secureStorage = [[SecureStorage alloc]init];
47-
mmkvInstances = [NSMutableDictionary dictionary];
48-
}
49-
50-
return self;
51-
}
52-
5342
+ (BOOL)requiresMainQueueSetup
5443
{
5544
return YES;
@@ -756,12 +745,16 @@ - (void)setBridge:(RCTBridge *)bridge
756745
{
757746
_bridge = bridge;
758747
_setBridgeOnMainQueue = RCTIsMainQueue();
759-
748+
secureStorage = [[SecureStorage alloc]init];
749+
mmkvInstances = [NSMutableDictionary dictionary];
750+
760751
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
761752
if (!cxxBridge.runtime) {
762753
return;
763754
}
764755

756+
757+
765758
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
766759
NSString *libraryPath = (NSString *) [paths firstObject];
767760
NSString *rootDir = [libraryPath stringByAppendingPathComponent:@"mmkv"];

0 commit comments

Comments
 (0)