Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
659599c
feat: share tweet to tip
bmc08gt Jul 18, 2024
b4e5b2d
build: prep next development cycle
bmc08gt Aug 8, 2024
34b395f
fix: make tip card dismissal more deterministic
bmc08gt Aug 8, 2024
8b73d62
Merge pull request #501 from code-payments/fix/make-tip-card-dismissa…
bmc08gt Aug 8, 2024
73827fd
chore: support directly handling tipcard deeplinks
bmc08gt Aug 9, 2024
c56efbc
Merge pull request #502 from code-payments/feat/tipcard-deeplinks
bmc08gt Aug 9, 2024
90e7223
Merge remote-tracking branch 'origin/develop' into HEAD
bmc08gt Aug 9, 2024
f386b19
chore: move share tweet to tip behind beta flag
bmc08gt Aug 9, 2024
fcb492e
Merge pull request #503 from code-payments/feat/share-tweet-to-tip
bmc08gt Aug 9, 2024
8b949c0
chore(slideconfirm): make loading state visibility tied directly to l…
bmc08gt Aug 12, 2024
f7115fb
Merge pull request #504 from code-payments/fix/slide-confirm-loading-…
bmc08gt Aug 12, 2024
cce747a
chore: track tip card linkage
bmc08gt Aug 12, 2024
12513b5
Merge pull request #505 from code-payments/chore/track-tip-card-links
bmc08gt Aug 12, 2024
cfec920
build: prep next development cycle
bmc08gt Aug 12, 2024
567c9a3
chore: open app from push notification
bmc08gt Aug 13, 2024
553b69b
Merge pull request #506 from code-payments/chore/open-app-from-notifi…
bmc08gt Aug 13, 2024
554c264
chore: add a retry mechanism to retrieving account from AccountManager
bmc08gt Aug 13, 2024
7e893a9
Merge pull request #507 from code-payments/chore/account-login-retry
bmc08gt Aug 13, 2024
ff7f106
build: prep next development cycle
bmc08gt Aug 14, 2024
412bceb
fix(chat): use localized title for mute banner
bmc08gt Aug 14, 2024
c364904
Merge pull request #508 from code-payments/fix/use-localized-title-mu…
bmc08gt Aug 14, 2024
bc7ad47
chore(accounthome): move version info to BottomBar; draw with gradient
bmc08gt Aug 14, 2024
880808d
build: prep next development cycle
bmc08gt Aug 14, 2024
6bdbb80
Merge pull request #509 from code-payments/chore/move-version-info-to…
bmc08gt Aug 14, 2024
e527536
build: bump build number
bmc08gt Aug 16, 2024
3c06420
feat: add tip card to home screen behind beta flag
bmc08gt Aug 16, 2024
5af52ac
Merge pull request #510 from code-payments/feat/add-tipcard-to-homesc…
bmc08gt Aug 16, 2024
7baaf2d
chore: switch to generated versionCode
bmc08gt Aug 16, 2024
ca9eef1
chore: show instead of push ConnectAccountScreen from home screen
bmc08gt Aug 16, 2024
4e45694
build: prep next development cycle
bmc08gt Aug 16, 2024
275308c
chore: update translations
bmc08gt Aug 16, 2024
458fd64
Merge pull request #511 from code-payments/chore/update-translations
bmc08gt Aug 16, 2024
35aaf8e
chore: instrument breadcrumbs for core flows
bmc08gt Aug 16, 2024
50a33bd
Merge pull request #512 from code-payments/chore/breadcrumbs
bmc08gt Aug 16, 2024
e645db7
feat: update share action for tip cards
bmc08gt Aug 16, 2024
65367c8
Merge pull request #513 from code-payments/chore/update-share-action-…
bmc08gt Aug 16, 2024
29d5020
build: fetch all commits in CI
bmc08gt Aug 16, 2024
a10ae96
chore(tipcontroller): reduce polling frequency to 5s from 20; don't p…
bmc08gt Aug 19, 2024
3181389
Merge pull request #514 from code-payments/chore/tip-controller-polling
bmc08gt Aug 19, 2024
5d6ce83
chore: remove label for cancel bill action
bmc08gt Aug 19, 2024
166dd4e
Merge pull request #515 from code-payments/chore/remove-label-cancel-…
bmc08gt Aug 19, 2024
87edfa6
feat: simplify home bottom bar
bmc08gt Aug 19, 2024
b909806
Merge pull request #516 from code-payments/feat/home-simplify
bmc08gt Aug 19, 2024
01b557f
chore: create a tip verification state
bmc08gt Aug 19, 2024
31116b4
Merge pull request #517 from code-payments/chore/improve-twitter-veri…
bmc08gt Aug 19, 2024
18ce593
chore: update Give Kin title to Give Cash
bmc08gt Aug 19, 2024
09beff6
Merge pull request #518 from code-payments/chore/give-kin-give-cash
bmc08gt Aug 19, 2024
6c88beb
chore: update localizations
bmc08gt Aug 20, 2024
4ae4c3d
Merge pull request #519 from code-payments/chore/update-translations
bmc08gt Aug 20, 2024
e57c45a
build: update protobuf and grpc dependencies
bmc08gt Aug 20, 2024
a7effce
chore: split protos into own module; reorganize
bmc08gt Aug 20, 2024
b9226f5
Merge pull request #520 from code-payments/chore/update-protobuf-grpc
bmc08gt Aug 21, 2024
7a180d5
style(home): update bottom bar assets
bmc08gt Aug 21, 2024
acc07b8
Merge pull request #521 from code-payments/style/update-bottom-bar-as…
bmc08gt Aug 21, 2024
73efc90
feat: improve network resiliency when starting in a no network state
bmc08gt Aug 21, 2024
bfc061a
Merge pull request #522 from code-payments/fix/network-state-balance-…
bmc08gt Aug 21, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/build-upload-android-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:

steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Setup Java env
uses: actions/setup-java@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-upload-android-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:

steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Setup Java env
uses: actions/setup-java@v3
Expand Down
6 changes: 6 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.google.protobuf.gradle.protobuf

plugins {
id(Plugins.android_library)
id(Plugins.kotlin_android)
Expand Down Expand Up @@ -70,10 +72,14 @@ android {

dependencies {
implementation(project(":common:resources"))
api(project(":service:models"))
implementation(project(":crypto:ed25519"))
implementation(project(":crypto:kin"))

implementation(Libs.rxjava)
implementation(Libs.kotlinx_coroutines_core)
implementation(Libs.kotlinx_serialization_json)
implementation(Libs.kotlinx_datetime)
implementation(Libs.inject)

implementation(Libs.grpc_okhttp)
Expand Down
7 changes: 6 additions & 1 deletion api/src/main/java/com/getcode/analytics/AnalyticsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ class AnalyticsManager @Inject constructor(
)
}

override fun tipCardLinked() {
track(Name.TipCardLinked)
}

override fun backgroundSwapInitiated() {
track(Name.BackgroundSwap)
}
Expand Down Expand Up @@ -319,11 +323,12 @@ class AnalyticsManager @Inject constructor(
Login("Login"),
CreateAccount("Create Account"),
UnintentionalLogout("Unintentional Logout"),
TipCardLinked("Tip Card Linked"),

//Bill
Bill("Bill"),
Request("Request Card"),
TipCard("TIp Card"),
TipCard("Tip Card"),

//Transfer
Transfer("Transfer"),
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/getcode/analytics/AnalyticsService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface AnalyticsService {
fun withdrawal(amount: KinAmount, successful: Boolean)

fun tipCardShown(username: String)
fun tipCardLinked()

fun backgroundSwapInitiated()
fun unintentionalLogout()
Expand Down Expand Up @@ -93,6 +94,7 @@ class AnalyticsServiceNull : AnalyticsService {
override fun upgradePrivacy(successful: Boolean, intentId: PublicKey, actionCount: Int) = Unit
override fun onBillReceived() = Unit
override fun tipCardShown(username: String) = Unit
override fun tipCardLinked() = Unit
override fun backgroundSwapInitiated() = Unit
override fun unintentionalLogout() = Unit
override fun appSettingToggled(setting: AppSetting, value: Boolean) = Unit
Expand Down
6 changes: 6 additions & 0 deletions api/src/main/java/com/getcode/db/ConversationDao.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.getcode.db

import androidx.paging.PagingData
import androidx.paging.PagingSource
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
Expand All @@ -19,6 +21,10 @@ interface ConversationDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertConversations(vararg conversation: Conversation)

@RewriteQueriesToDropUnusedColumns
@Query("SELECT * FROM conversations")
fun observeConversations(): PagingSource<Int, Conversation>

@RewriteQueriesToDropUnusedColumns
@Query("SELECT * FROM conversations LEFT JOIN conversation_pointers ON conversations.idBase58 = conversation_pointers.conversationIdBase58 WHERE conversations.idBase58 = :id")
fun observeConversation(id: String): Flow<ConversationWithLastPointers?>
Expand Down
1 change: 0 additions & 1 deletion api/src/main/java/com/getcode/mapper/ConversationMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.getcode.model.Conversation
import com.getcode.model.chat.Chat
import com.getcode.model.chat.ChatType
import com.getcode.model.chat.self
import com.getcode.network.TipController
import com.getcode.network.localized
import com.getcode.network.repository.base58
import com.getcode.util.resources.ResourceHelper
Expand Down
13 changes: 9 additions & 4 deletions api/src/main/java/com/getcode/model/Feature.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ data class TipCardFeature(
override val available: Boolean = true, // always available
): Feature

data class TipChatFeature(
override val enabled: Boolean = BetaOptions.Defaults.tipsChatEnabled,
data class TipCardOnHomeScreenFeature(
override val enabled: Boolean = BetaOptions.Defaults.tipCardOnHomeScreen,
override val available: Boolean = true, // always available
): Feature

data class TipChatCashFeature(
override val enabled: Boolean = BetaOptions.Defaults.tipsChatCashEnabled,
data class ConversationsFeature(
override val enabled: Boolean = BetaOptions.Defaults.conversationsEnabled,
override val available: Boolean = true, // always available
): Feature

data class ConversationCashFeature(
override val enabled: Boolean = BetaOptions.Defaults.conversationCashEnabled,
override val available: Boolean = true, // always available
): Feature

Expand Down
7 changes: 5 additions & 2 deletions api/src/main/java/com/getcode/model/Kin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ data class Kin(val quarks: Long): Value {
}
}

fun min(a: Kin, b: Kin): Kin {
private fun min(a: Kin, b: Kin): Kin {
if (a.quarks > b.quarks) {
return b
}

return a
}
}

val Kin.description: String
get() = "K ${toKinTruncating().quarks} ${fractionalQuarks()}"
9 changes: 5 additions & 4 deletions api/src/main/java/com/getcode/model/PrefBool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ sealed class PrefsBool(val value: String) {
data object IS_ELIGIBLE_GIVE_FIRST_KIN_AIRDROP: PrefsBool("is_eligible_give_first_kin_airdrop"), InternalRouting
data object HAS_REMOVED_LOCAL_CURRENCY: PrefsBool("removed_local_currency"), InternalRouting
data object SEEN_TIP_CARD : PrefsBool("seen_tip_card"), InternalRouting
data object STARTED_TIP_CONNECT: PrefsBool("started_tip_connect"), InternalRouting

data object BUY_MODULE_AVAILABLE : PrefsBool("buy_module_available"), InternalRouting

Expand All @@ -43,14 +44,14 @@ sealed class PrefsBool(val value: String) {
data object SHOW_CONNECTIVITY_STATUS: PrefsBool("debug_no_network"), BetaFlag
data object GIVE_REQUESTS_ENABLED: PrefsBool("give_requests_enabled"), BetaFlag
data object BUY_MODULE_ENABLED : PrefsBool("buy_kin_enabled"), BetaFlag


data object CHAT_UNSUB_ENABLED: PrefsBool("chat_unsub_enabled"), BetaFlag
data object TIPS_ENABLED : PrefsBool("tips_enabled"), BetaFlag
data object TIPS_CHAT_ENABLED: PrefsBool("tips_chat_enabled"), BetaFlag
data object TIPS_CHAT_CASH_ENABLED: PrefsBool("tips_chat_cash_enabled"), BetaFlag
data object CONVERSATIONS_ENABLED: PrefsBool("conversations_enabled"), BetaFlag
data object CONVERSATION_CASH_ENABLED: PrefsBool("convo_cash_enabled"), BetaFlag
data object BALANCE_CURRENCY_SELECTION_ENABLED: PrefsBool("balance_currency_enabled"), BetaFlag
data object KADO_WEBVIEW_ENABLED : PrefsBool("kado_inapp_enabled"), BetaFlag
data object SHARE_TWEET_TO_TIP : PrefsBool("share_tweet_to_tip"), BetaFlag
data object TIP_CARD_ON_HOMESCREEN: PrefsBool("tip_card_on_home_screen"), BetaFlag
}

val APP_SETTINGS: List<AppSetting> = listOf(PrefsBool.CAMERA_START_BY_DEFAULT, PrefsBool.REQUIRE_BIOMETRICS)
5 changes: 5 additions & 0 deletions api/src/main/java/com/getcode/model/chat/Chat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.getcode.model.chat

import com.getcode.model.Cursor
import com.getcode.model.ID
import kotlinx.serialization.Serializable
import java.util.UUID

/**
Expand All @@ -18,6 +19,7 @@ import java.util.UUID
* @param cursor [Cursor] value for this chat for reference in subsequent GetChatsRequest
* @param messages List of messages within this chat
*/
@Serializable
data class Chat(
val id: ID,
val type: ChatType,
Expand Down Expand Up @@ -135,6 +137,9 @@ data class Chat(
val Chat.isV2: Boolean
get() = members.isNotEmpty()

val Chat.isNotification: Boolean
get() = type == ChatType.Notification

val Chat.isConversation: Boolean
get() = type == ChatType.TwoWay

Expand Down
4 changes: 4 additions & 0 deletions api/src/main/java/com/getcode/model/chat/ChatMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.getcode.ed25519.Ed25519.KeyPair
import com.getcode.model.Cursor
import com.getcode.model.ID
import com.getcode.model.MessageStatus
import com.getcode.utils.serializer.UUIDSerializer
import kotlinx.serialization.Serializable
import java.util.UUID

/**
Expand All @@ -18,8 +20,10 @@ import java.util.UUID
* @param contents Ordered message content. A message may have more than one piece of content.
* @param status Derived [MessageStatus] from [Pointer]'s in [ChatMember].
*/
@Serializable
data class ChatMessage(
val id: ID, // time based UUID in v2
@Serializable(with = UUIDSerializer::class)
val senderId: UUID?,
val isFromSelf: Boolean,
val cursor: Cursor,
Expand Down
51 changes: 31 additions & 20 deletions api/src/main/java/com/getcode/network/BalanceController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.getcode.solana.organizer.Organizer
import com.getcode.solana.organizer.Tray
import com.getcode.utils.FormatUtils
import com.getcode.utils.network.NetworkConnectivityListener
import com.getcode.utils.network.retryable
import com.getcode.utils.trace
import io.reactivex.rxjava3.core.Completable
import kotlinx.coroutines.CoroutineScope
Expand All @@ -23,6 +24,7 @@ import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
Expand All @@ -38,8 +40,7 @@ data class BalanceDisplay(
val marketValue: Double = 0.0,
val formattedValue: String = "",
val currency: Currency? = null,

)
)

open class BalanceController @Inject constructor(
exchange: Exchange,
Expand All @@ -65,25 +66,34 @@ open class BalanceController @Inject constructor(
.stateIn(scope, SharingStarted.Eagerly, BalanceDisplay())

init {
combine(
exchange.observeLocalRate()
.flowOn(Dispatchers.IO)
.onEach {
val display = _balanceDisplay.value ?: BalanceDisplay()
_balanceDisplay.value = display.copy(currency = getCurrencyFromCode(it.currency))
networkObserver.state
.map { it.connected }
.onEach { connected ->
if (connected) {
retryable({ fetchBalanceSuspend() })
}
}
.flatMapLatest {
combine(
exchange.observeLocalRate()
.flowOn(Dispatchers.IO)
.onEach {
val display = _balanceDisplay.value ?: BalanceDisplay()
_balanceDisplay.value =
display.copy(currency = getCurrencyFromCode(it.currency))
}
.onEach { exchange.fetchRatesIfNeeded() },
balanceRepository.balanceFlow,
) { rate, balance ->
rate to balance.coerceAtLeast(0.0)
}.map { (rate, balance) ->
refreshBalance(balance, rate)
}
.onEach { exchange.fetchRatesIfNeeded() },
balanceRepository.balanceFlow,
networkObserver.state
) { rate, balance, _ ->
rate to balance.coerceAtLeast(0.0)
}.map { (rate, balance) ->
refreshBalance(balance, rate)
}.distinctUntilChanged().onEach { (marketValue, amountText) ->
val display = _balanceDisplay.value ?: BalanceDisplay()
_balanceDisplay.value =
display.copy(marketValue = marketValue, formattedValue = amountText)
}.launchIn(scope)
}.distinctUntilChanged().onEach { (marketValue, amountText) ->
val display = _balanceDisplay.value ?: BalanceDisplay()
_balanceDisplay.value =
display.copy(marketValue = marketValue, formattedValue = amountText)
}.launchIn(scope)
}

fun setTray(organizer: Organizer, tray: Tray) {
Expand Down Expand Up @@ -155,6 +165,7 @@ open class BalanceController @Inject constructor(


suspend fun fetchBalanceSuspend() {
Timber.d("fetching balance")
if (SessionManager.isAuthenticated() != true) {
Timber.d("FetchBalance - Not authenticated")
return
Expand Down
Loading