This commit is contained in:
Vicente Ferrari Smith 2026-05-10 16:48:48 +02:00
parent c143311608
commit 16d4c8b521

View File

@ -16,6 +16,7 @@ func runSendTestNotification(args []string) {
email := fs.String("email", "", "Send to all device tokens for this user") email := fs.String("email", "", "Send to all device tokens for this user")
deviceToken := fs.String("token", "", "Send to this specific device token") deviceToken := fs.String("token", "", "Send to this specific device token")
message := fs.String("message", "Test notification", "Notification body") message := fs.String("message", "Test notification", "Notification body")
sandbox := fs.Bool("sandbox", false, "Use APNs sandbox (development builds)")
fs.Parse(args) fs.Parse(args)
if *email == "" && *deviceToken == "" { if *email == "" && *deviceToken == "" {
@ -38,11 +39,13 @@ func runSendTestNotification(args []string) {
fmt.Fprintf(os.Stderr, "apns key: %v\n", err) fmt.Fprintf(os.Stderr, "apns key: %v\n", err)
os.Exit(1) os.Exit(1)
} }
client := apns.NewTokenClient(&token.Token{ t := &token.Token{AuthKey: authKey, KeyID: keyID, TeamID: teamID}
AuthKey: authKey, var client *apns.Client
KeyID: keyID, if *sandbox {
TeamID: teamID, client = apns.NewTokenClient(t).Development()
}).Production() } else {
client = apns.NewTokenClient(t).Production()
}
var targets []string var targets []string