1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-11 16:22:09 -04:00

fix(Clipboard) remove unused copyServe logic

This commit is contained in:
purian23
2026-03-07 20:42:54 -05:00
parent 754bf8fa3c
commit c984b0b9ae

View File

@@ -18,6 +18,22 @@ func Copy(data []byte, mimeType string) error {
} }
func CopyOpts(data []byte, mimeType string, foreground, pasteOnce bool) error { func CopyOpts(data []byte, mimeType string, foreground, pasteOnce bool) error {
if foreground {
return copyServeWithWriter(func(writer io.Writer) error {
total := 0
for total < len(data) {
n, err := writer.Write(data[total:])
total += n
if err != nil {
return err
}
}
if total != len(data) {
return io.ErrShortWrite
}
return nil
}, mimeType, pasteOnce)
}
return CopyReader(bytes.NewReader(data), mimeType, foreground, pasteOnce) return CopyReader(bytes.NewReader(data), mimeType, foreground, pasteOnce)
} }
@@ -65,24 +81,6 @@ func copyFork(data io.Reader, mimeType string, pasteOnce bool) error {
return nil return nil
} }
func copyServe(data []byte, mimeType string, pasteOnce bool) error {
return copyServeWithWriter(func(writer io.Writer) error {
total := 0
for total < len(data) {
n, err := writer.Write(data[total:])
total += n
if err != nil {
return err
}
}
if total != len(data) {
return io.ErrShortWrite
}
return nil
}, mimeType, pasteOnce)
}
func copyServeReader(data io.Reader, mimeType string, pasteOnce bool) error { func copyServeReader(data io.Reader, mimeType string, pasteOnce bool) error {
cachedData, err := createClipboardCacheFile() cachedData, err := createClipboardCacheFile()
if err != nil { if err != nil {