Skip to content

Commit 11c4779

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feat/create-chat-flow
* origin/develop: feat: increase lookup successes from gallery chore: HomeViewModel => Session fix(camera): prevent possible fish eye effect after scanning a bill and returning to initial zoom chore(home/bottom): update tip card asset; simplify BottomBarAction use feat(gallery): divide and conquer parsing images from gallery chore(beta): mark CAMERA_DRAG_INVERTED deprecated; add Launched status chore: update gallery icon and vertical arrangement feat(camera): ease-in drag-to-zoom; move to GestureController chore: add ability to invert drag-to-zoom direction behind beta flag chore(camera): reverse drag-to-zoom direction feat: add gallery support and share image to code Update CodeScanner.kt build: prep next development cycle chore: refinements to cooperate camera gestures chore: allow pinch to zoom and drag to zoom to work together
2 parents bb7095c + 4b99655 commit 11c4779

68 files changed

Lines changed: 1326 additions & 606 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/main/java/com/getcode/manager/SessionManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import javax.inject.Inject
1818
import javax.inject.Singleton
1919

2020

21+
// TODO: figure out a better naming paradigm b/w this and Session
2122
@Singleton
2223
class SessionManager @Inject constructor(
2324
private val client: Client,

api/src/main/java/com/getcode/model/Feature.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ data class CameraGesturesFeature(
4848
override val available: Boolean = true, // always available
4949
): Feature
5050

51+
data class InvertedDragZoomFeature(
52+
override val enabled: Boolean = BetaOptions.Defaults.invertedDragZoom,
53+
override val available: Boolean = true, // always available
54+
): Feature
55+
5156
data class FlippableTipCardFeature(
5257
override val enabled: Boolean = BetaOptions.Defaults.canFlipTipCard,
5358
override val available: Boolean = true, // always available
59+
): Feature
60+
61+
data class GalleryFeature(
62+
override val enabled: Boolean = BetaOptions.Defaults.galleryEnabled,
63+
override val available: Boolean = true, // always available
5464
): Feature

api/src/main/java/com/getcode/model/PrefBool.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package com.getcode.model
44

55
import androidx.room.Entity
66
import androidx.room.PrimaryKey
7+
import dagger.internal.Beta
78

89
@Entity
910
data class PrefBool(
@@ -19,9 +20,12 @@ sealed interface AppSetting
1920
sealed interface BetaFlag
2021
// Dev settings
2122
sealed interface DevSetting
22-
// Once a feature behind a beta flag is made public, it becomes immutable
2323
// This removes it from the UI in Settings -> Beta Flags
2424
sealed interface Immutable
25+
// Once a feature behind a beta flag is made public, it becomes immutable
26+
sealed interface Launched: Immutable
27+
// A feature flag can also be deemed deprecated and is also then immutable
28+
sealed interface Deprecated : Immutable
2529

2630

2731
sealed class PrefsBool(val value: String) {
@@ -51,17 +55,19 @@ sealed class PrefsBool(val value: String) {
5155
data object DISPLAY_ERRORS: PrefsBool("debug_display_errors"), BetaFlag
5256
data object SHOW_CONNECTIVITY_STATUS: PrefsBool("debug_no_network"), BetaFlag
5357
data object GIVE_REQUESTS_ENABLED: PrefsBool("give_requests_enabled"), BetaFlag
54-
data object BUY_MODULE_ENABLED : PrefsBool("buy_kin_enabled"), BetaFlag, Immutable
58+
data object BUY_MODULE_ENABLED : PrefsBool("buy_kin_enabled"), BetaFlag, Launched
5559
data object CHAT_UNSUB_ENABLED: PrefsBool("chat_unsub_enabled"), BetaFlag
56-
data object TIPS_ENABLED : PrefsBool("tips_enabled"), BetaFlag, Immutable
60+
data object TIPS_ENABLED : PrefsBool("tips_enabled"), BetaFlag, Launched
5761
data object CONVERSATIONS_ENABLED: PrefsBool("conversations_enabled"), BetaFlag
5862
data object CONVERSATION_CASH_ENABLED: PrefsBool("convo_cash_enabled"), BetaFlag
59-
data object BALANCE_CURRENCY_SELECTION_ENABLED: PrefsBool("balance_currency_enabled"), BetaFlag, Immutable
63+
data object BALANCE_CURRENCY_SELECTION_ENABLED: PrefsBool("balance_currency_enabled"), BetaFlag, Launched
6064
data object KADO_WEBVIEW_ENABLED : PrefsBool("kado_inapp_enabled"), BetaFlag
61-
data object SHARE_TWEET_TO_TIP : PrefsBool("share_tweet_to_tip"), BetaFlag, Immutable
62-
data object TIP_CARD_ON_HOMESCREEN: PrefsBool("tip_card_on_home_screen"), BetaFlag, Immutable
65+
data object SHARE_TWEET_TO_TIP : PrefsBool("share_tweet_to_tip"), BetaFlag, Launched
66+
data object TIP_CARD_ON_HOMESCREEN: PrefsBool("tip_card_on_home_screen"), BetaFlag, Launched
6367
data object TIP_CARD_FLIPPABLE: PrefsBool("tipcard_flippable"), BetaFlag
64-
data object CAMERA_GESTURES_ENABLED: PrefsBool("camera_gestures_enabled"), BetaFlag
68+
data object CAMERA_GESTURES_ENABLED: PrefsBool("camera_gestures_enabled"), BetaFlag, Launched
69+
data object CAMERA_DRAG_INVERTED: PrefsBool("camera_drag_inverted"), BetaFlag, Deprecated
70+
data object GALLERY_ENABLED: PrefsBool("gallery_enabled"), BetaFlag
6571
}
6672

6773
val APP_SETTINGS: List<AppSetting> = listOf(PrefsBool.CAMERA_START_BY_DEFAULT, PrefsBool.REQUIRE_BIOMETRICS)

api/src/main/java/com/getcode/network/repository/BetaFlagsRepository.kt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ data class BetaOptions(
2222
val shareTweetToTip: Boolean,
2323
val tipCardOnHomeScreen: Boolean,
2424
val cameraGesturesEnabled: Boolean,
25+
val invertedDragZoom: Boolean,
2526
val canFlipTipCard: Boolean,
27+
val galleryEnabled: Boolean,
2628
) {
2729
companion object {
2830
// Default states for various beta flags in app.
@@ -43,7 +45,9 @@ data class BetaOptions(
4345
shareTweetToTip = true,
4446
tipCardOnHomeScreen = true,
4547
cameraGesturesEnabled = true,
46-
canFlipTipCard = false
48+
invertedDragZoom = false,
49+
canFlipTipCard = false,
50+
galleryEnabled = false
4751
)
4852
}
4953
}
@@ -82,7 +86,9 @@ class BetaFlagsRepository @Inject constructor(
8286
observeBetaFlag(PrefsBool.SHARE_TWEET_TO_TIP, default = defaults.shareTweetToTip),
8387
observeBetaFlag(PrefsBool.TIP_CARD_ON_HOMESCREEN, defaults.tipCardOnHomeScreen),
8488
observeBetaFlag(PrefsBool.CAMERA_GESTURES_ENABLED, defaults.cameraGesturesEnabled),
85-
observeBetaFlag(PrefsBool.TIP_CARD_FLIPPABLE, defaults.canFlipTipCard)
89+
observeBetaFlag(PrefsBool.CAMERA_DRAG_INVERTED, defaults.invertedDragZoom),
90+
observeBetaFlag(PrefsBool.TIP_CARD_FLIPPABLE, defaults.canFlipTipCard),
91+
observeBetaFlag(PrefsBool.GALLERY_ENABLED, defaults.galleryEnabled),
8692
) {
8793
BetaOptions(
8894
showNetworkDropOff = it[0],
@@ -101,7 +107,9 @@ class BetaFlagsRepository @Inject constructor(
101107
shareTweetToTip = it[13],
102108
tipCardOnHomeScreen = it[14],
103109
cameraGesturesEnabled = it[15],
104-
canFlipTipCard = it[16],
110+
invertedDragZoom = it[16],
111+
canFlipTipCard = it[17],
112+
galleryEnabled = it[18],
105113
)
106114
}
107115
}
@@ -125,19 +133,34 @@ class BetaFlagsRepository @Inject constructor(
125133
PrefsBool.BALANCE_CURRENCY_SELECTION_ENABLED -> balanceCurrencySelectionEnabled
126134
PrefsBool.BUCKET_DEBUGGER_ENABLED -> canViewBuckets
127135
PrefsBool.BUY_MODULE_ENABLED -> buyModuleEnabled
136+
PrefsBool.CAMERA_GESTURES_ENABLED -> cameraGesturesEnabled
137+
PrefsBool.CAMERA_DRAG_INVERTED -> invertedDragZoom
128138
PrefsBool.CHAT_UNSUB_ENABLED -> chatUnsubEnabled
129139
PrefsBool.CONVERSATIONS_ENABLED -> conversationsEnabled
130140
PrefsBool.CONVERSATION_CASH_ENABLED -> conversationCashEnabled
131141
PrefsBool.DISPLAY_ERRORS -> displayErrors
142+
PrefsBool.GALLERY_ENABLED -> galleryEnabled
132143
PrefsBool.GIVE_REQUESTS_ENABLED -> giveRequestsEnabled
133144
PrefsBool.KADO_WEBVIEW_ENABLED -> kadoWebViewEnabled
134145
PrefsBool.LOG_SCAN_TIMES -> debugScanTimesEnabled
135146
PrefsBool.SHARE_TWEET_TO_TIP -> shareTweetToTip
136147
PrefsBool.SHOW_CONNECTIVITY_STATUS -> showNetworkDropOff
137148
PrefsBool.TIPS_ENABLED -> tipsEnabled
149+
PrefsBool.TIP_CARD_FLIPPABLE -> canFlipTipCard
138150
PrefsBool.TIP_CARD_ON_HOMESCREEN -> tipCardOnHomeScreen
139151
PrefsBool.VIBRATE_ON_SCAN -> tickOnScan
140-
else -> false
152+
PrefsBool.BUY_MODULE_AVAILABLE -> false
153+
PrefsBool.CAMERA_START_BY_DEFAULT -> false
154+
PrefsBool.DISMISSED_TIP_CARD_BANNER -> false
155+
PrefsBool.ESTABLISH_CODE_RELATIONSHIP -> false
156+
PrefsBool.HAS_REMOVED_LOCAL_CURRENCY -> false
157+
PrefsBool.IS_DEBUG_ACTIVE -> false
158+
PrefsBool.IS_DEBUG_ALLOWED -> false
159+
PrefsBool.IS_ELIGIBLE_GET_FIRST_KIN_AIRDROP -> false
160+
PrefsBool.IS_ELIGIBLE_GIVE_FIRST_KIN_AIRDROP -> false
161+
PrefsBool.REQUIRE_BIOMETRICS -> false
162+
PrefsBool.SEEN_TIP_CARD -> false
163+
PrefsBool.STARTED_TIP_CONNECT -> false
141164
}
142165
}
143166
}

api/src/main/java/com/getcode/network/repository/FeatureRepository.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import com.getcode.model.TipCardOnHomeScreenFeature
1010
import com.getcode.model.ConversationCashFeature
1111
import com.getcode.model.ConversationsFeature
1212
import com.getcode.model.FlippableTipCardFeature
13+
import com.getcode.model.GalleryFeature
14+
import com.getcode.model.InvertedDragZoomFeature
1315
import kotlinx.coroutines.flow.combine
1416
import kotlinx.coroutines.flow.map
1517
import javax.inject.Inject
@@ -24,19 +26,25 @@ class FeatureRepository @Inject constructor(
2426
val buyModule = combine(
2527
betaFlags.observe().map { it.buyModuleEnabled },
2628
prefRepository.observeOrDefault(PrefsBool.BUY_MODULE_AVAILABLE, false)
27-
) { enabled, available -> BuyModuleFeature(enabled, available) }
29+
) { enabled, available -> BuyModuleFeature(enabled, available) }
2830

2931
val tipCards = betaFlags.observe().map { TipCardFeature(it.tipsEnabled) }
30-
val tipCardOnHomeScreen = betaFlags.observe().map { TipCardOnHomeScreenFeature(it.tipCardOnHomeScreen) }
32+
val tipCardOnHomeScreen =
33+
betaFlags.observe().map { TipCardOnHomeScreenFeature(it.tipCardOnHomeScreen) }
3134
val tipCardFlippable = betaFlags.observe().map { FlippableTipCardFeature(it.canFlipTipCard) }
3235
val conversations = betaFlags.observe().map { ConversationsFeature(it.conversationsEnabled) }
33-
val conversationsCash = betaFlags.observe().map { ConversationCashFeature(it.conversationCashEnabled) }
36+
val conversationsCash =
37+
betaFlags.observe().map { ConversationCashFeature(it.conversationCashEnabled) }
3438

3539
val cameraGestures = betaFlags.observe().map { CameraGesturesFeature(it.cameraGesturesEnabled) }
40+
val invertedDragZoom = betaFlags.observe().map { InvertedDragZoomFeature(it.invertedDragZoom) }
41+
42+
val galleryEnabled = betaFlags.observe().map { GalleryFeature(it.galleryEnabled) }
3643

3744
val requestKin = betaFlags.observe().map { RequestKinFeature(it.giveRequestsEnabled) }
3845

39-
val balanceCurrencySelection = betaFlags.observe().map { BalanceCurrencyFeature(it.balanceCurrencySelectionEnabled) }
46+
val balanceCurrencySelection =
47+
betaFlags.observe().map { BalanceCurrencyFeature(it.balanceCurrencySelectionEnabled) }
4048

4149
suspend fun isEnabled(feature: PrefsBool): Boolean = betaFlags.isEnabled(feature)
4250
}

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ dependencies {
168168

169169
implementation(Libs.androidx_biometrics)
170170

171+
implementation(Libs.androidx_activity)
172+
171173
// cameraX
172174
implementation(Libs.androidx_camerax_core)
173175
implementation(Libs.androidx_camerax_camera2)

app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest xmlns:tools="http://schemas.android.com/tools"
3+
xmlns:android="http://schemas.android.com/apk/res/android">
34

45
<uses-feature
56
android:name="android.hardware.camera"
@@ -54,6 +55,18 @@
5455
<category android:name="android.intent.category.LAUNCHER" />
5556
</intent-filter>
5657

58+
<intent-filter>
59+
<action android:name="android.intent.action.SEND"/>
60+
<category android:name="android.intent.category.DEFAULT"/>
61+
<data android:mimeType="text/plain"/>
62+
</intent-filter>
63+
64+
<intent-filter>
65+
<action android:name="android.intent.action.SEND"/>
66+
<category android:name="android.intent.category.DEFAULT"/>
67+
<data android:mimeType="image/*"/>
68+
</intent-filter>
69+
5770
<intent-filter android:autoVerify="true">
5871
<action android:name="android.intent.action.VIEW" />
5972

@@ -151,17 +164,20 @@
151164
</intent-filter>
152165
</activity>
153166

154-
<activity-alias
155-
android:name="com.getcode.view.TweetShareHandler"
156-
android:exported="true"
157-
android:targetActivity="com.getcode.view.MainActivity"
158-
android:enabled="true">
167+
<!--
168+
Prompt Google Play services to install the backported photo picker module
169+
https://developer.android.com/training/data-storage/shared/photopicker#device-availability
170+
-->
171+
<!--suppress AndroidDomInspection -->
172+
<service android:name="com.google.android.gms.metadata.ModuleDependencies"
173+
android:enabled="false"
174+
android:exported="false"
175+
tools:ignore="MissingClass">
159176
<intent-filter>
160-
<action android:name="android.intent.action.SEND"/>
161-
<category android:name="android.intent.category.DEFAULT"/>
162-
<data android:mimeType="text/plain"/>
177+
<action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
163178
</intent-filter>
164-
</activity-alias>
179+
<meta-data android:name="photopicker_activity:0:required" android:value="" />
180+
</service>
165181

166182
<service
167183
android:name="com.getcode.util.AuthenticatorService"

app/src/main/java/com/getcode/CodeApp.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ import com.getcode.ui.components.bars.TopBarContainer
4747
import com.getcode.ui.utils.getActivity
4848
import com.getcode.ui.utils.getActivityScopedViewModel
4949
import com.getcode.ui.utils.measured
50+
import com.getcode.ui.utils.rememberBiometricsState
5051
import com.getcode.util.BiometricsError
51-
import com.getcode.view.main.home.components.BiometricsBlockingView
52-
import com.getcode.view.main.home.components.rememberBiometricsState
52+
import com.getcode.view.main.scanner.views.BiometricsBlockingView
5353
import dev.bmcreations.tipkit.TipScaffold
5454
import dev.bmcreations.tipkit.engines.TipsEngine
5555

app/src/main/java/com/getcode/Locals.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import com.getcode.analytics.AnalyticsServiceNull
99
import com.getcode.network.exchange.Exchange
1010
import com.getcode.network.exchange.ExchangeNull
1111
import com.getcode.network.repository.BetaOptions
12+
import com.getcode.ui.utils.BiometricsState
1213
import com.getcode.util.CurrencyUtils
1314
import com.getcode.util.DeeplinkHandler
1415
import com.getcode.util.PhoneUtils
1516
import com.getcode.utils.network.NetworkConnectivityListener
1617
import com.getcode.utils.network.NetworkObserverStub
17-
import com.getcode.view.main.home.components.BiometricsState
1818

19+
val LocalSession: ProvidableCompositionLocal<Session?> = staticCompositionLocalOf { null }
1920
val LocalAnalytics: ProvidableCompositionLocal<AnalyticsService> = staticCompositionLocalOf { AnalyticsServiceNull() }
2021
val LocalNetworkObserver: ProvidableCompositionLocal<NetworkConnectivityListener> = staticCompositionLocalOf { NetworkObserverStub() }
2122
val LocalPhoneFormatter: ProvidableCompositionLocal<PhoneUtils?> = staticCompositionLocalOf { null }

0 commit comments

Comments
 (0)