This commit is contained in:
xaoxuu 2019-08-13 14:42:08 +08:00
parent 6ac80334f6
commit f33102e564
9 changed files with 11 additions and 53 deletions

View File

@ -63,13 +63,12 @@ public extension ProHUD {
/// - Parameter title: /// - Parameter title:
/// - Parameter message: /// - Parameter message:
/// - Parameter icon: /// - 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() self.init()
vm.vc = self vm.vc = self
vm.scene = scene vm.scene = scene
vm.title = title vm.title = title
vm.message = message vm.message = message
vm.icon = icon
actions?(self) actions?(self)
} }

View File

@ -59,7 +59,11 @@ public extension Alert {
durationBlock?.cancel() durationBlock?.cancel()
if let t = duration ?? scene.alertDuration, t > 0 { if let t = duration ?? scene.alertDuration, t > 0 {
durationBlock = DispatchWorkItem(block: { [weak self] in 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!) DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
} else { } else {
@ -78,7 +82,6 @@ public extension Alert.ViewModel {
/// - Parameter text: /// - Parameter text:
/// - Parameter handler: /// - Parameter handler:
@discardableResult func add(action style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton { @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) return vc!.insert(action: nil, style: style, title: title, handler: handler)
} }
@ -88,7 +91,6 @@ public extension Alert.ViewModel {
/// - Parameter title: /// - Parameter title:
/// - Parameter handler: /// - Parameter handler:
@discardableResult func insert(action index: Int, style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton { @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) return vc!.insert(action: index, style: style, title: title, handler: handler)
} }

View File

@ -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"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -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"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -56,7 +56,11 @@ public extension Toast {
durationBlock?.cancel() durationBlock?.cancel()
if let t = duration ?? scene.toastDuration, t > 0 { if let t = duration ?? scene.toastDuration, t > 0 {
durationBlock = DispatchWorkItem(block: { [weak self] in 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!) DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
} else { } else {