Skip to content

Commit

Permalink
Update main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeydarrenlau authored Aug 10, 2024
1 parent 85450bd commit 11a26c3
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,33 +209,7 @@ export default class ObsidianSpotify extends Plugin {

sharedstuff.set("refreshspot", refreshspot);

if(Platform.isMobileApp) {
console.log("[" + this.manifest.name + "] Mobile app detected, using fake events");
window.network = false
window.netcheck_spotify = setInterval(async () => {
const checkConnection = async () => {
try {
const response = await requestUrl({
'url': 'https://accounts.spotify.com'
});

return response.status >= 200 && response.status < 300;
} catch (error) {
return false;
}
};
if(await checkConnection() == window.network) {
return;
}
if(await checkConnection()) {
let event = new CustomEvent("online-custom");
document.dispatchEvent(event)
} else {
let event = new CustomEvent("offline-custom");
document.dispatchEvent(event)
}
},1000)
}


if (this.settings.spotify_access_token.refresh_token) {
RefreshClass.refreshInit({ sharedstuff, refreshspot, settings: this.settings, manifest: this.manifest });
Expand Down

0 comments on commit 11a26c3

Please sign in to comment.