feat(ios): share extension ile Ratebubble iOS istemcisini ekle ve paylaşım akışını düzelt
This commit is contained in:
31
ios/Ratebubble/Shared/SharedPayloadStore.swift
Normal file
31
ios/Ratebubble/Shared/SharedPayloadStore.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
import Foundation
|
||||
|
||||
enum SharedConfig {
|
||||
static var appGroupID: String {
|
||||
Bundle.main.object(forInfoDictionaryKey: "APP_GROUP_ID") as? String
|
||||
?? "group.net.wisecolt.ratebubble"
|
||||
}
|
||||
|
||||
static var appURLScheme: String {
|
||||
Bundle.main.object(forInfoDictionaryKey: "APP_URL_SCHEME") as? String
|
||||
?? "ratebubble"
|
||||
}
|
||||
}
|
||||
|
||||
enum SharedKeys {
|
||||
static let incomingURL = "incoming_shared_url"
|
||||
}
|
||||
|
||||
enum SharedPayloadStore {
|
||||
static func saveIncomingURL(_ url: String) {
|
||||
guard let defaults = UserDefaults(suiteName: SharedConfig.appGroupID) else { return }
|
||||
defaults.set(url, forKey: SharedKeys.incomingURL)
|
||||
defaults.synchronize()
|
||||
}
|
||||
|
||||
static func consumeIncomingURL() -> String? {
|
||||
guard let defaults = UserDefaults(suiteName: SharedConfig.appGroupID) else { return nil }
|
||||
defer { defaults.removeObject(forKey: SharedKeys.incomingURL) }
|
||||
return defaults.string(forKey: SharedKeys.incomingURL)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user