|
@@ -111,6 +111,10 @@ extension KMAdvertisementManager {
|
|
|
@param superView 父视图 <NSView>
|
|
|
@return KMAdvertisementModel
|
|
|
*/
|
|
|
+ @objc public func show(type: KMAdvertisementShowType, data: KMAdvertisementModel?, superView: NSView?, _ action: KMAdvertisementActionCompletion?) -> NSView {
|
|
|
+ return self.show(type: type, data: data, superView: superView, action, nil)
|
|
|
+ }
|
|
|
+
|
|
|
@objc public func show(type: KMAdvertisementShowType, data: KMAdvertisementModel?, superView: NSView?, _ action: KMAdvertisementActionCompletion?, _ loadCompletion: KMAdvertisementLoadCompletion?) -> NSView {
|
|
|
var view = KMAdvertisementBaseView()
|
|
|
#if os(OSX)
|
|
@@ -243,7 +247,7 @@ extension KMAdvertisementManager {
|
|
|
time <= endTime &&
|
|
|
platform == data.platform &&
|
|
|
self.compareVersion(nowVersion:localVersion, newVersion: version) &&
|
|
|
- subscribeType == data.subscribeType &&
|
|
|
+ (subscribeType == data.subscribeType || data.subscribeType == .all) &&
|
|
|
!hidden) {
|
|
|
result = true
|
|
|
}
|
|
@@ -252,9 +256,15 @@ extension KMAdvertisementManager {
|
|
|
|
|
|
//过滤item是否显示
|
|
|
func allowLoadItemData(_ data: KMAdvertisementModel) -> KMAdvertisementModel {
|
|
|
- var model = data
|
|
|
- var sections: [KMAdvertisementModel.Section] = []
|
|
|
- for var section in data.content! {
|
|
|
+ //获取缓存数据
|
|
|
+ if (UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") == nil) {
|
|
|
+ UserDefaults.standard.set([], forKey: "KMAdvertisementShowScroll_iOS")
|
|
|
+ }
|
|
|
+ let cacheArray: [String] = UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") as! [String]
|
|
|
+
|
|
|
+ let model = data
|
|
|
+ var sections: [KMAdvertisementModelSection] = []
|
|
|
+ for section in data.content! {
|
|
|
var items: [KMAdvertisementModelItem] = []
|
|
|
for item in section.content! {
|
|
|
let timeString = KMAdvertisementTimeStampConversion.getCurrentTimeInterval()
|
|
@@ -266,7 +276,8 @@ extension KMAdvertisementManager {
|
|
|
print(hidden ? "隐藏" : "显示")
|
|
|
if (!hidden &&
|
|
|
time >= startTime &&
|
|
|
- time <= endTime) {
|
|
|
+ time <= endTime &&
|
|
|
+ !cacheArray.contains(item.productID ?? "")) {
|
|
|
items.append(item)
|
|
|
}
|
|
|
}
|