Sfoglia il codice sorgente

【会员系统】夜间模式适配

dinglingui 3 mesi fa
parent
commit
66276b4254

+ 1 - 0
PDF Office/PDF Master/MemberCenter/Assets/en.lproj/MemberCenterLocalizable.strings

@@ -94,6 +94,7 @@
 "Device name" = "Device name";
 "Action" = "Action";
 "Can keep %d devices online at the same time" = "Can keep %d devices online at the same time";
+"Can keep %d device online at the same time" = "Can keep %d device online at the same time";
 "Do not log in to the current device" = "Do not log in to the current device";
 "Log in to the current device" = "Log in to the current device";
 "Unbind" = "Unbind";

+ 1 - 0
PDF Office/PDF Master/MemberCenter/Assets/zh-Hans.lproj/MemberCenterLocalizable.strings

@@ -90,6 +90,7 @@
 "Device name" = "设备名称";
 "Action" = "操作";
 "Can keep %d devices online at the same time" = "可以保持%d台设备同时在线";
+"Can keep %d device online at the same time" = "可以保持%d台设备同时在线";
 "Do not log in to the current device" = "暂不登录当前设备";
 "Log in to the current device" = "登录当前设备";
 "Unbind" = "解绑";

+ 1 - 0
PDF Office/PDF Master/MemberCenter/Assets/zh-Hant.lproj/MemberCenterLocalizable.strings

@@ -90,6 +90,7 @@
 "Device name" = "設備名稱";
 "Action" = "操作";
 "Can keep %d devices online at the same time" = "可保持%d台設備同時在線";
+"Can keep %d device online at the same time" = "可保持%d台設備同時在線";
 "Do not log in to the current device" = "暫不登入目前設備";
 "Log in to the current device" = "登入目前設備";
 "Unbind" = "解绑";

+ 13 - 7
PDF Office/PDF Master/MemberCenter/WindowsController/KMCloseAccountWC.swift

