Skip to content

Commit

Permalink
Release 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Selligent committed Oct 23, 2024
1 parent 01b82c2 commit ae62fd3
Show file tree
Hide file tree
Showing 39 changed files with 766 additions and 471 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

- __4.0.1__
- Fix bug that caused events to not be forwarded to the subscribers when the JS layer loading was slower than the native operation

- __4.0.0__
- BREAKING (Android) Add `delayedPushAction` behaviour to Android. If already being used for iOS, remove any `if (Platform.OS === 'ios')` surrounding `Selligent.executePushAction()` to keep things working on Android
- (Android) Fix IAM date properties not properly exposing the native value
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation 'com.selligent.sdk:selligent_mobile_reactnative_sdk:3.8.1'
implementation 'com.selligent.sdk:selligent_mobile_reactnative_sdk:3.8.2'
}

def loadSelligentSettings(variant) {
Expand Down
11 changes: 11 additions & 0 deletions ios/CustomEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>

@interface CustomEvent : NSObject

@property(nonatomic) NSString *_Nonnull name;
@property(nonatomic) NSString *_Nonnull type;
@property(nonatomic) NSDictionary *_Nullable data;

+ (instancetype _Nonnull) eventWithData:(NSDictionary*_Nullable)data AndName:(NSString*_Nonnull)name AndType:(NSString*_Nonnull)type;

@end
18 changes: 18 additions & 0 deletions ios/CustomEvent.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "CustomEvent.h"

@implementation CustomEvent

+ (instancetype) eventWithData:(NSDictionary*)data AndName:(NSString*)name AndType:(NSString*)type {
return [[self alloc] initWithData:data AndName:name AndType: type];
}

- (instancetype) initWithData:(NSDictionary*)data AndName:(NSString*)name AndType:(NSString*)type {
self = [super init];
self.data = data;
self.type = type;
self.name = name;

return self;
}

@end
8 changes: 0 additions & 8 deletions ios/RNSelligentMapper.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// RNSelligentMapper.h
// SelligentDevAppRN
//
// Created by Marc Biosca on 16/5/23.
// Copyright © 2023 Facebook. All rights reserved.
//

#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
Expand Down
24 changes: 22 additions & 2 deletions ios/RNSelligentMapper.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "RNSelligentMapper.h"
#import "CustomEvent.h"

@implementation RNSelligentMapper

Expand All @@ -8,6 +9,8 @@ - (instancetype) init {
self = [super init];

RNSelligent.eventDelegate = self;
self.pendingEvents = [NSMutableArray new];
[RNSelligent subscribeToEvents:@[]];

return self;
}
Expand Down Expand Up @@ -133,10 +136,27 @@ + (BOOL) requiresMainQueueSetup {

RCT_EXPORT_METHOD(subscribeToEvents:(NSArray<NSString *> *)events) {
[RNSelligent subscribeToEvents:events];
self.listeningEvents = true;
[self sendPendingEvents];
}

- (void) sendBroadcastEventWithName:(NSString * _Nonnull)name type:(NSString * _Nonnull)type data:(NSDictionary * _Nullable)data {
[self sendEventWithName:name body:@{@"data": data ?: [NSNull null], @"broadcastEventType": type}];
if (self.listeningEvents) {
[self sendEventWithName:name body:@{@"data": data ?: [NSNull null], @"broadcastEventType": type}];
}
else {
[self.pendingEvents addObject:[CustomEvent eventWithData:data AndName:name AndType:type]];
}
}

- (void) sendPendingEvents {
if (self.pendingEvents.count == 0) { return; }

for (CustomEvent* event in self.pendingEvents) {
[self sendEventWithName:event.name body:@{@"data": event.data ?: [NSNull null], @"broadcastEventType": event.type}];
}

self.pendingEvents = [NSMutableArray new];
}

- (NSArray<NSString *> *) supportedEvents {
Expand All @@ -153,4 +173,4 @@ - (void) sendBroadcastEventWithName:(NSString * _Nonnull)name type:(NSString * _
];
}

@end
@end
16 changes: 11 additions & 5 deletions ios/RNSelligentMobileSDK.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,39 @@
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>RNSelligentMobileSDK.framework/RNSelligentMobileSDK</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>RNSelligentMobileSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>RNSelligentMobileSDK.framework/RNSelligentMobileSDK</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>RNSelligentMobileSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>RNSelligentMobileSDK.framework/Versions/A/RNSelligentMobileSDK</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit ae62fd3

Please sign in to comment.