Skip to content

Commit

Permalink
Merge pull request #4 from Derewith/update
Browse files Browse the repository at this point in the history
fix: api kay change clean (no more crash)
  • Loading branch information
Derewith authored Nov 28, 2023
2 parents 36c36c0 + 81aae69 commit 0302f9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions ios/BundleUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
#else
#import <React/RCTBridgeModule.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface BundleUpdater : NSObject <RCTBridgeModule, UIViewControllerTransitioningDelegate>
@property (nonatomic, weak) RCTBridge *bridge;

+ (instancetype)sharedInstance;
- (void)initialization:(NSString *)apiKey
resolve:(void (^)(NSString *))resolve
reject:(void (^)(NSString *, NSString *, NSError *))reject;
- (NSURL *)initializeBundle:(RCTBridge *)bridge withKey:(NSString *)key;
- (void)reload;
- (void)checkAndReplaceBundle: (nullable NSString *)apiKey;
NS_ASSUME_NONNULL_END

#endif

@end
10 changes: 4 additions & 6 deletions ios/BundleUpdater.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#import "BundleUpdaterBottomSheetViewController.h"

#import "CommonCrypto/CommonDigest.h"
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <sys/utsname.h>
#import <React/RCTBundleURLProvider.h>
Expand All @@ -22,8 +21,6 @@ @implementation BundleUpdater{
NSString *_bundle_id_from_api;
BundleUpdaterBottomSheetViewController *_bottomSheetVC;
}
@synthesize bridge = _bridge;

RCT_EXPORT_MODULE()

+ (instancetype)sharedInstance{
Expand All @@ -38,7 +35,7 @@ + (instancetype)sharedInstance{
- (instancetype)init{
self = [super init];
// init variables
_apiUrl = @"http://192.168.0.102:3003";
_apiUrl = @"http://192.168.1.92:3003";
_bundle_id_from_api = @"";
_bottomSheetVC = [[BundleUpdaterBottomSheetViewController alloc] init];
return self;
Expand Down Expand Up @@ -210,8 +207,8 @@ -(void)hideBottomSheet {
* @param apiKey - the apiKey for the app
*/
- (void)initialization:(NSString *)apiKey
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject {
resolve:(void (^)(NSString *))resolve
reject:(void (^)(NSString *, NSString *, NSError *))reject {
// TODO fix Conflicting parameter types in implementation of
// 'initialization:resolve:reject:': 'void (^__strong)(NSString *__strong)'
// vs '__strong RCTPromiseResolveBlock' (aka 'void (^__strong)(__strong
Expand Down Expand Up @@ -347,6 +344,7 @@ - (NSURL *)initializeBundle:(RCTBridge *)bridge withKey:(NSString *)key{
[[NSFileManager defaultManager] removeItemAtPath:documentDirectoryJSBundleFilePath error:nil];
}
[[NSUserDefaults standardUserDefaults] setObject:key forKey:@"bundleKey"];
[[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"bundleId"];
}
// Check if there is the main.jsbundle file in the Document directory
NSString *documentDirectoryJSBundleFilePath =
Expand Down

0 comments on commit 0302f9e

Please sign in to comment.