浏览代码

Modify push notification

marinofaggiana 6 年之前
父节点
当前提交
4e348a5d2c
共有 2 个文件被更改,包括 18 次插入5 次删除
  1. 9 2
      iOSClient/AppDelegate.m
  2. 9 3
      iOSClient/Networking/OCNetworking.m

+ 9 - 2
iOSClient/AppDelegate.m

@@ -507,7 +507,8 @@ PKPushRegistry *pushRegistry;
     NSString *message = [payload.dictionaryPayload objectForKey:@"subject"];
     
     if (message) {
-        for (tableAccount *result in  [[NCManageDatabase sharedInstance] getAllAccount]) {
+        NSArray *results = [[NCManageDatabase sharedInstance] getAllAccount];
+        for (tableAccount *result in results) {
             if ([CCUtility getPushNotificationPrivateKey:result.account]) {
                 NSString *decryptedMessage = [[NCPushNotificationEncryption sharedInstance] decryptPushNotification:message withDevicePrivateKey: [CCUtility getPushNotificationPrivateKey:result.account]];
                 if (decryptedMessage) {
@@ -529,7 +530,13 @@ PKPushRegistry *pushRegistry;
                     } else {
                         content.title = app.capitalizedString;
                     }
-                    content.title = [NSString stringWithFormat:@"%@ - %@ (%@)", content.title, result.displayName, domain];
+                    if (results.count == 1) {
+                        content.title = content.title;
+                    } else {
+                        content.title = content.title;
+                        content.subtitle = [NSString stringWithFormat:@"%@ (%@)", result.displayName, domain];
+                        content.threadIdentifier = content.subtitle;
+                    }
                     if (subject) {
                         content.body = subject;
                     } else {

+ 9 - 3
iOSClient/Networking/OCNetworking.m

@@ -1586,9 +1586,12 @@
     
     devicePublicKey = [CCUtility URLEncodeStringFromString:devicePublicKey];
     NSString *proxyServerPath = [NCBrandOptions sharedInstance].pushNotificationServerProxy;
-    //proxyServerPath = @"http://127.0.0.1:8088";
     NSString *proxyServer = [NCBrandOptions sharedInstance].pushNotificationServerProxy;
-    //proxyServer = @"https://10.132.0.37:8443/pushnotifications";
+    
+#ifdef DEBUG
+    proxyServerPath = @"http://127.0.0.1:8088";
+    proxyServer = @"https://10.132.0.37:8443/pushnotifications";
+#endif
     
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     
@@ -1645,7 +1648,10 @@
     }
     
     NSString *proxyServer = [NCBrandOptions sharedInstance].pushNotificationServerProxy;
-    //proxyServer = @"https://10.132.0.37:8443/pushnotifications";
+    
+#ifdef DEBUG
+    proxyServer = @"https://10.132.0.37:8443/pushnotifications";
+#endif
     
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;