Skip to content

Commit

Permalink
Merge branch 'trunk' into bump_kotlin_to_1_9_22
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Feb 21, 2024
2 parents d8cfd88 + 72e7db7 commit 372f90b
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 48 deletions.
6 changes: 5 additions & 1 deletion WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,16 @@ tasks.register("dependencyTreeDiffCommentToGitHub", ViolationCommentsToGitHubTas
commentOnlyChangedFiles = false
minSeverity = SEVERITY.INFO
commentTemplate = """
### The PR caused the following dependency changes:
<details><summary>The PR caused some dependency changes (expand to see details)</summary>
<p>
```diff
{{{violation.message}}}
```
</p>
</details>
*Please review and act accordingly*
"""
violations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@
import org.wordpress.android.ui.stats.StatsTimeframe;
import org.wordpress.android.ui.stats.StatsViewType;
import org.wordpress.android.ui.stats.refresh.StatsActivity;
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom;
import org.wordpress.android.ui.stats.refresh.StatsViewAllActivity;
import org.wordpress.android.ui.stats.refresh.lists.StatsListViewModel.StatsSection;
import org.wordpress.android.ui.stats.refresh.lists.detail.StatsDetailActivity;
import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider.SelectedDate;
import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementActivity;
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom;
import org.wordpress.android.ui.stockmedia.StockMediaPickerActivity;
import org.wordpress.android.ui.stories.StoryComposerActivity;
import org.wordpress.android.ui.suggestion.SuggestionActivity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.wordpress.android.fluxc.store.SiteStore;
import org.wordpress.android.login.LoginMode;
import org.wordpress.android.ui.accounts.LoginActivity;
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom;
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.SiteUtils;
import org.wordpress.android.util.ToastUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.wordpress.android.analytics.AnalyticsTracker;
import org.wordpress.android.fluxc.model.SiteModel;
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalPhaseHelper;
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom;
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom;
import org.wordpress.android.util.AppLog;

import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.wordpress.android.ui.deeplinks.DeepLinkNavigator.NavigateAction.ViewP
import org.wordpress.android.ui.sitecreation.misc.SiteCreationSource.DEEP_LINK
import org.wordpress.android.ui.sitemonitor.SiteMonitorType
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.util.UriWrapper
import javax.inject.Inject

Expand Down Expand Up @@ -66,14 +66,14 @@ class DeepLinkNavigator
is OpenStatsForSite -> ActivityLauncher.viewStatsInNewStack(
activity,
navigateAction.site,
StatsActivity.StatsLaunchedFrom.LINK
StatsLaunchedFrom.LINK
)

is OpenStatsForSiteAndTimeframe -> ActivityLauncher.viewStatsInNewStack(
activity,
navigateAction.site,
navigateAction.statsTimeframe,
StatsActivity.StatsLaunchedFrom.LINK
StatsLaunchedFrom.LINK
)

OpenReader -> ActivityLauncher.viewReaderInNewStack(activity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
import org.wordpress.android.ui.review.ReviewViewModel;
import org.wordpress.android.ui.sitecreation.misc.SiteCreationSource;
import org.wordpress.android.ui.stats.StatsTimeframe;
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom;
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom;
import org.wordpress.android.ui.stories.intro.StoriesIntroDialogFragment;
import org.wordpress.android.ui.uploads.UploadActionUseCase;
import org.wordpress.android.ui.uploads.UploadUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import org.wordpress.android.ui.quickstart.QuickStartTracker
import org.wordpress.android.ui.reader.ReaderActivityLauncher
import org.wordpress.android.ui.reader.tracker.ReaderTracker
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.uploads.UploadService
import org.wordpress.android.ui.uploads.UploadUtilsWrapper
import org.wordpress.android.ui.utils.TitleSubtitleSnackbarSpannable
Expand Down Expand Up @@ -611,7 +611,7 @@ class MySiteFragment : Fragment(R.layout.my_site_fragment),
is SiteNavigationAction.OpenStats -> ActivityLauncher.viewBlogStats(
activity,
action.site,
StatsActivity.StatsLaunchedFrom.QUICK_ACTIONS
StatsLaunchedFrom.QUICK_ACTIONS
)

is SiteNavigationAction.ConnectJetpackForStats ->
Expand Down Expand Up @@ -678,7 +678,7 @@ class MySiteFragment : Fragment(R.layout.my_site_fragment),
requireActivity(),
action.site,
StatsTimeframe.INSIGHTS,
StatsActivity.StatsLaunchedFrom.TODAY_STATS_CARD
StatsLaunchedFrom.TODAY_STATS_CARD
)

is SiteNavigationAction.OpenExternalUrl ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import org.wordpress.android.ui.mysite.items.listitem.ListItemAction
import org.wordpress.android.ui.pages.SnackbarMessageHolder
import org.wordpress.android.ui.prefs.SiteSettingsFragment
import org.wordpress.android.ui.quickstart.QuickStartMySitePrompts
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.utils.ListItemInteraction
import org.wordpress.android.ui.utils.UiString
import org.wordpress.android.util.LocaleManager
Expand Down Expand Up @@ -147,7 +147,7 @@ class MenuActivity : AppCompatActivity() {
is SiteNavigationAction.OpenStats -> ActivityLauncher.viewBlogStats(
this,
action.site,
StatsActivity.StatsLaunchedFrom.ROW
StatsLaunchedFrom.ROW
)

is SiteNavigationAction.OpenDomains -> ActivityLauncher.viewDomainsDashboardActivity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import org.wordpress.android.ui.reader.comments.ThreadedCommentsActionSource;
import org.wordpress.android.ui.reader.tracker.ReaderTracker;
import org.wordpress.android.ui.stats.StatsViewType;
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom;
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.StringUtils;
import org.wordpress.android.util.ToastUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.wordpress.android.ui.reader.comments.ThreadedCommentsActionSource.ACT
import org.wordpress.android.ui.reader.tracker.ReaderTracker
import org.wordpress.android.ui.reader.utils.ReaderUtils
import org.wordpress.android.ui.stats.StatsViewType.FOLLOWERS
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T.API
import org.wordpress.android.util.ToastUtils
Expand Down Expand Up @@ -118,7 +118,7 @@ class FormattableContentClickHandler @Inject constructor(
if (rangeType == FormattableRangeType.FOLLOW) {
ActivityLauncher.viewAllTabbedInsightsStats(activity, FOLLOWERS, 0, site.id)
} else {
ActivityLauncher.viewBlogStats(activity, site, StatsActivity.StatsLaunchedFrom.ACTIVITY_LOG)
ActivityLauncher.viewBlogStats(activity, site, StatsLaunchedFrom.ACTIVITY_LOG)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.wordpress.android.ui.ActivityLauncher
import org.wordpress.android.ui.LocaleAwareActivity
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalPhaseHelper
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.util.JetpackBrandingUtils
import javax.inject.Inject
Expand Down Expand Up @@ -90,16 +91,4 @@ class StatsActivity : LocaleAwareActivity() {
notificationType?.let { putExtra(ARG_NOTIFICATION_TYPE, it) }
}
}

enum class StatsLaunchedFrom(val value: String) {
QUICK_ACTIONS("quick_actions"),
TODAY_STATS_CARD("today_stats_card"),
ROW("row"),
WIDGET("widget"),
NOTIFICATION("notification"),
LINK("link"),
SHORTCUT("shortcut"),
ACTIVITY_LOG("activity_log"),
JETPACK_CONNECTION("jetpack_connection")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import org.wordpress.android.ui.stats.StatsTimeframe.DAY
import org.wordpress.android.ui.stats.StatsTimeframe.MONTH
import org.wordpress.android.ui.stats.StatsTimeframe.WEEK
import org.wordpress.android.ui.stats.StatsTimeframe.YEAR
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.StatsModuleActivateRequestState.Failure.NetworkUnavailable
import org.wordpress.android.ui.stats.refresh.StatsModuleActivateRequestState.Failure.RemoteRequestFailure
import org.wordpress.android.ui.stats.refresh.StatsModuleActivateRequestState.Success
Expand All @@ -47,6 +46,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDa
import org.wordpress.android.ui.stats.refresh.utils.NewsCardHandler
import org.wordpress.android.ui.stats.refresh.utils.SelectedSectionManager
import org.wordpress.android.ui.stats.refresh.utils.SelectedTrafficGranularityManager
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.ui.stats.refresh.utils.toStatsGranularity
import org.wordpress.android.ui.stats.refresh.utils.trackStatsAccessed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.fragment.app.commit
import dagger.hilt.android.AndroidEntryPoint
import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.analytics.AnalyticsTracker.Stat
import org.wordpress.android.databinding.StatsDetailActivityBinding
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.fluxc.network.utils.StatsGranularity
Expand All @@ -19,7 +18,6 @@ import org.wordpress.android.ui.stats.refresh.StatsViewAllFragment
import org.wordpress.android.ui.stats.refresh.lists.StatsListFragment
import org.wordpress.android.ui.stats.refresh.lists.StatsListViewModel.StatsSection
import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider.SelectedDate
import org.wordpress.android.util.analytics.AnalyticsUtils
import org.wordpress.android.util.extensions.getSerializableCompat
import java.io.Serializable
import android.R as AndroidR
Expand Down Expand Up @@ -79,10 +77,6 @@ class StatsDetailActivity : LocaleAwareActivity() {
if (postUrl != null) {
statsPostViewIntent.putExtra(POST_URL, postUrl)
}
AnalyticsUtils.trackWithSiteId(
Stat.STATS_SINGLE_POST_ACCESSED,
site.siteId
)
context.startActivity(statsPostViewIntent)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import org.wordpress.android.ui.jetpackoverlay.JetpackOverlayConnectedFeature
import org.wordpress.android.ui.pages.SnackbarMessageHolder
import org.wordpress.android.ui.stats.refresh.BLOCK_DETAIL_USE_CASE
import org.wordpress.android.ui.stats.refresh.lists.BaseListUseCase
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.utils.StatsPostProvider
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.ui.stats.refresh.utils.trackStatsAccessed
import org.wordpress.android.ui.utils.UiString.UiStringRes
import org.wordpress.android.util.NetworkUtilsWrapper
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.util.mergeNotNull
import org.wordpress.android.viewmodel.Event
import org.wordpress.android.viewmodel.ScopedViewModel
Expand All @@ -28,6 +31,7 @@ class StatsDetailViewModel
private val statsSiteProvider: StatsSiteProvider,
private val statsPostProvider: StatsPostProvider,
private val networkUtilsWrapper: NetworkUtilsWrapper,
private val analyticsTrackerWrapper: AnalyticsTrackerWrapper,
private val jetpackFeatureRemovalOverlayUtil: JetpackFeatureRemovalOverlayUtil
) : ScopedViewModel(mainDispatcher) {
private val _isRefreshing = MutableLiveData<Boolean>()
Expand All @@ -49,6 +53,11 @@ class StatsDetailViewModel
postTitle: String,
postUrl: String?
) {
analyticsTrackerWrapper.trackStatsAccessed(
statsSiteProvider.siteModel,
StatsLaunchedFrom.POSTS.value
)

statsPostProvider.init(postId, postType, postTitle, postUrl)

if (jetpackFeatureRemovalOverlayUtil.shouldShowFeatureSpecificJetpackOverlay(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import org.wordpress.android.WordPress
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.StatsTimeframe.INSIGHTS
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color
import org.wordpress.android.ui.stats.refresh.lists.widget.utils.getColorMode
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom

class WidgetBlockListProvider(val context: Context, val viewModel: WidgetBlockListViewModel, intent: Intent) :
RemoteViewsFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.SITE_ID_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color
import org.wordpress.android.ui.stats.refresh.lists.widget.utils.getColorMode
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import javax.inject.Inject

class AllTimeWidgetListProvider(val context: Context, intent: Intent) : RemoteViewsFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.SITE_ID_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color
import org.wordpress.android.ui.stats.refresh.lists.widget.utils.getColorMode
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import javax.inject.Inject

class TodayWidgetListProvider(val context: Context, intent: Intent) : RemoteViewsFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import org.wordpress.android.fluxc.model.stats.time.VisitsAndViewsModel.PeriodDa
import org.wordpress.android.modules.UI_THREAD
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.IS_WIDE_VIEW_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.SITE_ID_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.WidgetService
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color.DARK
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color.LIGHT
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsWidgetConfigureFragment.WidgetType
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.util.image.ImageManager
import org.wordpress.android.util.image.ImageType.ICON
import org.wordpress.android.viewmodel.ResourceProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import org.wordpress.android.WordPress
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.Companion.INITIAL_SELECTED_PERIOD_KEY
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.IS_WIDE_VIEW_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.SITE_ID_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.utils.getColorMode
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import javax.inject.Inject

class ViewsWidgetListProvider(val context: Context, intent: Intent) : RemoteViewsFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.ui.stats.StatsTimeframe
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.StatsActivity.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.lists.widget.SITE_ID_KEY
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsColorSelectionViewModel.Color
import org.wordpress.android.ui.stats.refresh.lists.widget.utils.getColorMode
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import javax.inject.Inject

class WeekViewsWidgetListProvider(val context: Context, intent: Intent) : RemoteViewsFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ private const val MINIFIED_WIDGET_PROPERTY = "minified"
private const val CHIP_VIEWS_PROPERTY = "views"
private const val CHIP_VISITORS__PROPERTY = "visitors"

enum class StatsLaunchedFrom(val value: String) {
QUICK_ACTIONS("quick_actions"),
TODAY_STATS_CARD("today_stats_card"),
ROW("row"),
POSTS("posts"),
WIDGET("widget"),
NOTIFICATION("notification"),
LINK("link"),
SHORTCUT("shortcut"),
ACTIVITY_LOG("activity_log"),
JETPACK_CONNECTION("jetpack_connection")
}

fun AnalyticsTrackerWrapper.trackStatsAccessed(site: SiteModel, tapSource: String) =
track(stat = Stat.STATS_ACCESSED, site = site, properties = mutableMapOf(TAP_SOURCE_PROPERTY to tapSource))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalPhaseHelper
import org.wordpress.android.ui.notifications.SystemNotificationsTracker
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.ui.stats.StatsTimeframe.WEEK
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.utils.StatsLaunchedFrom
import org.wordpress.android.ui.stats.refresh.utils.StatsUtils
import org.wordpress.android.util.SiteUtilsWrapper
import org.wordpress.android.viewmodel.ContextProvider
Expand Down Expand Up @@ -76,7 +76,7 @@ class WeeklyRoundupNotifier @Inject constructor(
WEEK,
data.period,
WEEKLY_ROUNDUP,
StatsActivity.StatsLaunchedFrom.NOTIFICATION,
StatsLaunchedFrom.NOTIFICATION,
notificationId,
FLAG_CANCEL_CURRENT or FLAG_IMMUTABLE
)
Expand Down
Loading

0 comments on commit 372f90b

Please sign in to comment.