mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 08:52:49 -05:00
clipboard: add raw image mime-type to offers in CopyFile
This commit is contained in:
@@ -1615,6 +1615,8 @@ func (m *Manager) CopyFile(filePath string) error {
|
|||||||
m.updateState()
|
m.updateState()
|
||||||
m.notifySubscribers()
|
m.notifySubscribers()
|
||||||
|
|
||||||
|
_, imgMime, imgErr := image.DecodeConfig(bytes.NewReader(fileData))
|
||||||
|
|
||||||
m.post(func() {
|
m.post(func() {
|
||||||
if m.dataControlMgr == nil || m.dataDevice == nil {
|
if m.dataControlMgr == nil || m.dataDevice == nil {
|
||||||
log.Error("Data control manager or device not initialized")
|
log.Error("Data control manager or device not initialized")
|
||||||
@@ -1638,6 +1640,11 @@ func (m *Manager) CopyFile(filePath string) error {
|
|||||||
{"text/plain", []byte(filePath)},
|
{"text/plain", []byte(filePath)},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if imgErr == nil {
|
||||||
|
imgMimeType := "image/" + imgMime
|
||||||
|
offers = append(offers, offer{imgMimeType, fileData})
|
||||||
|
}
|
||||||
|
|
||||||
offerData := make(map[string][]byte)
|
offerData := make(map[string][]byte)
|
||||||
for _, o := range offers {
|
for _, o := range offers {
|
||||||
if err := source.Offer(o.mime); err != nil {
|
if err := source.Offer(o.mime); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user