mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
feat(notification): add plugin (#326)
This commit is contained in:
committed by
GitHub
parent
864b9d790f
commit
e9bbe94181
@@ -0,0 +1,24 @@
|
||||
import UIKit
|
||||
import WebKit
|
||||
import Tauri
|
||||
import SwiftRs
|
||||
|
||||
class NotificationPlugin: Plugin {
|
||||
@objc public func requestPermission(_ invoke: Invoke) throws {
|
||||
invoke.resolve(["permissionState": "granted"])
|
||||
}
|
||||
|
||||
@objc public func permissionState(_ invoke: Invoke) throws {
|
||||
invoke.resolve(["permissionState": "granted"])
|
||||
}
|
||||
|
||||
@objc public func notify(_ invoke: Invoke) throws {
|
||||
// TODO
|
||||
invoke.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("init_plugin_notification")
|
||||
func initPlugin(name: SRString, webview: WKWebView?) {
|
||||
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: NotificationPlugin())
|
||||
}
|
||||
Reference in New Issue
Block a user