Skip to content

Commit 468498b

Browse files
authored
Use thread ID and category for chat message pushes (#82)
1 parent 90fe742 commit 468498b

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

pkg/code/push/data.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ func sendMutableNotificationToOwner(
115115
ctx,
116116
pushTokenRecord.PushToken,
117117
titleKey,
118+
string(notificationType),
119+
titleKey, // All mutable pushes have a thread ID that's the title
118120
kvs,
119121
)
120122
case push_data.TokenTypeFcmAndroid:

pkg/push/fcm/provider.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ func (p *provider) SendPush(ctx context.Context, pushToken, title, body string)
8989
}
9090

9191
// SendMutableAPNSPush implements push.Provider.SendMutableAPNSPush
92-
func (p *provider) SendMutableAPNSPush(ctx context.Context, pushToken, titleKey string, kvs map[string]string) error {
92+
func (p *provider) SendMutableAPNSPush(
93+
ctx context.Context,
94+
pushToken,
95+
titleKey, category, threadId string,
96+
kvs map[string]string,
97+
) error {
9398
defer metrics.TraceMethodCall(ctx, metricsStructName, "SendMutableAPNSPush").End()
9499

95100
_, err := p.client.Send(ctx, &messaging.Message{
@@ -102,6 +107,8 @@ func (p *provider) SendMutableAPNSPush(ctx context.Context, pushToken, titleKey
102107
TitleLocKey: titleKey,
103108
Body: "...",
104109
},
110+
Category: category,
111+
ThreadID: threadId,
105112
MutableContent: true,
106113
},
107114
},

pkg/push/memory/provider.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ func (p *provider) SendPush(ctx context.Context, pushToken, title, body string)
3535
}
3636

3737
// SendMutableAPNSPush implements push.Provider.SendMutableAPNSPush
38-
func (p *provider) SendMutableAPNSPush(ctx context.Context, pushToken, titleKey string, kvs map[string]string) error {
38+
func (p *provider) SendMutableAPNSPush(
39+
ctx context.Context,
40+
pushToken,
41+
titleKey, category, threadId string,
42+
kvs map[string]string,
43+
) error {
3944
return simulateSendingPush(pushToken)
4045
}
4146

pkg/push/provider.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ type Provider interface {
1313

1414
// SendMutableAPNSPush sends a push over APNS with a text body that's mutable
1515
// on the client using custom key value pairs
16-
SendMutableAPNSPush(ctx context.Context, pushToken, titleKey string, kvs map[string]string) error
16+
SendMutableAPNSPush(
17+
ctx context.Context,
18+
pushToken,
19+
titleKey, category, threadId string,
20+
kvs map[string]string,
21+
) error
1722

1823
// SendDataPush sends a data push
1924
SendDataPush(ctx context.Context, pushToken string, kvs map[string]string) error

0 commit comments

Comments
 (0)