@@ -35,6 +35,10 @@ class KMCloseAccountWC: NSWindowController {
         
 //        self.window?.backgroundColor = NSColor.gray
         
+        productView.wantsLayer = true
+        proView.wantsLayer = true
+        aiView.wantsLayer = true
+
         languageLocalized()
         initializeUI()
         
@@ -64,8 +68,17 @@ class KMCloseAccountWC: NSWindowController {
         let isDarkModel = KMAdvertisementConfig.isDarkModel()
         if  isDarkModel {
             self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+            
+            productView.layer?.backgroundColor = NSColor(hex: "323232").cgColor
+            proView.layer?.backgroundColor = NSColor(hex: "272727").cgColor
+            aiView.layer?.backgroundColor = NSColor(hex: "272727").cgColor
+
         } else {
             self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+            productView.layer?.backgroundColor = NSColor(hex: "E4E4E4").cgColor
+            proView.layer?.backgroundColor = NSColor(hex: "F0F0F0").cgColor
+            aiView.layer?.backgroundColor = NSColor(hex: "F0F0F0").cgColor
+
         }
 
         titleLabel.textColor = NSColor(named: "000000_0.85")
@@ -74,14 +87,7 @@ class KMCloseAccountWC: NSWindowController {
         subTitleLabel.font = NSFont.SFProTextRegularFont(12)
         productBox.borderColor = NSColor(named: "DADBDE") ?? .gray
         productLabel.textColor = NSColor(named: "42464D")
-        productView.wantsLayer = true
-        productView.layer?.backgroundColor = NSColor(named: "000000_0.05")?.cgColor
         
-        proView.wantsLayer = true
-        proView.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
-
-        aiView.wantsLayer = true
-        aiView.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
 
         productLabel.font = NSFont.SFProTextRegularFont(13)
         if KMMemberInfo.shared.ai_productName == "" {

+ 30 - 22
PDF Office/PDF Master/MemberCenter/WindowsController/KMMemberCenterWindowController.swift

@@ -65,25 +65,43 @@ class KMMemberCenterWindowController: NSWindowController {
         cancelButton.title = NSLocalizedString("Do not log in to the current device", tableName: "MemberCenterLocalizable", comment: "")
         loginButton.title = NSLocalizedString("Log in to the current device", tableName: "MemberCenterLocalizable", comment: "")
 
+        productView.wantsLayer = true
+        device1View.wantsLayer = true
+        device2View.wantsLayer = true
+        device3View.wantsLayer = true
+        device4View.wantsLayer = true
+
         initializeUI()
         
-        DistributedNotificationCenter.default.addObserver(self, selector: #selector(themeChanged(_:)), name: NSNotification.Name("AppleInterfaceThemeChangedNotification"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
     }
     
-    @objc func themeChanged(_ notification: Notification) {
-        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+    @objc func changeEffectiveAppearance() {
             self.initializeUI()
-        }
     }
     
     private func initializeUI() -> Void {
         self.window?.contentView?.wantsLayer = true
         let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        var proColor = NSColor(hex: "323232")
+        var prosubColor = NSColor(hex: "272727")
+
         if  isDarkModel {
-            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "282828").cgColor;
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "282828").cgColor
+            proColor = NSColor(hex: "323232")
+            prosubColor = NSColor(hex: "272727")
         } else {
             self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "f6f6f6").cgColor;
+            proColor = NSColor(hex: "E4E4E4")
+            prosubColor = NSColor(hex: "F0F0F0")
         }
+        
+        productView.layer?.backgroundColor = proColor.cgColor
+        device1View.layer?.backgroundColor = prosubColor.cgColor
+        device2View.layer?.backgroundColor = prosubColor.cgColor
+        device3View.layer?.backgroundColor = prosubColor.cgColor
+        device4View.layer?.backgroundColor = prosubColor.cgColor
+
         productBox.borderColor = NSColor(named: "DADBDE") ?? .gray
 
         productLabel.textColor = NSColor(named: "42464D")
@@ -95,21 +113,7 @@ class KMMemberCenterWindowController: NSWindowController {
         tipLabel.textColor = NSColor(named: "4982E6")
 
         cancelButton.setTitleColor(color: NSColor(named: "000000") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13))
-        
-        productView.wantsLayer = true
-        productView.layer?.backgroundColor = NSColor(named: "000000_0.05")?.cgColor
-        
-        device1View.wantsLayer = true
-        device1View.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
 
-        device2View.wantsLayer = true
-        device2View.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
-
-        device3View.wantsLayer = true
-        device3View.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
-
-        device4View.wantsLayer = true
-        device4View.layer?.backgroundColor = NSColor(named: "000000_0.76")?.cgColor
         device1Button.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.blue, font: NSFont.SFProTextRegularFont(13))
         device2Button.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.blue, font: NSFont.SFProTextRegularFont(13))
         device3Button.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.blue, font: NSFont.SFProTextRegularFont(13))
@@ -156,10 +160,14 @@ class KMMemberCenterWindowController: NSWindowController {
                 device4Label.stringValue = device.deviceName ?? "PDF Reader Pro User"
             }
         }
+        let maxDeviceNum = memberCenterdeviceResult.maxDeviceNum ?? 1
+        if (maxDeviceNum <= 1) {
+            tipLabel.stringValue = String(format: NSLocalizedString("Can keep %d device online at the same time", tableName: "MemberCenterLocalizable", comment: ""), maxDeviceNum)
+        } else {
+            tipLabel.stringValue = String(format: NSLocalizedString("Can keep %d devices online at the same time", tableName: "MemberCenterLocalizable", comment: ""), maxDeviceNum)
+        }
         
-        tipLabel.stringValue = String(format: NSLocalizedString("Can keep %d devices online at the same time", tableName: "MemberCenterLocalizable", comment: ""), memberCenterdeviceResult.maxDeviceNum ?? 1)
-        
-        if deviceList_Result.count == memberCenterdeviceResult.maxDeviceNum {
+        if deviceList_Result.count == maxDeviceNum {
             loginButton.isEnabled = false
         } else {
             loginButton.isEnabled = true