darwinShare TM
This commit is contained in:
parent
7395086bea
commit
6363375361
3 changed files with 31 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
import {join} from "path";
|
import {join} from "path";
|
||||||
import {app, BrowserWindow as bw, ipcMain, shell} from "electron";
|
import {app, BrowserWindow as bw, ipcMain, shell, ShareMenu} from "electron";
|
||||||
import * as windowStateKeeper from "electron-window-state";
|
import * as windowStateKeeper from "electron-window-state";
|
||||||
import * as express from "express";
|
import * as express from "express";
|
||||||
import * as getPort from "get-port";
|
import * as getPort from "get-port";
|
||||||
|
@ -534,6 +534,25 @@ export class BrowserWindow {
|
||||||
await linux_autoUpdater.checkForUpdatesAndNotify()
|
await linux_autoUpdater.checkForUpdatesAndNotify()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('share-menu', async (_event, url) => {
|
||||||
|
if ( process.platform != 'darwin') return;
|
||||||
|
//https://www.electronjs.org/docs/latest/api/share-menu
|
||||||
|
console.log('[Share Sheet - App.ts]', url)
|
||||||
|
const options = {
|
||||||
|
title: 'Share',
|
||||||
|
urls: [url]
|
||||||
|
};
|
||||||
|
// @ts-ignore
|
||||||
|
const shareMenu = new ShareMenu(options);
|
||||||
|
shareMenu.popup();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *********************************************************************************************
|
/* *********************************************************************************************
|
||||||
* Window Events
|
* Window Events
|
||||||
* **********************************************************************************************/
|
* **********************************************************************************************/
|
||||||
|
|
|
@ -987,8 +987,12 @@ const app = new Vue({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
copyToClipboard(str) {
|
copyToClipboard(str) {
|
||||||
notyf.success(app.getLz('term.share.success'))
|
if (process.platform === 'darwin') {
|
||||||
navigator.clipboard.writeText(str)
|
this.darwinShare(str)
|
||||||
|
} else {
|
||||||
|
notyf.success(app.getLz('term.share.success'))
|
||||||
|
navigator.clipboard.writeText(str)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
newPlaylist(name = app.getLz('term.newPlaylist'), tracks = []) {
|
newPlaylist(name = app.getLz('term.newPlaylist'), tracks = []) {
|
||||||
let self = this
|
let self = this
|
||||||
|
@ -3580,7 +3584,10 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
checkForUpdate(){
|
checkForUpdate(){
|
||||||
ipcRenderer.send('check-for-update')
|
ipcRenderer.send('check-for-update')
|
||||||
}
|
},
|
||||||
|
darwinShare(url){
|
||||||
|
ipcRenderer.send('share-menu', url)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<button class="md-btn md-btn-block meta-btn" @click="openUrl(selected.attributes.websiteUrl)">{{$root.getLz('podcast.website')}}</button>
|
<button class="md-btn md-btn-block meta-btn" @click="openUrl(selected.attributes.websiteUrl)">{{$root.getLz('podcast.website')}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button class="md-btn md-btn-block meta-btn">{{$root.getLz('action.share')}}</button>
|
<button class="md-btn md-btn-block meta-btn" @click="$root.share(selected.attributes.websiteUrl)">{{$root.getLz('action.share')}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue