|
@@ -167,7 +167,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
|
|
|
#if VERSION_DMG
|
|
|
VerificationManager.default()
|
|
|
-
|
|
|
#else
|
|
|
self.initiVersionData()
|
|
|
IAPProductsManager.default().initIAP()
|
|
@@ -239,15 +238,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
if urlString.contains("open=expired") {
|
|
|
KMPrint("刷新用户信息")
|
|
|
if !KMLightMemberManager.manager.isLogin() && NSApp.mainWindow != nil {
|
|
|
- KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
+ _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
} else {
|
|
|
if NSApp.mainWindow != nil && KMLightMemberManager.manager.isLogin() {
|
|
|
- KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
|
|
|
+ _ = KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
|
|
|
}
|
|
|
}
|
|
|
} else if urlString.contains("open=success") {
|
|
|
if !KMLightMemberManager.manager.isLogin() && NSApp.mainWindow != nil {
|
|
|
- KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
+ _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
} else {
|
|
|
KMPurchaseManager.manager.restorePurchases { isSuccess, error in
|
|
|
if isSuccess {
|
|
@@ -265,7 +264,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
// 执行相应的操作
|
|
|
if url.scheme == "subscriptionSchemes" {
|
|
|
//刷新用户信息
|
|
|
- KMRequestServerManager.manager.getUserInfo { [weak self] success, data, error, isLocal in
|
|
|
+ KMRequestServerManager.manager.getUserInfo { success, data, error, isLocal in
|
|
|
|
|
|
}
|
|
|
|
|
@@ -399,9 +398,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
|
|
|
//MARK: - iVersion
|
|
|
func initiVersionData() -> Void{
|
|
|
- #if VERSION_DMG
|
|
|
- return
|
|
|
- #endif
|
|
|
+#if VERSION_DMG
|
|
|
+
|
|
|
+#else
|
|
|
let tVersion = iVersion.sharedInstance()
|
|
|
tVersion?.applicationBundleID = Bundle.main.bundleIdentifier
|
|
|
|
|
@@ -432,7 +431,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
tStr = "LATER";
|
|
|
tVersion!.remindButtonLabel = tVersion?.localizedString(forKey: tStr, withDefault: tStr)
|
|
|
tVersion!.ignoreButtonLabel = ""
|
|
|
-
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
// MARK: - Menu
|
|
@@ -459,7 +458,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
|
|
|
let PDFOfficeMenu = mainMenu?.item(at: 0)?.submenu
|
|
|
#if VERSION_DMG
|
|
|
- PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
|
|
|
+ _ = PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
|
|
|
let accountRefreshItem = PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Account Refresh", comment: ""), action: #selector(accountRefreshAction), target: self, at: 8)
|
|
|
accountRefreshItem?.tag = kKMMainMenuAccountRefreshItemTag
|
|
|
#endif
|
|
@@ -535,42 +534,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- // 有使用付费功能
|
|
|
- Task { @MainActor in
|
|
|
- if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
- let _ = KMSubscribeWaterMarkWindowController.show(window: NSApp.mainWindow!, isContinue: true) { isSubscribeSuccess, isWaterMarkExport, isClose in
|
|
|
- if (isClose) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (isSubscribeSuccess) {
|
|
|
- let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
- represent.perform(withItems: [document.fileURL as Any])
|
|
|
- return
|
|
|
- }
|
|
|
- if (isWaterMarkExport) {
|
|
|
- let doucumentURL = document.fileURL
|
|
|
- let docDir = NSTemporaryDirectory()
|
|
|
- let documentName : String = doucumentURL!.path.lastPathComponent
|
|
|
- let path = docDir.stringByAppendingPathComponent(documentName)
|
|
|
-
|
|
|
- let data = KMTools.saveWatermarkDocument(document: document.mainViewController!.document!, to: URL(fileURLWithPath: path), secureOptions: document.mainViewController!.secureOptions, removePWD: document.mainViewController!.removeSecureFlag)
|
|
|
- let writeSuccess = data != nil
|
|
|
- if writeSuccess == false {
|
|
|
- __NSBeep()
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
- represent.perform(withItems: [data as Any])
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
- represent.perform(withItems: [document.fileURL as Any])
|
|
|
- }
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
+ represent.perform(withItems: [document.fileURL as Any])
|
|
|
}
|
|
|
@objc func deviceCameraMenuItemAciton(sender: NSMenuItem) {
|
|
|
KMPrint("deviceCameraMenuItemAciton")
|
|
@@ -587,7 +552,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
|
|
|
@objc @IBAction func manageAcctounMenuAction(_ sender: Any) {
|
|
|
if KMLightMemberManager.manager.isLogin() {
|
|
|
- KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
|
|
|
+ _ = KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -596,7 +561,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
|
|
|
if KMLightMemberManager.manager.isLogin() {
|
|
|
|
|
|
} else {
|
|
|
- KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
+ _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
|
|
|
}
|
|
|
}
|
|
|
|