Skip to content

Commit

Permalink
Merge pull request #11 from Synerise/v1.2.0
Browse files Browse the repository at this point in the history
Release of version 1.2.0
  • Loading branch information
awoczek authored Jul 15, 2024
2 parents c96e857 + c318110 commit b708c43
Show file tree
Hide file tree
Showing 36 changed files with 827 additions and 172 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.2.0] - 2024-07-15

### Added
- We added a`testDelivery` and `journeyId` parameters to tracked notification events (`push.view`, `push.click`, and so on). It describes if the notification was sent as a test notification from a campaign.
- We added a new `Synerise.content.generateDocumentWithApiQuery(apiQuery, onSuccess, onError)` method. It is analogous to `Synerise.content.generateDocument(slug, onSuccess, onError)`, but can contain more context parameters provided in a query object.
- We added a new `Synerise.content.generateScreenViewWithApiQuery(apiQuery, onSuccess, onError)` method. It is analogous to `Synerise.content.generateScreenView(feedSlug, onSuccess, onError)`, but can contain more context parameters provided in a query object.
- Anchors from Drag & Drop Builder in the In-App editor are interpreted as URL or as deeplink depending on the value.

### Changed
- We added validation of reserved parameters in events. Now, if a parameter is forbidden, it is removed from the parameters and a log is printed.
- Improvements to stability.

### Changed
- Stability improvements.


## [1.1.1] - 2024-06-17

### Changed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Synerise Flutter SDK (synerise-flutter-sdk) (1.1.1)
# Synerise Flutter SDK (synerise-flutter-sdk) (1.2.0)

