* Some improve
1. Use bytes.Buffer.String or bytes.Buffer.Bytes
2. Use a single append to concatenate two slices
3. Poor file permissions used when creating file or using chmod
4. Using a deprecated function, variable, constant or field
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* improve
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* if queue is full then mark notification as failed and unblock the wait group instead of hanging
* use WaitDone() function instead of calling Done() on notification wait group as it is safer
* feat: add tryEnqueue function.
tryEnqueue tries to enqueue a job to the given job channel. Returns true if
the operation was successful, and false if enqueuing would not have been
possible without blocking. Job is not enqueued in the latter case.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* remove inital worker
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Currently the notification, if a sound is specified, will be converted into a critical notification. This behaviour occurs because the sideshow/apns2 package initializes a new sound-dict on `payload.SoundName()` and inserts the name into it. If the sound-key is specified as a dictionary, the alert will be seen as a critical alert according to the documentation [developer.apple.com/documentation/usernotifications](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943363).
In order to prevent the notification to get a critical one by specifying a sound, the sound name from the rest-API needs to be set as string to the sound-property of the payload for apns. This can be achieved by setting either the sound-key from the request to the sound property of the payload if it is a string or by setting the soundname-key from the request to the sound property without the usage of `payload.SoundName()`. For more consistency to the documentation, this pull request implements the variant, that the sound-key from the request is set as string into the sound-property of the apns-payload.