Skip to content

Commit 5fd37c6

Browse files
author
Krzysztof Kurzawa
committed
Release of version 0.20.0
1 parent cd4e896 commit 5fd37c6

File tree

11 files changed

+71
-10
lines changed

11 files changed

+71
-10
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.20.0] - 2024-06-02
6+
7+
### Fixed
8+
- [iOS] Some potential issues with retrieving system push consent by the SDK. The SDK set the constent to false when the general consent for the application was enabled, but at least one of the following options was disabled: alerts, sounds, badges.
9+
10+
### Added
11+
- `Synerise.settings.tracker.eventsTriggeringFlush` option in settings to let you set the list of event actions which will trigger instant sending of all events in the queue. The default array contains only push event's actions.
12+
13+
### Changed
14+
- All events connected with push campaigns will flush the queue and send events immediately.
15+
- Improvements to push notifications registration.
16+
- Stability improvements.
17+
- Update of native SDK's dependencies.
18+
19+
520
## [0.19.0] - 2024-04-09
621

722
### Fixed

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ext.versions = [
44
'minSdk' : 21,
55
'compileSdk' : 33,
66
'targetSdk' : 33,
7-
'versionCode': 33,
8-
'versionName': "0.19.0"
7+
'versionCode': 34,
8+
'versionName': "0.20.0"
99
]
1010

