Skip to content

Commit

Permalink
SDK v3.2.3 | Sample v3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelskotnicki committed Aug 1, 2018
1 parent 0b80b33 commit 47507ce
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.2.3] - 2018-08-01
### Added
- Synerise push messages type detection

### Changed
- Tracker and Injector debug modes are now merged with Synerise debug mode
- Firebase version incrementation (17.1.0)
- Google Play Services version incrementation (4.0.0)
- Gradle version incrementation (3.3.0-alpha03)
- Push message type is now validated with it's content type, not message type

### Removed
- FirebaseInstanceIDService implementation as it is deprecated with new Firebase (17.1.0)

### Fixed
- Standardize event source type
- Password validation

## [3.2.2] - 2018-06-26
### Added
- Synerise Promotions
Expand Down
64 changes: 20 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ apply plugin: 'synerise-plugin'
dependencies {
...
// Synerise Android SDK
implementation 'com.synerise.sdk:synerise-mobile-sdk:3.2.2'
implementation 'com.synerise.sdk:synerise-mobile-sdk:3.2.3'
}
```
Finally, please make sure your `Instant Run` is disabled.
Expand Down Expand Up @@ -78,8 +78,6 @@ public class App extends Application {
Synerise.Builder.with(this, syneriseBusinessProfileApiKey, syneriseClientApiKey, appId)
.notificationIcon(R.drawable.notification_icon)
.syneriseDebugMode(DEBUG_MODE)
.trackerDebugMode(DEBUG_MODE)
.injectorDebugMode(DEBUG_MODE)
.clientRefresh(true)
.poolUuid("your-pool-uuid-here")
.trackerTrackMode(FINE)
Expand Down Expand Up @@ -182,17 +180,6 @@ in your AndroidManifest application tag.

## Tracker

### Debug

You can receive some simple logs about events by enabling debug mode, which is disabled by default.
```
Synerise.Builder.with(this, syneriseBusinessProfileApiKey, syneriseClientApiKey, appId)
.trackerDebugMode(true)
...
.build();
```
Note: It is not recommended to use debug mode in release version of your application.

### View tracking

As of now, Tracker also supports auto-tracking mode which can be enabled with:
Expand Down Expand Up @@ -557,16 +544,6 @@ Method returns `IApiCall` object to execute request.

Injector is designed to be simple to develop with, allowing you to integrate Synerise Mobile Content into your apps easily.<br>

### Debug
You can receive some simple logs about Injector by enabling debug mode, which is disabled by default.
```
Synerise.Builder.with(this, syneriseBusinessProfileApiKey, syneriseClientApiKey, appId)
.injectorDebugMode(true)
...
.build();
```
Note: It is not recommended to use debug mode in release version of your application.

### Handling push notifications
In order to display push messages and banners properly, you have to pass incoming push notification payload to `Injector` in your `FirebaseMessagingService` implementation:
```
Expand All @@ -583,24 +560,20 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
Overriding `onMessageReceived(RemoteMessage)` causes simple notification to not being displayed while app is visible to user. <br>
Please check our sample app for example usage of building your non-Synerise notification. <br>
<br>
Also register for push messages in your `FirebaseInstanceIdService` implementation:
Also register for push messages:
```
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = MyFirebaseInstanceIDService.class.getSimpleName();
@Override
public void onTokenRefresh() {
public void onNewToken(String refreshedToken) {
super.onNewToken(refreshedToken);
final String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
if (refreshedToken != null) {
IApiCall call = Profile.registerForPush(refreshedToken);
call.execute(() -> Log.d(TAG, "Register for push succeed: " + refreshedToken),
call.execute(() -> Log.d(TAG, "Register for Push succeed: " + refreshedToken),
apiError -> Log.w(TAG, "Register for push failed: " + refreshedToken));
}
}
}
```
and in your `Application` implementation:
```
Expand All @@ -621,18 +594,18 @@ public class App extends MultiDexApplication implements OnRegisterForPushListene
@Override
public void onRegisterForPushRequired() {
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(instanceIdResult -> {
String refreshedToken = instanceIdResult.getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
final String refreshedToken = FirebaseInstanceId.getInstance().getToken();
if (refreshedToken != null) {
IApiCall call = Profile.registerForPush(refreshedToken);
call.execute(() -> Log.d(TAG, "Register for Push succeed: " + refreshedToken),
apiError -> Log.w(TAG, "Register for push failed: " + refreshedToken));
}
});
}
}
```
Please remember to register services in AndroidManifest as follows:
Please remember to register your service in AndroidManifest as follows:
```
<application
android:name=".App"
Expand All @@ -651,12 +624,6 @@ Please remember to register services in AndroidManifest as follows:
</intent-filter>
</service>
<service android:name=".service.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
```

Expand Down Expand Up @@ -693,6 +660,15 @@ If your launcher activity was already created and notification was clicked - you
}
```

##### Synerise Push type detection
Sometimes you may need to know whether incoming push message comes from Synerise and if so, what information is exactly carrying.<br>
`Injector.isSynerisePush(Map<String, String>)` only checks whether provided push data comes from Synerise.
It is validated by checking if incoming push contains "issuer" key with "Synerise" value.<br>
`Injector.isSyneriseSimplePush(Map<String, String>)` only checks whether provided push data comes from Synerise and is it specifically Synerise Simple Push.
It is validated by checking if incoming push contains "content-type" key with "simple-push" value.<br>
`Injector.isSyneriseBanner(Map<String, String>)` only checks whether provided push data comes from Synerise and is it specifically Synerise Banner.
It is validated by checking if incoming push contains "content-type" key with "template-banner" value.<br>

#### Optional callbacks
It is not always suitable for you to cover your Activities with any banners which may come.<br>
Fortunately, we have put this into deep consideration and as for now, we'd like to present our optional banner callbacks.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'

classpath 'com.synerise.sdk:synerise-gradle-plugin:3.0.2'
Expand All @@ -35,10 +35,10 @@ allprojects {

ext {
supportVersion = '27.1.1'
rxJavaVersion = '2.1.10'
rxJavaVersion = '2.1.16'
rxAndroidVersion = '2.0.2'
okHttpVersion = '3.10.0'
retrofitVersion = '2.3.0'
retrofitVersion = '2.4.0'
// Support
supportAnnotations = "com.android.support:support-annotations:$supportVersion"
appCompatV7 = "com.android.support:appcompat-v7:$supportVersion"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Oct 26 12:31:45 CEST 2017
#Tue Jul 24 11:07:26 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-rc-1-all.zip
12 changes: 6 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdkVersion 19
targetSdkVersion 27
applicationId "com.synerise.sample"
versionCode 11
versionName "3.0.2"
versionCode 12
versionName "3.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down Expand Up @@ -57,9 +57,9 @@ android {
}

ext {
daggerVersion = '2.15'
syneriseVersion = '3.2.2'
playServicesVersion = '17.0.0'
daggerVersion = '2.16'
syneriseVersion = '3.2.3'
playServicesVersion = '17.1.0'
}

dependencies {
Expand Down Expand Up @@ -91,7 +91,7 @@ dependencies {
//implementation project(':synerise-mobile-sdk')
// Firebase
implementation "com.google.firebase:firebase-messaging:$playServicesVersion"
implementation "com.google.firebase:firebase-core:16.0.1" // for crashlytics
implementation "com.google.firebase:firebase-core:16.0.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
// UI
implementation 'com.facebook.fresco:fresco:1.9.0'
Expand Down
10 changes: 2 additions & 8 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:theme">
tools:replace="android:theme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">

<!-- ****************************************************************************************************************************** -->

Expand Down Expand Up @@ -92,13 +93,6 @@
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".service.MyFirebaseInstanceIDService"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

<meta-data
android:name="io.fabric.ApiKey"
Expand Down
12 changes: 5 additions & 7 deletions sample/src/main/java/com/synerise/sdk/sample/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ private void initSynerise() {
Synerise.Builder.with(this, syneriseBusinessProfileApiKey, syneriseClientApiKey, appId)
.notificationIcon(R.drawable.ic_cart)
.syneriseDebugMode(DEBUG_MODE)
.trackerDebugMode(DEBUG_MODE)
.injectorDebugMode(DEBUG_MODE)
.clientRefresh(true)
.poolUuid(null)
.trackerTrackMode(FINE)
Expand All @@ -97,17 +95,17 @@ public AppComponent getComponent() {
@Override
public void onRegisterForPushRequired() {
// your logic here
final String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(instanceIdResult -> {
String refreshedToken = instanceIdResult.getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

if (refreshedToken != null) {
IApiCall call = Profile.registerForPush(refreshedToken);
call.execute(() -> Log.d(TAG, "Register for Push succeed: " + refreshedToken),
apiError -> Log.w(TAG, "Register for push failed: " + refreshedToken));

Intent intent = FirebaseIdChangeBroadcastReceiver.createFirebaseIdChangedIntent();
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}
LocalBroadcastManager.getInstance(App.this).sendBroadcast(intent);
});
}

@Override
Expand Down

This file was deleted.

Loading

0 comments on commit 47507ce

Please sign in to comment.