Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion api/src/main/java/com/getcode/model/PrefBool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ data class PrefBool(
val value: Boolean
)

// Used internally to control logic and UI
sealed interface InternalRouting
// User setting exposed in Settings -> App Settings
sealed interface AppSetting
// Beta flag exposed in Settings -> Beta Flags to enable bleeding edge features
sealed interface BetaFlag
// Dev settings
sealed interface DevSetting
// Once a feature behind a beta flag is made public, it becomes immutable
// This removes it from the UI in Settings -> Beta Flags
sealed interface Immutable


Expand Down Expand Up @@ -52,7 +58,7 @@ sealed class PrefsBool(val value: String) {
data object CONVERSATION_CASH_ENABLED: PrefsBool("convo_cash_enabled"), BetaFlag
data object BALANCE_CURRENCY_SELECTION_ENABLED: PrefsBool("balance_currency_enabled"), BetaFlag, Immutable
data object KADO_WEBVIEW_ENABLED : PrefsBool("kado_inapp_enabled"), BetaFlag
data object SHARE_TWEET_TO_TIP : PrefsBool("share_tweet_to_tip"), BetaFlag
data object SHARE_TWEET_TO_TIP : PrefsBool("share_tweet_to_tip"), BetaFlag, Immutable
data object TIP_CARD_ON_HOMESCREEN: PrefsBool("tip_card_on_home_screen"), BetaFlag, Immutable
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data class BetaOptions(
conversationCashEnabled = false,
balanceCurrencySelectionEnabled = true,
kadoWebViewEnabled = false,
shareTweetToTip = false,
shareTweetToTip = true,
tipCardOnHomeScreen = true,
)
}
Expand Down Expand Up @@ -108,6 +108,29 @@ class BetaFlagsRepository @Inject constructor(
}

suspend fun isEnabled(flag: PrefsBool): Boolean {
return prefRepository.get(flag, false)
return prefRepository.get(flag, default(flag))
}

private fun default(flag: PrefsBool): Boolean {
return with(BetaOptions.Defaults) {
when (flag) {
PrefsBool.BALANCE_CURRENCY_SELECTION_ENABLED -> balanceCurrencySelectionEnabled
PrefsBool.BUCKET_DEBUGGER_ENABLED -> canViewBuckets
PrefsBool.BUY_MODULE_ENABLED -> buyModuleEnabled
PrefsBool.CHAT_UNSUB_ENABLED -> chatUnsubEnabled
PrefsBool.CONVERSATIONS_ENABLED -> conversationsEnabled
PrefsBool.CONVERSATION_CASH_ENABLED -> conversationCashEnabled
PrefsBool.DISPLAY_ERRORS -> displayErrors
PrefsBool.GIVE_REQUESTS_ENABLED -> giveRequestsEnabled
PrefsBool.KADO_WEBVIEW_ENABLED -> kadoWebViewEnabled
PrefsBool.LOG_SCAN_TIMES -> debugScanTimesEnabled
PrefsBool.SHARE_TWEET_TO_TIP -> shareTweetToTip
PrefsBool.SHOW_CONNECTIVITY_STATUS -> showNetworkDropOff
PrefsBool.TIPS_ENABLED -> tipsEnabled
PrefsBool.TIP_CARD_ON_HOMESCREEN -> tipCardOnHomeScreen
PrefsBool.VIBRATE_ON_SCAN -> tickOnScan
else -> false
}
}
}
}
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,13 @@
android:pathPattern="/x/.*"
android:scheme="https" />
</intent-filter>

</activity>

<activity-alias
android:name="com.getcode.view.TweetShareHandler"
android:exported="true"
android:targetActivity="com.getcode.view.MainActivity"
android:enabled="false">
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
Expand Down