Kaynağa Gözat

【轻会员】第一次登录时,弹出注册界面

lizhe 1 yıl önce
ebeveyn
işleme
3826ca3c27

+ 10 - 0
PDF Office/PDF Office/AppDelegate.swift

@@ -41,6 +41,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
 //        测试模式,默认false
         KMAdvertisementManager.manager.debug = true
         
+        //第一次开启app
+        var info = UserDefaults.standard.value(forKey: "kFirstOpenAppCount")
+        var count = 0
+        if info != nil {
+            count = info as? Int ?? 0
+        }
+        count += 1
+        UserDefaults.standard.set(count, forKey: "kFirstOpenAppCount")
+        UserDefaults.standard.synchronize()
+        
         self.initMainMenu()
         /// pro
 //    [DBClientsManager setupWithAppKeyDesktop:@"amipzwtlg9lrwyl"];

+ 10 - 0
PDF Office/PDF Office/Class/KMLightMember/Controller/Login&Register/KMLoginWindowController.swift

@@ -44,6 +44,16 @@ class KMLoginWindowController: NSWindowController {
     
     //MARK: 打开文件
     static func show(window: NSWindow, _ type: DataNavigationViewButtonActionType = .Batch, _ logType: KMRegisterLogType = .login) -> KMLoginWindowController? {
+        
+        var logType = logType
+        var count = UserDefaults.standard.value(forKey: "kFirstOpenAppCount")
+        
+        if (count as? Int == 1) {
+            if logType == .login  {
+                logType = .register
+            }
+        }
+        
         let controller: KMLoginWindowController = KMLoginWindowController.init(windowNibName: "KMLoginWindowController")
         controller.inputType = type
         controller.logType = logType

+ 2 - 2
PDF Office/PDF Office/Class/KMLightMember/Controller/VerificationCode/View/KMLightMemberAlertView.swift

@@ -49,8 +49,8 @@ class KMLightMemberAlertView: KMBaseXibView {
         
         self.titleLabel.stringValue = NSLocalizedString(KMRequestServerErrorCodeType.typeOfMessage(type: KMRequestServerErrorCodeType(rawValue: result.code)), comment: "")
         
-        DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [unowned self] in
-            self.fadeOut()
+        DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [weak self] in
+            self?.fadeOut()
         }
     }
     

+ 1 - 1
PDF Office/PDF Office/Class/KMLightMember/Controller/VerificationCode/View/KMVerificationCodeView.swift

@@ -127,7 +127,7 @@ class KMVerificationCodeView: KMBaseXibView {
                 textField!.textField.alignment = .center
                 textField?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 4)
                 textField?.textField.onFocus = {
-                    textField?.superview?.border(NSColor(hex: "#1770F4"), 1, 4)
+                textField?.superview?.border(NSColor(hex: "#1770F4"), 1, 4)
                 }
                 
                 textField?.textDidEndEditing = { [unowned self] string in

+ 9 - 0
PDF Office/PDF Office/Class/PDFTools/Tools/KMBaseXibView/KMBaseXibView.swift

@@ -28,6 +28,7 @@ class KMBaseXibView: NSView {
         self.updateUI()
         self.updateLanguage()
         self.reloadData()
+        self.addNotification()
     }
     
     private func initContentView() {
@@ -82,4 +83,12 @@ class KMBaseXibView: NSView {
     func resetData() {
         
     }
+    
+    func addNotification() {
+        
+    }
+    
+    func removeNotification() {
+        
+    }
 }