Skip to content

Commit

Permalink
[Fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe0929 committed Jan 19, 2024
1 parent 4e646c0 commit 4c8f888
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ShiledConfig
struct AppAddButtonView: View {
let userDefaults = UserDefaults(suiteName: "group.65NSM72327.HMH-iOS.HMH-iOS")
@AppStorage("selectedApps", store: UserDefaults(suiteName: "group.65NSM7Z327.com.HMH.group"))
var shieldedApps = FamilyActivitySelection()
var shieldedApps = FamilyActivitySelection()

@EnvironmentObject var model: BlockingApplicationModel
@State var isPresented = false
Expand All @@ -37,20 +37,18 @@ struct AppAddButtonView: View {
.familyActivityPicker(isPresented: $isPresented, selection: $model.newSelection)
.onChange(of: isPresented) { oldValue, newValue in
if newValue == false {
if !model.newSelection.applicationTokens.isEmpty {
ScreenTime.shared.selectedApps = model.newSelection
shieldedApps = model.newSelection
ScreenTime.shared.saveHashValue()

let mainViewController = TabBarController()
let navigationController = UINavigationController(rootViewController: mainViewController)
let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate
guard let delegate = sceneDelegate else {
return
}
delegate.window?.rootViewController = navigationController
navigationController.pushViewController(GoalTimeSelectViewController(), animated: true)
ScreenTime.shared.selectedApps = model.newSelection
shieldedApps = model.newSelection
ScreenTime.shared.saveHashValue()

let mainViewController = TabBarController()
let navigationController = UINavigationController(rootViewController: mainViewController)
let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate
guard let delegate = sceneDelegate else {
return
}
delegate.window?.rootViewController = navigationController
navigationController.pushViewController(GoalTimeSelectViewController(), animated: true)
}
}

Expand Down

0 comments on commit 4c8f888

Please sign in to comment.