How can ConnectionManager get expiredRegistrationId that was captured in AndroidPush class?
Am I doing this the wrong way?
Any suggestions on how I may improve my solution?
Is there any pattern I could follow?
Solution : Managers
public class ConnectionManger
{
private readonly IPushManager pushManager = new PushManager();
public void NotifyAppUser(List<PushNotificationSubscription> regIds, Alert alert)
{
pushManager.PushNotification(regIds, alert);
var expiredRegistrationId = ??
}
}
Solution : PushNotification
public class PushManager : IPushManager
{
public void PushNotification(List<PushNotificationSubscription> registeredPhone, Alert alert)
{
AndroidPush androidPush = new AndroidPush();
androidPush.Push(alert, registeredPhone);
}
}
public class AndroidPush : IPushNotificationStrategy
{
public void Push(Alert alert, List<string> registrationIds)
{
// Wait for GCM server
#region GCM Events
gcmBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
var expiredRegistrationId = aggregateEx.OldId;
Q: How do i pass expiredRegistrationId to ConnectionManager class?
};
}
}