[![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://github.com/synerise/synerise-ios-sdk)
[![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)
[![Languages](https://img.shields.io/badge/language-Dart%20%7C%20Java%20%7C%20Objective--C-orange.svg)](https://github.com/synerise/synerise-flutter-sdk)
[![Synerise](https://img.shields.io/badge/www-synerise-green.svg)](https://synerise.com)
Expand Down
6 changes: 4 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:8.3.0'
}
}

Expand All @@ -32,6 +32,8 @@ android {
defaultConfig {
minSdkVersion 21
}

namespace 'com.synerise.synerise_flutter_sdk'
}

repositories {
Expand All @@ -41,5 +43,5 @@ repositories {
}

dependencies {
implementation 'com.synerise.sdk:synerise-mobile-sdk:5.17.0'
implementation 'com.synerise.sdk:synerise-mobile-sdk:5.19.0'
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.synerise.synerise_flutter_sdk">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import com.synerise.sdk.content.model.DocumentsApiQueryType;
import com.synerise.sdk.content.model.ScreenViewResponse;
import com.synerise.sdk.content.model.document.Document;
import com.synerise.sdk.content.model.document.DocumentApiQuery;
import com.synerise.sdk.content.model.recommendation.FiltersJoinerRule;
import com.synerise.sdk.content.model.recommendation.RecommendationRequestBody;
import com.synerise.sdk.content.model.recommendation.RecommendationResponse;
import com.synerise.sdk.content.model.screenview.ScreenView;
import com.synerise.sdk.content.model.screenview.ScreenViewApiQuery;
import com.synerise.sdk.content.widgets.dataModel.Recommendation;
import com.synerise.sdk.core.net.IDataApiCall;
import com.synerise.synerise_flutter_sdk.SyneriseModule;
Expand Down Expand Up @@ -54,6 +56,9 @@ public void handleMethodCall(MethodCall call, MethodChannel.Result result, Strin
case "generateDocument":
generateDocument(call, result);
return;
case "generateDocumentWithApiQuery":
generateDocumentWithApiQuery(call, result);
return;
case "getDocuments":
getDocuments(call, result);
return;
Expand All @@ -69,6 +74,9 @@ public void handleMethodCall(MethodCall call, MethodChannel.Result result, Strin
case "generateScreenView":
generateScreenView(call, result);
return;
case "generateScreenViewWithApiQuery":
generateScreenViewWithApiQuery(call, result);
return;
}
}

Expand Down Expand Up @@ -106,6 +114,52 @@ public void generateDocument(MethodCall call, MethodChannel.Result result) {
}, apiError -> SyneriseModule.executeFailureResult(apiError, result));
}

public void generateDocumentWithApiQuery(MethodCall call, MethodChannel.Result result) {
Map documentApiQueryMap = (Map) call.arguments;
String productID = null;
String slugName = null;
if (call.arguments != null) {
productID = (String) documentApiQueryMap.get("productId");
slugName = (String) documentApiQueryMap.get("slug");
}

DocumentApiQuery documentApiQuery = new DocumentApiQuery(slugName);
documentApiQuery.setProductId(productID);
documentApiQuery.setItemsIds(documentApiQueryMap.get("itemsIds") != null ? (ArrayList<String>) documentApiQueryMap.get("itemsIds") : null);
documentApiQuery.setItemsExcluded((ArrayList<String>) documentApiQueryMap.get("itemsExcluded"));
documentApiQuery.setAdditionalFilters((String) documentApiQueryMap.get("additionalFilters"));
if (documentApiQueryMap.get("filtersJoiner") != null) {
documentApiQuery.setFiltersJoiner(getFiltersJoinerRuleFromString((String) documentApiQueryMap.get("filtersJoiner")));
}
if (documentApiQueryMap.get("elasticFiltersJoiner") != null) {
documentApiQuery.setElasticFiltersJoiner(getFiltersJoinerRuleFromString((String) documentApiQueryMap.get("elasticFiltersJoiner")));
}
documentApiQuery.setAdditionalElasticFilters((String) documentApiQueryMap.get("additionalElasticFilters"));
documentApiQuery.setDisplayAttributes((ArrayList<String>) documentApiQueryMap.get("displayAttributes"));
documentApiQuery.setIncludeContextItems((boolean) documentApiQueryMap.get("includeContextItems"));


Map<String, Object> documentMap = new HashMap<>();
if (generateDocumentApiCall != null) generateDocumentApiCall.cancel();
generateDocumentApiCall = Content.generateDocument(documentApiQuery);
generateDocumentApiCall.execute(document -> {
if (document.getContent() instanceof String) {
try {
HashMap<String, Object> contentMap = new Gson().fromJson((String) document.getContent(), HashMap.class);
documentMap.put("content", contentMap);
} catch (Exception e) {
e.printStackTrace();
}
} else {
documentMap.put("content", document.getContent());
}
documentMap.put("identifier", document.getUuid());
documentMap.put("slug", document.getSlug());
documentMap.put("schema", document.getSchema());
SyneriseModule.executeSuccessResult(documentMap, result);
}, apiError -> SyneriseModule.executeFailureResult(apiError, result));
}

public void getDocuments(MethodCall call, MethodChannel.Result result) {
Map documentApiQueryMap = (Map) call.arguments;
DocumentsApiQuery documentsApiQuery = new DocumentsApiQuery();
Expand Down Expand Up @@ -170,7 +224,7 @@ public void getRecommendationsV2(MethodCall call, MethodChannel.Result result) {

RecommendationRequestBody recommendationRequestBody = new RecommendationRequestBody();
recommendationRequestBody.setProductId(productID);
recommendationRequestBody.setItemsIds(recommendationOptions.get("productIDs") != null ? (ArrayList<String>) recommendationOptions.get("productIDs") : null);
recommendationRequestBody.setItemsIds(recommendationOptions.get("itemsIds") != null ? (ArrayList<String>) recommendationOptions.get("itemsIds") : null);
recommendationRequestBody.setItemsExcluded((ArrayList<String>) recommendationOptions.get("itemsExcluded"));
recommendationRequestBody.setAdditionalFilters((String) recommendationOptions.get("additionalFilters"));
if (recommendationOptions.get("filtersJoiner") != null) {
Expand Down Expand Up @@ -257,6 +311,42 @@ public void generateScreenView(MethodCall call, MethodChannel.Result result) {
}, apiError -> SyneriseModule.executeFailureResult(apiError, result));
}

public void generateScreenViewWithApiQuery(MethodCall call, MethodChannel.Result result) {
Map screenViewApiQueryMap = (Map) call.arguments;
String productID = null;
String slugName = null;
if (call.arguments != null) {
productID = (String) screenViewApiQueryMap.get("productId");
slugName = (String) screenViewApiQueryMap.get("feedSlug");
}
ScreenViewApiQuery screenViewApiQuery = new ScreenViewApiQuery(slugName, productID);
Map<String, Object> screenViewMap = new HashMap<>();
if (generateScreenViewApiCall != null) generateScreenViewApiCall.cancel();
generateScreenViewApiCall = Content.generateScreenView(screenViewApiQuery);
generateScreenViewApiCall.execute(screenView -> {
screenViewMap.put("audience", screenViewAudienceToWritableMap(screenView.getAudience()));
screenViewMap.put("identifier", screenView.getId());
screenViewMap.put("hashString", screenView.getHash());
screenViewMap.put("path", screenView.getPath());
screenViewMap.put("name", screenView.getName());
screenViewMap.put("priority", screenView.getPriority());
screenViewMap.put("data", screenViewDataMapper(screenView.getData()));
try {
Date createdAtDate = new SimpleDateFormat(ISO8601_FORMAT, Locale.getDefault()).parse(screenView.getCreatedAt());
Date updatedAtDate = new SimpleDateFormat(ISO8601_FORMAT, Locale.getDefault()).parse(screenView.getUpdatedAt());
if (createdAtDate != null) {
screenViewMap.put("createdAt", createdAtDate.getTime());
}
if (updatedAtDate != null) {
screenViewMap.put("updatedAt", updatedAtDate.getTime());
}
} catch (ParseException e) {
e.printStackTrace();
}
SyneriseModule.executeSuccessResult(screenViewMap, result);
}, apiError -> SyneriseModule.executeFailureResult(apiError, result));
}

private ArrayList<Map<String, Object>> recommendationToArrayList(List<Recommendation> array) {

ArrayList<Map<String, Object>> arrayList = new ArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.flutter.plugin.common.MethodChannel;

public class SyneriseInitializer implements SyneriseModule {
private static String sdkPluginVersion = "1.1.1";
private static String sdkPluginVersion = "1.2.0";
private static SyneriseInitializer instance;
protected static volatile boolean isInitialized = false;
public SyneriseInitializer() {
Expand Down
7 changes: 5 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion
ndkVersion "25.1.8937393"

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -53,7 +53,10 @@ android {
signingConfig signingConfigs.debug
}
}

packagingOptions {
exclude 'META-INF/versions/9/OSGI-INF/MANIFEST.MF'
}
namespace 'com.synerise.synerise_flutter_sdk_example'
}

flutter {
Expand Down
Loading

0 comments on commit b708c43

Please sign in to comment.