mirror of https://github.com/xaoxuu/ProHUD
update
This commit is contained in:
parent
8bd68d36f6
commit
f0e6cb2fda
|
@ -44,37 +44,42 @@ class TestToastVC: BaseListVC {
|
||||||
}.startRotate()
|
}.startRotate()
|
||||||
simulateSync()
|
simulateSync()
|
||||||
} else if row == 1 {
|
} else if row == 1 {
|
||||||
Toast.push("progress") { (t) in
|
if let _ = Toast.find("progress").last {
|
||||||
t.update { (vm) in
|
|
||||||
vm.scene = .loading
|
} else {
|
||||||
vm.title = "正在同步"
|
Toast.push("progress") { (t) in
|
||||||
vm.message = "请稍等片刻"
|
t.update { (vm) in
|
||||||
}
|
vm.scene = .loading
|
||||||
t.startRotate()
|
vm.title = "正在同步"
|
||||||
t.update(progress: 0)
|
vm.message = "请稍等片刻"
|
||||||
let s = DispatchSemaphore(value: 1)
|
}
|
||||||
DispatchQueue.global().async {
|
t.startRotate()
|
||||||
for i in 0 ... 5 {
|
t.update(progress: 0)
|
||||||
s.wait()
|
let s = DispatchSemaphore(value: 1)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.global().async {
|
||||||
Toast.find("progress", last: { (t) in
|
for i in 0 ... 5 {
|
||||||
t.update(progress: CGFloat(i)/5)
|
s.wait()
|
||||||
print("\(CGFloat(i)/5)")
|
DispatchQueue.main.async {
|
||||||
if i == 5 {
|
Toast.find("progress", last: { (t) in
|
||||||
t.update { (vm) in
|
t.update(progress: CGFloat(i)/5)
|
||||||
vm.scene = .success
|
print("\(CGFloat(i)/5)")
|
||||||
vm.title = "同步成功"
|
if i == 5 {
|
||||||
vm.message = "xxx"
|
t.update { (vm) in
|
||||||
|
vm.scene = .success
|
||||||
|
vm.title = "同步成功"
|
||||||
|
vm.message = "xxx"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now()+1) {
|
||||||
|
s.signal()
|
||||||
}
|
}
|
||||||
})
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()+1) {
|
|
||||||
s.signal()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if row == 2 {
|
} else if row == 2 {
|
||||||
let t = Toast.push(scene: .success, title: "同步成功", message: "点击查看详情")
|
let t = Toast.push(scene: .success, title: "同步成功", message: "点击查看详情")
|
||||||
t.didTapped { [weak self, weak t] in
|
t.didTapped { [weak self, weak t] in
|
||||||
|
|
|
@ -15,6 +15,6 @@ extension String {
|
||||||
|
|
||||||
extension ProHUD {
|
extension ProHUD {
|
||||||
static var safeAreaInsets: UIEdgeInsets {
|
static var safeAreaInsets: UIEdgeInsets {
|
||||||
return Inspire.shared.screen.updatedSafeAreaInsets
|
return Inspire.shared.screen.safeAreaInsets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue