-
Notifications
You must be signed in to change notification settings - Fork 1
Add Liquidity in Receive Flow #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3e5f153
feat: LiquidityFeeScreen WIP
jvsena42 0e6d321
Merge branch 'master' into feat/add-liquidity
jvsena42 f0a0e16
feat: create shouldRequestAdditionalLiquidity method
jvsena42 17341d0
refactor: wrap on try catch
jvsena42 2ab7ccb
feat: navigation logic
jvsena42 bc2708c
feat: cjit invoice creation
jvsena42 7f5249e
feat: clog invoice creation
jvsena42 08780cf
feat: update invoice call
jvsena42 d3fa78a
feat: adapt ReceiveConfirmScreen to add liquidity
jvsena42 ade33be
feat: adapt ReceiveLiquidityScreen to add liquidity
jvsena42 211d741
feat: remove comments
jvsena42 c3de24a
test: shouldRequestAdditionalLiquidity tests
jvsena42 329a006
test: EditInvoiceVM tests
jvsena42 0f34324
feat: preview
jvsena42 645a55c
fix: adapt bg image to small devices
jvsena42 495d7ef
Merge pull request #138 from synonymdev/fix/bg-image-receive-confirm
ovitrif e1e1ff9
refactor: line formatting
jvsena42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/src/main/java/to/bitkit/ui/screens/wallets/receive/EditInvoiceVM.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package to.bitkit.ui.screens.wallets.receive | ||
|
|
||
| import androidx.lifecycle.ViewModel | ||
| import androidx.lifecycle.viewModelScope | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
| import kotlinx.coroutines.flow.asSharedFlow | ||
| import kotlinx.coroutines.launch | ||
| import to.bitkit.repositories.WalletRepo | ||
| import to.bitkit.utils.Logger | ||
| import javax.inject.Inject | ||
|
|
||
| @HiltViewModel | ||
| class EditInvoiceVM @Inject constructor( | ||
| val walletRepo: WalletRepo | ||
| ): ViewModel() { | ||
|
|
||
| private val _editInvoiceEffect = MutableSharedFlow<EditInvoiceScreenEffects>(extraBufferCapacity = 1) | ||
| val editInvoiceEffect = _editInvoiceEffect.asSharedFlow() | ||
| private fun editInvoiceEffect(effect: EditInvoiceScreenEffects) = viewModelScope.launch { _editInvoiceEffect.emit(effect) } | ||
|
|
||
| fun onClickContinue() { | ||
| viewModelScope.launch { | ||
| walletRepo.shouldRequestAdditionalLiquidity().onSuccess { shouldRequest -> | ||
| if (shouldRequest) { | ||
| editInvoiceEffect(EditInvoiceScreenEffects.NavigateAddLiquidity) | ||
| } else { | ||
| editInvoiceEffect(EditInvoiceScreenEffects.UpdateInvoice) | ||
| } | ||
| }.onFailure { | ||
| Logger.warn("Error checking for liquidity, navigating back to QR Screen", context = TAG) | ||
| editInvoiceEffect(EditInvoiceScreenEffects.UpdateInvoice) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| sealed interface EditInvoiceScreenEffects { | ||
| data object UpdateInvoice : EditInvoiceScreenEffects | ||
| data object NavigateAddLiquidity : EditInvoiceScreenEffects | ||
| } | ||
|
|
||
| companion object { | ||
| const val TAG = "EditInvoiceVM" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.