diff --git a/ProHUD/Alert/AlertController.swift b/ProHUD/Alert/AlertController.swift index 37f771b..5202b6c 100644 --- a/ProHUD/Alert/AlertController.swift +++ b/ProHUD/Alert/AlertController.swift @@ -63,13 +63,12 @@ public extension ProHUD { /// - Parameter title: 标题 /// - Parameter message: 内容 /// - Parameter icon: 图标 - public convenience init(scene: Scene = .default, title: String? = nil, message: String? = nil, icon: UIImage? = nil, actions: ((Alert) -> Void)? = nil) { + public convenience init(scene: Scene = .default, title: String? = nil, message: String? = nil, actions: ((Alert) -> Void)? = nil) { self.init() vm.vc = self vm.scene = scene vm.title = title vm.message = message - vm.icon = icon actions?(self) } diff --git a/ProHUD/Alert/AlertModel.swift b/ProHUD/Alert/AlertModel.swift index 172c52b..9c5d679 100644 --- a/ProHUD/Alert/AlertModel.swift +++ b/ProHUD/Alert/AlertModel.swift @@ -59,7 +59,11 @@ public extension Alert { durationBlock?.cancel() if let t = duration ?? scene.alertDuration, t > 0 { durationBlock = DispatchWorkItem(block: { [weak self] in - self?.vc?.pop() + if let vc = self?.vc { + if vc.buttonEvents.count == 0 { + vc.pop() + } + } }) DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!) } else { @@ -78,7 +82,6 @@ public extension Alert.ViewModel { /// - Parameter text: 标题 /// - Parameter handler: 事件处理 @discardableResult func add(action style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton { - duration = 0 return vc!.insert(action: nil, style: style, title: title, handler: handler) } @@ -88,7 +91,6 @@ public extension Alert.ViewModel { /// - Parameter title: 标题 /// - Parameter handler: 事件处理 @discardableResult func insert(action index: Int, style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton { - duration = 0 return vc!.insert(action: index, style: style, title: title, handler: handler) } diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json deleted file mode 100644 index 68e7e4c..0000000 --- a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDMinimize@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDMinimize@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "template-rendering-intent" : "original" - } -} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png deleted file mode 100644 index 4ee0a98..0000000 Binary files a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png and /dev/null differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png deleted file mode 100644 index 0086dda..0000000 Binary files a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png and /dev/null differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json deleted file mode 100644 index f6faed5..0000000 --- a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDTrash@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDTrash@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png deleted file mode 100644 index d136622..0000000 Binary files a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png and /dev/null differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png deleted file mode 100644 index d3f1cce..0000000 Binary files a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png and /dev/null differ diff --git a/ProHUD/Toast/ToastModel.swift b/ProHUD/Toast/ToastModel.swift index 85c9f59..ebfd3da 100644 --- a/ProHUD/Toast/ToastModel.swift +++ b/ProHUD/Toast/ToastModel.swift @@ -56,7 +56,11 @@ public extension Toast { durationBlock?.cancel() if let t = duration ?? scene.toastDuration, t > 0 { durationBlock = DispatchWorkItem(block: { [weak self] in - self?.vc?.pop() + if let vc = self?.vc { + if vc.buttonEvents.count == 0 { + vc.pop() + } + } }) DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!) } else {