Просмотр исходного кода

【fix】【个人登录后卡片】试用卡片调整

tangchao 1 неделя назад
Родитель
Сommit
a0e6c3a8d1

+ 3 - 0
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -678,6 +678,9 @@ class KMMemberCenterManager: NSObject {
             if let token = result_dict["canTrail"] { canTrail = token as! String }
 
             let userInfo = KMMemberUserInfo(id: userId, email: email, fullName: fullName, activeVIP: [userInfoActiveVIP], activeAI: [userInfoActiveAI], aiPoint: aiPoint, validFlag: validFlag, isHaveAIDiscount: isHaveAIDiscount, canTrail: canTrail)
+            if let data = result_dict["avatarUrl"] as? String {
+                userInfo.avatarUrl = data
+            }
             
             let result = KMMemberCenterResult(code: code, msg: message, userInfo: userInfo)
             if code == 200 {

+ 2 - 0
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterResult.swift

@@ -172,6 +172,8 @@ class KMMemberUserInfo: NSObject {
     var isHaveAIDiscount: String = "" // 【必需】1是0否 是否有ai折扣
     var canTrail        : String = "" // 【必需】1是0否 是否能试用
     
+    var avatarUrl: String = "" // 头像
+    
     init(id: String = "", email: String = "", fullName: String = "", activeVIP: [KMMemberUserInfoActiveVIP] = [], activeAI: [KMMemberUserInfoActiveVIP] = [], aiPoint: Int = 0, validFlag: String = ""/*, isHavePwd: String = ""*/, isHaveAIDiscount: String = "", canTrail: String = "") {
         self.id = id
         self.email = email

+ 5 - 1
PDF Office/PDF Master/MemberCenter/Model/KMMemberInfo.swift

@@ -248,7 +248,9 @@ import Cocoa
     
 //    var currentTime: String = "" // 当前注销时间
 //    var logOffTime: String = "" // 注销时间
-
+    
+    var avatarUrl: String = "" // 头像
+    var avatarImage: NSImage?
     
     // MARK: Get & Set
     
@@ -912,6 +914,8 @@ import Cocoa
         }
         activeVips = model.activeVIP
         activeAis = model.activeAI
+        
+        avatarUrl = model.avatarUrl
     }
     
     func advancedFunctionUsage() -> Void {

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

@@ -153,6 +153,14 @@ class KMUserInfoViewController: NSViewController {
         initializeUI()
 #endif
         
+        if let data = KMMemberInfo.shared.avatarImage {
+            userImageView.image = data
+        } else {
+            userImageView.image = KMAdvertisementImage.imageWithURL(url: URL(string: KMMemberInfo.shared.avatarUrl) , completion: { [weak self] image in
+                self?.userImageView.image = image
+                KMMemberInfo.shared.avatarImage = image
+            })
+        }
         NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
     }
     
@@ -453,6 +461,16 @@ class KMUserInfoViewController: NSViewController {
             centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
             number1Label.textColor = NSColor(hex: "0E1114")
         }
+        
+        if lockedLabel.stringValue == NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "") {
+            lockedLabel.textColor = NSColor(hex: "#42464D")
+        } else if lockedLabel.stringValue == NSLocalizedString("Subscription", tableName: "MemberCenterLocalizable", comment: "") {
+            lockedLabel.textColor = NSColor(hex: "#42464D")
+        } else if lockedLabel.stringValue == NSLocalizedString("Permanent", tableName: "MemberCenterLocalizable", comment: "") {
+            lockedLabel.textColor = NSColor(hex: "#273C62")
+        } else if lockedLabel.stringValue == NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "") {
+            lockedLabel.textColor = NSColor(hex: "#42464D")
+        }
     }
     
     private func initializeUI() -> Void {

+ 6 - 0
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -539,17 +539,23 @@ class KMProductModel: ObservableObject {
             } else {
                 code = "PDF Reader Pro Advanced - Annual Plan"
             }
+            #if VERSION_DMG
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
             embeddedWC.showWindow(nil)
             embeddedWC.window?.center()
+            #endif
         } else if state == .dmg_Upgrades1 {
+            #if VERSION_DMG
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 2-Device · Advanced Annual")
             embeddedWC.showWindow(nil)
             embeddedWC.window?.center()
+            #endif
         } else if state == .dmg_Upgrades2 {
+            #if VERSION_DMG
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 3-Device · Advanced Annual")
             embeddedWC.showWindow(nil)
             embeddedWC.window?.center()
+            #endif
         } else if state == .lite_Base {
             if tag == 0 {
                 if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }

+ 1 - 0
PDF Office/PDF Master/MemberCenter/ViewModel/KMSignUpViewModel.swift

@@ -296,6 +296,7 @@ class KMSignUpViewModel: ObservableObject {
                 self.timer?.cancel()
                 self.sendContent = NSLocalizedString("Resend", tableName: "MemberCenterLocalizable", comment: "")
 
+                KMMemberInfo.shared.avatarImage = nil
             } else {
                 if(resultDict.code == 305) {
                     if KMMemberCenterManager.manager.isConnectionAvailable() == false {

+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -42,6 +42,12 @@
 		6536FDEB2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6536FDEA2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib */; };
 		6536FDEC2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6536FDEA2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib */; };
 		6536FDED2C9C49C1004A0FB9 /* KMNoteFooterCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6536FDEA2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib */; };
+		653F389F2CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F389E2CE9FDF1009E97B2 /* AIConfigWindowController.xib */; };
+		653F38A02CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F389E2CE9FDF1009E97B2 /* AIConfigWindowController.xib */; };
+		653F38A12CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F389E2CE9FDF1009E97B2 /* AIConfigWindowController.xib */; };
+		653F38A32CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F38A22CE9FE2B009E97B2 /* KMProductCompareWC.xib */; };
+		653F38A42CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F38A22CE9FE2B009E97B2 /* KMProductCompareWC.xib */; };
+		653F38A52CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 653F38A22CE9FE2B009E97B2 /* KMProductCompareWC.xib */; };
 		654A5A832C895DE5001FBD4B /* KMComparativeGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD6218D32A7D29F40088475C /* KMComparativeGradientView.swift */; };
 		654A5A842C895DE6001FBD4B /* KMComparativeGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD6218D32A7D29F40088475C /* KMComparativeGradientView.swift */; };
 		654A5A852C89628A001FBD4B /* KMWatermarkAdjectivePropertyBaseController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB897235294B38DC0045787C /* KMWatermarkAdjectivePropertyBaseController.xib */; };
