|
@@ -208,12 +208,12 @@ import Cocoa
|
|
|
|
|
|
if KMAdvertisementManager.manager.infoDict.allKeys.count > 0 {
|
|
|
if let adsInfo = KMAdvertisementManager.manager.infoDict["adsInfo"] {
|
|
|
- var infoDict: NSDictionary = KMAdvertisementManager.manager.infoDict["adsInfo"] as! NSDictionary
|
|
|
+ let infoDict: NSDictionary = KMAdvertisementManager.manager.infoDict["adsInfo"] as! NSDictionary
|
|
|
let array: [[String: Any]] = infoDict["content"] as! [[String : Any]]
|
|
|
|
|
|
- var arrM = NSMutableArray.init()
|
|
|
+ let arrM = NSMutableArray.init()
|
|
|
for dict in array {
|
|
|
- var adsInfo = KMAdsInfo.init()
|
|
|
+ let adsInfo = KMAdsInfo.init()
|
|
|
let mutableDictionary = NSMutableDictionary(dictionary: dict)
|
|
|
adsInfo.infoDict = mutableDictionary
|
|
|
arrM.add(adsInfo)
|
|
@@ -819,16 +819,33 @@ extension KMHomeViewController {
|
|
|
|
|
|
//MARK: - AI
|
|
|
func loadAIIconView() -> Void {
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(aiTipIconViewShowStateChangeNoti), name: NSNotification.Name(rawValue: "kAIIconShowStateChangeNotification"), object: nil)
|
|
|
+
|
|
|
self.aiTipView = AITipIconView.createFromNib()
|
|
|
self.aiTipView.clickHandle = { [weak self] view in
|
|
|
self?.showAITypeChooseView()
|
|
|
}
|
|
|
+ self.aiTipView.rightClickHandle = { [weak self] view in
|
|
|
+ AIInfoManager.default().showAIIcon = false
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kAIIconShowStateChangeNotification"), object: nil)
|
|
|
+
|
|
|
+ }
|
|
|
self.aiTipView.frame = CGRectMake(CGRectGetWidth(self.view.frame)-84, CGRectGetHeight(self.view.frame)-84, 72, 72)
|
|
|
self.aiTipView.autoresizingMask = [.minXMargin, .minYMargin]
|
|
|
self.view.addSubview(self.aiTipView)
|
|
|
|
|
|
+ self.updateAITipViewShowState()
|
|
|
}
|
|
|
|
|
|
+ func updateAITipViewShowState() {
|
|
|
+ if AIInfoManager.default().showAIIcon {
|
|
|
+ self.aiTipView.isHidden = false
|
|
|
+ } else {
|
|
|
+ self.aiTipView.isHidden = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
func showAITypeChooseView() -> Void {
|
|
|
if AIInfoManager.default().aiInfo.infoDict.isEmpty == true {
|
|
|
#if VERSION_DMG
|
|
@@ -954,4 +971,8 @@ extension KMHomeViewController {
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
+
|
|
|
+ @objc func aiTipIconViewShowStateChangeNoti() {
|
|
|
+ self.updateAITipViewShowState()
|
|
|
+ }
|
|
|
}
|