Validity check failed: Device token is invalid
Hi.. I faced a problem when trying to create a Rpush::Apns::Notification because the device_token from an user was longer than 64 characters and according to iOS documentation (https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW14):
APNs device tokens are of variable length. Do not hard-code their size.
So the thing is that in the generators templates you put a limit of 64 characters for this attribute. In the case that I saw in my project, an user has a device_token with 108 characters. He installed the app but he doesn't receive the notifications because the validation fails. I think it's better to remove the length restriction, according to the documentation link above.
I already created a local migration to change that in the Rpush::Notification table of my project but Rpush has this validator that doesn't allow me to save it :https://github.com/rpush/rpush/blob/master/lib/rpush/client/active_model/apns/device_token_format_validator.rb
Fix for it: https://github.com/rpush/rpush/pull/463