fix(training): 按后台权限控制培训中心入口
This commit is contained in:
@@ -100,13 +100,29 @@ final class AllFunctionsViewController: BaseViewController {
|
||||
self?.applyViewModel(animated: self?.hasAppliedInitialSnapshot == true)
|
||||
}
|
||||
}
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(reloadFunctions),
|
||||
name: NotificationName.permissionItemsDidChange,
|
||||
object: AppStore.shared.permissions
|
||||
)
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(reloadFunctions),
|
||||
name: NotificationName.accountDidSwitch,
|
||||
object: nil
|
||||
)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
viewModel.loadFunctions()
|
||||
}
|
||||
|
||||
@objc private func reloadFunctions() {
|
||||
Task { @MainActor [weak self] in self?.viewModel.loadFunctions() }
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
if isMovingFromParent, viewModel.didCustomize {
|
||||
|
||||
Reference in New Issue
Block a user