Skip to content

Commit

Permalink
Release of version 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Kurzawa committed Jun 15, 2023
1 parent 20692f2 commit 9200ccf
Show file tree
Hide file tree
Showing 43 changed files with 1,244 additions and 91 deletions.
17 changes: 17 additions & 0 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.14.0] - 2023-06-15

### Fixed
- `Synerise.isInitialized` method checks native and javascript module if it is completely initialized.

### Added
- We added a new `Client.signOut(mode:fromAllDevices:onSuccess:onError:)` method. It is analogous to Client.signOut(mode:). It is an asynchronous method and notifies the backend that the client is signed out and determines if all other devices should be signed out too. Remember, signOutWithSessionDestroy mode clears the anonymous session and regenerates the client UUID. The `Client.signOut(mode:)` method is removed now.
- TSDoc code documentation in modules for better syntax promting.

### Changed
- `Client.deleteAccount(password:onSuccess:onError:)` is deprecated now.
- `Client.deleteAccountByOAuth(accessToken:onSuccess:onError)` is deprecated now.
- `Client.deleteAccountByFacebook(facebookToken:onSuccess:onError)` is deprecated now.
- Update of native SDK's dependencies.
- Improvements to stability.


## [0.13.0] - 2023-05-19

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ If you prefer linking manually, check [React Native - Linking Libraries](http://

```javascript
Synerise.Initializer()
.withClientApiKey('YOUR_CLIENT_API_KEY')
.withClientApiKey('YOUR_PROFILE_API_KEY')
.withDebugModeEnabled(true)
.withCrashHandlingEnabled(true)
.init()
Expand Down
4 changes: 2 additions & 2 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': 24,
'versionName': "0.12.0"
'versionCode': 26,
'versionName': "0.14.0"
]

buildscript {
Expand Down
30 changes: 29 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 @@ -17,6 +17,7 @@
import com.synerise.sdk.client.model.listener.OnClientStateChangeListener;
import com.synerise.sdk.core.listeners.ActionListener;
import com.synerise.sdk.core.types.enums.ClientSessionEndReason;
import com.synerise.sdk.core.types.enums.ClientSignOutMode;
import com.synerise.sdk.react.utils.ArrayUtil;
import com.synerise.sdk.react.utils.MapUtil;
import com.synerise.sdk.client.Client;
Expand Down Expand Up @@ -47,7 +48,7 @@
public class RNClient extends RNBaseModule {

private ReactApplicationContext reactApplicationContext;
private IApiCall signInCall, signUpCall, confirmCall, activateCall, updateAccountCall, refreshTokenCall;
private IApiCall signInCall, signUpCall, confirmCall, activateCall, updateAccountCall, refreshTokenCall, signOutCall;
private IApiCall passwordResetCall, deleteAccountByFacebookCall, deleteAccountByOAuthCall;
private IDataApiCall<Token> getTokenCall;
private IDataApiCall<GetAccountInformation> getAccountCall;
Expand Down Expand Up @@ -120,6 +121,33 @@ public boolean signOut() {
return true;
}

// signOutWithMode()
@ReactMethod
public void signOutWithMode(String mode, Boolean fromAllDevices, Callback callback) {
ClientSignOutMode nativeMode = null;
if (mode.equals("SIGN_OUT")) {
nativeMode = ClientSignOutMode.SIGN_OUT;
}

if (mode.equals("SIGN_OUT_WITH_SESSION_DESTROY")) {
nativeMode = ClientSignOutMode.SIGN_OUT_WITH_SESSION_DESTROY;
}

if (signOutCall != null) signOutCall.cancel();
signOutCall = Client.signOut(nativeMode, fromAllDevices);
signOutCall.execute(new ActionListener() {
@Override
public void onAction() {
executeSuccessCallbackResponse(callback, null, null);
}
}, new DataActionListener<ApiError>() {
@Override
public void onDataAction(ApiError apiError) {
executeFailureCallbackResponse(callback, null, apiError);
}
});
}

//destroySession()
@ReactMethod
public void destroySession() {
Expand Down
Binary file not shown.
13 changes: 8 additions & 5 deletions ios/ReactNativeSynerise/Modules/RNClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,17 @@ - (NSDictionary *)constantsToExport
return @YES;
}

//signOutWithMode(mode: ClientSignOutMode)
//signOutWithMode(mode: ClientSignOutMode, fromAllDevices: boolean, onSuccess: () => void, onError: (error: Error) => void)

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(signOutWithMode:(NSString *)string)
RCT_EXPORT_METHOD(signOutWithMode:(NSString *)modeString fromAllDevices:(nonnull NSNumber *)fromAllDevices response:(RCTResponseSenderBlock)response)
{
SNRClientSignOutMode mode = [self enumClientSignOutModeWithString:string];
[SNRClient signOutWithMode:mode];
SNRClientSignOutMode mode = [self enumClientSignOutModeWithString:modeString];

return @YES;
[SNRClient signOutWithMode:mode fromAllDevices:[fromAllDevices boolValue] success:^() {
[self executeSuccessCallbackResponse:response data:@1];
} failure:^(NSError *error) {
[self executeFailureCallbackResponse:response error:error];
}];
}

//destroySession()
Expand Down
2 changes: 1 addition & 1 deletion ios/react-native-synerise-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'json'

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

SYNERISE_SDK_FRAMEWORK_VERSION = '4.12.2'
SYNERISE_SDK_FRAMEWORK_VERSION = '4.13.1'

Pod::Spec.new do |s|
s.name = package['name']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var RecommendationEvent_1 = require("./RecommendationEvent");
var Params;
(function (Params) {
Params["ITEMS"] = "items";
Params["NAME"] = "name";
Params["CATEGORY"] = "category";
Params["URL"] = "url";
Params["CAMPAIGN_ID"] = "campaignId";
Expand Down
3 changes: 2 additions & 1 deletion lib/classes/models/Promotions/Promotion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IPromotionDetails, PromotionDetails } from './PromotionDetails';
import { PromotionDiscountType } from './../Promotions/PromotionDiscountType';
import { PromotionDiscountMode } from './../Promotions/PromotionDiscountMode';
import { IPromotionDiscountModeDetails, PromotionDiscountModeDetails } from './PromotionDiscountModeDetails';
import { IPromotionImage } from './PromotionImage';
import { PromotionItemScope } from './../Promotions/PromotionItemScope';
declare const PromotionSortingKey: {
ExpireAt: string;
Expand Down Expand Up @@ -40,7 +41,7 @@ interface IPromotion {
name?: string;
headline?: string;
descriptionText?: string;
images?: Array<object>;
images?: Array<IPromotionImage>;
assignedAt?: number;
startAt?: number;
expireAt?: number;
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/Promotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var PromotionSortingKey = {
RequireRedeemPoints: 'requireRedeemedPoints',
UpdatedAt: 'updatedAt',
Type: 'type',
Priority: 'priority',
Priority: 'priority'
};
exports.PromotionSortingKey = PromotionSortingKey;
var Promotion = /** @class */ (function (_super) {
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/PromotionDiscountMode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ declare enum PromotionDiscountMode {
Step = "STEP"
}
declare function PromotionDiscountModeFromString(string: string): PromotionDiscountMode;
declare function PromotionDiscountModeToString(promotionItemScope: PromotionDiscountMode): string;
declare function PromotionDiscountModeToString(mode: PromotionDiscountMode): string;
export { PromotionDiscountMode, PromotionDiscountModeToString, PromotionDiscountModeFromString };
4 changes: 2 additions & 2 deletions lib/classes/models/Promotions/PromotionDiscountMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function PromotionDiscountModeFromString(string) {
return PromotionDiscountMode.Static;
}
exports.PromotionDiscountModeFromString = PromotionDiscountModeFromString;
function PromotionDiscountModeToString(promotionItemScope) {
return promotionItemScope;
function PromotionDiscountModeToString(mode) {
return mode;
}
exports.PromotionDiscountModeToString = PromotionDiscountModeToString;
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/PromotionDiscountType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ declare enum PromotionDiscountType {
ExactPrice = "EXACT_PRICE"
}
declare function PromotionDiscountTypeFromString(string: string): PromotionDiscountType;
declare function PromotionDiscountTypeToString(promotionDiscountType: PromotionDiscountType): string;
declare function PromotionDiscountTypeToString(type: PromotionDiscountType): string;
export { PromotionDiscountType, PromotionDiscountTypeFromString, PromotionDiscountTypeToString };
4 changes: 2 additions & 2 deletions lib/classes/models/Promotions/PromotionDiscountType.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function PromotionDiscountTypeFromString(string) {
return PromotionDiscountType.None;
}
exports.PromotionDiscountTypeFromString = PromotionDiscountTypeFromString;
function PromotionDiscountTypeToString(promotionDiscountType) {
return promotionDiscountType;
function PromotionDiscountTypeToString(type) {
return type;
}
exports.PromotionDiscountTypeToString = PromotionDiscountTypeToString;
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ declare enum PromotionDiscountUsageTrigger {
Redeem = "REDEEM"
}
declare function PromotionDiscountUsageTriggerFromString(string: string): PromotionDiscountUsageTrigger;
declare function PromotionDiscountUsageTriggerToString(promotionItemScope: PromotionDiscountUsageTrigger): string;
declare function PromotionDiscountUsageTriggerToString(trigger: PromotionDiscountUsageTrigger): string;
export { PromotionDiscountUsageTrigger, PromotionDiscountUsageTriggerFromString, PromotionDiscountUsageTriggerToString };
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function PromotionDiscountUsageTriggerFromString(string) {
return PromotionDiscountUsageTrigger.Transaction;
}
exports.PromotionDiscountUsageTriggerFromString = PromotionDiscountUsageTriggerFromString;
function PromotionDiscountUsageTriggerToString(promotionItemScope) {
return promotionItemScope;
function PromotionDiscountUsageTriggerToString(trigger) {
return trigger;
}
exports.PromotionDiscountUsageTriggerToString = PromotionDiscountUsageTriggerToString;
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/PromotionImageType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ declare enum PromotionImageType {
Thumbnail = "thumbnail"
}
declare function PromotionImageTypeFromString(string: string): PromotionImageType;
declare function PromotionImageTypeToString(type: PromotionImageType): string;
declare function PromotionImageTypeToString(promotionImageType: PromotionImageType): string;
export { PromotionImageType, PromotionImageTypeFromString, PromotionImageTypeToString };
4 changes: 2 additions & 2 deletions lib/classes/models/Promotions/PromotionImageType.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function PromotionImageTypeFromString(string) {
return PromotionImageType.Image;
}
exports.PromotionImageTypeFromString = PromotionImageTypeFromString;
function PromotionImageTypeToString(type) {
return type;
function PromotionImageTypeToString(promotionImageType) {
return promotionImageType;
}
exports.PromotionImageTypeToString = PromotionImageTypeToString;
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/PromotionStatus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ declare enum PromotionStatus {
Redeemed = "REDEEMED"
}
declare function PromotionStatusFromString(string: string): PromotionStatus;
declare function PromotionStatusToString(promotionStatus: PromotionStatus): string;
declare function PromotionStatusToString(status: PromotionStatus): string;
export { PromotionStatus, PromotionStatusFromString, PromotionStatusToString };
4 changes: 2 additions & 2 deletions lib/classes/models/Promotions/PromotionStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function PromotionStatusFromString(string) {
return PromotionStatus.None;
}
exports.PromotionStatusFromString = PromotionStatusFromString;
function PromotionStatusToString(promotionStatus) {
return promotionStatus;
function PromotionStatusToString(status) {
return status;
}
exports.PromotionStatusToString = PromotionStatusToString;
2 changes: 1 addition & 1 deletion lib/classes/models/Promotions/PromotionType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ declare enum PromotionType {
Handbill = "HANDBILL"
}
declare function PromotionTypeFromString(string: string): PromotionType;
declare function PromotionTypeToString(promotionType: PromotionType): string;
declare function PromotionTypeToString(type: PromotionType): string;
export { PromotionType, PromotionTypeFromString, PromotionTypeToString };
4 changes: 2 additions & 2 deletions lib/classes/models/Promotions/PromotionType.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function PromotionTypeFromString(string) {
return PromotionType.Unknown;
}
exports.PromotionTypeFromString = PromotionTypeFromString;
function PromotionTypeToString(promotionType) {
return promotionType;
function PromotionTypeToString(type) {
return type;
}
exports.PromotionTypeToString = PromotionTypeToString;
5 changes: 3 additions & 2 deletions lib/classes/models/Token/TokenOrigin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ declare enum TokenOrigin {
Unknown = "UNKNOWN",
Synerise = "SYNERISE",
Facebook = "FACEBOOK",
Oauth = "OAUTH"
Oauth = "OAUTH",
Apple = "APPLE"
}
declare function TokenOriginFromString(string: string): TokenOrigin;
declare function TokenOriginToString(tokenOrigin: TokenOrigin): string;
declare function TokenOriginToString(origin: TokenOrigin): string;
export { TokenOrigin, TokenOriginFromString, TokenOriginToString };
8 changes: 6 additions & 2 deletions lib/classes/models/Token/TokenOrigin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var TokenOrigin;
TokenOrigin["Synerise"] = "SYNERISE";
TokenOrigin["Facebook"] = "FACEBOOK";
TokenOrigin["Oauth"] = "OAUTH";
TokenOrigin["Apple"] = "APPLE";
})(TokenOrigin || (TokenOrigin = {}));
exports.TokenOrigin = TokenOrigin;
function TokenOriginFromString(string) {
Expand All @@ -18,10 +19,13 @@ function TokenOriginFromString(string) {
else if (string === TokenOrigin.Oauth) {
return TokenOrigin.Oauth;
}
else if (string === TokenOrigin.Apple) {
return TokenOrigin.Apple;
}
return TokenOrigin.Unknown;
}
exports.TokenOriginFromString = TokenOriginFromString;
function TokenOriginToString(tokenOrigin) {
return tokenOrigin;
function TokenOriginToString(origin) {
return origin;
}
exports.TokenOriginToString = TokenOriginToString;
2 changes: 1 addition & 1 deletion lib/classes/models/Vouchers/VoucherCodeStatus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ declare enum VoucherCodeStatus {
Canceled = "CANCELED"
}
declare function VoucherCodeStatusFromString(string: string): VoucherCodeStatus;
declare function VoucherCodeStatusToString(voucherCodeStatus: VoucherCodeStatus): string;
declare function VoucherCodeStatusToString(status: VoucherCodeStatus): string;
export { VoucherCodeStatus, VoucherCodeStatusFromString, VoucherCodeStatusToString };
4 changes: 2 additions & 2 deletions lib/classes/models/Vouchers/VoucherCodeStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function VoucherCodeStatusFromString(string) {
return VoucherCodeStatus.Unassigned;
}
exports.VoucherCodeStatusFromString = VoucherCodeStatusFromString;
function VoucherCodeStatusToString(voucherCodeStatus) {
return voucherCodeStatus;
function VoucherCodeStatusToString(status) {
return status;
}
exports.VoucherCodeStatusToString = VoucherCodeStatusToString;
19 changes: 10 additions & 9 deletions lib/config/import_models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@ export { ClientIdentityProvider } from './../classes/models/Client/ClientIdentit
export { ClientSessionEndReason, ClientSessionEndReasonFromString, ClientSessionEndReasonToString } from './../classes/models/Client/ClientSessionEndReason';
export { IClientConditionalAuthResult, ClientConditionalAuthResult } from '../classes/models/Client/ClientConditionalAuthResult';
export { ClientConditionalAuthStatus } from '../classes/models/Client/ClientConditionalAuthStatus';
export { PromotionResponse } from './../classes/models/Promotions/PromotionResponse';
export { Promotion, PromotionSortingKey } from './../classes/models/Promotions/Promotion';
export { PromotionIdentifier } from './../classes/models/Promotions/PromotionIdentifier';
export { PromotionIdentifierKey } from '../classes/models/Promotions/PromotionIdentifierKey';
export { PromotionStatus } from './../classes/models/Promotions/PromotionStatus';
export { PromotionType } from './../classes/models/Promotions/PromotionType';
export { PromotionDiscountType } from './../classes/models/Promotions/PromotionDiscountType';
export { PromotionItemScope } from './../classes/models/Promotions/PromotionItemScope';
export { Promotion, PromotionSortingKey } from './../classes/models/Promotions/Promotion';
export { PromotionResponse } from './../classes/models/Promotions/PromotionResponse';
export { PromotionIdentifier } from './../classes/models/Promotions/PromotionIdentifier';
export { PromotionIdentifierKey } from '../classes/models/Promotions/PromotionIdentifierKey';
export { IPromotionDiscountTypeDetails, PromotionDiscountTypeDetails } from '../classes/models/Promotions/PromotionDiscountTypeDetails';
export { PromotionDiscountUsageTrigger } from '../classes/models/Promotions/PromotionDiscountUsageTrigger';
export { IPromotionDetails, PromotionDetails } from './../classes/models/Promotions/PromotionDetails';
export { IPromotionDiscountStep, PromotionDiscountStep } from '../classes/models/Promotions/PromotionDiscountStep';
export { IPromotionDiscountModeDetails, PromotionDiscountModeDetails } from '../classes/models/Promotions/PromotionDiscountModeDetails';
export { IPromotionImage, PromotionImage } from '../classes/models/Promotions/PromotionImage';
export { PromotionImageType, PromotionImageTypeFromString, PromotionImageTypeToString } from '../classes/models/Promotions/PromotionImageType';
export { RecommendationOptions } from './../classes/models/Content/RecommendationOptions';
export { RecommendationResponse } from './../classes/models/Content/RecommendationResponse';
export { Recommendation } from './../classes/models/Content/Recommendation';
export { ScreenViewAudience } from './../classes/models/Content/ScreenViewAudience';
export { ScreenViewResponse } from './../classes/models/Content/ScreenViewResponse';
export { AssignVoucherResponse } from './../classes/models/Vouchers/AssignVoucherResponse';
export { VoucherCodesResponse } from './../classes/models/Vouchers/VoucherCodesResponse';
export { AssignVoucherData } from './../classes/models/Vouchers/AssignVoucherData';
export { VoucherCodesData } from './../classes/models/Vouchers/VoucherCodesData';
export { VoucherCodeStatus } from './../classes/models/Vouchers/VoucherCodeStatus';
export { RecommendationOptions } from './../classes/models/Content/RecommendationOptions';
export { RecommendationResponse } from './../classes/models/Content/RecommendationResponse';
export { Recommendation } from './../classes/models/Content/Recommendation';
export { ScreenViewAudience } from './../classes/models/Content/ScreenViewAudience';
export { ScreenViewResponse } from './../classes/models/Content/ScreenViewResponse';
export { BaseApiQuery, IApiQuerySorting, ApiQuerySortingOrder } from './../classes/api_queries/BaseApiQuery';
export { PromotionsApiQuery } from './../classes/api_queries/PromotionsApiQuery';
export { DocumentsApiQuery } from './../classes/api_queries/DocumentsApiQuery';
Expand Down
Loading

0 comments on commit 9200ccf

Please sign in to comment.