Parcourir la source

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

wangshuai il y a 4 mois
Parent
commit
1948161d9b

+ 0 - 2
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -738,8 +738,6 @@ NSPopoverDelegate>
     // 用户头像点击事件
     self.userMenu = [[NSMenu alloc] init];
     KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];
-    NSColor *color = [NSColor colorNamed:@"membercentercolor"];
-    userInfo.view.layer.backgroundColor = color.CGColor;
     NSMenuItem *item = [self.userMenu addItemWithTitle:@"" action:nil target:@""];
     item.target = self;
     item.representedObject = userInfo;

+ 1 - 1
PDF Office/PDF Master/MemberCenter/View/KMEnterVerificationCodeView.swift

@@ -104,7 +104,7 @@ class KMEnterVerificationCodeView: KMBaseXibView {
         tipLabel.font = NSFont.SFProTextRegularFont(12)
 
         sendLabel.textColor = NSColor(named: "FFFFFF") ?? NSColor.white
-        sendLabel.font = NSFont.SFProTextRegularFont(16)
+        sendLabel.font = NSFont.SFProTextRegularFont(13)
         verifficationErrorLabel.isHidden = viewModel.passwordError()
         verifficationErrorLabel.textColor = NSColor(named: "FA1E5D")
         verifficationErrorLabel.font = NSFont.SFProTextRegularFont(9)

+ 23 - 0
PDF Office/PDF Master/MemberCenter/ViewController/KMUserInfoViewController.swift

@@ -74,6 +74,8 @@ class KMUserInfoViewController: NSViewController {
     
     private var viewModel = KMUserInfoVCModel()
     private var cancellables = Set<AnyCancellable>()
+    
+    
 
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -85,6 +87,18 @@ class KMUserInfoViewController: NSViewController {
         bindViewModel()
         languageLocalized()
         initializeUI()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+    }
+    
+    @objc func changeEffectiveAppearance() {
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if isDarkModel {
+            self.view.appearance = NSAppearance(named: .darkAqua)
+        } else {
+            self.view.appearance = NSAppearance(named: .aqua)
+        }
+        initializeUI()
     }
     
     // MARK: Private Method
@@ -145,6 +159,15 @@ class KMUserInfoViewController: NSViewController {
     }
     
     private func initializeUI() -> Void {
+        self.view.wantsLayer = true
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if  isDarkModel {
+            self.view.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+        } else {
+            self.view.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+        }
+
+
         userImageView.image = NSImage(named: "UserProfilePicture_Size")
         emailLabel.textColor = NSColor(named: "0E1114")
         emailLabel.font = NSFont.SFMediumFontWithSize(14)

+ 12 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMCloseAccountWC.swift

@@ -37,6 +37,12 @@ class KMCloseAccountWC: NSWindowController {
         
         languageLocalized()
         initializeUI()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+    }
+    
+    @objc func changeEffectiveAppearance() {
+        self.initializeUI()
     }
     
     // MARK: Private Method
@@ -53,7 +59,12 @@ class KMCloseAccountWC: NSWindowController {
     
     private func initializeUI() -> Void {
         self.window?.contentView?.wantsLayer = true
-        self.window?.contentView?.layer?.backgroundColor = (NSColor(named: "membercentercolor") ?? NSColor.white).cgColor
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if  isDarkModel {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+        } else {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+        }
 
         titleLabel.textColor = NSColor(named: "000000_0.85")
         titleLabel.font = NSFont.SFProTextSemiboldFont(13)

+ 12 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMCloseApplyWC.swift

@@ -31,6 +31,12 @@ class KMCloseApplyWC: NSWindowController {
         
         languageLocalized()
         initializeUI()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+    }
+    
+    @objc func changeEffectiveAppearance() {
+        self.initializeUI()
     }
     
     // MARK: Private Method
@@ -44,7 +50,12 @@ class KMCloseApplyWC: NSWindowController {
     
     private func initializeUI() -> Void {
         self.window?.contentView?.wantsLayer = true
-        self.window?.contentView?.layer?.backgroundColor = (NSColor(named: "membercentercolor") ?? NSColor.white).cgColor
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if  isDarkModel {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+        } else {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+        }
 
         titleLabel.textColor = NSColor(named: "000000_0.85")
         titleLabel.font = NSFont.SFProTextSemiboldFont(13)

+ 12 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMCloseVerificationWC.swift

@@ -41,6 +41,12 @@ class KMCloseVerificationWC: NSWindowController {
         initializeUI()
         
         signUpModel.countDown(type: .logout)
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+    }
+    
+    @objc func changeEffectiveAppearance() {
+        self.initializeUI()
     }
     
     
@@ -57,7 +63,12 @@ class KMCloseVerificationWC: NSWindowController {
     
     private func initializeUI() -> Void {
         self.window?.contentView?.wantsLayer = true
-        self.window?.contentView?.layer?.backgroundColor = (NSColor(named: "membercentercolor") ?? NSColor.white).cgColor
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if  isDarkModel {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+        } else {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+        }
 
         verifficationBox.fillColor = NSColor(named: "texefiedfillcolor") ?? NSColor.white
 

+ 12 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMMemberPromptWC.swift

@@ -43,6 +43,12 @@ class KMMemberPromptWC: NSWindowController {
         
         languageLocalized()
         initializeUI()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+    }
+    
+    @objc func changeEffectiveAppearance() {
+        self.initializeUI()
     }
     
     // MARK: Private Method
@@ -80,7 +86,12 @@ class KMMemberPromptWC: NSWindowController {
     
     private func initializeUI() -> Void {
         self.window?.contentView?.wantsLayer = true
-        self.window?.contentView?.layer?.backgroundColor = (NSColor(named: "membercentercolor") ?? NSColor.white).cgColor
+        let isDarkModel = KMAdvertisementConfig.isDarkModel()
+        if  isDarkModel {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
+        } else {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
+        }
 
         if tipType == .logout {
             titleLabel.textColor = NSColor(named: "000000_0.85")