Skip to content

Commit

Permalink
[TIMOB-25048] Fix handling of shortcut intents
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Aug 13, 2018
1 parent cf53e76 commit c2a1ed3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1332,18 +1332,6 @@ protected void onResume()
tiApp.setCurrentActivity(this, this);
TiApplication.updateActivityTransitionState(false);

// handle shortcut intents
Intent intent = getIntent();
String shortcutId =
intent.hasExtra(TiC.EVENT_PROPERTY_SHORTCUT) ? intent.getStringExtra(TiC.EVENT_PROPERTY_SHORTCUT) : null;
if (shortcutId != null) {
KrollModule appModule = TiApplication.getInstance().getModuleByName("App");
if (appModule != null) {
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_ID, shortcutId);
appModule.fireEvent(TiC.EVENT_SHORTCUT_ITEM_CLICK, data);
}
}

if (activityProxy != null) {
activityProxy.fireEvent(TiC.EVENT_RESUME, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ protected void onCreate(Bundle savedInstanceState)
}
}

// handle shortcut intents
String shortcutId = intent.hasExtra(TiC.EVENT_PROPERTY_SHORTCUT)
? intent.getStringExtra(TiC.EVENT_PROPERTY_SHORTCUT)
: null;
if (shortcutId != null) {
KrollModule appModule = TiApplication.getInstance().getModuleByName("App");
if (appModule != null) {
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_ID, shortcutId);
appModule.fireEvent(TiC.EVENT_SHORTCUT_ITEM_CLICK, data);
}
intent.removeExtra(TiC.EVENT_PROPERTY_SHORTCUT);
intent.setAction(Intent.ACTION_MAIN);
}

// TIMOB-15253: implement 'singleTask' like launchMode as android:launchMode cannot be used with Titanium
if (tiApp.intentFilterNewTask() && intent.getAction() != null
&& intent.getAction().equals(Intent.ACTION_VIEW) && intent.getDataString() != null
Expand Down

0 comments on commit c2a1ed3

Please sign in to comment.