use of org.wikipedia.analytics.IntentFunnel in project apps-android-wikipedia by wikimedia.
the class MainFragment method handleIntent.
public void handleIntent(Intent intent) {
IntentFunnel funnel = new IntentFunnel(WikipediaApp.getInstance());
if (intent.hasExtra(Constants.INTENT_APP_SHORTCUT_SEARCH)) {
openSearchFragment(SearchInvokeSource.APP_SHORTCUTS, null);
} else if (intent.hasExtra(Constants.INTENT_APP_SHORTCUT_RANDOM)) {
startActivity(RandomActivity.newIntent(getActivity(), RandomActivity.INVOKE_SOURCE_SHORTCUT));
} else if (Intent.ACTION_SEND.equals(intent.getAction()) && Constants.PLAIN_TEXT_MIME_TYPE.equals(intent.getType())) {
funnel.logShareIntent();
openSearchFragment(SearchInvokeSource.INTENT_SHARE, intent.getStringExtra(Intent.EXTRA_TEXT));
} else if (Intent.ACTION_PROCESS_TEXT.equals(intent.getAction()) && Constants.PLAIN_TEXT_MIME_TYPE.equals(intent.getType()) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
funnel.logProcessTextIntent();
openSearchFragment(SearchInvokeSource.INTENT_PROCESS_TEXT, intent.getStringExtra(Intent.EXTRA_PROCESS_TEXT));
} else if (intent.hasExtra(Constants.INTENT_SEARCH_FROM_WIDGET)) {
funnel.logSearchWidgetTap();
openSearchFragment(SearchInvokeSource.WIDGET, null);
} else if (intent.hasExtra(Constants.INTENT_EXTRA_DELETE_READING_LIST)) {
goToTab(NavTab.READING_LISTS);
} else if (lastPageViewedWithin(1) && !intent.hasExtra(Constants.INTENT_RETURN_TO_MAIN)) {
startActivity(PageActivity.newIntent(getContext()));
}
}
use of org.wikipedia.analytics.IntentFunnel in project apps-android-wikipedia by wikimedia.
the class PageActivity method handleIntent.
private void handleIntent(@NonNull Intent intent) {
if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() != null) {
WikiSite wiki = new WikiSite(intent.getData());
PageTitle title = wiki.titleForUri(intent.getData());
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK);
loadPageInForegroundTab(title, historyEntry);
} else if (ACTION_LOAD_IN_NEW_TAB.equals(intent.getAction()) || ACTION_LOAD_IN_CURRENT_TAB.equals(intent.getAction())) {
PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE);
HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY);
if (ACTION_LOAD_IN_NEW_TAB.equals(intent.getAction())) {
loadPageInForegroundTab(title, historyEntry);
} else if (ACTION_LOAD_IN_CURRENT_TAB.equals(intent.getAction())) {
loadPage(title, historyEntry, TabPosition.CURRENT_TAB);
}
if (intent.hasExtra(Constants.INTENT_EXTRA_REVERT_QNUMBER)) {
showDescriptionEditRevertDialog(intent.getStringExtra(Constants.INTENT_EXTRA_REVERT_QNUMBER));
}
} else if (ACTION_LOAD_FROM_EXISTING_TAB.equals(intent.getAction())) {
PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE);
HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY);
loadPage(title, historyEntry, TabPosition.EXISTING_TAB);
} else if (ACTION_SHOW_TAB_LIST.equals(intent.getAction()) || ACTION_RESUME_READING.equals(intent.getAction()) || intent.hasExtra(Constants.INTENT_APP_SHORTCUT_CONTINUE_READING)) {
// do nothing, since this will be handled indirectly by PageFragment.
} else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
PageTitle title = new PageTitle(query, app.getWikiSite());
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_SEARCH);
loadPageInForegroundTab(title, historyEntry);
} else if (intent.hasExtra(Constants.INTENT_FEATURED_ARTICLE_FROM_WIDGET)) {
new IntentFunnel(app).logFeaturedArticleWidgetTap();
loadMainPageInForegroundTab();
} else {
loadMainPageInCurrentTab();
}
}
Aggregations