Skip to content

Commit

Permalink
fix: expo reload with dev client
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocle2497 committed Jan 23, 2025
1 parent e8e7158 commit 5b42f09
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions ios/Keys.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#import "YeetJSIUtils.h"
#import <React/RCTBridge+Private.h>

//#import "crypto.cpp"
#import "crypto.h"
#import "GeneratedDotEnv.m"
#import "privateKey.m"
Expand Down Expand Up @@ -38,20 +37,14 @@ + (BOOL)requiresMainQueueSetup {
if (jsiRuntime == nil) {
return @false;
}

auto& runtime = *jsiRuntime;

// example::install(*(facebook::jsi::Runtime *)jsiRuntime);
install(*(facebook::jsi::Runtime *)jsiRuntime, self);


return @true;
}

static void install(jsi::Runtime &jsiRuntime, Keys *_Keys) {
auto secureFor = Function::createFromHostFunction(jsiRuntime,
PropNameID::forAscii(jsiRuntime,
auto secureFor = Function::createFromHostFunction(runtime,
PropNameID::forAscii(runtime,
"secureFor"),
0,
[_Keys](Runtime &runtime,
1,
[](Runtime &runtime,
const Value &thisValue,
const Value *arguments,
size_t count) -> Value {
Expand All @@ -60,14 +53,14 @@ static void install(jsi::Runtime &jsiRuntime, Keys *_Keys) {
return Value(runtime, convertNSStringToJSIString(runtime, value));
});

jsiRuntime.global().setProperty(jsiRuntime, "secureFor", move(secureFor));
runtime.global().setProperty(runtime, "secureFor", std::move(secureFor));


auto publicKeys = Function::createFromHostFunction(jsiRuntime,
PropNameID::forAscii(jsiRuntime,
auto publicKeys = Function::createFromHostFunction(runtime,
PropNameID::forAscii(runtime,
"publicKeys"),
0,
[_Keys](Runtime &runtime,
[](Runtime &runtime,
const Value &thisValue,
const Value *arguments,
size_t count) -> Value {
Expand All @@ -76,12 +69,15 @@ static void install(jsi::Runtime &jsiRuntime, Keys *_Keys) {

});

jsiRuntime.global().setProperty(jsiRuntime, "publicKeys", move(publicKeys));

runtime.global().setProperty(runtime, "publicKeys", std::move(publicKeys));




return @true;
}


+ (NSString *)secureFor: (NSString *)key {
@try {
NSDictionary *privatesKeyEnv = PRIVATE_KEY;
Expand Down

0 comments on commit 5b42f09

Please sign in to comment.