add some more native code

This commit is contained in:
Hailey
2024-06-16 23:32:12 -07:00
parent fa004bc8df
commit 8785ef3b3c
14 changed files with 206 additions and 58 deletions
@@ -0,0 +1,26 @@
import ExpoModulesCore
public class ExpoBlueskySwissArmyModule: Module {
func getDefaults(_ useAppGroup: Bool) -> UserDefaults? {
if useAppGroup {
return UserDefaults(suiteName: "group.app.bsky")
} else {
return UserDefaults.standard
}
}
public func definition() -> ModuleDefinition {
Name("ExpoBlueskySwissArmy")
AsyncFunction("getStringValueAsync") { (key: String, useAppGroup: Bool) in
let defaults = self.getDefaults(useAppGroup)
return defaults?.string(forKey: key)
}
AsyncFunction("setStringValueAsync") { (key: String, value: String?, useAppGroup: Bool) in
let defaults = self.getDefaults(useAppGroup)
defaults?.setValue(value, forKey: key)
}
}
}