-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to delete shortcut & menubar shortcut update & refactor u…
…sing defaults bridge
- Loading branch information
1 parent
17e264b
commit f693368
Showing
6 changed files
with
117 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3412,6 +3412,9 @@ | |
} | ||
} | ||
} | ||
}, | ||
"xx" : { | ||
|
||
}, | ||
"Youdao" : { | ||
"extractionState" : "manual", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
Easydict/NewApp/Utility/Extensions/Defaults/KeyCombo+Defaults.Serializable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// KeyCombo+Defaults.Serializable.swift | ||
// Easydict | ||
// | ||
// Created by 戴藏龙 on 2024/1/21. | ||
// Copyright © 2024 izual. All rights reserved. | ||
// | ||
|
||
import Defaults | ||
import Foundation | ||
import Magnet | ||
|
||
extension KeyCombo: Defaults.Serializable { | ||
public static var bridge = ShortcutBridge() | ||
|
||
public struct ShortcutBridge: Defaults.Bridge { | ||
public func serialize(_ value: Magnet.KeyCombo??) -> Data? { | ||
guard let value else { return nil } | ||
return try? JSONEncoder().encode(value) | ||
} | ||
|
||
public func deserialize(_ object: Data?) -> Magnet.KeyCombo?? { | ||
guard let data = object else { return nil } | ||
return try? JSONDecoder().decode(KeyCombo.self, from: data) as Magnet.KeyCombo? | ||
} | ||
|
||
public typealias Value = KeyCombo? | ||
|
||
public typealias Serializable = Data | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters