Closed gronpipmaster closed 9 years ago
@gronpipmaster the change is not backwards-compatible, as Notification.Payload() now returns a Topic (it used to return a *Payload). Any chance of making this backwards-compatible?
Yes you are right, but I believe that the use of:
payload := notif.Payload().(*apns.Payload)
Is bad idea. Custom type custing, reflection, and other.
New usage:
payload := new(apns.Payload)
payload.SetAlertString("Alert")
notif.SetPayload(payload)
//or create me type support method Bytes
type MyPayload struct {
foo []byte
}
func(m MyPayload) Bytes() ([]byte, error){
return m.foo, nil
}
payload := &MyPayload{foo:[]byte(`{"aps":{"alert":"Alert 111!","badge":1}}`)}
notif.SetPayload(payload)
This small backwards-compatible change allows a more versatile use.
Thanks!