Skip to content

Commit

Permalink
fix: ios fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijeetverma committed Jun 8, 2024
1 parent 280dc18 commit 6c48a89
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions ios/HyperSdkReact.mm
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ -(void)didMoveToSuperview {

@implementation SdkDelegate

NSMutableSet<NSString *> *registeredComponents = [[NSMutableSet alloc] init];

- (id)initWithBridge:(RCTBridge *)bridge {
// Hold references to all merchant views provided to the sdk
self.rootHolder = [[NSMutableDictionary alloc] init];
// Hold latest vaule of height provided by react
self.heightHolder = [[NSMutableDictionary alloc] init];
// Hold reference to latest constraints so that they can be replaced if height is modified
self.heightConstraintHolder = [[NSMutableDictionary alloc] init];
// Hold reference to registered components
self.registeredComponents = [[NSMutableSet alloc] init];
// Hold reference to bridge so that RCTRootViews can share JS VM
self.bridge = bridge;
return self;
Expand Down Expand Up @@ -100,13 +100,13 @@ - (UIView * _Nullable)merchantViewForViewType:(NSString * _Nonnull)viewType {
// Create a SDKRootView so that we can attach width constraints once it is attached to it's parent
RCTRootView *rrv = [SDKRootView alloc];
NSString *moduleName = @"JP_003";
if ([viewType isEqual:@"HEADER"] && isViewRegistered(@"JuspayHeader")) {
if ([viewType isEqual:@"HEADER"] && [registeredComponents containsObject:@"JuspayHeader"]) {
moduleName = @"JuspayHeader";
} else if ([viewType isEqual:@"HEADER_ATTACHED"] && isViewRegistered(@"JuspayHeaderAttached")) {
} else if ([viewType isEqual:@"HEADER_ATTACHED"] && [registeredComponents containsObject:@"JuspayHeaderAttached"]) {
moduleName = @"JuspayHeaderAttached";
} else if ([viewType isEqual:@"FOOTER"] && isViewRegistered(@"JuspayFooter")) {
} else if ([viewType isEqual:@"FOOTER"] && [registeredComponents containsObject:@"JuspayFooter"]) {
moduleName = @"JuspayFooter";
} else if ([viewType isEqual:@"FOOTER_ATTACHED"] && isViewRegistered(@"JuspayFooterAttached")) {
} else if ([viewType isEqual:@"FOOTER_ATTACHED"] && [registeredComponents containsObject:@"JuspayFooterAttached"]) {
moduleName = @"JuspayFooterAttached";
}

Expand Down Expand Up @@ -137,13 +137,6 @@ - (UIView * _Nullable)merchantViewForViewType:(NSString * _Nonnull)viewType {
return rrv;
}

- (BOOL)isViewRegistered:(NSString * _Nonnull) viewType {
if ([self.registeredComponents containsObject:viewType]){
return YES
}
return NO
}

- (void) onWebViewReady:(WKWebView *)webView {
//Ignored
}
Expand Down Expand Up @@ -282,7 +275,7 @@ -(void)stopObserving {
}

RCT_EXPORT_METHOD(notifyAboutRegisterComponent:(NSString *)viewType) {
[self.registeredComponents addObject:viewType];
[registeredComponents addObject:viewType];
}

RCT_EXPORT_METHOD(isInitialised:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
Expand Down

0 comments on commit 6c48a89

Please sign in to comment.