forked from wordpress-mobile/WordPress-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wordpress-mobile#20956 from wordpress-mobile/merge…
…/25.0-final-into-trunk Merge 25.0 final into trunk
- Loading branch information
Showing
114 changed files
with
4,358 additions
and
3,098 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
WordPress/src/main/java/org/wordpress/android/ui/main/analytics/MainCreateSheetTracker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.wordpress.android.ui.main.analytics | ||
|
||
import org.wordpress.android.analytics.AnalyticsTracker | ||
import org.wordpress.android.ui.main.MainActionListItem | ||
import org.wordpress.android.ui.main.WPMainNavigationView | ||
import org.wordpress.android.ui.mysite.cards.dashboard.bloggingprompts.BloggingPromptAttribution | ||
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper | ||
import java.util.Locale | ||
import javax.inject.Inject | ||
|
||
class MainCreateSheetTracker @Inject constructor( | ||
private val analyticsTracker: AnalyticsTrackerWrapper, | ||
) { | ||
fun trackActionTapped(page: WPMainNavigationView.PageType, actionType: MainActionListItem.ActionType) { | ||
val stat = when (page) { | ||
WPMainNavigationView.PageType.MY_SITE -> AnalyticsTracker.Stat.MY_SITE_CREATE_SHEET_ACTION_TAPPED | ||
WPMainNavigationView.PageType.READER -> AnalyticsTracker.Stat.READER_CREATE_SHEET_ACTION_TAPPED | ||
else -> return | ||
} | ||
val properties = mapOf("action" to actionType.name.lowercase(Locale.ROOT)) | ||
analyticsTracker.track(stat, properties) | ||
} | ||
|
||
fun trackAnswerPromptActionTapped(page: WPMainNavigationView.PageType, attribution: BloggingPromptAttribution) { | ||
val properties = mapOf("attribution" to attribution.value).filterValues { it.isNotBlank() } | ||
val stat = when (page) { | ||
WPMainNavigationView.PageType.MY_SITE -> AnalyticsTracker.Stat.MY_SITE_CREATE_SHEET_ANSWER_PROMPT_TAPPED | ||
WPMainNavigationView.PageType.READER -> AnalyticsTracker.Stat.READER_CREATE_SHEET_ANSWER_PROMPT_TAPPED | ||
else -> return | ||
} | ||
analyticsTracker.track(stat, properties) | ||
} | ||
|
||
fun trackHelpPromptActionTapped(page: WPMainNavigationView.PageType) { | ||
val stat = when (page) { | ||
WPMainNavigationView.PageType.MY_SITE -> AnalyticsTracker.Stat.MY_SITE_CREATE_SHEET_PROMPT_HELP_TAPPED | ||
WPMainNavigationView.PageType.READER -> AnalyticsTracker.Stat.READER_CREATE_SHEET_PROMPT_HELP_TAPPED | ||
else -> return | ||
} | ||
analyticsTracker.track(stat) | ||
} | ||
|
||
fun trackSheetShown(page: WPMainNavigationView.PageType) { | ||
val stat = when (page) { | ||
WPMainNavigationView.PageType.MY_SITE -> AnalyticsTracker.Stat.MY_SITE_CREATE_SHEET_SHOWN | ||
WPMainNavigationView.PageType.READER -> AnalyticsTracker.Stat.READER_CREATE_SHEET_SHOWN | ||
else -> return | ||
} | ||
analyticsTracker.track(stat) | ||
} | ||
|
||
fun trackFabShown(page: WPMainNavigationView.PageType) { | ||
val stat = when (page) { | ||
WPMainNavigationView.PageType.MY_SITE -> AnalyticsTracker.Stat.MY_SITE_CREATE_FAB_SHOWN | ||
WPMainNavigationView.PageType.READER -> AnalyticsTracker.Stat.READER_CREATE_FAB_SHOWN | ||
else -> return | ||
} | ||
analyticsTracker.track(stat) | ||
} | ||
|
||
fun trackCreateActionsSheetCard(actions: List<MainActionListItem>) { | ||
if (actions.any { it is MainActionListItem.AnswerBloggingPromptAction }) { | ||
analyticsTracker.track(AnalyticsTracker.Stat.BLOGGING_PROMPTS_CREATE_SHEET_CARD_VIEWED) | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
WordPress/src/main/java/org/wordpress/android/ui/main/utils/MainCreateSheetHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.wordpress.android.ui.main.utils | ||
|
||
import org.wordpress.android.fluxc.model.SiteModel | ||
import org.wordpress.android.ui.bloggingprompts.BloggingPromptsSettingsHelper | ||
import org.wordpress.android.ui.main.WPMainNavigationView.PageType | ||
import org.wordpress.android.ui.voicetocontent.VoiceToContentFeatureUtils | ||
import org.wordpress.android.util.BuildConfigWrapper | ||
import org.wordpress.android.util.SiteUtilsWrapper | ||
import org.wordpress.android.util.config.ReaderFloatingButtonFeatureConfig | ||
import javax.inject.Inject | ||
|
||
class MainCreateSheetHelper @Inject constructor( | ||
private val voiceToContentFeatureUtils: VoiceToContentFeatureUtils, | ||
private val readerFloatingButtonFeatureConfig: ReaderFloatingButtonFeatureConfig, | ||
private val bloggingPromptsSettingsHelper: BloggingPromptsSettingsHelper, | ||
private val buildConfig: BuildConfigWrapper, | ||
private val siteUtils: SiteUtilsWrapper, | ||
) { | ||
fun shouldShowFabForPage(page: PageType?): Boolean { | ||
val enabledForPage = page == PageType.MY_SITE || | ||
(page == PageType.READER && readerFloatingButtonFeatureConfig.isEnabled()) | ||
return buildConfig.isCreateFabEnabled && enabledForPage | ||
} | ||
|
||
@Suppress("FunctionOnlyReturningConstant") | ||
fun canCreatePost(): Boolean = true // for completeness | ||
|
||
fun canCreatePage(site: SiteModel?, page: PageType?): Boolean { | ||
return siteUtils.hasFullAccessToContent(site) && page == PageType.MY_SITE | ||
} | ||
|
||
fun canCreatePostFromAudio(site: SiteModel?): Boolean { | ||
return voiceToContentFeatureUtils.isVoiceToContentEnabled() && siteUtils.hasFullAccessToContent(site) | ||
} | ||
|
||
suspend fun canCreatePromptAnswer(): Boolean = bloggingPromptsSettingsHelper.shouldShowPromptsFeature() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ress/src/main/java/org/wordpress/android/util/config/ReaderFloatingButtonFeatureConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.wordpress.android.util.config | ||
|
||
import org.wordpress.android.BuildConfig | ||
import org.wordpress.android.annotation.Feature | ||
import javax.inject.Inject | ||
|
||
private const val READER_FLOATING_BUTTON_REMOTE_FIELD = "reader_floating_button" | ||
|
||
@Feature(READER_FLOATING_BUTTON_REMOTE_FIELD, false) | ||
class ReaderFloatingButtonFeatureConfig @Inject constructor( | ||
appConfig: AppConfig | ||
) : FeatureConfig( | ||
appConfig, | ||
BuildConfig.READER_FLOATING_BUTTON, | ||
READER_FLOATING_BUTTON_REMOTE_FIELD | ||
) |
Oops, something went wrong.