fix: use AppGroupStore setter methods from keyboard extension
AppGroupStore is a struct; property setters are mutating and cannot be called on a let binding. Add setOnboardingPage and setHasCompletedOnboarding helpers (like setDetectedAppContext). Co-authored-by: Rocky <hkgood@users.noreply.github.com>
This commit is contained in:
@@ -208,14 +208,14 @@ public final class KeyboardViewController: UIInputViewController {
|
|||||||
private func advanceOnboarding() {
|
private func advanceOnboarding() {
|
||||||
let store = AppGroupStore()
|
let store = AppGroupStore()
|
||||||
let nextPage = min(4, store.onboardingPage + 1)
|
let nextPage = min(4, store.onboardingPage + 1)
|
||||||
store.onboardingPage = nextPage
|
store.setOnboardingPage(nextPage)
|
||||||
state.onboardingPage = nextPage
|
state.onboardingPage = nextPage
|
||||||
}
|
}
|
||||||
|
|
||||||
private func completeOnboarding() {
|
private func completeOnboarding() {
|
||||||
let store = AppGroupStore()
|
let store = AppGroupStore()
|
||||||
store.hasCompletedOnboarding = true
|
store.setHasCompletedOnboarding(true)
|
||||||
store.onboardingPage = 4
|
store.setOnboardingPage(4)
|
||||||
state.hasCompletedOnboarding = true
|
state.hasCompletedOnboarding = true
|
||||||
state.onboardingPage = 4
|
state.onboardingPage = 4
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ public final class KeyboardViewController: UIInputViewController {
|
|||||||
guard state.onboardingPage == 3 else { return }
|
guard state.onboardingPage == 3 else { return }
|
||||||
guard KeyboardSetupBridge.isReadyForOnboardingSkip else { return }
|
guard KeyboardSetupBridge.isReadyForOnboardingSkip else { return }
|
||||||
let store = AppGroupStore()
|
let store = AppGroupStore()
|
||||||
store.onboardingPage = 4
|
store.setOnboardingPage(4)
|
||||||
state.onboardingPage = 4
|
state.onboardingPage = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,14 @@ public struct AppGroupStore: @unchecked Sendable {
|
|||||||
set { defaults.set(newValue, forKey: "config.onboardingPage") }
|
set { defaults.set(newValue, forKey: "config.onboardingPage") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setHasCompletedOnboarding(_ completed: Bool) {
|
||||||
|
defaults.set(completed, forKey: "config.hasCompletedOnboarding")
|
||||||
|
}
|
||||||
|
|
||||||
|
public func setOnboardingPage(_ page: Int) {
|
||||||
|
defaults.set(page, forKey: "config.onboardingPage")
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Detected app context (v0.3.0+)
|
// MARK: - Detected app context (v0.3.0+)
|
||||||
|
|
||||||
/// Last app context the keyboard extension detected for this
|
/// Last app context the keyboard extension detected for this
|
||||||
|
|||||||
Reference in New Issue
Block a user