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
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sealed interface HomeResult {
data class Request(val amount: KinAmount) : HomeResult
data class ConfirmTip(val amount: KinAmount) : HomeResult
data object ShowTipCard : HomeResult
data object CancelTipEntry: HomeResult
}

@Parcelize
Expand Down Expand Up @@ -66,6 +67,10 @@ data class HomeScreen(
is HomeResult.ShowTipCard -> {
vm.presentShareableTipCard()
}

is HomeResult.CancelTipEntry -> {
vm.cancelTipEntry()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.getcode.navigation.screens

import android.webkit.JavascriptInterface
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
Expand Down Expand Up @@ -436,13 +437,20 @@ data class EnterTipModal(val isInChat: Boolean = false) : MainGraph, ModalRoot {
} else {
navigator.progress > 0f
}
},
onCloseClicked = {
navigator.hideWithResult(HomeResult.CancelTipEntry)
}
) {
EnterTipScreen(getViewModel()) { result ->
navigator.hideWithResult(result)
}
}
}

BackHandler {
navigator.hideWithResult(HomeResult.CancelTipEntry)
}
}

}
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/com/getcode/view/main/home/HomeScan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
import cafe.adriel.voyager.core.stack.StackEvent
import com.getcode.LocalBiometricsState
import com.getcode.R
import com.getcode.manager.TopBarManager
Expand Down Expand Up @@ -127,15 +128,6 @@ fun HomeScreen(
}
.launchIn(this)
}

LaunchedEffect(navigator) {
// reset tip entry state when tip entry is manually dismissed
// without advancing next
snapshotFlow { navigator.progress }
.filter { it == 0f && navigator.lastModalItem is EnterTipModal }
.onEach { homeViewModel.cancelTipEntry() }
.launchIn(this)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private fun TweetPreview(
modifier = Modifier.weight(1f),
text = xMessage,
color = Color.White,
style = CodeTheme.typography.textSmall
style = CodeTheme.typography.textSmall,
)
}
}
Expand Down