Skip to content

[Dynamic Dashboard] Code cleanup #11457

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

Merged
merged 21 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import com.woocommerce.android.notifications.WooNotificationType.NEW_ORDER

/**
* This is not a screen per-se, as it shows the notification drawer with a push notification.
* This is why we provide an [R.id.my_store] as the [elementID].
* This is why we provide an [R.id.dashboard] as the [elementID].
*/
class NotificationsScreen(private val wooNotificationBuilder: WooNotificationBuilder) :
Screen(R.id.my_store) {
Screen(R.id.dashboard) {
init {
displayNotification()
openNotificationShade()
Expand Down
28 changes: 0 additions & 28 deletions WooCommerce/src/main/kotlin/com/woocommerce/android/AppPrefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.woocommerce.android.AppPrefs.DeletablePrefKey.WC_STORE_ID
import com.woocommerce.android.AppPrefs.DeletableSitePrefKey.AUTO_TAX_RATE_ID
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.APPLICATION_STORE_SNAPSHOT_TRACKED_FOR_SITE
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.ONBOARDING_CAROUSEL_DISPLAYED
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.STORE_ONBOARDING_SETTING_VISIBILITY
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.STORE_ONBOARDING_SHOWN_AT_LEAST_ONCE
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.STORE_ONBOARDING_TASKS_COMPLETED
import com.woocommerce.android.AppPrefs.UndeletablePrefKey.STORE_PHONE_NUMBER
Expand Down Expand Up @@ -119,7 +118,6 @@ object AppPrefs {
AI_CONTENT_GENERATION_TONE,
AI_PRODUCT_CREATION_IS_FIRST_ATTEMPT,
BLAZE_CELEBRATION_SCREEN_SHOWN,
MY_STORE_BLAZE_VIEW_DISMISSED,
WC_STORE_ID,
CHA_CHING_SOUND_ISSUE_DIALOG_DISMISSED,
TIMES_AI_PRODUCT_CREATION_SURVEY_DISPLAYED,
Expand Down Expand Up @@ -190,9 +188,6 @@ object AppPrefs {
// Was store onboarding shown at least once
STORE_ONBOARDING_SHOWN_AT_LEAST_ONCE,

// User preference in regards to show store onboarding or not
STORE_ONBOARDING_SETTING_VISIBILITY,

// Time when the last successful payment was made with a card reader
CARD_READER_LAST_SUCCESSFUL_PAYMENT_TIME,

Expand Down Expand Up @@ -947,19 +942,6 @@ object AppPrefs {
default = false
)

fun getOnboardingSettingVisibility(siteId: Int): Boolean =
getBoolean(
key = PrefKeyString("$STORE_ONBOARDING_SETTING_VISIBILITY:$siteId"),
default = true
)

fun setOnboardingSettingVisibility(siteId: Int, visible: Boolean) {
setBoolean(
key = PrefKeyString("$STORE_ONBOARDING_SETTING_VISIBILITY:$siteId"),
value = visible
)
}

fun getCardReaderLastSuccessfulPaymentTime() =
getLong(UndeletablePrefKey.CARD_READER_LAST_SUCCESSFUL_PAYMENT_TIME, 0L)

Expand Down Expand Up @@ -1024,16 +1006,6 @@ object AppPrefs {
value = value
)

var isMyStoreBlazeViewDismissed: Boolean
get() = getBoolean(
key = DeletablePrefKey.MY_STORE_BLAZE_VIEW_DISMISSED,
default = false
)
set(value) = setBoolean(
key = DeletablePrefKey.MY_STORE_BLAZE_VIEW_DISMISSED,
value = value
)

var timesAiProductCreationSurveyDisplayed: Int
get() = getInt(
key = DeletablePrefKey.TIMES_AI_PRODUCT_CREATION_SURVEY_DISPLAYED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class AppPrefsWrapper @Inject constructor() {

var isBlazeCelebrationScreenShown by AppPrefs::isBlazeCelebrationScreenShown

var isMyStoreBlazeViewDismissed by AppPrefs::isMyStoreBlazeViewDismissed

var wasAIProductDescriptionCelebrationShown by AppPrefs::wasAIProductDescriptionCelebrationShown

var chaChingSoundIssueDialogDismissed by AppPrefs::chaChingSoundIssueDialogDismissed
Expand Down Expand Up @@ -338,12 +336,6 @@ class AppPrefsWrapper @Inject constructor() {

fun getStoreOnboardingShown(siteId: Int): Boolean = AppPrefs.getStoreOnboardingShown(siteId)

fun getOnboardingSettingVisibility(siteId: Int): Boolean = AppPrefs.getOnboardingSettingVisibility(siteId)

fun setOnboardingSettingVisibility(siteId: Int, show: Boolean) {
AppPrefs.setOnboardingSettingVisibility(siteId, show)
}

fun setStorePhoneNumber(siteId: Int, phoneNumber: String) = AppPrefs.setStorePhoneNumber(siteId, phoneNumber)

fun getStorePhoneNumber(siteId: Int): String = AppPrefs.getStorePhoneNumber(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,6 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
STORE_ONBOARDING_TASK_TAPPED,
STORE_ONBOARDING_TASK_COMPLETED,
STORE_ONBOARDING_COMPLETED,
STORE_ONBOARDING_HIDE_LIST,
STORE_ONBOARDING_WCPAY_BEGIN_SETUP_TAPPED,
STORE_ONBOARDING_WCPAY_TERMS_CONTINUE_TAPPED,

Expand Down Expand Up @@ -1009,7 +1008,6 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
BLAZE_CAMPAIGN_DETAIL_SELECTED,
BLAZE_CAMPAIGN_LIST_ENTRY_POINT_SELECTED,
BLAZE_INTRO_DISPLAYED,
BLAZE_VIEW_DISMISSED,
BLAZE_INTRO_LEARN_MORE_TAPPED,
BLAZE_CREATION_FORM_DISPLAYED,
BLAZE_CREATION_EDIT_AD_TAPPED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import com.woocommerce.android.datastore.DataStoreType.DASHBOARD_STATS
import com.woocommerce.android.datastore.DataStoreType.TOP_PERFORMER_PRODUCTS
import com.woocommerce.android.datastore.DataStoreType.TRACKER
import com.woocommerce.android.di.AppCoroutineScope
import com.woocommerce.android.ui.dashboard.data.CustomDateRangeSerializer
import com.woocommerce.android.ui.mystore.data.CustomDateRange
import com.woocommerce.android.ui.mystore.data.CustomDateRangeSerializer
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import com.woocommerce.android.ui.analytics.hub.sync.SessionState
import com.woocommerce.android.ui.analytics.hub.sync.UpdateAnalyticsHubStats
import com.woocommerce.android.ui.analytics.ranges.StatsTimeRangeSelection
import com.woocommerce.android.ui.analytics.ranges.StatsTimeRangeSelection.SelectionType
import com.woocommerce.android.ui.dashboard.DashboardStatsUsageTracksEventEmitter
import com.woocommerce.android.ui.dashboard.domain.ObserveLastUpdate
import com.woocommerce.android.ui.feedback.FeedbackRepository
import com.woocommerce.android.ui.mystore.MyStoreStatsUsageTracksEventEmitter
import com.woocommerce.android.ui.mystore.domain.ObserveLastUpdate
import com.woocommerce.android.util.CurrencyFormatter
import com.woocommerce.android.util.DateUtils
import com.woocommerce.android.util.locale.LocaleProvider
Expand Down Expand Up @@ -74,7 +74,7 @@ class AnalyticsHubViewModel @Inject constructor(
private val resourceProvider: ResourceProvider,
private val currencyFormatter: CurrencyFormatter,
private val transactionLauncher: AnalyticsHubTransactionLauncher,
private val usageTracksEventEmitter: MyStoreStatsUsageTracksEventEmitter,
private val usageTracksEventEmitter: DashboardStatsUsageTracksEventEmitter,
private val updateStats: UpdateAnalyticsHubStats,
private val observeLastUpdate: ObserveLastUpdate,
private val localeProvider: LocaleProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import com.woocommerce.android.ui.analytics.ranges.StatsTimeRangeSelection.Selec
import com.woocommerce.android.ui.analytics.ranges.revenueStatsGranularity
import com.woocommerce.android.ui.analytics.ranges.visitorStatsGranularity
import com.woocommerce.android.ui.analytics.ranges.visitorSummaryStatsGranularity
import com.woocommerce.android.ui.mystore.data.StatsRepository
import com.woocommerce.android.ui.mystore.data.asRevenueRangeId
import com.woocommerce.android.ui.dashboard.data.StatsRepository
import com.woocommerce.android.ui.dashboard.data.asRevenueRangeId
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.woocommerce.android.tools.connectionType
import com.woocommerce.android.ui.analytics.ranges.StatsTimeRangeSelection
import com.woocommerce.android.ui.analytics.ranges.revenueStatsGranularity
import com.woocommerce.android.ui.analytics.ranges.visitorStatsGranularity
import com.woocommerce.android.ui.dashboard.data.StatsRepository
import com.woocommerce.android.ui.login.AccountRepository
import com.woocommerce.android.ui.mystore.data.StatsRepository
import com.woocommerce.android.util.CoroutineDispatchers
import kotlinx.coroutines.withContext
import org.wordpress.android.fluxc.model.SiteModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import androidx.annotation.StringRes
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope
import com.woocommerce.android.AppPrefsWrapper
import com.woocommerce.android.R
import com.woocommerce.android.analytics.AnalyticsEvent
import com.woocommerce.android.analytics.AnalyticsTracker
import com.woocommerce.android.analytics.AnalyticsTrackerWrapper
import com.woocommerce.android.model.DashboardWidget
import com.woocommerce.android.support.help.HelpOrigin
import com.woocommerce.android.ui.blaze.BlazeRepository
import com.woocommerce.android.ui.blaze.BlazeRepository.PaymentMethodsData
import com.woocommerce.android.ui.dashboard.data.DashboardRepository
import com.woocommerce.android.util.CurrencyFormatter
import com.woocommerce.android.viewmodel.MultiLiveEvent
import com.woocommerce.android.viewmodel.ScopedViewModel
Expand All @@ -28,7 +29,7 @@ class BlazeCampaignPaymentSummaryViewModel @Inject constructor(
private val blazeRepository: BlazeRepository,
currencyFormatter: CurrencyFormatter,
private val analyticsTrackerWrapper: AnalyticsTrackerWrapper,
private val prefsWrapper: AppPrefsWrapper
private val dashboardRepository: DashboardRepository
) : ScopedViewModel(savedStateHandle) {
private val navArgs = BlazeCampaignPaymentSummaryFragmentArgs.fromSavedStateHandle(savedStateHandle)
private val budgetFormatted = currencyFormatter.formatCurrency(
Expand Down Expand Up @@ -124,7 +125,7 @@ class BlazeCampaignPaymentSummaryViewModel @Inject constructor(
onSuccess = {
campaignCreationState.value = null
analyticsTrackerWrapper.track(stat = AnalyticsEvent.BLAZE_CREATION_PAYMENT_SUBMIT_CAMPAIGN_TAPPED)
prefsWrapper.isMyStoreBlazeViewDismissed = false
dashboardRepository.updateWidgetVisibility(type = DashboardWidget.Type.ONBOARDING, isVisible = true)
triggerEvent(NavigateToStartingScreenWithSuccessBottomSheet)
},
onFailure = {
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading