Browse Source

【BOTA】部分功能新增付费限制

tangchao 1 year ago
parent
commit
34301b6d08

+ 49 - 55
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -2049,10 +2049,10 @@ extension KMLeftSideViewController: KMBotaTableViewDelegate {
     }
     
     func tableView(_ aTableView: NSTableView, pasteFromPasteboard pboard: NSPasteboard?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         
         if aTableView.isEqual(to: self.thumbnailTableView) {
             if self._copysPages.count > 0 {
@@ -2745,7 +2745,6 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                         let pathExtension = path.pathExtension.lowercased()
                         if pathExtension == "pdf" {
                             var index = row
-                            //                            __block NSMutableIndexSet *insertIndexSet = [[[NSMutableIndexSet alloc] init] autorelease];
                             var insertIndexSet = IndexSet()
                             var pdf = CPDFDocument(url: URL(fileURLWithPath: path))
                             if let data = pdf?.isEncrypted, data {
@@ -2919,7 +2918,6 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                     }
                     let paths = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)
                     var cachesDir = paths.first ?? ""
-//                    docmentName = [NSString stringWithFormat:@"%@%@",docmentName,tFileName];
                     docmentName = String(format: "%@%@", docmentName, tFileName)
                     if (docmentName.count > 50) {
                         docmentName = docmentName.substring(to: 50)
@@ -2941,10 +2939,7 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                 }
                 pboard.setData(tiffData, forType: .tiff)
                 pboard.setPropertyList([fileExt], forType: .filePromise)
-            
-//            let data: Data = try! NSKeyedArchiver.archivedData(withRootObject: rowIndexes, requiringSecureCoding: true)
-//            pboard.declareTypes([.localDraggedTypes], owner: self)
-//            pboard.setData(data, forType: .localDraggedTypes)
+
                 return true
             }
         }
@@ -2962,10 +2957,10 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
     }
     
     @objc dynamic func tableView(_ aTableView: NSTableView, deleteRowsWithIndexes rowIndexes: IndexSet) {
-//        if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
 //        if ([tv isEqual:rightSideController.snapshotTableView]) {
 //            NSArray *controllers = [[rightSideController.snapshotArrayController arrangedObjects] objectsAtIndexes:rowIndexes];
 //            [controllers makeObjectsPerformSelector:@selector(close)];
@@ -2993,10 +2988,10 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
     }
     
     func tableView(_ aTableView: NSTableView, copyRowsWithIndexes rowIndexes: IndexSet) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         if aTableView.isEqual(to: self.thumbnailTableView) {
             self._copysPages.removeAll()
             if self.listView.document.isLocked == false {
@@ -4583,10 +4578,10 @@ extension KMLeftSideViewController: KMNoteOutlineViewDelegate {
 
 extension KMLeftSideViewController {
     @objc func cutPage(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         self._tableView(self.thumbnailTableView, cutRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
     }
     
@@ -4599,27 +4594,26 @@ extension KMLeftSideViewController {
     }
     
     @objc func deletePage(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         self.tableView(self.thumbnailTableView, deleteRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
     }
     
     @objc func rotatePageMenuAction(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
-//
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         self.tableView(self.thumbnailTableView, rotateRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes as NSIndexSet)
     }
     
     @objc func quickInsert(_ sender: AnyObject?) {
-//        if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
 
         let idx = self.thumbnailTableView.selectedRowIndexes.first ?? NSNotFound
         if idx == NSNotFound || idx >= self.listView.document.pageCount {
@@ -4637,10 +4631,10 @@ extension KMLeftSideViewController {
     }
     
     @objc func insert(_ sender: AnyObject?) {
-//        if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         
         guard let document = self.listView.document else {
             return
@@ -4702,10 +4696,10 @@ extension KMLeftSideViewController {
     }
     
     @objc func insertPDF(_ sender: AnyObject?) {
-        //        if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-        //            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-        //            return;
-        //        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
                 
         guard let document = self.listView.document else {
             return
@@ -4808,10 +4802,10 @@ extension KMLeftSideViewController {
     }
     
     @objc func extractPage(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         self.tableView(self.thumbnailTableView, extractRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
     }
     
@@ -4820,10 +4814,10 @@ extension KMLeftSideViewController {
     }
     
     @objc func displayPageSize(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         
         self.isDisplayPageSize = !self.isDisplayPageSize;
         UserDefaults.standard.setValue(self.isDisplayPageSize, forKey: "kKMThumbnailDisplayPageSizeKey")
@@ -4835,10 +4829,10 @@ extension KMLeftSideViewController {
     }
     
     @objc func sharePage(_ sender: AnyObject?) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         
         guard let document = self.listView.document else {
             return