mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-26 20:50:20 +08:00

* updated icons. * bumped version. * fixed lint. * added synced shared preferences package. * fixed stories list view. * updated LICENSE. * fixed runtime err. * updated README.md * fixed color profile. * added backward compatibility * fixed version. * updated pubspec.lock * improved feature discovery flow. #16 * fixed shared prefs. * bumped version. * upgraded to Flutter 3.0 * added lock file. * fixed time machine. * added collapse cubit. * bumped version.
58 lines
2.4 KiB
Swift
58 lines
2.4 KiB
Swift
import Flutter
|
|
import UIKit
|
|
|
|
public class SwiftSyncedSharedPreferencesPlugin: NSObject, FlutterPlugin {
|
|
public static func register(with registrar: FlutterPluginRegistrar) {
|
|
let channel = FlutterMethodChannel(name: "synced_shared_preferences", binaryMessenger: registrar.messenger())
|
|
let instance = SwiftSyncedSharedPreferencesPlugin()
|
|
registrar.addMethodCallDelegate(instance, channel: channel)
|
|
}
|
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
switch call.method {
|
|
case "setBool":
|
|
if let params = call.arguments as? [String: Any] {
|
|
let info: [String: Any] = ["result": result,
|
|
"params": params]
|
|
NotificationCenter.default.post(name: Notification.Name("setBool"), object: nil, userInfo: info)
|
|
}
|
|
|
|
return
|
|
case "getBool":
|
|
if let params = call.arguments as? [String: Any] {
|
|
let info: [String: Any] = ["result": result,
|
|
"params": params]
|
|
NotificationCenter.default.post(name: Notification.Name("getBool"), object: nil, userInfo: info)
|
|
}
|
|
|
|
return
|
|
case "setStringList":
|
|
if let params = call.arguments as? [String: Any] {
|
|
let info: [String: Any] = ["result": result,
|
|
"params": params]
|
|
NotificationCenter.default.post(name: Notification.Name("setStringList"), object: nil, userInfo: info)
|
|
}
|
|
|
|
return
|
|
case "getStringList":
|
|
if let params = call.arguments as? [String: Any] {
|
|
let info: [String: Any] = ["result": result,
|
|
"params": params]
|
|
NotificationCenter.default.post(name: Notification.Name("getStringList"), object: nil, userInfo: info)
|
|
}
|
|
|
|
return
|
|
case "clearAll":
|
|
if let params = call.arguments as? [String: Any] {
|
|
let info: [String: Any] = ["result": result,
|
|
"params": params]
|
|
NotificationCenter.default.post(name: Notification.Name("clearAll"), object: nil, userInfo: info)
|
|
}
|
|
|
|
return
|
|
default:
|
|
result(FlutterMethodNotImplemented)
|
|
}
|
|
}
|
|
}
|