Browse Source

remove old extension

marinofaggiana 6 years ago
parent
commit
43353cf922

+ 0 - 12
Nextcloud.xcodeproj/project.pbxproj

@@ -847,8 +847,6 @@
 		F73D71631F2674A400E233EB /* NCText.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCText.storyboard; sourceTree = "<group>"; };
 		F73F537E1E929C8500F8678D /* CCMore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CCMore.swift; sourceTree = "<group>"; };
 		F7417DB2216CE925007D05F5 /* NCTrashSectionHeaderFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrashSectionHeaderFooter.swift; sourceTree = "<group>"; };
-		F7425B2A224B846E009A3857 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
-		F7425B33224B84BA009A3857 /* NotificationServiceExtension-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NotificationServiceExtension-Bridging-Header.h"; sourceTree = "<group>"; };
 		F7434B5F20E2440600417916 /* FileProviderExtension-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FileProviderExtension-Bridging-Header.h"; sourceTree = "<group>"; };
 		F743B2C31C95BBE8006F5B4A /* CCShareInfoCMOC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCShareInfoCMOC.h; sourceTree = "<group>"; };
 		F743B2C41C95BBE8006F5B4A /* CCShareInfoCMOC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCShareInfoCMOC.m; sourceTree = "<group>"; };
@@ -1864,15 +1862,6 @@
 			path = Text;
 			sourceTree = "<group>";
 		};
-		F7425B29224B846E009A3857 /* Notification Service Extension */ = {
-			isa = PBXGroup;
-			children = (
-				F7425B33224B84BA009A3857 /* NotificationServiceExtension-Bridging-Header.h */,
-				F7425B2A224B846E009A3857 /* NotificationService.swift */,
-			);
-			path = "Notification Service Extension";
-			sourceTree = "<group>";
-		};
 		F74D3DB81BAC1941000BAE4B /* Networking */ = {
 			isa = PBXGroup;
 			children = (
@@ -2831,7 +2820,6 @@
 				F7F67BAB1A24D27800EE80DA /* Supporting Files */,
 				F771E3D120E2392D00AFB62D /* File Provider Extension */,
 				F7C0F46D1C8880540059EC54 /* Share */,
-				F7425B29224B846E009A3857 /* Notification Service Extension */,
 				F7FC7D651DC1F98700BB2C6A /* Products */,
 				F7FC7D541DC1F93700BB2C6A /* Frameworks */,
 				F771E3D020E2392D00AFB62D /* File Provider Extension.appex */,

+ 0 - 89
Notification Service Extension/NotificationService.swift

@@ -1,89 +0,0 @@
-//
-//  NotificationService.swift
-//  Notification Service Extension
-//
-//  Created by Marino Faggiana on 27/07/18.
-//  Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-import UserNotifications
-
-class NotificationService: UNNotificationServiceExtension {
-
-    var contentHandler: ((UNNotificationContent) -> Void)?
-    var bestAttemptContent: UNMutableNotificationContent?
-
-    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
-        
-        self.contentHandler = contentHandler
-        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
-        
-        if let bestAttemptContent = bestAttemptContent {
-
-            bestAttemptContent.title = ""
-            bestAttemptContent.body = "Nextcloud notification"
-            
-            guard let message = bestAttemptContent.userInfo["subject"] else {
-                contentHandler(bestAttemptContent)
-                return
-            }
-            
-            for result in NCManageDatabase.sharedInstance.getAllAccount() {
-                guard let privateKey = CCUtility.getPushNotificationPrivateKey(result.account) else {
-                    continue
-                }
-                guard let decryptedMessage = NCPushNotificationEncryption.sharedInstance()?.decryptPushNotification(message as? String, withDevicePrivateKey: privateKey) else {
-                    continue
-                }
-                guard let data = decryptedMessage.data(using: .utf8) else {
-                    contentHandler(bestAttemptContent)
-                    return
-                }
-                
-                do {
-                    let json = try JSONSerialization.jsonObject(with: data) as! [String:AnyObject]
-                    if let app = json["app"] as? String {
-                        if app == "spreed" {
-                            bestAttemptContent.title = "Nextcloud Talk"
-                        } else {
-                            bestAttemptContent.title = app.capitalized
-                        }
-                    }
-                    if let subject = json["subject"] as? String {
-                        bestAttemptContent.body = subject
-                    }
-                } catch let error as NSError {
-                    print("Failed : \(error.localizedDescription)")
-                }
-            }
-            
-            contentHandler(bestAttemptContent)
-        }
-    }
-    
-    override func serviceExtensionTimeWillExpire() {
-
-        if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {
-            
-            bestAttemptContent.title = ""
-            bestAttemptContent.body = "Nextcloud"
-            
-            contentHandler(bestAttemptContent)
-        }
-    }
-}

+ 0 - 31
Notification Service Extension/NotificationServiceExtension-Bridging-Header.h

@@ -1,31 +0,0 @@
-//
-//  NotificationServiceExtension-Bridging-Header.h
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 27/07/18.
-//  Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCUtility.h"
-#import "NCPushNotificationEncryption.h"
-
-#import "OCActivity.h"
-#import "OCUserProfile.h"
-#import "OCCapabilities.h"
-#import "OCExternalSites.h"
-#import "OCSharedDto.h"