Skip to content

Commit

Permalink
変換候補選択時のバックスペースの挙動の設定をUserDefaultsに永続化する
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgto committed Sep 29, 2024
1 parent ea8d40a commit d4409f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions macSKK/Settings/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@ final class SettingsViewModel: ObservableObject {
Global.insertBlankStringBundleIdentifiers.send(applications.filter { $0.insertBlankString }.map { $0.bundleIdentifier })
}.store(in: &cancellables)

$selectingBackspace.sink { selectingBackspace in
Global.selectingBackspace = selectingBackspace
}.store(in: &cancellables)

NotificationCenter.default.publisher(for: notificationNameToggleDirectMode)
.sink { [weak self] notification in
if let bundleIdentifier = notification.object as? String {
Expand Down Expand Up @@ -459,6 +455,12 @@ final class SettingsViewModel: ObservableObject {
Global.systemDict = systemDict
}.store(in: &cancellables)

$selectingBackspace.dropFirst().sink { selectingBackspace in
logger.log("変換候補選択時のバックスペースの挙動を \(selectingBackspace.description, privacy: .public) に変更しました")
UserDefaults.standard.set(selectingBackspace.rawValue, forKey: UserDefaultsKeys.selectingBackspace)
Global.selectingBackspace = selectingBackspace
}.store(in: &cancellables)

NotificationCenter.default.publisher(for: notificationNameDictLoad).receive(on: RunLoop.main).sink { [weak self] notification in
if let loadEvent = notification.object as? DictLoadEvent, let self {
if let userDict = Global.dictionary.userDict as? FileDict, userDict.id == loadEvent.id {
Expand Down

0 comments on commit d4409f8

Please sign in to comment.