Skip to content

Commit

Permalink
Merge pull request #16537 from wordpress-mobile/issue/16350-add-qs-no…
Browse files Browse the repository at this point in the history
…tifications-task-wpandroid

Quick Start for Existing Users V2: Add check notifications task
  • Loading branch information
ashiagr authored May 13, 2022
2 parents 9c18e23 + da89b84 commit c51955f
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.wordpress.android.fluxc.store.PostStore;
import org.wordpress.android.fluxc.store.PostStore.OnPostUploaded;
import org.wordpress.android.fluxc.store.QuickStartStore;
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartExistingSiteTask;
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartNewSiteTask;
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask;
import org.wordpress.android.fluxc.store.SiteStore;
Expand Down Expand Up @@ -966,6 +967,12 @@ public void onPageChanged(int position) {
mQuickStartRepository.requestNextStepOfTask(followSiteTask);
}

if (pageType == PageType.NOTIFS) {
// MySite fragment might not be attached to activity, so we need to remove focus point from here
QuickStartUtils.removeQuickStartFocusPoint(findViewById(R.id.root_view_main));
mQuickStartRepository.completeTask(QuickStartExistingSiteTask.CHECK_NOTIFICATIONS);
}

mViewModel.onPageChanged(
mSiteStore.hasSite() && pageType == PageType.MY_SITE,
getSelectedSite()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class WPMainNavigationView @JvmOverloads constructor(
if (i == getPosition(READER)) {
customView.id = R.id.bottom_nav_reader_button // identify view for QuickStart
}
if (i == getPosition(NOTIFS)) {
customView.id = R.id.bottom_nav_notifications_button // identify view for QuickStart
}

itemView.addView(customView)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class QuickStartItemBuilder
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL ->
R.drawable.img_illustration_quick_start_task_explore_plans
QuickStartStore.QUICK_START_CREATE_SITE_LABEL -> R.drawable.img_illustration_quick_start_task_create_site
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL ->
R.drawable.img_illustration_quick_start_task_placeholder
else -> R.drawable.img_illustration_quick_start_task_placeholder
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ enum class QuickStartMySitePrompts constructor(
R.id.quick_action_pages_button,
R.string.quick_start_dialog_edit_homepage_message_short,
R.drawable.ic_pages_white_24dp
),
CHECK_NOTIFICATIONS(
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL,
R.id.root_view_main,
R.id.bottom_nav_notifications_button,
R.string.quick_start_dialog_check_notifications_message_short,
R.drawable.ic_bell_white_24dp
);

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.wordpress.android.ui.quickstart

import androidx.annotation.StringRes
import org.wordpress.android.R.string
import org.wordpress.android.R
import org.wordpress.android.fluxc.store.QuickStartStore
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask

Expand All @@ -15,53 +15,58 @@ enum class QuickStartNoticeDetails(
) {
UPDATE_SITE_TITLE(
QuickStartStore.QUICK_START_UPDATE_SITE_TITLE_LABEL,
string.quick_start_list_update_site_title_title,
string.quick_start_list_update_site_title_subtitle
R.string.quick_start_list_update_site_title_title,
R.string.quick_start_list_update_site_title_subtitle
),
VIEW_SITE_TUTORIAL(
QuickStartStore.QUICK_START_VIEW_SITE_LABEL,
string.quick_start_dialog_view_site_title,
string.quick_start_dialog_view_site_message
R.string.quick_start_dialog_view_site_title,
R.string.quick_start_dialog_view_site_message
),
SHARE_SITE_TUTORIAL(
QuickStartStore.QUICK_START_ENABLE_POST_SHARING_LABEL,
string.quick_start_dialog_share_site_title,
string.quick_start_dialog_share_site_message
R.string.quick_start_dialog_share_site_title,
R.string.quick_start_dialog_share_site_message
),
PUBLISH_POST_TUTORIAL(
QuickStartStore.QUICK_START_PUBLISH_POST_LABEL,
string.quick_start_dialog_publish_post_title,
string.quick_start_dialog_publish_post_message
R.string.quick_start_dialog_publish_post_title,
R.string.quick_start_dialog_publish_post_message
),
FOLLOW_SITES_TUTORIAL(
QuickStartStore.QUICK_START_FOLLOW_SITE_LABEL,
string.quick_start_dialog_follow_sites_title,
string.quick_start_dialog_follow_sites_message
R.string.quick_start_dialog_follow_sites_title,
R.string.quick_start_dialog_follow_sites_message
),
UPLOAD_SITE_ICON(
QuickStartStore.QUICK_START_UPLOAD_SITE_ICON_LABEL,
string.quick_start_dialog_upload_icon_title,
string.quick_start_dialog_upload_icon_message
R.string.quick_start_dialog_upload_icon_title,
R.string.quick_start_dialog_upload_icon_message
),
CHECK_STATS(
QuickStartStore.QUICK_START_CHECK_STATS_LABEL,
string.quick_start_dialog_check_stats_title,
string.quick_start_dialog_check_stats_message
R.string.quick_start_dialog_check_stats_title,
R.string.quick_start_dialog_check_stats_message
),
EXPLORE_PLANS(
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL,
string.quick_start_dialog_explore_plans_title,
string.quick_start_dialog_explore_plans_message
R.string.quick_start_dialog_explore_plans_title,
R.string.quick_start_dialog_explore_plans_message
),
EDIT_HOMEPAGE(
QuickStartStore.QUICK_START_EDIT_HOMEPAGE_LABEL,
string.quick_start_dialog_edit_homepage_title,
string.quick_start_dialog_edit_homepage_message
R.string.quick_start_dialog_edit_homepage_title,
R.string.quick_start_dialog_edit_homepage_message
),
REVIEW_PAGES(
QuickStartStore.QUICK_START_REVIEW_PAGES_LABEL,
string.quick_start_dialog_review_pages_title,
string.quick_start_dialog_review_pages_message
R.string.quick_start_dialog_review_pages_title,
R.string.quick_start_dialog_review_pages_message
),
CHECK_NOTIFICATIONS(
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL,
R.string.quick_start_dialog_check_notifications_title,
R.string.quick_start_dialog_check_notifications_message
);

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package org.wordpress.android.ui.quickstart

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import org.wordpress.android.R.drawable
import org.wordpress.android.R.string
import org.wordpress.android.R
import org.wordpress.android.fluxc.store.QuickStartStore
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask

Expand All @@ -18,69 +17,75 @@ enum class QuickStartTaskDetails(
) {
CREATE_SITE_TUTORIAL(
QuickStartStore.QUICK_START_CREATE_SITE_LABEL,
string.quick_start_list_create_site_title,
string.quick_start_list_create_site_subtitle,
drawable.ic_gridicons_site_white_24dp
R.string.quick_start_list_create_site_title,
R.string.quick_start_list_create_site_subtitle,
R.drawable.ic_gridicons_site_white_24dp
),
UPDATE_SITE_TITLE(
QuickStartStore.QUICK_START_UPDATE_SITE_TITLE_LABEL,
string.quick_start_list_update_site_title_title,
string.quick_start_list_update_site_title_subtitle,
drawable.ic_pencil_white_24dp
R.string.quick_start_list_update_site_title_title,
R.string.quick_start_list_update_site_title_subtitle,
R.drawable.ic_pencil_white_24dp
),
VIEW_SITE_TUTORIAL(
QuickStartStore.QUICK_START_VIEW_SITE_LABEL,
string.quick_start_list_view_site_title,
string.quick_start_list_view_site_subtitle,
drawable.ic_external_white_24dp
R.string.quick_start_list_view_site_title,
R.string.quick_start_list_view_site_subtitle,
R.drawable.ic_external_white_24dp
),
SHARE_SITE_TUTORIAL(
QuickStartStore.QUICK_START_ENABLE_POST_SHARING_LABEL,
string.quick_start_list_enable_sharing_title,
string.quick_start_list_enable_sharing_subtitle,
drawable.ic_share_white_24dp
R.string.quick_start_list_enable_sharing_title,
R.string.quick_start_list_enable_sharing_subtitle,
R.drawable.ic_share_white_24dp
),
PUBLISH_POST_TUTORIAL(
QuickStartStore.QUICK_START_PUBLISH_POST_LABEL,
string.quick_start_list_publish_post_title,
string.quick_start_list_publish_post_subtitle,
drawable.ic_posts_white_24dp
R.string.quick_start_list_publish_post_title,
R.string.quick_start_list_publish_post_subtitle,
R.drawable.ic_posts_white_24dp
),
FOLLOW_SITES_TUTORIAL(
QuickStartStore.QUICK_START_FOLLOW_SITE_LABEL,
string.quick_start_list_follow_site_title,
string.quick_start_list_follow_site_subtitle,
drawable.ic_reader_white_24dp
R.string.quick_start_list_follow_site_title,
R.string.quick_start_list_follow_site_subtitle,
R.drawable.ic_reader_white_24dp
),
UPLOAD_SITE_ICON(
QuickStartStore.QUICK_START_UPLOAD_SITE_ICON_LABEL,
string.quick_start_list_upload_icon_title,
string.quick_start_list_upload_icon_subtitle,
drawable.ic_globe_white_24dp
R.string.quick_start_list_upload_icon_title,
R.string.quick_start_list_upload_icon_subtitle,
R.drawable.ic_globe_white_24dp
),
CHECK_STATS(
QuickStartStore.QUICK_START_CHECK_STATS_LABEL,
string.quick_start_list_check_stats_title,
string.quick_start_list_check_stats_subtitle,
drawable.ic_stats_alt_white_24dp
R.string.quick_start_list_check_stats_title,
R.string.quick_start_list_check_stats_subtitle,
R.drawable.ic_stats_alt_white_24dp
),
EXPLORE_PLANS(
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL,
string.quick_start_list_explore_plans_title,
string.quick_start_list_explore_plans_subtitle,
drawable.ic_plans_white_24dp
R.string.quick_start_list_explore_plans_title,
R.string.quick_start_list_explore_plans_subtitle,
R.drawable.ic_plans_white_24dp
),
EDIT_HOMEPAGE(
QuickStartStore.QUICK_START_EDIT_HOMEPAGE_LABEL,
string.quick_start_list_edit_homepage_title,
string.quick_start_list_edit_homepage_subtitle,
drawable.ic_homepage_16dp
R.string.quick_start_list_edit_homepage_title,
R.string.quick_start_list_edit_homepage_subtitle,
R.drawable.ic_homepage_16dp
),
REVIEW_PAGES(
QuickStartStore.QUICK_START_REVIEW_PAGES_LABEL,
string.quick_start_list_review_pages_title,
string.quick_start_list_review_pages_subtitle,
drawable.ic_pages_white_24dp
R.string.quick_start_list_review_pages_title,
R.string.quick_start_list_review_pages_subtitle,
R.drawable.ic_pages_white_24dp
),
CHECK_NOTIFICATIONS(
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL,
R.string.quick_start_list_check_notification_title,
R.string.quick_start_list_check_notification_subtitle,
R.drawable.ic_bell_white_24dp
);

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ object QuickStartUtils {
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL -> Stat.QUICK_START_LIST_EXPLORE_PLANS_TAPPED
QuickStartStore.QUICK_START_EDIT_HOMEPAGE_LABEL -> Stat.QUICK_START_LIST_EDIT_HOMEPAGE_TAPPED
QuickStartStore.QUICK_START_REVIEW_PAGES_LABEL -> Stat.QUICK_START_LIST_REVIEW_PAGES_TAPPED
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL -> Stat.QUICK_START_LIST_CHECK_NOTIFICATIONS_TAPPED
else -> throw IllegalStateException("The task '$task' is not valid")
}
}
Expand All @@ -221,6 +222,7 @@ object QuickStartUtils {
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL -> Stat.QUICK_START_LIST_EXPLORE_PLANS_SKIPPED
QuickStartStore.QUICK_START_EDIT_HOMEPAGE_LABEL -> Stat.QUICK_START_LIST_EDIT_HOMEPAGE_SKIPPED
QuickStartStore.QUICK_START_REVIEW_PAGES_LABEL -> Stat.QUICK_START_LIST_REVIEW_PAGES_SKIPPED
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL -> Stat.QUICK_START_LIST_CHECK_NOTIFICATIONS_SKIPPED
else -> throw IllegalStateException("The task '$task' is not valid")
}
}
Expand All @@ -238,6 +240,8 @@ object QuickStartUtils {
QuickStartStore.QUICK_START_EXPLORE_PLANS_LABEL -> Stat.QUICK_START_EXPLORE_PLANS_COMPLETED
QuickStartStore.QUICK_START_EDIT_HOMEPAGE_LABEL -> Stat.QUICK_START_EDIT_HOMEPAGE_TASK_COMPLETED
QuickStartStore.QUICK_START_REVIEW_PAGES_LABEL -> Stat.QUICK_START_REVIEW_PAGES_TASK_COMPLETED
QuickStartStore.QUICK_START_CHECK_NOTIFIATIONS_LABEL ->
Stat.QUICK_START_CHECK_NOTIFICATIONS_TASK_COMPLETED
else -> throw IllegalStateException("The task '$task' is not valid")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("MaximumLineLength")
package org.wordpress.android.viewmodel.main

import androidx.lifecycle.LiveData
Expand All @@ -10,6 +11,7 @@ import org.wordpress.android.analytics.AnalyticsTracker.Stat
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.fluxc.store.QuickStartStore
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartExistingSiteTask
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartNewSiteTask.PUBLISH_POST
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask
import org.wordpress.android.fluxc.store.SiteStore
Expand Down Expand Up @@ -360,11 +362,14 @@ class WPMainActivityViewModel @Inject constructor(
}

private fun getExternalFocusPointInfo(task: QuickStartTask?): List<FocusPointInfo> {
// For now, we only do this for the FOLLOW_SITE task.
val followSiteTask = quickStartRepository.quickStartType
.getTaskFromString(QuickStartStore.QUICK_START_FOLLOW_SITE_LABEL)
val followSitesTaskFocusPointInfo = FocusPointInfo(followSiteTask, task == followSiteTask)
return listOf(followSitesTaskFocusPointInfo)
val checkNotifsTaskFocusPointInfo = FocusPointInfo(
QuickStartExistingSiteTask.CHECK_NOTIFICATIONS,
task == QuickStartExistingSiteTask.CHECK_NOTIFICATIONS
)
return listOf(followSitesTaskFocusPointInfo, checkNotifsTaskFocusPointInfo)
}

fun handleSiteRemoved() {
Expand Down
1 change: 1 addition & 0 deletions WordPress/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<item type="id" name="note_block_tag_id" />
<item type="id" name="bottom_nav_reader_button" />
<item type="id" name="bottom_nav_new_post_button" />
<item type="id" name="bottom_nav_notifications_button" />
<item type="id" name="media_grid_remote_thumb_extract_id" />
<item type="id" name="post_menu_item_view_layout_type" />
<item type="id" name="original_view_pager_fragment_id_tag_key" />
Expand Down
5 changes: 5 additions & 0 deletions WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3094,8 +3094,11 @@
<string name="quick_start_dialog_edit_homepage_title">Edit your homepage</string>
<string name="quick_start_dialog_edit_homepage_message">Change, add, or remove content from your site\'s homepage.</string>
<string name="quick_start_dialog_edit_homepage_message_short" tools:ignore="UnusedResources">Select %1$s Pages %2$s to see your page list.</string>
<string name="quick_start_dialog_check_notifications_message_short">Select the %1$s Notifications tab %2$s to get updates on the go.</string>
<string name="quick_start_dialog_edit_homepage_message_pages_short" tools:ignore="UnusedResources">Select %1$s Homepage %2$s to edit your Homepage.</string>
<string name="quick_start_dialog_review_pages_title">Review site pages</string>
<string name="quick_start_dialog_check_notifications_title">Check your notifications</string>
<string name="quick_start_dialog_check_notifications_message">Get real time updates from your pocket.</string>
<string name="quick_start_dialog_review_pages_message">Change, add, or remove your site\'s pages.</string>
<string name="quick_start_dialog_review_pages_message_short" tools:ignore="UnusedResources">Select %1$s Pages %2$s to see your page list.</string>
<string name="quick_start_complete_tasks_header">Complete (%d)</string>
Expand All @@ -3122,6 +3125,8 @@
<string name="quick_start_list_edit_homepage_title" translatable="false">@string/quick_start_dialog_edit_homepage_title</string>
<string name="quick_start_list_review_pages_subtitle">Check your pages and make changes, or add or remove pages.</string>
<string name="quick_start_list_review_pages_title" translatable="false">@string/quick_start_dialog_review_pages_title</string>
<string name="quick_start_list_check_notification_subtitle">Get real time updates from your pocket</string>
<string name="quick_start_list_check_notification_title" translatable="false">@string/quick_start_dialog_check_notifications_title</string>
<string name="quick_start_sites">Next Steps</string>
<string name="quick_start_sites_type_customize">Customize your site</string>
<string name="quick_start_sites_type_grow">Grow your audience</string>
Expand Down
Loading

0 comments on commit c51955f

Please sign in to comment.