1111
buildscript {
@@ -57,7 +57,7 @@ repositories {
5757
dependencies {
5858
implementation 'com.facebook.react:react-native:+'
5959
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
60-
api 'com.synerise.sdk:synerise-mobile-sdk:5.16.2'
60+
api 'com.synerise.sdk:synerise-mobile-sdk:5.17.0'
6161
}
6262

6363
//apply from: 'publish.gradle'

android/src/main/java/com/synerise/sdk/react/RNSettings.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
package com.synerise.sdk.react;
22

3+
34
import android.util.Log;
45

56
import com.facebook.react.bridge.Arguments;
67
import com.facebook.react.bridge.ReactApplicationContext;
78
import com.facebook.react.bridge.ReactMethod;
9+
import com.facebook.react.bridge.ReadableArray;
810
import com.facebook.react.bridge.ReadableMap;
911
import com.facebook.react.bridge.ReadableMapKeySetIterator;
1012
import com.facebook.react.bridge.ReadableType;
13+
import com.facebook.react.bridge.WritableArray;
1114
import com.facebook.react.bridge.WritableMap;
1215
import com.synerise.sdk.core.Synerise;
1316
import com.synerise.sdk.core.settings.Settings;
1417

18+
import java.util.ArrayList;
1519
import java.util.HashMap;
20+
import java.util.List;
1621
import java.util.Map;
22+
import java.util.Objects;
1723

1824
import javax.annotation.Nonnull;
1925
import javax.annotation.Nullable;
@@ -27,6 +33,7 @@ public class RNSettings extends RNBaseModule {
2733
public static final String RN_SETTINGS_TRACKER_MIN_BATCH_SIZE = "TRACKER_MIN_BATCH_SIZE";
2834
public static final String RN_SETTINGS_TRACKER_MAX_BATCH_SIZE = "TRACKER_MAX_BATCH_SIZE";
2935
public static final String RN_SETTINGS_TRACKER_AUTO_FLUSH_TIMEOUT = "TRACKER_AUTO_FLUSH_TIMEOUT";
36+
public static final String RN_SETTINGS_TRACKER_EVENTS_TRIGGERING_FLUSH = "TRACKER_EVENTS_TRIGGERING_FLUSH";
3037
public static final String RN_SETTINGS_NOTIFICATIONS_ENABLED = "NOTIFICATIONS_ENABLED";
3138
public static final String RN_SETTINGS_NOTIFICATIONS_ENCRYPTION = "NOTIFICATIONS_ENCRYPTION";
3239
public static final String RN_SETTINGS_INJECTOR_AUTOMATIC = "INJECTOR_AUTOMATIC";
@@ -55,6 +62,7 @@ public Map<String, Object> getConstants() {
5562
constants.put(RN_SETTINGS_TRACKER_MIN_BATCH_SIZE, RN_SETTINGS_TRACKER_MIN_BATCH_SIZE);
5663
constants.put(RN_SETTINGS_TRACKER_MAX_BATCH_SIZE, RN_SETTINGS_TRACKER_MAX_BATCH_SIZE);
5764
constants.put(RN_SETTINGS_TRACKER_AUTO_FLUSH_TIMEOUT, RN_SETTINGS_TRACKER_AUTO_FLUSH_TIMEOUT);
65+
constants.put(RN_SETTINGS_TRACKER_EVENTS_TRIGGERING_FLUSH, RN_SETTINGS_TRACKER_EVENTS_TRIGGERING_FLUSH);
5866
constants.put(RN_SETTINGS_INJECTOR_AUTOMATIC, RN_SETTINGS_INJECTOR_AUTOMATIC);
5967
constants.put(RN_SETTINGS_NOTIFICATIONS_ENABLED, RN_SETTINGS_NOTIFICATIONS_ENABLED);
6068
constants.put(RN_SETTINGS_NOTIFICATIONS_ENCRYPTION, RN_SETTINGS_NOTIFICATIONS_ENCRYPTION);
@@ -77,6 +85,16 @@ public WritableMap getOne(String key) {
7785
if (settings.get(key) instanceof Integer) {
7886
setting.putInt(key, (int) settings.get(key));
7987
}
88+
if (settings.get(key) instanceof List) {
89+
List<String> eventsTriggeringFlush = (List<String>) settings.get(key);
90+
WritableArray writableArray = Arguments.createArray();
91+
92+
for (int i = 0; i < Objects.requireNonNull(eventsTriggeringFlush).size(); i++) {
93+
writableArray.pushString(eventsTriggeringFlush.get(i));
94+
}
95+
96+
setting.putArray(key, (WritableArray) writableArray);
97+
}
8098
return setting;
8199
}
82100

@@ -92,6 +110,9 @@ public void setOne(ReadableMap settingMap) {
92110
case Number:
93111
matchSetting(key, settingMap.getInt("value"));
94112
break;
113+
case Array:
114+
matchSetting(key, settingMap.getArray("value"));
115+
break;
95116
}
96117
}
97118

@@ -103,14 +124,16 @@ public void setMany(ReadableMap newSettings) {
103124
while (iterator.hasNextKey()) {
104125
String key = iterator.nextKey();
105126
ReadableType type = newSettings.getType(key);
106-
107127
switch (type) {
108128
case Boolean:
109129
matchSetting(key, newSettings.getBoolean(key));
110130
break;
111131
case Number:
112132
matchSetting(key, newSettings.getInt(key));
113133
break;
134+
case Array:
135+
matchSetting(key, newSettings.getArray(key));
136+
break;
114137
}
115138
}
116139
}
@@ -136,6 +159,15 @@ private void matchSetting(String key, Object value) {
136159
Settings.getInstance().tracker.setAutoFlushTimeout(((int) value) * 1000);
137160
}
138161
break;
162+
case RN_SETTINGS_TRACKER_EVENTS_TRIGGERING_FLUSH:
163+
if (value instanceof ReadableArray) {
164+
List<String> eventsFromRN = new ArrayList<>();
165+
for (int i = 0; i< ((ReadableArray) value).size(); i++) {
166+
eventsFromRN.add(((ReadableArray) value).getString(i));
167+
}
168+
Settings.getInstance().tracker.eventsTriggeringFlush = eventsFromRN;
169+
}
170+
break;
139171
case RN_SETTINGS_TRACKER_MAX_BATCH_SIZE:
140172
if (value instanceof Integer) {
141173
Settings.getInstance().tracker.setMaximumBatchSize((int) value);
@@ -195,6 +227,7 @@ private Map<String, Object> settingsDictionary() {
195227
settings.put(RN_SETTINGS_TRACKER_MIN_BATCH_SIZE, Synerise.settings.tracker.minBatchSize);
196228
settings.put(RN_SETTINGS_TRACKER_MAX_BATCH_SIZE, Synerise.settings.tracker.maxBatchSize);
197229
settings.put(RN_SETTINGS_TRACKER_AUTO_FLUSH_TIMEOUT, Synerise.settings.tracker.autoFlushTimeout / 1000);
230+
settings.put(RN_SETTINGS_TRACKER_EVENTS_TRIGGERING_FLUSH, Synerise.settings.tracker.eventsTriggeringFlush);
198231
settings.put(RN_SETTINGS_INJECTOR_AUTOMATIC, Synerise.settings.injector.automatic);
199232
settings.put(RN_SETTINGS_NOTIFICATIONS_ENABLED, Synerise.settings.notifications.enabled);
200233
settings.put(RN_SETTINGS_NOTIFICATIONS_ENCRYPTION, Synerise.settings.notifications.getEncryption());

android/src/main/java/com/synerise/sdk/react/RNSyneriseInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class RNSyneriseInitializer {
1717
public Boolean isCrashHandlingEnabled;
1818
public static volatile boolean isInitialized = false;
1919

20-
public static final String SDK_PLUGIN_VERSION = "0.19.0";
20+
public static final String SDK_PLUGIN_VERSION = "0.20.0";
2121

2222
public void initialize(Application app) {
2323
if (isInitialized == false) {

ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import "RNSyneriseInitializer.h"
1010

11-
NSString * const SNRSyneriseSDKPluginVersion = @"0.19.0";
11+
NSString * const SNRSyneriseSDKPluginVersion = @"0.20.0";
1212

1313
@implementation RNSyneriseInitializer
1414

ios/ReactNativeSynerise/Modules/RNSettings.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
static NSString * const RNSettingsTrackerMinBatchSize = @"TRACKER_MIN_BATCH_SIZE";
2020
static NSString * const RNSettingsTrackerMaxBatchSize = @"TRACKER_MAX_BATCH_SIZE";
2121
static NSString * const RNSettingsTrackerAutoFlushTimeout = @"TRACKER_AUTO_FLUSH_TIMEOUT";
22+
static NSString * const RNSettingsTrackerEventsTriggeringFlush = @"TRACKER_EVENTS_TRIGGERING_FLUSH";
2223

2324
static NSString * const RNSettingsNotificationsEnabled = @"NOTIFICATIONS_ENABLED";
2425
static NSString * const RNSettingsNotificationsEncryption = @"NOTIFICATIONS_ENCRYPTION";
@@ -71,7 +72,8 @@ - (void)updateSettingsWithDictionary:(NSDictionary *)dictionary {
7172
[self updateSettingsKeyPath:@"tracker.minBatchSize" expectedClass:[NSNumber class] object:dictionary[RNSettingsTrackerMinBatchSize]];
7273
[self updateSettingsKeyPath:@"tracker.maxBatchSize" expectedClass:[NSNumber class] object:dictionary[RNSettingsTrackerMaxBatchSize]];
7374
[self updateSettingsKeyPath:@"tracker.autoFlushTimeout" expectedClass:[NSNumber class] object:dictionary[RNSettingsTrackerAutoFlushTimeout]];
74-
75+
[self updateSettingsKeyPath:@"tracker.eventsTriggeringFlush" expectedClass:[NSArray class] object:dictionary[RNSettingsTrackerEventsTriggeringFlush]];
76+
7577
[self updateSettingsKeyPath:@"notifications.enabled" expectedClass:[NSNumber class] object:dictionary[RNSettingsNotificationsEnabled]];
7678
[self updateSettingsKeyPath:@"notifications.encryption" expectedClass:[NSNumber class] object:dictionary[RNSettingsNotificationsEncryption]];
7779
[self updateSettingsKeyPath:@"notifications.disableInAppAlerts" expectedClass:[NSNumber class] object:dictionary[RNSettingsNotificationsDisableInAppAlerts]];
@@ -143,6 +145,7 @@ - (NSDictionary *)settingsDictionary {
143145
dictionary[RNSettingsTrackerMinBatchSize] = [NSNumber numberWithInteger:SNRSynerise.settings.tracker.minBatchSize];
144146
dictionary[RNSettingsTrackerMaxBatchSize] = [NSNumber numberWithInteger:SNRSynerise.settings.tracker.maxBatchSize];
145147
dictionary[RNSettingsTrackerAutoFlushTimeout] = [NSNumber numberWithDouble:SNRSynerise.settings.tracker.autoFlushTimeout];
148+
dictionary[RNSettingsTrackerEventsTriggeringFlush] = SNRSynerise.settings.tracker.eventsTriggeringFlush ?: [NSNull null];
146149

147150
dictionary[RNSettingsNotificationsEnabled] = [NSNumber numberWithBool:SNRSynerise.settings.notifications.enabled];
148151
dictionary[RNSettingsNotificationsEncryption] = [NSNumber numberWithBool:SNRSynerise.settings.notifications.encryption];
@@ -174,6 +177,7 @@ - (NSDictionary *)constantsToExport
174177
RNSettingsTrackerMinBatchSize: RNSettingsTrackerMinBatchSize,
175178
RNSettingsTrackerMaxBatchSize: RNSettingsTrackerMaxBatchSize,
176179
RNSettingsTrackerAutoFlushTimeout: RNSettingsTrackerAutoFlushTimeout,
180+
RNSettingsTrackerEventsTriggeringFlush: RNSettingsTrackerEventsTriggeringFlush,
177181

178182
RNSettingsNotificationsEnabled: RNSettingsNotificationsEnabled,
179183
RNSettingsNotificationsEncryption: RNSettingsNotificationsEncryption,

ios/react-native-synerise-sdk.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require 'json'
22

33
package = JSON.parse(File.read('./../package.json'))
44

5-
SYNERISE_SDK_FRAMEWORK_VERSION = '4.16.1'
5+
SYNERISE_SDK_FRAMEWORK_VERSION = '4.17.0'
66

77
Pod::Spec.new do |s|
88
s.name = package['name']

lib/main/modules/SettingsModule.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface ISettingsOptions {
1515
minBatchSize?: number;
1616
maxBatchSize?: number;
1717
autoFlushTimeout?: number;
18+
eventsTriggeringFlush?: Array<string>;
1819
};
1920
notifications?: {
2021
enabled?: boolean;
@@ -46,6 +47,7 @@ declare class SettingsModule extends Module {
4647
minBatchSize: any;
4748
maxBatchSize: any;
4849
autoFlushTimeout: any;
50+
eventsTriggeringFlush: any;
4951
};
5052
notifications: {
5153
enabled: any;

lib/main/modules/SettingsModule.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function mapSettingsOptionsForNativeModule(settingsOptions) {
4141
TRACKER_MIN_BATCH_SIZE: settingsOptions.tracker && settingsOptions.tracker.minBatchSize,
4242
TRACKER_MAX_BATCH_SIZE: settingsOptions.tracker && settingsOptions.tracker.maxBatchSize,
4343
TRACKER_AUTO_FLUSH_TIMEOUT: settingsOptions.tracker && settingsOptions.tracker.autoFlushTimeout,
44+
TRACKER_EVENTS_TRIGGERING_FLUSH: settingsOptions.tracker && settingsOptions.tracker.eventsTriggeringFlush,
4445
NOTIFICATIONS_ENABLED: settingsOptions.notifications && settingsOptions.notifications.enabled,
4546
NOTIFICATIONS_ENCRYPTION: settingsOptions.notifications && settingsOptions.notifications.encryption,
4647
NOTIFICATIONS_DISABLE_IN_APP_ALERTS: settingsOptions.notifications && settingsOptions.notifications.disableInAppAlerts,
@@ -150,6 +151,12 @@ var SettingsModule = /** @class */ (function (_super) {
150151
set autoFlushTimeout(value) {
151152
setOne(RNSettings.TRACKER_AUTO_FLUSH_TIMEOUT, value);
152153
},
154+
get eventsTriggeringFlush() {
155+
return getOne(RNSettings.TRACKER_EVENTS_TRIGGERING_FLUSH);
156+
},
157+
set eventsTriggeringFlush(value) {
158+
setOne(RNSettings.TRACKER_EVENTS_TRIGGERING_FLUSH, value);
159+
},
153160
};
154161
_this.notifications = {
155162
get enabled() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-synerise-sdk",
3-
"version": "0.19.0",
3+
"version": "0.20.0",
44
"description": "React Native wrapper for Synerise SDK",
55
"author": {
66
"name": "Synerise",

react-native-synerise-sdk.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require 'json'
22

33
package = JSON.parse(File.read('./package.json'))
44

5-
SYNERISE_SDK_FRAMEWORK_VERSION = '4.16.1'
5+
SYNERISE_SDK_FRAMEWORK_VERSION = '4.17.0'
66

77
Pod::Spec.new do |s|
88
s.name = package['name']

0 commit comments

Comments
 (0)