basic firebase notification sending + token registration logic
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package SuMoC.backend.firebase;
|
||||
|
||||
import SuMoC.backend.notification.models.Notification;
|
||||
import com.google.firebase.messaging.Message;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class FirebaseMessageBuilder {
|
||||
|
||||
public Message generateMessage(Notification notification, String token) {
|
||||
var builder = Message.builder().setToken(token);
|
||||
builder.putData("type", notification.getType().toString());
|
||||
builder.putData("data", notification.getData());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user