Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Desktop Client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Desktop Client
Commits
b2549b86
Commit
b2549b86
authored
Apr 07, 2020
by
Andreas Heimann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added spinshare-user deeplink
parent
b8b733b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
main.js
main.js
+17
-4
package.json
package.json
+2
-1
src/assets/js/navigation.js
src/assets/js/navigation.js
+2
-0
src/assets/js/protocol.js
src/assets/js/protocol.js
+3
-4
No files found.
main.js
View file @
b2549b86
...
...
@@ -4,6 +4,7 @@ const isDev = require('electron-is-dev');
let
win
;
let
deeplinkingUrl
;
let
deeplinkingType
;
const
gotTheLock
=
app
.
requestSingleInstanceLock
();
if
(
!
gotTheLock
)
{
...
...
@@ -18,13 +19,25 @@ function executeDeeplink(commandLine) {
if
(
process
.
platform
==
'
win32
'
)
{
let
commandLineString
=
commandLine
.
slice
(
1
)
+
''
;
let
commandLineArgs
=
commandLineString
.
split
(
"
,
"
);
deeplinkingUrl
=
commandLineArgs
[
commandLineArgs
.
length
-
1
].
replace
(
"
spinshare-song://
"
,
""
).
replace
(
"
/
"
,
""
);
let
fullCommand
=
commandLineArgs
[
commandLineArgs
.
length
-
1
];
if
(
fullCommand
.
includes
(
"
spinshare-song
"
))
{
deeplinkingType
=
"
song
"
;
deeplinkingUrl
=
fullCommand
.
replace
(
"
spinshare-song://
"
,
""
).
replace
(
"
/
"
,
""
);
}
else
if
(
fullCommand
.
includes
(
"
spinshare-user
"
))
{
deeplinkingType
=
"
user
"
;
deeplinkingUrl
=
fullCommand
.
replace
(
"
spinshare-user://
"
,
""
).
replace
(
"
/
"
,
""
);
}
}
if
(
win
)
{
if
(
win
.
isMinimized
())
win
.
restore
();
win
.
focus
();
win
.
webContents
.
executeJavaScript
(
`NavigateToSongDetail("
${
deeplinkingUrl
}
")`
);
if
(
deeplinkingType
==
"
song
"
)
{
win
.
webContents
.
executeJavaScript
(
`NavigateToSongDetail("
${
deeplinkingUrl
}
")`
);
}
else
if
(
deeplinkingType
==
"
user
"
)
{
win
.
webContents
.
executeJavaScript
(
`NavigateToUser("
${
deeplinkingUrl
}
")`
);
}
}
}
...
...
@@ -70,8 +83,8 @@ app.on('open-url', function (event, url) {
deeplinkingUrl
=
url
;
});
const
PROTOCOL_PREFIX_SONG
=
"
spinshare-song
"
;
app
.
setAsDefaultProtocolClient
(
PROTOCOL_PREFIX_SONG
);
app
.
setAsDefaultProtocolClient
(
"
spinshare-song
"
)
;
app
.
setAsDefaultProtocolClient
(
"
spinshare-user
"
);
ipcMain
.
on
(
"
download
"
,
(
event
,
info
)
=>
{
console
.
log
(
"
Download Request Received
"
);
...
...
package.json
View file @
b2549b86
...
...
@@ -31,7 +31,8 @@
"protocols"
:
{
"name"
:
"spinshare-song-deeplink"
,
"schemes"
:
[
"spinshare-song"
"spinshare-song"
,
"spinshare-user"
]
},
"dmg"
:
{
...
...
src/assets/js/navigation.js
View file @
b2549b86
...
...
@@ -87,6 +87,8 @@ function NavigateToSongDetail(songId) {
}
function
NavigateToUser
(
userId
)
{
console
.
log
(
"
Loading User
"
+
userId
);
// Stop audio if playing
SongDetailStopPreview
();
...
...
src/assets/js/protocol.js
View file @
b2549b86
// Protocol
ipcRenderer
.
on
(
"
protocol-to-songdetail
"
,
(
event
,
info
)
=>
{
console
.
log
(
info
);
});
if
(
process
.
argv
.
length
>
1
)
{
if
(
process
.
argv
[
1
].
includes
(
"
spinshare-song
"
))
{
let
songId
=
process
.
argv
[
1
].
replace
(
"
spinshare-song://
"
,
""
).
replace
(
"
/
"
,
""
);
NavigateToSongDetail
(
songId
);
}
else
if
(
process
.
argv
[
1
].
includes
(
"
spinshare-user
"
))
{
let
userId
=
process
.
argv
[
1
].
replace
(
"
spinshare-user://
"
,
""
).
replace
(
"
/
"
,
""
);
NavigateToUser
(
userId
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment