Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

242195 Fix app state reset on opening push notification #58

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cordova-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@optimove-inc/cordova-sdk",
"displayName": "Optimove Cordova plugin",
"version": "2.2.1",
"version": "2.2.2",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"scripts": {
"build": "webpack",
Expand Down
2 changes: 1 addition & 1 deletion cordova-sdk/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="optimove-cordova-sdk" version="2.2.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<plugin id="optimove-cordova-sdk" version="2.2.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>OptimoveSDKPlugin</name>
<js-module name="OptimoveCore" src="www/OptimoveCore.js"/>
<js-module name="Optimove" src="www/Optimove.js">
Expand Down
2 changes: 1 addition & 1 deletion cordova-sdk/src/android/OptimoveInitProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class OptimoveInitProvider extends ContentProvider {
private static final String DELAYED_INITIALIZATION_ENABLE_OPTIMOVE = "delayedInitialization.featureSet.enableOptimove";
private static final String DELAYED_INITIALIZATION_ENABLE_OPTIMOBILE = "delayedInitialization.featureSet.enableOptimobile";

private static final String SDK_VERSION = "2.2.1";
private static final String SDK_VERSION = "2.2.2";
private static final int RUNTIME_TYPE = 3;
private static final int SDK_TYPE = 106;

Expand Down
31 changes: 15 additions & 16 deletions cordova-sdk/src/android/PushReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ protected void onPushOpened(Context context, PushMessage pushMessage) {
PushReceiver.handlePushOpen(context, pushMessage, null);
}

@Override
protected Intent getPushOpenActivityIntent(Context context, PushMessage pushMessage) {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());

if (null == launchIntent) {
return null;
}

launchIntent.putExtra(PushMessage.EXTRAS_KEY, pushMessage);
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

return launchIntent;
}


private static void handlePushOpen(Context context, PushMessage pushMessage, String actionId) {
PushReceiver pr = new PushReceiver();
Intent launchIntent = pr.getPushOpenActivityIntent(context, pushMessage);
Expand Down Expand Up @@ -91,22 +106,6 @@ private static void handlePushOpen(Context context, PushMessage pushMessage, Str
addDeepLinkExtras(pushMessage, existingIntent);
}

if (null != pushMessage.getUrl()) {
launchIntent = new Intent(Intent.ACTION_VIEW, pushMessage.getUrl());

addDeepLinkExtras(pushMessage, launchIntent);

TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
taskStackBuilder.addParentStack(component);
taskStackBuilder.addNextIntent(launchIntent);
taskStackBuilder.startActivities();
} else {
launchIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

addDeepLinkExtras(pushMessage, launchIntent);

context.startActivity(launchIntent);
}

if (null == OptimoveSDKPlugin.jsCallbackContext) {
OptimoveSDKPlugin.pendingPush = pushMessage;
Expand Down
2 changes: 1 addition & 1 deletion cordova-sdk/src/ios/OptimoveSDKPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum InAppConsentStrategy: String {
private static var pendingPush: PushNotification? = nil
private static var pendingDdl: DeepLinkResolution? = nil

private static let sdkVersion = "2.2.1"
private static let sdkVersion = "2.2.2"
private static let sdkTypeOptimoveCordova = 106
private static let runtimeTypeCordova = 3

Expand Down