Pārlūkot izejas kodu

【注册登录】登录账号吗,在文档view页面退出账号,返回home,此时引导提示显示不全 修复

lizhe 1 gadu atpakaļ
vecāks
revīzija
1b8dc50852

+ 2 - 2
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -311,8 +311,8 @@ extension KMBrowserWindowController: KMToolbarRightViewDelegate {
         }
     }
     
-    func homeRefreshButtonAction(_ sender: NSButton) {
-        
+    func homeRefreshButtonAction(_ sender: NSButton?) {
+        self.layoutSubviews()
     }
     
     func homeUploadButtonAction(_ sender: NSButton) {

+ 23 - 13
PDF Office/PDF Master/Class/ChromiumTabs/KMToolbarRightView.swift

@@ -10,7 +10,7 @@ import Cocoa
 @objc protocol KMToolbarRightViewDelegate {
     @objc func pdfRightSegmentedControlAction(_ sender: KMSegmentedBox?)
     @objc func userInfoButtonAction(_ sender: NSButton)
-    @objc func homeRefreshButtonAction(_ sender: NSButton)
+    @objc func homeRefreshButtonAction(_ sender: NSButton?)
     @objc func homeUploadButtonAction(_ sender: NSButton)
     @objc func homeMenuSortAction(_ sender: NSPopUpButton)
     @objc func homeMenuFilterAction(_ sender: NSPopUpButton)
@@ -63,15 +63,7 @@ import Cocoa
             }
             
             if self.rightSegmentControlConstraint != nil {
-                let paragraphStyle = NSMutableParagraphStyle()
-                paragraphStyle.lineHeightMultiple = 1.32
-                paragraphStyle.alignment = .right
-                let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
-                                  NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
-                let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
-                let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
-                                              attributes: attributes).size
-                
+                let size = self.fetchAdvancedViewSize()
                 self.rightSegmentControlConstraint.constant = size.width + 20
             }
         } else {
@@ -98,11 +90,29 @@ import Cocoa
         }
     }
     
+    func fetchAdvancedViewSize() -> CGSize {
+        let paragraphStyle = NSMutableParagraphStyle()
+        paragraphStyle.lineHeightMultiple = 1.32
+        paragraphStyle.alignment = .right
+        let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
+                          NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
+        let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
+        let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
+                                      attributes: attributes).size
+        
+        return size
+    }
+    
     func addNotification() {
         self.removeNotification()
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
+    }
+    
+    func updateAdvancedContentView() {
+        self.updateView()
+        self.delete?.homeRefreshButtonAction(nil)
     }
     
     func removeNotification() {

+ 7 - 2
PDF Office/PDF Master/Class/ChromiumTabs/src/Browser Window/CTBrowserWindowController.m

@@ -863,7 +863,7 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     
     CTTabContents* document = [self.browser activeTabContents];
 
-    NSView* rightStripView = nil;
+    KMToolbarRightView *rightStripView = nil;
     if (document.isHome) {
         rightStripView = self.homeRightStripView;
     } else {
@@ -873,6 +873,7 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     CGFloat rightWidth = NSWidth([rightStripView frame]);
     if ([[KMLightMemberManager manager] canShowAdvancedView] && ![[KMLightMemberManager manager] isLogin]) {
         rightWidth = NSWidth([rightStripView frame]);
+        rightWidth += rightStripView.fetchAdvancedViewSize.width;
     } else {
         rightWidth = 56.0;
     }
@@ -891,7 +892,11 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     
     [tabStripController_ setIndentForControls:0];
 
-    [rightStripView setFrame:NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight)];
+//    [rightStripView setFrame:NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight)];
+    self.homeRightStripView.frame = NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight);
+    self.rightStripView.frame = NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight);
+    [(KMToolbarRightView *)self.rightStripView updateView];
+    [(KMToolbarRightView *)self.homeRightStripView updateView];
 
     // Set indentation.
     [tabStripController_ layoutTabsWithoutAnimation];