mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-24 22:42:42 +01:00
feat: switched to TIDAL's universal link format in the entire app
This commit is contained in:
parent
53603c4cad
commit
000853414e
11
CHANGELOG.md
11
CHANGELOG.md
@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [next]
|
||||
|
||||
- Implemented TIDAL's universal links. All links are now universal.
|
||||
- Custom `tidal://` protocol fixed - By [TheRockYT](https://github.com/TheRockYT)
|
||||
- Global media shortcuts removed since TIDAL includes them by default - By [TheRockYT]
|
||||
|
||||
- Fixes
|
||||
- [#390](https://github.com/Mastermindzh/tidal-hifi/issues/390)
|
||||
- [#376](https://github.com/Mastermindzh/tidal-hifi/issues/376)
|
||||
- [#383](https://github.com/Mastermindzh/tidal-hifi/issues/383)
|
||||
|
||||
## [5.10.0]
|
||||
|
||||
- TIDAL will now close the previous notification if a new one is sent whilst the old is still visible. [#364](https://github.com/Mastermindzh/tidal-hifi/pull/364)
|
||||
|
@ -19,7 +19,7 @@ export const updateMediaInfo = (arg: MediaInfo) => {
|
||||
mediaInfo.artists = propOrDefault(arg.artists);
|
||||
mediaInfo.album = propOrDefault(arg.album);
|
||||
mediaInfo.icon = propOrDefault(arg.icon);
|
||||
mediaInfo.url = propOrDefault(arg.url);
|
||||
mediaInfo.url = toUniversalUrl(propOrDefault(arg.url));
|
||||
mediaInfo.status = propOrDefault(arg.status);
|
||||
mediaInfo.current = propOrDefault(arg.current);
|
||||
mediaInfo.duration = propOrDefault(arg.duration);
|
||||
@ -33,5 +33,18 @@ export const updateMediaInfo = (arg: MediaInfo) => {
|
||||
* @param {*} defaultValue defaults to ""
|
||||
*/
|
||||
function propOrDefault(prop: string, defaultValue = "") {
|
||||
return prop ? prop : defaultValue;
|
||||
return prop || defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the universal link syntax (?u) to any url
|
||||
* @param url url to append the universal link syntax to
|
||||
* @returns url with `?u` appended, or the original value of url if falsy
|
||||
*/
|
||||
function toUniversalUrl(url: string) {
|
||||
if (url) {
|
||||
const queryParamsSet = url.indexOf("?");
|
||||
return queryParamsSet > -1 ? `${url}&u` : `${url}?u`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user