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
1 change: 0 additions & 1 deletion apps/flipcash/features/scanner/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
implementation(project(":apps:flipcash:shared:appupdates"))
implementation(project(":apps:flipcash:shared:bills"))
implementation(project(":apps:flipcash:shared:bill-customization"))
implementation(project(":apps:flipcash:shared:featureflags"))
implementation(project(":apps:flipcash:shared:router"))
implementation(project(":apps:flipcash:shared:session"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -18,8 +17,6 @@ import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.platform.testTag
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.flipcash.app.core.android.extensions.launchAppSettings
import com.flipcash.app.featureflags.FeatureFlag
import com.flipcash.app.featureflags.LocalFeatureFlags
import com.flipcash.app.scanner.internal.GalleryScanButton
import com.flipcash.app.session.LocalSessionController
import com.flipcash.app.updates.LocalAppUpdater
Expand Down Expand Up @@ -124,23 +121,14 @@ internal fun ScannableContainer(
}
}

// Remembered because `observe` builds a fresh `stateIn(dataScope, Eagerly, ..)` on every
// call and `dataScope` outlives the screen: calling it straight from a composable body
// starts a DataStore collection per recomposition that nothing ever cancels.
val featureFlags = LocalFeatureFlags.current
val galleryFlag = remember(featureFlags) {
featureFlags.observe(FeatureFlag.ScanFromGallery)
}
val galleryEnabled by galleryFlag.collectAsStateWithLifecycle()

// Outside the permission `when` on purpose: a picked photo needs no camera, and someone
// who declined the camera is exactly who this is for.
//
// Hidden while a bill is up. `NavBillOverlayEntryDecorator` draws the bill after this
// entry's content, so the bill already covers the button -- but leaving it composed under
// the scrim means a live control is sitting behind something modal, which is worth not
// having rather than relying on the overlay to swallow every touch.
if (galleryEnabled && billState.bill == null) {
if (billState.bill == null) {
GalleryScanButton(
onImagePicked = onImagePicked,
hazeState = hazeState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ sealed interface FeatureFlag<T: Any> {
override val persistLogOut: Boolean = false
}

@FeatureFlagMarker
data object ScanFromGallery: FeatureFlag<Boolean> {
override val key: String = "scan_from_gallery"
override val default: Boolean = false
override val launched: Boolean = false
override val visible: Boolean = true
// Matches ContactPickerMode: the setting is about how you reach the camera, not about
// the account you reached it with.
override val persistLogOut: Boolean = true
}

companion object {
val entries: List<FeatureFlag<*>>
get() = FeatureFlagEntries.entries
Expand All @@ -139,7 +128,6 @@ val FeatureFlag<*>.title: String
FeatureFlag.ContactPickerMode -> "Contact Picker Mode"
FeatureFlag.ShowNetworkState -> "Network Offline Indicator"
FeatureFlag.FrostedTipCard -> "Frosted Tip Card"
FeatureFlag.ScanFromGallery -> "Scan from Gallery"
}

val FeatureFlag<*>.message: String
Expand All @@ -152,8 +140,4 @@ val FeatureFlag<*>.message: String
FeatureFlag.ContactPickerMode -> "When enabled, contacts will be accessed via the system contact picker instead of requesting full READ_CONTACTS permission"
FeatureFlag.ShowNetworkState -> "When enabled, you'll gain the ability to see the network state on the Scanner when offline"
FeatureFlag.FrostedTipCard -> "When enabled, the tip card in the scanner renders as frosted glass over a blurred snapshot of the camera instead of a solid card"
FeatureFlag.ScanFromGallery -> "When enabled, the scanner gains a gallery button for searching a photo you already have for a code, for when someone sends you a screenshot instead of showing you their screen"
}



Loading