mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
feat(clipboard-manager): implement clear on iOS and Android (#1462)
This commit is contained in:
@@ -92,7 +92,11 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
val clipData = when (args) {
|
||||
is WriteOptions.PlainText -> {
|
||||
ClipData.newPlainText(args.label, args.text)
|
||||
} else -> {
|
||||
invoke.reject("Invalid write options provided")
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
manager.setPrimaryClip(clipData)
|
||||
@@ -120,4 +124,12 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
|
||||
invoke.resolveObject(data)
|
||||
}
|
||||
|
||||
@Command
|
||||
fun clear(invoke: Invoke) {
|
||||
if (manager.hasPrimaryClip()) {
|
||||
manager.clearPrimaryClip()
|
||||
}
|
||||
invoke.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user