@@ -33,13 +33,6 @@ export function useOndoCampaignEndedOutcomeToast(
3333 const { showToast } = useRewardsToast ( ) ;
3434
3535 const subscriptionId = useSelector ( selectRewardsSubscriptionId ) ;
36- const toastKey =
37- subscriptionId && campaignId ? `${ subscriptionId } :${ campaignId } ` : '' ;
38- const isDismissed = useSelector (
39- selectIsCampaignOutcomeToastDismissed ( subscriptionId ?? undefined , campaignId ) ,
40- ) ;
41-
42- const hasShownRef = useRef ( false ) ;
4336
4437 const isEligible =
4538 campaign ?. type === CampaignType . ONDO_HOLDING &&
@@ -51,6 +44,28 @@ export function useOndoCampaignEndedOutcomeToast(
5144 isEligible ? campaignId : undefined ,
5245 ) ;
5346
47+ const outcomeVariant = outcome
48+ ? outcome . winnerVerificationCode && outcome . outcomeStatus === 'pending'
49+ ? 'winner_pending'
50+ : ! outcome . winnerVerificationCode && outcome . outcomeStatus === 'finalized'
51+ ? 'participant_finalized'
52+ : undefined
53+ : undefined ;
54+
55+ const toastKey =
56+ subscriptionId && campaignId && outcomeVariant
57+ ? `${ subscriptionId } :${ campaignId } :${ outcomeVariant } `
58+ : '' ;
59+ const isDismissed = useSelector (
60+ selectIsCampaignOutcomeToastDismissed (
61+ subscriptionId ?? undefined ,
62+ campaignId ,
63+ outcomeVariant ,
64+ ) ,
65+ ) ;
66+
67+ const shownVariantsRef = useRef ( new Set < string > ( ) ) ;
68+
5469 const handleDismiss = useCallback ( ( ) => {
5570 toastRef ?. current ?. closeToast ( ) ;
5671 if ( toastKey ) {
@@ -62,8 +77,9 @@ export function useOndoCampaignEndedOutcomeToast(
6277 if (
6378 ! isEligible ||
6479 ! outcome ||
80+ ! outcomeVariant ||
6581 isDismissed ||
66- hasShownRef . current ||
82+ shownVariantsRef . current . has ( outcomeVariant ) ||
6783 ! campaignId
6884 ) {
6985 return ;
@@ -75,7 +91,7 @@ export function useOndoCampaignEndedOutcomeToast(
7591 const isPending = outcome . outcomeStatus === 'pending' ;
7692
7793 if ( isFinalized && ! hasCode ) {
78- hasShownRef . current = true ;
94+ shownVariantsRef . current . add ( 'participant_finalized' ) ;
7995 showToast ( {
8096 variant : ToastVariants . Icon ,
8197 iconName : IconName . Confirmation ,
@@ -85,17 +101,22 @@ export function useOndoCampaignEndedOutcomeToast(
85101 hapticsType : NotificationFeedbackType . Success ,
86102 labelOptions : [
87103 {
88- label : strings ( 'rewards.ondo_outcome_toast.participant_finalized.title' ) ,
104+ label : strings (
105+ 'rewards.ondo_outcome_toast.participant_finalized.title' ,
106+ ) ,
89107 isBold : true ,
90108 } ,
91109 ] ,
92110 descriptionOptions : {
93111 description : strings (
94112 'rewards.ondo_outcome_toast.participant_finalized.description' ,
113+ { campaignName : campaign ?. name ?? '' } ,
95114 ) ,
96115 } ,
97116 linkButtonOptions : {
98- label : strings ( 'rewards.ondo_outcome_toast.view' ) ,
117+ label : strings (
118+ 'rewards.ondo_outcome_toast.participant_finalized.view' ,
119+ ) ,
99120 onPress : ( ) => {
100121 navigation . navigate ( Routes . REWARDS_ONDO_CAMPAIGN_LEADERBOARD , {
101122 campaignId : resolvedCampaignId ,
@@ -109,7 +130,7 @@ export function useOndoCampaignEndedOutcomeToast(
109130 } ,
110131 } ) ;
111132 } else if ( isPending && hasCode ) {
112- hasShownRef . current = true ;
133+ shownVariantsRef . current . add ( 'winner_pending' ) ;
113134 showToast ( {
114135 variant : ToastVariants . Icon ,
115136 iconName : IconName . Star ,
@@ -126,10 +147,13 @@ export function useOndoCampaignEndedOutcomeToast(
126147 descriptionOptions : {
127148 description : strings (
128149 'rewards.ondo_outcome_toast.winner_pending.description' ,
150+ { campaignName : campaign ?. name ?? '' } ,
129151 ) ,
130152 } ,
131153 linkButtonOptions : {
132- label : strings ( 'rewards.ondo_outcome_toast.view_details' ) ,
154+ label : strings (
155+ 'rewards.ondo_outcome_toast.winner_pending.view_details' ,
156+ ) ,
133157 onPress : ( ) => {
134158 navigation . navigate ( Routes . REWARDS_ONDO_CAMPAIGN_WINNING_VIEW , {
135159 campaignId : resolvedCampaignId ,
@@ -147,6 +171,7 @@ export function useOndoCampaignEndedOutcomeToast(
147171 } , [
148172 isEligible ,
149173 outcome ,
174+ outcomeVariant ,
150175 isDismissed ,
151176 campaignId ,
152177 campaign ,
0 commit comments