@@ -8,9 +8,11 @@ import (
88 "golang.org/x/text/message"
99
1010 commonpb "github.com/code-payments/flipcash2-protobuf-api/generated/go/common/v1"
11+ pushpb "github.com/code-payments/flipcash2-protobuf-api/generated/go/push/v1"
1112
1213 "github.com/code-payments/flipcash2-server/localization"
1314 ocp_currency "github.com/code-payments/ocp-server/currency"
15+ ocp_common "github.com/code-payments/ocp-server/ocp/common"
1416)
1517
1618var (
@@ -24,34 +26,62 @@ func SendUsdfDepositedPush(ctx context.Context, pusher Pusher, user *commonpb.Us
2426 "$%.2f was added to your USD Reserves" ,
2527 usdMarketValue ,
2628 )
27- return pusher .SendBasicPushes (ctx , title , body , user )
29+ customPayload := & pushpb.Payload {
30+ Navigation : & pushpb.Navigation {
31+ Type : & pushpb.Navigation_CurrencyInfo {
32+ CurrencyInfo : & commonpb.PublicKey {Value : ocp_common .CoreMintAccount .PublicKey ().ToBytes ()},
33+ },
34+ },
35+ }
36+ return pusher .SendPushes (ctx , title , body , customPayload , user )
2837}
2938
30- func SendFlipcashCurrencyDepositedPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , currencyName string , usdMarketValue float64 ) error {
39+ func SendFlipcashCurrencyDepositedPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , mint * commonpb. PublicKey , currencyName string , usdMarketValue float64 ) error {
3140 title := fmt .Sprintf ("%s Now Available" , currencyName )
3241 body := amountPrinter .Sprintf (
3342 "$%.2f of %s was added to your Flipcash wallet" ,
3443 usdMarketValue ,
3544 currencyName ,
3645 )
37- return pusher .SendBasicPushes (ctx , title , body , user )
46+ customPayload := & pushpb.Payload {
47+ Navigation : & pushpb.Navigation {
48+ Type : & pushpb.Navigation_CurrencyInfo {
49+ CurrencyInfo : mint ,
50+ },
51+ },
52+ }
53+ return pusher .SendPushes (ctx , title , body , customPayload , user )
3854}
3955
40- func SendFlipcashCurrencyBoughtPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , currencyName string , region ocp_currency.Code , nativeAmount float64 ) error {
56+ func SendFlipcashCurrencyBoughtPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , mint * commonpb. PublicKey , currencyName string , region ocp_currency.Code , nativeAmount float64 ) error {
4157 title := fmt .Sprintf ("%s Successfully Purchased" , currencyName )
4258 body := amountPrinter .Sprintf (
4359 "%s of %s was added to your Flipcash wallet" ,
4460 localization .FormatFiat (defaultLocale , region , nativeAmount ),
4561 currencyName ,
4662 )
47- return pusher .SendBasicPushes (ctx , title , body , user )
63+ customPayload := & pushpb.Payload {
64+ Navigation : & pushpb.Navigation {
65+ Type : & pushpb.Navigation_CurrencyInfo {
66+ CurrencyInfo : mint ,
67+ },
68+ },
69+ }
70+ return pusher .SendPushes (ctx , title , body , customPayload , user )
4871}
4972
50- func SendFlipcashCurrencySoldPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , currencyName string , region ocp_currency.Code , nativeAmount float64 ) error {
73+ func SendFlipcashCurrencySoldPush (ctx context.Context , pusher Pusher , user * commonpb.UserId , mint * commonpb. PublicKey , currencyName string , region ocp_currency.Code , nativeAmount float64 ) error {
5174 title := fmt .Sprintf ("%s Successfully Sold" , currencyName )
5275 body := amountPrinter .Sprintf (
5376 "%s was added to your USD Reserves" ,
5477 localization .FormatFiat (defaultLocale , region , nativeAmount ),
5578 )
56- return pusher .SendBasicPushes (ctx , title , body , user )
79+ customPayload := & pushpb.Payload {
80+ Navigation : & pushpb.Navigation {
81+ Type : & pushpb.Navigation_CurrencyInfo {
82+ CurrencyInfo : mint ,
83+ },
84+ },
85+ }
86+ return pusher .SendPushes (ctx , title , body , customPayload , user )
5787}
0 commit comments