Skip to content

Commit

Permalink
Release of version 0.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Kurzawa committed Oct 9, 2024
1 parent 82a5563 commit faa7a18
Show file tree
Hide file tree
Showing 20 changed files with 275 additions and 23 deletions.
31 changes: 24 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

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

## [0.24.0] - 2024-10-07

### Fixed
- [iOS] Some potential issues with possible database corruption.
- [Android] Notification callback issue when app was in foreground.

### Added
- `Synerise.Settings.inAppMessaging.contentBaseUrl` option in settings to let you set the base URL to use for all relative URLs in an in-app message's creation.
- `Synerise.Client.updateAccountBasicInformation(context, onSuccess, onError)` method. The new method updates anonymous users.
- `ClientAccountUpdateBasicInformationContext` model correlated with the new `Synerise.Client.updateAccountBasicInformation(context, onSuccess, onError)` method.

### Changed
- [Android] Fresco library is now updated to 3.2.0.
- Optimization of the In-app messaging module (variants are no longer assigned once more when the profile's UUID changes).
- Improvements to stability.


## [0.23.1] - 2024-09-16

### Fixed
Expand Down Expand Up @@ -43,7 +60,7 @@ The SDK version 0.21.0 has been omitted for technical reasons.
- [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.

### Added
- `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.
- `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.

### Changed
- All events connected with push campaigns will flush the queue and send events immediately.
Expand All @@ -62,7 +79,7 @@ The SDK version 0.21.0 has been omitted for technical reasons.

### Added
- Global Control Group support for in-app messages. From now on, you can use this feature in in-app messaging communication. This lets you take your marketing efforts to the next level and provides a solid foundation for accurate measurement of campaign effectiveness. Read more at https://hub.synerise.com/docs/settings/configuration/global-control-group/.
- [iOS] `Synerise.settings.sdk.localizable` option in settings to let you localize some strings displayed by the SDK.
- [iOS] `Synerise.Settings.sdk.localizable` option in settings to let you localize some strings displayed by the SDK.

### Changed
- Improved mechanism for checking capping in in-app messages. The number of views no longer resets when the account's UUID changes.
Expand Down Expand Up @@ -278,14 +295,14 @@ https://hub.synerise.com//developers/mobile-sdk/campaigns/action-handling/
### Added

- Information about device root is moved to AppStarted event.
- New option to set whether events should be sent when server time synchronization has failed - `Synerise.settings.tracker.isBackendTimeSyncRequired`.
- New option to set whether events should be sent when server time synchronization has failed - `Synerise.Settings.tracker.isBackendTimeSyncRequired`.
- `Client.deleteAccountByIdentityProvider` method.

## [0.9.14] - 2020-10-15

### Added

- Support for encrypted notifications (enabled by `Synerise.settings.notifications.encryption`). [1]
- Support for encrypted notifications (enabled by `Synerise.Settings.notifications.encryption`). [1]

[1] Please read full documentation:
iOS: https://help.synerise.com/developers/ios-sdk/configure-notifications/#configuring-notification-encryption
Expand All @@ -308,7 +325,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification
- `Synerise.Injector.authenticateByOAuthIfRegistered` method.
- `Synerise.Injector.deleteAccountByOAuth` method.
- `Synerise.Injector.deleteAccountByAppleSignIn` method.
- `Synerise.settings.sdk.sdk.shouldDestroySessionOnApiKeyChange` option in settings.
- `Synerise.Settings.sdk.shouldDestroySessionOnApiKeyChange` option in settings.

## [0.9.11] - 2020-05-18

Expand Down Expand Up @@ -336,7 +353,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification

### Fixed

- `Synerise.settings` module issues.
- `Synerise.Settings` module issues.

## [0.9.7] - 2020-03-02

Expand All @@ -345,7 +362,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification
- OAuth/Facebook authentication.
- Walkthrough campaign.
- Walkthrough listener in `Synerise.Injector` module.
- `Synerise.settings.injector.automatic` option in settings.
- `Synerise.Settings.injector.automatic` option in settings.
- Vouchers methods in `Synerise.Promotions` module.
- `Synerise.changeClientApiKey` method.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synerise React Native SDK (react-native-synerise-sdk) (0.23.1)
# Synerise React Native SDK (react-native-synerise-sdk) (0.24.0)

[![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://github.com/synerise/ios-sdk)
[![Platform](https://img.shields.io/badge/platform-Android-orange.svg)](https://github.com/synerise/android-sdk)
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ext.versions = [
'minSdk' : 21,
'compileSdk' : 33,
'targetSdk' : 33,
'versionCode': 38,
'versionName': "0.23.1"
'versionCode': 40,
'versionName': "0.24.0"
]

buildscript {
Expand Down Expand Up @@ -58,7 +58,7 @@ repositories {
dependencies {
implementation 'com.facebook.react:react-native:+'
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
api 'com.synerise.sdk:synerise-mobile-sdk:5.20.1'
api 'com.synerise.sdk:synerise-mobile-sdk:5.22.0'
}

//apply from: 'publish.gradle'
42 changes: 41 additions & 1 deletion android/src/main/java/com/synerise/sdk/react/RNClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.synerise.sdk.client.Client;
import com.synerise.sdk.client.model.GetAccountInformation;
import com.synerise.sdk.client.model.UpdateAccountInformation;
import com.synerise.sdk.client.model.UpdateAccountBasicInformation;
import com.synerise.sdk.client.model.client.Agreements;
import com.synerise.sdk.client.model.client.Attributes;
import com.synerise.sdk.client.model.client.RegisterClient;
Expand Down Expand Up @@ -556,7 +557,6 @@ public void onDataAction(GetAccountInformation getAccountInformation) {
accountMap.putBoolean("anonymous", getAccountInformation.getAnonymous());
accountMap.putMap("agreements", agreements);
accountMap.putMap("attributes", MapUtil.stringMapToWritableMap(getAccountInformation.getAttributes()));
accountMap.putArray("tags", ArrayUtil.toWritableArray(getAccountInformation.getTags()));
if (getAccountInformation.getLastActivityDate() != null) {
accountMap.putDouble("lastActivityDate", getAccountInformation.getLastActivityDate().getTime());
}
Expand All @@ -571,6 +571,46 @@ public void onDataAction(ApiError apiError) {
});
}

//updateAccountBasicInformation(context: ClientAccountUpdateBasicInformationContext, onSuccess: () => void, onError: (error: Error) => void)
@ReactMethod
public void updateAccountBasicInformation(ReadableMap map, Callback callback) {
UpdateAccountBasicInformation updateAccountBasicInformation = new UpdateAccountBasicInformation();
updateAccountBasicInformation.setFirstName(map.hasKey("firstName") ? map.getString("firstName") : null);
updateAccountBasicInformation.setLastName(map.hasKey("lastName") ? map.getString("lastName") : null);
updateAccountBasicInformation.setDisplayName(map.hasKey("displayName") ? map.getString("displayName") : null);
if (map.hasKey("sex")) {
updateAccountBasicInformation.setSex(Sex.getSex(map.getString("sex")));
}
updateAccountBasicInformation.setPhoneNumber(map.hasKey("phone") ? map.getString("phone") : null);
updateAccountBasicInformation.setBirthDate(map.hasKey("birthDate") ? map.getString("birthDate") : null);
updateAccountBasicInformation.setAvatarUrl(map.hasKey("avatarUrl") ? map.getString("avatarUrl") : null);
updateAccountBasicInformation.setCompany(map.hasKey("company") ? map.getString("company") : null);
updateAccountBasicInformation.setAddress(map.hasKey("address") ? map.getString("address") : null);
updateAccountBasicInformation.setCity(map.hasKey("city") ? map.getString("city") : null);
updateAccountBasicInformation.setProvince(map.hasKey("province") ? map.getString("province") : null);
updateAccountBasicInformation.setZipCode(map.hasKey("zipCode") ? map.getString("zipCode") : null);
updateAccountBasicInformation.setCountryCode(map.hasKey("countryCode") ? map.getString("countryCode") : null);

if (map.hasKey("attributes")) {
Attributes attributes = attributesMapper(map.getMap("attributes").toHashMap());
updateAccountBasicInformation.setAttributes(attributes);
}

if (map.hasKey("agreements")) {
Agreements agreements = agreementsMapper(map.getMap("agreements"));
updateAccountBasicInformation.setAgreements(agreements);
}

if (updateAccountCall != null) updateAccountCall.cancel();
updateAccountCall = Client.updateAccountBasicInformation(updateAccountBasicInformation);
updateAccountCall.execute(() -> executeSuccessCallbackResponse(callback, null, null), new DataActionListener<ApiError>() {
@Override
public void onDataAction(ApiError apiError) {
executeFailureCallbackResponse(callback, null, apiError);
}
});
}

//updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void)
@ReactMethod
public void updateAccount(ReadableMap map, Callback callback) {
Expand Down
17 changes: 16 additions & 1 deletion android/src/main/java/com/synerise/sdk/react/RNSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class RNSettings extends RNBaseModule {
public static final String RN_SETTINGS_INJECTOR_AUTOMATIC = "INJECTOR_AUTOMATIC";
public static final String RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH = "IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH";
public static final String RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT = "IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT";
public static final String RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL = "IN_APP_MESSAGING_CONTENT_BASE_URL";
public static final String RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT = "IN_APP_MESSAGING_RENDERING_TIMEOUT";
public static final String RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT = "IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT";

Expand Down Expand Up @@ -69,6 +70,7 @@ public Map<String, Object> getConstants() {
constants.put(RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE, RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE);
constants.put(RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH, RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH);
constants.put(RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT, RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT);
constants.put(RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL, RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL);
constants.put(RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT, RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT);
constants.put(RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT, RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT);
return constants;
Expand All @@ -85,6 +87,9 @@ public WritableMap getOne(String key) {
if (settings.get(key) instanceof Integer) {
setting.putInt(key, (int) settings.get(key));
}
if (settings.get(key) instanceof String) {
setting.putString(key, (String) settings.get(key));
}
if (settings.get(key) instanceof List) {
List<String> eventsTriggeringFlush = (List<String>) settings.get(key);
WritableArray writableArray = Arguments.createArray();
Expand All @@ -110,6 +115,9 @@ public void setOne(ReadableMap settingMap) {
case Number:
matchSetting(key, settingMap.getInt("value"));
break;
case String:
matchSetting(key, settingMap.getString("value"));
break;
case Array:
matchSetting(key, settingMap.getArray("value"));
break;
Expand All @@ -131,6 +139,9 @@ public void setMany(ReadableMap newSettings) {
case Number:
matchSetting(key, newSettings.getInt(key));
break;
case String:
matchSetting(key, newSettings.getString(key));
break;
case Array:
matchSetting(key, newSettings.getArray(key));
break;
Expand Down Expand Up @@ -206,7 +217,10 @@ private void matchSetting(String key, Object value) {
if (value instanceof Integer) {
Settings.getInstance().inAppMessaging.setMaxDefinitionUpdateIntervalLimit((int) value);
}

case RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL:
if (value instanceof String) {
Settings.getInstance().inAppMessaging.setContentBaseUrl((String) value);
}
case RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT:
if (value instanceof Integer) {
Settings.getInstance().inAppMessaging.renderingTimeout = ((int) value) * 1000;
Expand All @@ -233,6 +247,7 @@ private Map<String, Object> settingsDictionary() {
settings.put(RN_SETTINGS_NOTIFICATIONS_ENCRYPTION, Synerise.settings.notifications.getEncryption());
settings.put(RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE, Synerise.settings.sdk.shouldDestroySessionOnApiKeyChange);
settings.put(RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH, Synerise.settings.inAppMessaging.checkGlobalControlGroupsOnDefinitionsFetch);
settings.put(RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL, Synerise.settings.inAppMessaging.getContentBaseUrl());
settings.put(RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT, Synerise.settings.inAppMessaging.renderingTimeout / 1000);
settings.put(RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT, Synerise.settings.inAppMessaging.getMaxDefinitionUpdateIntervalLimit());
settings.put(RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT, Synerise.settings.inAppMessaging.shouldSendInAppCappingEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RNSyneriseInitializer {
public Boolean isCrashHandlingEnabled;
public static volatile boolean isInitialized = false;

public static final String SDK_PLUGIN_VERSION = "0.23.1";
public static final String SDK_PLUGIN_VERSION = "0.24.0";

public void initialize(Application app) {
if (isInitialized == false) {
Expand Down
2 changes: 1 addition & 1 deletion ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "RNSyneriseInitializer.h"

NSString * const SNRSyneriseSDKPluginVersion = @"0.23.1";
NSString * const SNRSyneriseSDKPluginVersion = @"0.24.0";

@implementation RNSyneriseInitializer

Expand Down
50 changes: 47 additions & 3 deletions ios/ReactNativeSynerise/Modules/RNClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,34 @@ - (nullable SNRClientSimpleAuthenticationData *)modelClientSimpleAuthenticationD
return nil;
}

- (nullable SNRClientUpdateAccountBasicInformationContext *)modelClientUpdateAccountBasicInformationContextWithDictionary:(nullable NSDictionary *)dictionary {
if (dictionary != nil) {
SNRClientUpdateAccountBasicInformationContext *model = [SNRClientUpdateAccountContext new];
model.firstName = [dictionary getStringForKey:@"firstName"];
model.lastName = [dictionary getStringForKey:@"lastName"];
model.displayName = [dictionary getStringForKey:@"displayName"];
model.sex = SNR_StringToClientSex([dictionary getStringForKey:@"sex"]);
model.phone = [dictionary getStringForKey:@"phone"];
model.birthDate = [dictionary getStringForKey:@"birthDate"];
model.avatarUrl = [dictionary getStringForKey:@"avatarUrl"];

model.company = [dictionary getStringForKey:@"company"];
model.address = [dictionary getStringForKey:@"address"];
model.city = [dictionary getStringForKey:@"city"];
model.province = [dictionary getStringForKey:@"province"];
model.zipCode = [dictionary getStringForKey:@"zipCode"];
model.countryCode = [dictionary getStringForKey:@"countryCode"];

model.agreements = [self modelClientAgreementsWithDictionary:[dictionary getDictionaryForKey:@"agreements"]];

model.attributes = [dictionary getDictionaryForKey:@"attributes"];

return model;
}

return nil;
}

- (nullable SNRClientUpdateAccountContext *)modelClientUpdateAccountContextWithDictionary:(nullable NSDictionary *)dictionary {
if (dictionary != nil) {
SNRClientUpdateAccountContext *model = [SNRClientUpdateAccountContext new];
Expand Down Expand Up @@ -723,13 +751,29 @@ - (NSDictionary *)constantsToExport
}];
}

//updateAccountBasicInformation(context: ClientAccountUpdateBasicInformationContext, onSuccess: () => void, onError: (error: Error) => void)

RCT_EXPORT_METHOD(updateAccountBasicInformation:(NSDictionary *)dictionary response:(RCTResponseSenderBlock)response)
{
SNRClientUpdateAccountBasicInformationContext *context = [self modelClientUpdateAccountBasicInformationContextWithDictionary:dictionary];
if (context != nil) {
[SNRClient updateAccountBasicInformation:context success:^(BOOL isSuccess) {
[self executeSuccessCallbackResponse:response data:@1];
} failure:^(NSError *error) {
[self executeFailureCallbackResponse:response error:error];
}];
} else {
[self executeDefaultFailureCallbackResponse:response];
}
}

//updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void)

RCT_EXPORT_METHOD(updateAccount:(NSDictionary *)dictionary response:(RCTResponseSenderBlock)response)
{
SNRClientUpdateAccountContext *clientUpdateAccountContext = [self modelClientUpdateAccountContextWithDictionary:dictionary];
if (clientUpdateAccountContext != nil) {
[SNRClient updateAccount:clientUpdateAccountContext success:^(BOOL isSuccess) {
SNRClientUpdateAccountContext *context = [self modelClientUpdateAccountContextWithDictionary:dictionary];
if (context != nil) {
[SNRClient updateAccount:context success:^(BOOL isSuccess) {
[self executeSuccessCallbackResponse:response data:@1];
} failure:^(NSError *error) {
[self executeFailureCallbackResponse:response error:error];
Expand Down
Loading

0 comments on commit faa7a18

Please sign in to comment.