@@ -5764,6 +5770,8 @@
 		6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMNoteReplyHanddler.swift; sourceTree = "<group>"; };
 		6536FDE62C9C49A6004A0FB9 /* KMNoteFooterCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMNoteFooterCellView.swift; sourceTree = "<group>"; };
 		6536FDEA2C9C49C0004A0FB9 /* KMNoteFooterCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMNoteFooterCellView.xib; sourceTree = "<group>"; };
+		653F389E2CE9FDF1009E97B2 /* AIConfigWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AIConfigWindowController.xib; sourceTree = "<group>"; };
+		653F38A22CE9FE2B009E97B2 /* KMProductCompareWC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMProductCompareWC.xib; sourceTree = "<group>"; };
 		654A5A8B2C8AE200001FBD4B /* KMAnalytics+KMExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMAnalytics+KMExtensions.swift"; sourceTree = "<group>"; };
 		655445082C88483B00BD9010 /* KMDiscountToSaveWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMDiscountToSaveWindowController.xib; sourceTree = "<group>"; };
 		655445092C88483C00BD9010 /* KMDiscountToSaveWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMDiscountToSaveWindowController.h; sourceTree = "<group>"; };
@@ -9112,6 +9120,7 @@
 		9F4ACEC52CC790BC005CF727 /* WindowsController */ = {
 			isa = PBXGroup;
 			children = (
+				653F38A22CE9FE2B009E97B2 /* KMProductCompareWC.xib */,
 				9F4ACEC82CC79270005CF727 /* KMLoginWindowsController.swift */,
 				9F4ACEC92CC79270005CF727 /* KMLoginWindowsController.xib */,
 				9F33C9BF2CD8E2550080D3C2 /* KMMemberPromptWC.swift */,
@@ -11825,6 +11834,7 @@
 		BB0FE0202B734DD1001E0F88 /* AIConfigWindowController */ = {
 			isa = PBXGroup;
 			children = (
+				653F389E2CE9FDF1009E97B2 /* AIConfigWindowController.xib */,
 				BB0FE0222B734DD1001E0F88 /* AIConfigWindowController.swift */,
 				BBB789632BE8BF2300F7E09C /* AINewConfigWindowController.swift */,
 				BBB789602BE8BF2300F7E09C /* AINewConfigWindowController.xib */,
@@ -15253,6 +15263,7 @@
 				BBB789C02BE8BF2400F7E09C /* AIChatView.xib in Resources */,
 				BB0FE0552B734DD1001E0F88 /* AIUserInfoController.xib in Resources */,
 				BB86C2A22BC8C39600326A6B /* ExportAccessoryView.xib in Resources */,
+				653F389F2CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */,
 				BBAFC84D298519F700D0648E /* KMSavePanelAccessoryController.xib in Resources */,
 				BB0FE0402B734DD1001E0F88 /* AITypeChooseView.xib in Resources */,
 				F3A9DC81294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib in Resources */,
@@ -15435,6 +15446,7 @@
 				BB1B0B042B4FC6E900889528 /* KMCustomColorGuideView.xib in Resources */,
 				65341C772C63CCFE00FE30F9 /* KMSearchReplaceWindowController.xib in Resources */,
 				BB853C672AF87502009C20C1 /* KMBatchOperateRemoveWatermarkViewController.xib in Resources */,
+				653F38A32CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */,
 				BB1BFF6D2AEA030F003EB179 /* KMBatchOperateSplitViewController.xib in Resources */,
 				BB6AAF562C2175A3009C4CB1 /* KMEditPDFPopToolBarController.xib in Resources */,
 				ADE86A8D2B02269400414DFA /* KMRemovePasswordWindowController.xib in Resources */,
@@ -15835,6 +15847,7 @@
 				BB49ECFA293F44DC00C82CA2 /* KMConvertExcelWindowController.xib in Resources */,
 				BB1B0AC32B4FC6E900889528 /* KMFunctionGuideWindowController.xib in Resources */,
 				89E4E7862967BF5A002DBA6F /* KMCustomizeStampViewController.xib in Resources */,
+				653F38A02CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */,
 				AD85D1BE2AF0D2DD000F4D28 /* KMHomeQuickToolsCollectionView.xib in Resources */,
 				BB03D6A12B024AC8008C9976 /* KMPDFEditInsertPageWindow.xib in Resources */,
 				BBA19F3729ADACC5001A285A /* signPicture_nor.pdf in Resources */,
@@ -16017,6 +16030,7 @@
 				BB183DD52B4EAD5400F99C7E /* Ubuntu-Bold.ttf in Resources */,
 				AD8810B629A846B100178CA1 /* KMVerficationCodeWindowController.xib in Resources */,
 				BB0FE03B2B734DD1001E0F88 /* AITipIconView.xib in Resources */,
+				653F38A42CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */,
 				BB2EDF74296ECE17003BCF58 /* KMPageEditThumbnailItem.xib in Resources */,
 				BB897232294B08DE0045787C /* KMWatermarkViewController.xib in Resources */,
 				ADFA8F012B5649AE002595A4 /* KMAutoFlowOptionsSheetController.xib in Resources */,
@@ -16436,6 +16450,7 @@
 				AD88108929A719E500178CA1 /* KMRegisterView.xib in Resources */,
 				9F0CB4842967F64D00007028 /* KMPropertiesPanelReadOnlySubVC.xib in Resources */,
 				BB8810AE2B4F7D7500AFA63E /* KMVerificationViewController.xib in Resources */,
+				653F38A12CE9FDF1009E97B2 /* AIConfigWindowController.xib in Resources */,
 				9FDD0F9B2952FF4D000C4DAD /* alias-light.json in Resources */,
 				65C9CB032CA16B36009794E5 /* DocumentAI.bundle in Resources */,
 				AD867F9A29D955D200F00440 /* KMBOTAOutlineCellView.xib in Resources */,
@@ -16466,6 +16481,7 @@
 				AD7D5CEA2B96B3B2006562CD /* KMBookmarkOutlineSeparatorCellView.xib in Resources */,
 				BB0FE05D2B734DD1001E0F88 /* AIImage.xcassets in Resources */,
 				9F0201832A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
+				653F38A52CE9FE2B009E97B2 /* KMProductCompareWC.xib in Resources */,
 				BB96A0B62AFCD56B00559E24 /* KMToolCompareWindowController.xib in Resources */,
 				9FDD0F9E2952FF4D000C4DAD /* comp-light.json in Resources */,
 				9F94747D29FA22700042F949 /* InfoPlist.strings in Resources */,