|
@@ -400,13 +400,9 @@
|
|
|
#pragma mark ===== Push Notification =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- (void)subscribingNextcloudServerPushNotification
|
|
|
+- (void)subscribingNextcloudServerPushNotification:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url
|
|
|
{
|
|
|
- // test
|
|
|
- if (self.activeAccount.length == 0 || self.maintenanceMode)
|
|
|
- return;
|
|
|
-
|
|
|
- OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:self.activeUser withUserID:self.activeUserID withPassword:self.activePassword withUrl:self.activeUrl];
|
|
|
+ OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:user withUserID:userID withPassword:password withUrl:url];
|
|
|
|
|
|
[[NCPushNotificationEncryption sharedInstance] generatePushNotificationsKeyPair];
|
|
|
|
|
@@ -418,7 +414,7 @@
|
|
|
self.pnDeviceIdentifierSignature = nil;
|
|
|
self.pnPublicKey = nil;
|
|
|
|
|
|
- [ocNetworking subscribingPushNotificationServer:self.activeUrl pushToken:pushToken Hash:pushTokenHash devicePublicKey:devicePublicKey success:^(NSString *deviceIdentifier, NSString *deviceIdentifierSignature, NSString *publicKey) {
|
|
|
+ [ocNetworking subscribingPushNotificationServer:url pushToken:pushToken Hash:pushTokenHash devicePublicKey:devicePublicKey success:^(NSString *deviceIdentifier, NSString *deviceIdentifierSignature, NSString *publicKey) {
|
|
|
NSLog(@"[LOG] Subscribed to Push Notification server & proxy successfully.");
|
|
|
self.pnDeviceIdentifier = deviceIdentifier;
|
|
|
self.pnDeviceIdentifierSignature = deviceIdentifierSignature;
|
|
@@ -428,15 +424,11 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)unsubscribingNextcloudServerPushNotification
|
|
|
+- (void)unsubscribingNextcloudServerPushNotification:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url
|
|
|
{
|
|
|
- // test
|
|
|
- if (self.activeAccount.length == 0 || self.maintenanceMode)
|
|
|
- return;
|
|
|
-
|
|
|
- OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:self.activeUser withUserID:self.activeUserID withPassword:self.activePassword withUrl:self.activeUrl];
|
|
|
+ OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:user withUserID:userID withPassword:password withUrl:url];
|
|
|
|
|
|
- [ocNetworking unsubscribingPushNotificationServer:self.activeUrl deviceIdentifier:self.pnDeviceIdentifier deviceIdentifierSignature:self.pnDeviceIdentifierSignature publicKey:self.pnPublicKey success:^{
|
|
|
+ [ocNetworking unsubscribingPushNotificationServer:url deviceIdentifier:self.pnDeviceIdentifier deviceIdentifierSignature:self.pnDeviceIdentifierSignature publicKey:self.pnPublicKey success:^{
|
|
|
NSLog(@"[LOG] Unsubscribed to Push Notification server & proxy successfully.");
|
|
|
} failure:^(NSString *message, NSInteger errorCode) {
|
|
|
NSLog(@"[LOG] Unsubscribed to Push Notification server & proxy successfully.");
|
|
@@ -508,10 +500,14 @@
|
|
|
|
|
|
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken
|
|
|
{
|
|
|
+ // test
|
|
|
+ if (self.activeAccount.length == 0 || self.maintenanceMode)
|
|
|
+ return;
|
|
|
+
|
|
|
NSLog(@"FCM registration token: %@", fcmToken);
|
|
|
[CCUtility setPushNotificationToken:fcmToken];
|
|
|
|
|
|
- [self subscribingNextcloudServerPushNotification];
|
|
|
+ [self subscribingNextcloudServerPushNotification:self.activeUser userID:self.activeUserID password:self.activePassword url:self.activeUrl];
|
|
|
}
|
|
|
|
|
|
#pragma --------------------------------------------------------------------------------------------
|