-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suite-native): send review cancelation dialog
- Loading branch information
Showing
14 changed files
with
86 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
suite-native/module-send/src/hooks/useShowReviewCancellationAlert.tsx
This file contains 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,33 @@ | ||
import { useDispatch } from 'react-redux'; | ||
|
||
import { useAlert } from '@suite-native/alerts'; | ||
import { Translation } from '@suite-native/intl'; | ||
import { cancelSignSendFormTransactionThunk } from '@suite-common/wallet-core'; | ||
|
||
type AlertResolveValue = { wasReviewCanceled: boolean }; | ||
|
||
export const useShowReviewCancellationAlert = () => { | ||
const { showAlert } = useAlert(); | ||
const dispatch = useDispatch(); | ||
|
||
const showReviewCancellationAlert = () => | ||
new Promise<AlertResolveValue>(resolve => | ||
showAlert({ | ||
title: <Translation id="moduleSend.review.cancelAlert.title" />, | ||
primaryButtonTitle: <Translation id="generic.buttons.cancel" />, | ||
primaryButtonVariant: 'redBold', | ||
secondaryButtonVariant: 'redElevation0', | ||
secondaryButtonTitle: ( | ||
<Translation id="moduleSend.review.cancelAlert.continueButton" /> | ||
), | ||
onPressPrimaryButton: () => { | ||
dispatch(cancelSignSendFormTransactionThunk()); | ||
|
||
return resolve({ wasReviewCanceled: true }); | ||
}, | ||
onPressSecondaryButton: () => resolve({ wasReviewCanceled: false }), | ||
}), | ||
); | ||
|
||
return showReviewCancellationAlert; | ||
}; |
This file contains 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 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 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 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 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 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 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