Repository: MahdiGhiasi/XpoMusic Branch: master Commit: a28f30186223 Files: 231 Total size: 771.4 KB Directory structure: gitextract__tqfcrvl/ ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── Preview.md ├── README.md ├── XpoMusic/ │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets/ │ │ ├── ReauthorizeForV2.html │ │ └── TileTemplates/ │ │ ├── LiveTileAlbumAndArtistArt.xml │ │ ├── LiveTileAlbumArtOnly.xml │ │ └── LiveTileArtistArtOnly.xml │ ├── Classes/ │ │ ├── AppConstants.cs │ │ ├── Cache/ │ │ │ ├── AlbumStore.cs │ │ │ ├── ArtistStore.cs │ │ │ ├── CacheStore.cs │ │ │ ├── GlobalCache.cs │ │ │ ├── PlaylistStore.cs │ │ │ └── SongExtraInfoStore.cs │ │ ├── Converters/ │ │ │ ├── BooleanToVisibilityConverter.cs │ │ │ ├── LanguageToStringConverter.cs │ │ │ ├── LiveTileDesignToStringConverter.cs │ │ │ ├── MillisecondsToMinSecConverter.cs │ │ │ └── ThemeToStringConverter.cs │ │ ├── LocalConfiguration.cs │ │ ├── Model/ │ │ │ ├── AutoPlayAction.cs │ │ │ ├── Language.cs │ │ │ ├── LocalStoragePlayback.cs │ │ │ ├── LyricsViewer/ │ │ │ │ └── CurrentPlayingSongInfo.cs │ │ │ ├── SongExtraInfo.cs │ │ │ ├── Theme.cs │ │ │ └── WebResourceModifications/ │ │ │ ├── WebResourceModificationRule.cs │ │ │ ├── WebResourceModificationRuleType.cs │ │ │ └── WebResourceStringModificationRule.cs │ │ ├── PlayStatusTracker.cs │ │ ├── SemaphoreQueue.cs │ │ └── WebViewController.cs │ ├── Controls/ │ │ ├── FlyoutContainer.xaml │ │ ├── FlyoutContainer.xaml.cs │ │ ├── NowPlayingView.xaml │ │ ├── NowPlayingView.xaml.cs │ │ ├── ProxyConfiguration.xaml │ │ ├── ProxyConfiguration.xaml.cs │ │ ├── SliderExtended.cs │ │ ├── SplashScreen.xaml │ │ ├── SplashScreen.xaml.cs │ │ ├── TopBar.xaml │ │ ├── TopBar.xaml.cs │ │ ├── XpoMusicWebApp.xaml │ │ └── XpoMusicWebApp.xaml.cs │ ├── Flyouts/ │ │ ├── DeveloperMessageFlyout.xaml │ │ ├── DeveloperMessageFlyout.xaml.cs │ │ ├── IFlyout.cs │ │ ├── SettingsFlyout.xaml │ │ ├── SettingsFlyout.xaml.cs │ │ ├── WhatsNewFlyout.xaml │ │ └── WhatsNewFlyout.xaml.cs │ ├── Helpers/ │ │ ├── AnalyticsHelper.cs │ │ ├── AssetManager.cs │ │ ├── ClipboardHelper.cs │ │ ├── CropBitmap.cs │ │ ├── DeveloperMessageHelper.cs │ │ ├── DeviceInfoHelper.cs │ │ ├── ImageSaveHelper.cs │ │ ├── Integration/ │ │ │ └── LyricsViewerIntegrationHelper.cs │ │ ├── JumpListHelper.cs │ │ ├── KeyboardShortcutHelper.cs │ │ ├── LanguageHelper.cs │ │ ├── LiveTileHelper.cs │ │ ├── MediaControlsHelper.cs │ │ ├── PackageHelper.cs │ │ ├── PlaybackActionHelper.cs │ │ ├── ProxyHelper.cs │ │ ├── SongImageProvider.cs │ │ ├── SpotifyShareUriHelper.cs │ │ ├── StoryboardExtensions.cs │ │ ├── StuckResolveHelper.cs │ │ ├── ThemeHelper.cs │ │ ├── TileHelper.cs │ │ ├── ToastHelper.cs │ │ ├── UnauthorizedHelper.cs │ │ ├── WebResourceModificationHelper.cs │ │ └── WhatsNewHelper.cs │ ├── InjectedAssets/ │ │ ├── clearPlaybackLocalStorage.js │ │ ├── clickOnFacebookLogin.js │ │ ├── gridTest.html │ │ └── isLoggedInCheck.js │ ├── NLog.config │ ├── Package.appxmanifest │ ├── Package.debug.appxmanifest │ ├── Pages/ │ │ ├── AboutPage.xaml │ │ ├── AboutPage.xaml.cs │ │ ├── DonatePage.xaml │ │ ├── DonatePage.xaml.cs │ │ ├── HelpPage.xaml │ │ ├── HelpPage.xaml.cs │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── SettingsPage.xaml │ │ └── SettingsPage.xaml.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ ├── Scripts/ │ │ ├── Common/ │ │ │ ├── action.ts │ │ │ ├── browserHistory.ts │ │ │ ├── color.ts │ │ │ ├── dragDrop.ts │ │ │ ├── indeterminateProgressBarHandler.ts │ │ │ ├── initScript-common.ts │ │ │ ├── keyboardShortcutListener.ts │ │ │ ├── mouseWheelListener.ts │ │ │ ├── pageTitleFinder.ts │ │ │ ├── playbackStuckHelper.ts │ │ │ ├── requestIntercepter.ts │ │ │ ├── resize.ts │ │ │ ├── startupAnimation.ts │ │ │ ├── statusReport.ts │ │ │ ├── themedScrollbar.ts │ │ │ ├── tracklistExtended.ts │ │ │ ├── uiElementModifier.ts │ │ │ ├── uiInjector.ts │ │ │ ├── uriHelper.ts │ │ │ └── web-player-backup.ts │ │ ├── DarkTheme/ │ │ │ ├── initScript-dark.ts │ │ │ └── tsconfig.json │ │ ├── Lib/ │ │ │ ├── focus-visible.ts │ │ │ └── vibrant.ts │ │ ├── LightTheme/ │ │ │ ├── initScript-light.ts │ │ │ ├── pageOverlay.ts │ │ │ └── tsconfig.json │ │ └── SpotifyApi/ │ │ ├── apiBase.ts │ │ ├── library.ts │ │ └── player.ts │ ├── SpotifyApi/ │ │ ├── Album.cs │ │ ├── ApiBase.cs │ │ ├── Artist.cs │ │ ├── Authorization.cs │ │ ├── Library.cs │ │ ├── Model/ │ │ │ ├── AlbumSimplified.cs │ │ │ ├── Artist.cs │ │ │ ├── ArtistSimplified.cs │ │ │ ├── CurrentlyPlayingContext.cs │ │ │ ├── Device.cs │ │ │ ├── Devices.cs │ │ │ ├── FollowedArtistsResponse.cs │ │ │ ├── Image.cs │ │ │ ├── Paging.cs │ │ │ ├── Playlist.cs │ │ │ ├── SavedAlbum.cs │ │ │ └── Track.cs │ │ ├── Player.cs │ │ ├── Playlist.cs │ │ └── TokenHelper.cs │ ├── Styles/ │ │ ├── CircleButtonStyle.xaml │ │ ├── MinimalButtonStyle.xaml │ │ ├── TopBarDarkButtonStyle.xaml │ │ └── TopBarLightButtonStyle.xaml │ ├── Stylesheets/ │ │ ├── Common/ │ │ │ ├── Animation/ │ │ │ │ ├── artistPage.scss │ │ │ │ ├── navbarStartup.scss │ │ │ │ ├── nowPlayingStartup.scss │ │ │ │ ├── pageEntrance.scss │ │ │ │ ├── pivotEntrance.scss │ │ │ │ ├── searchPage.scss │ │ │ │ └── tracklistEntrance.scss │ │ │ ├── adsContainer.scss │ │ │ ├── artistPage.scss │ │ │ ├── backButton.scss │ │ │ ├── common.scss │ │ │ ├── contextMenu.scss │ │ │ ├── fontStyle.scss │ │ │ ├── general.scss │ │ │ ├── navBar.scss │ │ │ ├── nowPlayingBar.scss │ │ │ ├── pivotTabStyle.scss │ │ │ ├── searchPage.scss │ │ │ ├── smallWidthWindow.scss │ │ │ ├── themedScrollbar.scss │ │ │ ├── trackList.scss │ │ │ └── windowTitle.scss │ │ ├── DarkTheme/ │ │ │ └── dark.scss │ │ └── LightTheme/ │ │ ├── artistPage.scss │ │ ├── contextMenu.scss │ │ ├── general.scss │ │ ├── light.scss │ │ ├── navBar.scss │ │ ├── nowPlayingBar.scss │ │ ├── pivotTabStyle.scss │ │ ├── podcastEpisodeDetails.scss │ │ ├── progressBar.scss │ │ ├── searchPage.scss │ │ ├── trackList.scss │ │ └── windowTitle.scss │ ├── Themes/ │ │ └── Generic.xaml │ ├── ViewModels/ │ │ ├── MainPageViewModel.cs │ │ ├── NowPlayingViewModel.cs │ │ ├── ProxyConfigurationViewModel.cs │ │ ├── SettingsViewModel.cs │ │ ├── TopBarViewModel.cs │ │ └── ViewModelBase.cs │ ├── XpoMusic.csproj │ ├── XpotifyApi/ │ │ ├── AppConstantsApi.cs │ │ ├── AssetUpdatesApi.cs │ │ ├── DeveloperMessageApi.cs │ │ └── Model/ │ │ ├── AssetPackage.cs │ │ ├── AssetPackageInfo.cs │ │ ├── DeveloperMessage.cs │ │ └── DeveloperMessageCollection.cs │ ├── compilerconfig.json │ └── compilerconfig.json.defaults ├── XpoMusic.sln ├── XpoMusicInstaller/ │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Resources/ │ │ └── XpoMusic.cer │ ├── XpoMusicInstaller.csproj │ └── app.manifest └── XpoMusicWebAgent/ ├── Model/ │ ├── ActionRequestedEventArgs.cs │ ├── InitFailedEventArgs.cs │ ├── LogMessageReceivedEventArgs.cs │ ├── NowPlayingData.cs │ ├── ProgressBarCommandEventArgs.cs │ ├── StatusReportReceivedEventArgs.cs │ └── WebAppStatus.cs ├── Properties/ │ └── AssemblyInfo.cs ├── WebAgent.cs └── XpoMusicWebAgent.csproj ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ ############################################################################### # Set default behavior to automatically normalize line endings. ############################################################################### * text=auto ############################################################################### # Set default behavior for command prompt diff. # # This is need for earlier builds of msysgit that does not have it on by # default for csharp files. # Note: This is only used by command line ############################################################################### #*.cs diff=csharp ############################################################################### # Set the merge driver for project and solution files # # Merging from the command prompt will add diff markers to the files if there # are conflicts (Merging from VS is not affected by the settings below, in VS # the diff markers are never inserted). Diff markers may cause the following # file extensions to fail to load in VS. An alternative would be to treat # these files as binary and thus will always conflict and require user # intervention with every merge. To do so, just uncomment the entries below ############################################################################### #*.sln merge=binary #*.csproj merge=binary #*.vbproj merge=binary #*.vcxproj merge=binary #*.vcproj merge=binary #*.dbproj merge=binary #*.fsproj merge=binary #*.lsproj merge=binary #*.wixproj merge=binary #*.modelproj merge=binary #*.sqlproj merge=binary #*.wwaproj merge=binary ############################################################################### # behavior for image files # # image files are treated as binary by default. ############################################################################### #*.jpg binary #*.png binary #*.gif binary ############################################################################### # diff behavior for common document formats # # Convert binary document formats to text before diffing them. This feature # is only available from the command line. Turn it on by uncommenting the # entries below. ############################################################################### #*.doc diff=astextplain #*.DOC diff=astextplain #*.docx diff=astextplain #*.DOCX diff=astextplain #*.dot diff=astextplain #*.DOT diff=astextplain #*.pdf diff=astextplain #*.PDF diff=astextplain #*.rtf diff=astextplain #*.RTF diff=astextplain ================================================ FILE: .gitignore ================================================ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.userosscache *.sln.docstates # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ # Visual Studio 2015 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* # NUNIT *.VisualState.xml TestResult.xml # Build Results of an ATL Project [Dd]ebugPS/ [Rr]eleasePS/ dlldata.c # DNX project.lock.json project.fragment.lock.json artifacts/ *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc # Chutzpah Test files _Chutzpah* # Visual C++ cache files ipch/ *.aps *.ncb *.opendb *.opensdf *.sdf *.cachefile *.VC.db *.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx *.sap # TFS 2012 Local Workspace $tf/ # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user # JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # NCrunch _NCrunch_* .*crunch*.local.xml nCrunchTemp_* # MightyMoose *.mm.* AutoTest.Net/ # Web workbench (sass) .sass-cache/ # Installshield output folder [Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html # Click-Once directory publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml # TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted #*.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to # checkin your Azure Web App publish settings, but sensitive information contained # in these scripts will be unencrypted PublishScripts/ # NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. !**/packages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config # NuGet v3's project.json files produces more ignoreable files *.nuget.props *.nuget.targets # Microsoft Azure Build Output csx/ *.build.csdef # Microsoft Azure Emulator ecf/ rcf/ # Windows Store app package directories and files AppPackages/ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache !*.[Cc]ache/ # Others ClientBin/ ~$* *~ *.dbmdl *.dbproj.schemaview *.jfm *.pfx *.publishsettings node_modules/ orleans.codegen.cs # Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #bower_components/ # RIA/Silverlight projects Generated_Code/ # Backup & report files from converting an old project file # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files *.mdf *.ldf # Business Intelligence projects *.rdl.data *.bim.layout *.bim_*.settings # Microsoft Fakes FakesAssemblies/ # GhostDoc plugin setting file *.GhostDoc.xml # Node.js Tools for Visual Studio .ntvs_analysis.dat # Visual Studio 6 build log *.plg # Visual Studio 6 workspace options file *.opt # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts **/*.DesktopClient/ModelManifest.xml **/*.Server/GeneratedArtifacts **/*.Server/ModelManifest.xml _Pvt_Extensions # Paket dependency manager .paket/paket.exe paket-files/ # FAKE - F# Make .fake/ # JetBrains Rider .idea/ *.sln.iml # CodeRush .cr/ # Python Tools for Visual Studio (PTVS) __pycache__/ *.pyc Secrets.cs # Generated css files XpoMusic/InjectedAssets/style-dark.css XpoMusic/InjectedAssets/style-dark.min.css XpoMusic/InjectedAssets/style-light.css XpoMusic/InjectedAssets/style-light.min.css #Generated js files XpoMusic/InjectedAssets/init-dark.js XpoMusic/InjectedAssets/init-dark.js.map XpoMusic/InjectedAssets/init-light.js XpoMusic/InjectedAssets/init-light.js.map ================================================ FILE: LICENSE.md ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: Preview.md ================================================ # Xpo Music Preview Xpo Music v3 is currently in development. It utilizes [WinUI 3](https://docs.microsoft.com/en-us/windows/apps/winui/winui3/) and brings numerous improvements, notably a new rendering engine (Edge Chromium) which will result in a lot of performance and reliability improvements. ### When will this get released? Xpo Music v3.0 will replace the current version when WinUI 3 is stable enough. Currently WinUI 3 itself is in preview, and is not stable enough for production usage. The goal is to make Xpo Music v3 ready before WinUI 3 launch. ### How can I get Xpo Music 3 Preview? Here are the steps to get the Xpo Music Preview: 1. Make sure you have installed new Edge browser (Beta, Dev or Canary version) on your PC. 2. Install test certificate [from here](https://xpomusic.com/vNext/get/XpoMusic_3.0.1.0_Debug_Test/XpoMusic_3.0.1.0_x86_Debug.cer); make sure to install it on Local Machine, inside Trusted Root Certificate Authorities. 3. Get the app by clicking on "Get the app" button on [this page](https://xpomusic.com/vNext/get/). ### Is the preview stable enough for daily use? The core playback functionality is working and is already more performant than v2, but some crashes are to be expected. Also, certain Windows integration features like Live Tiles and Pin To Start are not yet available in v3 Preview. ### How can I send feedback for the preview version? Simply open an issue in this repository, make sure to mention you're talking about the preview version, and not the release version. ### Can I contribute? Of course! read [here](https://github.com/MahdiGhiasi/XpoMusic#contributing) for more information. ================================================ FILE: README.md ================================================ # Xpo Music (formerly Xpotify) A modern Spotify experience for Windows 10 **Get it from [XpoMusic.com](https://xpomusic.com/)** ## Building from source #### Requirements You need to have these components installed in order to build Xpo Music: * Visual Studio 2019 (or 2017) * Windows 10 SDK 18362 * TypeScript * [Web Compiler extension for Visual Studio](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebCompiler) #### Configuration Create a file named `Secrets.cs` in the `XpoMusic/` directory, and put the following content into it: namespace XpoMusic { internal static class Secrets { internal static readonly string SpotifyClientId = ""; internal static readonly string SpotifyClientSecret = ""; internal static readonly string GoogleAnalyticsTrackerId = ""; internal static readonly string AppCenterId = ""; } } Sign up on [Spotify Developer website](https://developer.spotify.com/) and get an API key for yourself. Put Id and Secret that you get from Spotify into the `SpotifyClientId` and `SpotifyClientSecret` fields. You can leave the `GoogleAnalyticsTrackerId` empty. Also, you will need to add `https://xpomusic.ghiasi.net/login/redirect` as the redirect URI on Spotify developer dashboard for the app entry you created. Alternatively, you can choose a different redirect URI and then modify [this line of code](https://github.com/MahdiGhiasi/Xpotify/blob/7e003b9879104a5b8b771f48475feca92155de8a/Xpotify/SpotifyApi/Authorization.cs#L18) accordingly. ## Contributing If you want to work on a bug or an enhancement that is already present and approved in the Issues, please leave a comment under that issue stating that you're going to work on it (so we can avoid doing duplicate work). Also, if you want to work on a new feature you have in mind for Xpo Music, please create an issue first so we can discuss it. ## License Xpo Music is available under [GNU General Public License v3.0](https://github.com/MahdiGhiasi/Xpotify/blob/master/LICENSE.md). ================================================ FILE: XpoMusic/App.xaml ================================================  ================================================ FILE: XpoMusic/App.xaml.cs ================================================ using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Popups; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Animation; using Windows.UI.Xaml.Navigation; using XpoMusic.Pages; using Microsoft.AppCenter; using Microsoft.AppCenter.Crashes; using Microsoft.AppCenter.Analytics; namespace XpoMusic { /// /// Provides application-specific behavior to supplement the default Application class. /// sealed partial class App : Application { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); /// /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.UnhandledException += App_UnhandledException; if (!string.IsNullOrWhiteSpace(Secrets.AppCenterId)) { AppCenter.LogLevel = LogLevel.Debug; AppCenter.Start(Secrets.AppCenterId, typeof(Analytics), typeof(Crashes)); } } private async void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) { e.Handled = true; AnalyticsHelper.Log("unhandledException", e.Message, e.Exception.ToString()); await new MessageDialog(e.Message + "\r\n---\r\n" + e.Exception.ToString(), "An exception has been occured in Xpo Music.").ShowAsync(); logger.Error("Unhandled exception: \r\n" + e.Message + "\r\n---\r\n" + e.Exception.ToString()); } /// /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// /// Details about the launch request and process. protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = InitRootFrame(e.PreviousExecutionState); if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } else if (!string.IsNullOrEmpty(e.Arguments)) { // If app is already opened but a secondary tile is clicked, var currentMainPage = (rootFrame.Content as MainPage); if (currentMainPage == null) { // if MainPage is not opened, navigate to MainPage with the necessary argument rootFrame.Navigate(typeof(MainPage), e.Arguments); } else { // if MainPage is opened already, send a signal to it so it can navigate to the new url. currentMainPage.NavigateToSecondaryTile(e.Arguments); } } // Ensure the current window is active Window.Current.Activate(); } } protected override void OnActivated(IActivatedEventArgs e) { Frame rootFrame = InitRootFrame(e.PreviousExecutionState); // Handle toast activation if (e.Kind == ActivationKind.ToastNotification) { var toastActivationArgs = e as ToastNotificationActivatedEventArgs; logger.Info($"ToastActivation with argument '{toastActivationArgs.Argument}'."); // Parse the query string (using QueryString.NET) var args = new WwwFormUrlDecoder(toastActivationArgs.Argument); // See what action is being requested switch (args.GetFirstValueByName("action")) { // Open the image case "reopenApp": if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); } break; } } else if (e.Kind == ActivationKind.Protocol) { var args = e as ProtocolActivatedEventArgs; var uri = args.Uri.ToString(); var currentMainPage = (rootFrame.Content as MainPage); logger.Info($"ProtocolActivation with uri '{uri}'."); var targetPwaUri = SpotifyShareUriHelper.GetPwaUri(uri); if (string.IsNullOrWhiteSpace(targetPwaUri)) { // Invalid uri, will launch default page if (currentMainPage == null) { // if MainPage is not opened, navigate to MainPage with the necessary argument rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); } } else { var argument = "pageUrl=" + WebUtility.UrlEncode(targetPwaUri); if (uri.ToLower().StartsWith("spotify:nl:")) { var autoplay = targetPwaUri.ToLower().Contains("/track/") ? "track" : "playlist"; argument += "&autoplay=" + autoplay; argument += "&source=cortana"; } if (currentMainPage == null) { // if MainPage is not opened, navigate to MainPage with the necessary argument rootFrame.Navigate(typeof(MainPage), argument); } else { // if MainPage is opened already, send a signal to it so it can navigate to the new url. currentMainPage.NavigateWithConfig(argument); } } } // TODO: Handle other types of activation // Ensure the current window is active Window.Current.Activate(); } private Frame InitRootFrame(ApplicationExecutionState previousExecutionState) { // Get the root frame Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (previousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } return rootFrame; } /// /// Invoked when Navigation to a certain page fails /// /// The Frame which failed navigation /// Details about the navigation failure void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } /// /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// /// The source of the suspend request. /// Details about the suspend request. private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Save application state and stop any background activity deferral.Complete(); } } } ================================================ FILE: XpoMusic/Assets/ReauthorizeForV2.html ================================================ 

Welcome to Xpo Music v2.0

Xpotify has been renamed to Xpo Music!

This update also contains many new features and improvements:
  • Now Playing page
  • Keyboard shortcuts read more
  • Add or remove songs to your Liked Songs quickly on album and playlist pages
  • Mini view redesign
  • Change volume by mouse wheel over volume bar
  • Appropriate device and app name in Spotify Connect
  • Animation improvements
  • Playback improvements
  • Many more under the hood improvements

Xpo Music requires you to authorize it again with your Spotify account, so you can have the best experience possible.

================================================ FILE: XpoMusic/Assets/TileTemplates/LiveTileAlbumAndArtistArt.xml ================================================  {songName} {artistName} {songName} {artistName} {albumName} {songName} {artistName} {albumName} ================================================ FILE: XpoMusic/Assets/TileTemplates/LiveTileAlbumArtOnly.xml ================================================  {songName} {artistName} {songName} {artistName} {albumName} {songName} {artistName} {albumName} ================================================ FILE: XpoMusic/Assets/TileTemplates/LiveTileArtistArtOnly.xml ================================================  {songName} {artistName} {songName} {artistName} {albumName} {songName} {artistName} {albumName} ================================================ FILE: XpoMusic/Classes/AppConstants.cs ================================================ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.UI.ViewManagement; using XpoMusic.Classes.Model.WebResourceModifications; using XpoMusic.Helpers; using XpoMusic.XpotifyApi; namespace XpoMusic.Classes { public class AppConstants { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static AppConstants instance; public static AppConstants Instance { get { if (instance == null) instance = new AppConstants(); return instance; } } private AppConstants() { #if DEBUG var initialStateJson = JsonConvert.SerializeObject(this, Formatting.Indented); #endif var latestSavedAppConstantsString = LocalConfiguration.LatestAppConstants; try { if (!string.IsNullOrWhiteSpace(latestSavedAppConstantsString)) { JsonConvert.PopulateObject(latestSavedAppConstantsString, this); this.ConstantsUpdated?.Invoke(this, new EventArgs()); } } catch (Exception ex) { logger.Warn($"Updating AppConstants from latest saved app constants string failed. The content was: '{latestSavedAppConstantsString}'"); logger.Error($"Updating AppConstants from latest saved app constants string failed: {ex}"); } } public event EventHandler ConstantsUpdated; [JsonProperty] public int PlayStatePollIntervalMilliseconds { get; private set; } = 20000; [JsonProperty] public int PlayStatePollIntervalMillisecondsWithCompactOverlayOpen { get; private set; } = 15000; [JsonIgnore] public TimeSpan PlayStatePollInterval { get { if (ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay) return TimeSpan.FromMilliseconds(PlayStatePollIntervalMillisecondsWithCompactOverlayOpen); return TimeSpan.FromMilliseconds(PlayStatePollIntervalMilliseconds); } } [JsonProperty] public bool HeartbeatEnabled { get; private set; } = true; [JsonProperty] public int HeartbeatIntervalSeconds { get; private set; } = 60 * 10; [JsonIgnore] public TimeSpan HeartbeatInterval => TimeSpan.FromSeconds(HeartbeatIntervalSeconds); [JsonProperty] public int StuckDetectSameElapsedCount { get; private set; } = 10; [JsonProperty] public int StuckDetectSameElapsedExtraCount { get; private set; } = 5; [JsonProperty] public int MaxStuckResolveTryCount { get; private set; } = 1; [JsonProperty] public WebResourceModificationRule[] ModificationRules { get; private set; } = new[] { new WebResourceModificationRule { UriRegexMatch = @"web-player\.[a-zA-Z0-9]*\.js", Type = WebResourceModificationRuleType.ModifyString, StringModificationRules = new[] { new WebResourceStringModificationRule { RegexMatch = Regex.Escape(@"window.matchMedia(""(display-mode: standalone)"").addEventListener(""change"",function(t){e(t.matches)})"), ReplaceTo = @"window.matchMedia(""(display-mode: standalone)"").addListener(""change"",function(t){e(t.matches)})", }, new WebResourceStringModificationRule { RegexMatch = Regex.Escape(@"var t=window.matchMedia(""(display-mode: standalone)"");(t.addEventListener||t.addListener)(""change"",function(t){return e(t.matches)})"), ReplaceTo = @"var t=window.matchMedia(""(display-mode: standalone)"");t.addListener(""change"",function(t){return e(t.matches)})", }, new WebResourceStringModificationRule { RegexMatch = @"""Web Player \("".concat\([a-zA-Z]+.getBrowserName\(\),""\)""\)", ReplaceTo = @"""Xpo Music""", }, new WebResourceStringModificationRule { RegexMatch = @"\{\.\.\.r\._propagators,\.\.\.e\.propagators\}", ReplaceTo = @"Object.assign({}, r._propagators, e.propagators)", }, new WebResourceStringModificationRule { RegexMatch = @"\{\.\.\.p\}", ReplaceTo = @"Object.assign({}, p)", }, new WebResourceStringModificationRule { RegexMatch = @"\{\.\.\.f\}", ReplaceTo = @"Object.assign({}, f)", }, new WebResourceStringModificationRule { RegexMatch = @"globalThis", ReplaceTo = @"window", }, } }, new WebResourceModificationRule { UriRegexMatch = @"https\:\/\/accounts\.spotify\.com(\/[a-z]+)?\/status.*", Type = WebResourceModificationRuleType.ModifyString, StringModificationRules = new[] { new WebResourceStringModificationRule { RegexMatch = @"^(.*\s*)*$", ReplaceTo = @"", }, } } }; [JsonProperty] public bool WebPlayerBackupEnabled { get; private set; } = true; [JsonProperty] public bool XamlInvertFilterForLightThemeEnabled { get; private set; } = true; public static async void Update() { try { var updateString = await AppConstantsApi.GetAppConstantsString(); if (string.IsNullOrWhiteSpace(updateString)) { logger.Info("No AppConstants update available."); return; } JsonConvert.PopulateObject(updateString, Instance); Instance.ConstantsUpdated?.Invoke(Instance, new EventArgs()); LocalConfiguration.LatestAppConstants = updateString; } catch (Exception ex) { logger.Warn("AppConstants.Update failed: " + ex.ToString()); AnalyticsHelper.Log("constantsFetchException", ex.Message, ex.ToString()); } } } } ================================================ FILE: XpoMusic/Classes/Cache/AlbumStore.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Cache { public class AlbumStore : CacheStore { protected override Task RetrieveItem(string key) { var album = new SpotifyApi.Album(); return album.GetAlbum(key); } } } ================================================ FILE: XpoMusic/Classes/Cache/ArtistStore.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Cache { public class ArtistStore : CacheStore { protected override Task RetrieveItem(string key) { var artist = new SpotifyApi.Artist(); return artist.GetArtist(key); } } } ================================================ FILE: XpoMusic/Classes/Cache/CacheStore.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Cache { public abstract class CacheStore { private Dictionary data = new Dictionary(); private SemaphoreQueue semaphore = new SemaphoreQueue(1, 1); public void Clear() { data.Clear(); } protected abstract Task RetrieveItem(string key); public async Task GetItem(string key) { try { await semaphore.WaitAsync(); if (!data.ContainsKey(key)) { data[key] = await RetrieveItem(key); } return data[key]; } finally { semaphore.Release(); } } } } ================================================ FILE: XpoMusic/Classes/Cache/GlobalCache.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Cache { public static class GlobalCache { public static ArtistStore Artist { get; } = new ArtistStore(); public static AlbumStore Album { get; } = new AlbumStore(); public static PlaylistStore Playlist { get; } = new PlaylistStore(); } } ================================================ FILE: XpoMusic/Classes/Cache/PlaylistStore.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Cache { public class PlaylistStore : CacheStore { protected override Task RetrieveItem(string key) { var playlist = new SpotifyApi.Playlist(); return playlist.GetPlaylist(key); } } } ================================================ FILE: XpoMusic/Classes/Cache/SongExtraInfoStore.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using XpoMusic.Classes.Model; using XpoMusic.SpotifyApi; namespace XpoMusic.Classes.Cache { public class SongExtraInfoStore : CacheStore { protected override async Task RetrieveItem(string key) { var library = new Library(); var info = new SongExtraInfo { SongId = key, IsSavedToLibrary = await library.IsTrackSaved(key), }; return info; } } } ================================================ FILE: XpoMusic/Classes/Converters/BooleanToVisibilityConverter.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; namespace XpoMusic.Classes.Converters { public class BooleanToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) => (bool)value ^ (parameter as string ?? string.Empty).Equals("Reverse") ? Visibility.Visible : Visibility.Collapsed; public object ConvertBack(object value, Type targetType, object parameter, string language) => (Visibility)value == Visibility.Visible ^ (parameter as string ?? string.Empty).Equals("Reverse"); } } ================================================ FILE: XpoMusic/Classes/Converters/LanguageToStringConverter.cs ================================================ using XpoMusic.Classes.Model; using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace XpoMusic.Classes.Converters { public class LanguageToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var lang = (Language)value; return LanguageHelper.GetLanguageName(lang); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } } ================================================ FILE: XpoMusic/Classes/Converters/LiveTileDesignToStringConverter.cs ================================================ using XpoMusic.Classes.Model; using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; using static XpoMusic.Helpers.LiveTileHelper; namespace XpoMusic.Classes.Converters { public class LiveTileDesignToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var design = (LiveTileDesign)value; switch (design) { case LiveTileDesign.AlbumArtOnly: return "Album art only"; case LiveTileDesign.ArtistArtOnly: return "Artist art only"; case LiveTileDesign.Disabled: return "Disabled"; case LiveTileDesign.AlbumAndArtistArt: return "Album art and artist art"; default: return "???"; } } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } } ================================================ FILE: XpoMusic/Classes/Converters/MillisecondsToMinSecConverter.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace XpoMusic.Classes.Converters { public class MillisecondsToMinSecConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var ms = (double)value; var t = TimeSpan.FromMilliseconds(ms); return $"{(int)Math.Floor(t.TotalMinutes)}:{t.Seconds.ToString("00")}"; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } } ================================================ FILE: XpoMusic/Classes/Converters/ThemeToStringConverter.cs ================================================ using XpoMusic.Classes.Model; using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace XpoMusic.Classes.Converters { public class ThemeToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var lang = (Theme)value; return ThemeHelper.GetThemeName(lang); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } } ================================================ FILE: XpoMusic/Classes/LocalConfiguration.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Foundation; using Windows.Storage; using XpoMusic.Classes.Model; using XpoMusic.Helpers; using static XpoMusic.Helpers.LiveTileHelper; using static XpoMusic.Helpers.ProxyHelper; namespace XpoMusic.Classes { public static class LocalConfiguration { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static readonly Size compactOverlayDefaultSize = new Size(300, 300); public static Size CompactOverlaySize { get { var config = GetConfiguration("CompactOverlaySize"); if (string.IsNullOrEmpty(config)) return compactOverlayDefaultSize; try { var configParts = config.Split(';'); return new Size(double.Parse(configParts[0]), double.Parse(configParts[1])); } catch { return compactOverlayDefaultSize; } } set { SetConfiguration("CompactOverlaySize", $"{value.Width};{value.Height}"); } } public static Size WindowMinSize => new Size(500, 500); public static bool IsLoggedInByFacebook { get { return GetConfiguration("IsLoggedInByFacebook") == "1"; } set { SetConfiguration("IsLoggedInByFacebook", value ? "1" : "0"); } } public static bool IsCustomProxyEnabled { get { return GetConfiguration("IsCustomProxyEnabled") == "1"; } set { SetConfiguration("IsCustomProxyEnabled", value ? "1" : "0"); } } public static string CustomProxyAddress { get { return GetConfiguration("CustomProxyAddress"); } set { SetConfiguration("CustomProxyAddress", value); } } public static string CustomProxyPort { get { return GetConfiguration("CustomProxyPort"); } set { SetConfiguration("CustomProxyPort", value); } } public static ProxyType CustomProxyType { get { if (!int.TryParse(GetConfiguration("CustomProxyType"), out int type)) type = (int)ProxyType.HttpHttps; return (ProxyType)type; } set { SetConfiguration("CustomProxyType", ((int)value).ToString()); } } public static Language Language { get { if (!int.TryParse(GetConfiguration("Language"), out int type)) type = (int)Language.Default; return (Language)type; } set { SetConfiguration("Language", ((int)value).ToString()); } } public static Theme Theme { get { if (!int.TryParse(GetConfiguration("Theme"), out int type)) type = (int)Theme.Dark; return (Theme)type; } set { SetConfiguration("Theme", ((int)value).ToString()); } } public static LiveTileDesign LiveTileDesign { get { if (!int.TryParse(GetConfiguration("LiveTileDesign"), out int type)) type = (int)LiveTileDesign.AlbumAndArtistArt; return (LiveTileDesign)type; } set { SetConfiguration("LiveTileDesign", ((int)value).ToString()); } } public static string[] DeveloperMessageShownIds { get { try { var ids = GetConfiguration("DeveloperMessageShownIds"); if (string.IsNullOrEmpty(ids)) return new string[] { }; return ids.Split(';'); } catch (Exception ex) { logger.Warn("DeveloperMessageShownIds failed: " + ex.ToString()); AnalyticsHelper.Log("exception-DeveloperMessageShownIds", ex.Message, ex.ToString()); return new string[] { }; } } } public static void AddIdToDeveloperMessageShownIds(string id) { var ids = DeveloperMessageShownIds.ToList(); ids.Add(id); SetConfiguration("DeveloperMessageShownIds", string.Join(';', ids.ToArray())); } public static int LatestAssetUpdateVersion { get { if (int.TryParse(GetConfiguration("LatestAssetUpdateVersion"), out int latestVersion)) return latestVersion; return 0; } set { SetConfiguration("LatestAssetUpdateVersion", value.ToString()); } } public static Version LatestAppVersionOnAssetUpdate { get { if (Version.TryParse(GetConfiguration("LatestAppVersionOnAssetUpdate"), out Version latestVersion)) return latestVersion; return PackageHelper.GetAppVersion(); } set { SetConfiguration("LatestAppVersionOnAssetUpdate", value.ToString()); } } public static bool OpenInMiniViewByCortana { get { var config = GetConfiguration("OpenInMiniViewByCortana"); if (config == null) return true; return config == "1"; } set { SetConfiguration("OpenInMiniViewByCortana", value ? "1" : "0"); } } public static bool NowPlayingShowArtistArt { get { var config = GetConfiguration("NowPlayingShowArtistArt"); if (config == null) return true; return config == "1"; } set { SetConfiguration("NowPlayingShowArtistArt", value ? "1" : "0"); } } public static bool MiniViewShowArtistArt { get { var config = GetConfiguration("MiniViewShowArtistArt"); if (config == null) return false; return config == "1"; } set { SetConfiguration("MiniViewShowArtistArt", value ? "1" : "0"); } } public static int ApiTokenVersion { get { var config = GetConfiguration("ApiTokenVersion"); if (config == null) return 1; if (!int.TryParse(config, out int apiTokenVersion)) return 1; return apiTokenVersion; } set { SetConfiguration("ApiTokenVersion", value.ToString()); } } public static string LatestAppConstants { get { return GetConfiguration("LatestAppConstants"); } set { SetConfiguration("LatestAppConstants", value.ToString()); } } private static string GetConfiguration(string key) { var completeKey = "LocalConfiguration_" + key; if (!ApplicationData.Current.LocalSettings.Values.ContainsKey(completeKey)) return null; return ApplicationData.Current.LocalSettings.Values[completeKey].ToString(); } private static void SetConfiguration(string key, string value) { var completeKey = "LocalConfiguration_" + key; ApplicationData.Current.LocalSettings.Values[completeKey] = value; } } } ================================================ FILE: XpoMusic/Classes/Model/AutoPlayAction.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model { public enum AutoPlayAction { None, Track, Playlist, } } ================================================ FILE: XpoMusic/Classes/Model/Language.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model { public enum Language { Default = 0, English = 1, Arabic = 2, Hungarian = 4, Czech = 5, German = 6, Spanish = 7, Finnish = 8, French = 9, CanadianFrench = 10, Greek = 11, Indonesian = 12, Italian = 13, Japanese = 14, Malay = 15, Dutch = 16, Polish = 17, BrazillianPortuguese = 18, Swedish = 19, Thai = 20, Turkish = 21, Vietnamese = 22, } } ================================================ FILE: XpoMusic/Classes/Model/LocalStoragePlayback.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model { public class LocalStoragePlayback { public double volume; } } ================================================ FILE: XpoMusic/Classes/Model/LyricsViewer/CurrentPlayingSongInfo.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model.LyricsViewer { public class CurrentPlayingSongInfo { public string SongName { get; set; } public string ArtistName { get; set; } public string AlbumName { get; set; } public string AlbumArtUri { get; set; } public override bool Equals(object obj) { if (obj is CurrentPlayingSongInfo cpsi) { return SongName == cpsi.SongName && ArtistName == cpsi.ArtistName && AlbumArtUri == cpsi.AlbumArtUri && AlbumName == cpsi.AlbumName; } return false; } public override int GetHashCode() { var hashCode = 2090074316; hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(SongName); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ArtistName); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(AlbumName); hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(AlbumArtUri); return hashCode; } } } ================================================ FILE: XpoMusic/Classes/Model/SongExtraInfo.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model { public class SongExtraInfo { public string SongId { get; set; } public bool IsSavedToLibrary { get; set; } } } ================================================ FILE: XpoMusic/Classes/Model/Theme.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model { public enum Theme { Dark, Light, System, } } ================================================ FILE: XpoMusic/Classes/Model/WebResourceModifications/WebResourceModificationRule.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace XpoMusic.Classes.Model.WebResourceModifications { public class WebResourceModificationRule { public string UriRegexMatch { get; set; } public WebResourceModificationRuleType Type { get; set; } public string AlternativeFileUri { get; set; } public WebResourceStringModificationRule[] StringModificationRules { get; set; } public bool Match(string requestUri) => Regex.IsMatch(requestUri, UriRegexMatch); } } ================================================ FILE: XpoMusic/Classes/Model/WebResourceModifications/WebResourceModificationRuleType.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.Classes.Model.WebResourceModifications { public enum WebResourceModificationRuleType { ReplaceWholeFile = 1, ModifyString = 2, } } ================================================ FILE: XpoMusic/Classes/Model/WebResourceModifications/WebResourceStringModificationRule.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace XpoMusic.Classes.Model.WebResourceModifications { public class WebResourceStringModificationRule { public string RegexMatch { get; set; } public string ReplaceTo { get; set; } public string Apply(string responseString) => Regex.Replace(responseString, RegexMatch, ReplaceTo); } } ================================================ FILE: XpoMusic/Classes/PlayStatusTracker.cs ================================================ using XpoMusic.Helpers; using XpoMusic.SpotifyApi; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Media; using Windows.Storage.Streams; using Windows.UI.Xaml; using Newtonsoft.Json; using XpoMusic.Classes.Model; using XpoMusic.Classes.Cache; using XpoMusicWebAgent.Model; namespace XpoMusic.Classes { public static class PlayStatusTracker { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); static DispatcherTimer timer; static DateTime lastStatusFetch = DateTime.MinValue; public static bool IsLocalStatusTrackingOperational { get; private set; } = false; public static class LastPlayStatus { public static string ArtistName { get; internal set; } public static string ArtistId { get; internal set; } public static string AlbumName { get; internal set; } public static string AlbumId { get; internal set; } public static string SongName { get; internal set; } public static string SongId { get; internal set; } public static int SongLengthMilliseconds { get; internal set; } public static bool IsPlaying { get; internal set; } public static double Volume { get; internal set; } public static bool IsNextTrackAvailable { get; internal set; } public static bool IsPrevTrackAvailable { get; internal set; } private static int progressedMilliseconds; private static DateTime progressedMillisecondsSetMoment; public static int ProgressedMilliseconds { get { if (!IsPlaying) return Math.Min(progressedMilliseconds, SongLengthMilliseconds); return Math.Min(SongLengthMilliseconds, (int)(progressedMilliseconds + (DateTime.UtcNow - progressedMillisecondsSetMoment).TotalMilliseconds)); } set { progressedMilliseconds = value; progressedMillisecondsSetMoment = DateTime.UtcNow; } } public static event EventHandler Updated; internal static void InvokeUpdated() { Updated?.Invoke(null, null); } } static PlayStatusTracker() { timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1), }; timer.Tick += Timer_Tick; } public static void SeekPlayback(double percentage) { LastPlayStatus.ProgressedMilliseconds = (int)(LastPlayStatus.SongLengthMilliseconds * percentage); LastPlayStatus.InvokeUpdated(); } public static void SeekVolume(double percentage) { LastPlayStatus.Volume = percentage; LastPlayStatus.InvokeUpdated(); } private static async void Timer_Tick(object sender, object e) { // Ignore if not logged in if (!TokenHelper.HasTokens()) return; if ((DateTime.UtcNow - lastStatusFetch) > AppConstants.Instance.PlayStatePollInterval) { IsLocalStatusTrackingOperational = false; await RefreshPlayStatus(); } } public static void StartRegularRefresh() { if (!timer.IsEnabled) timer.Start(); } private static int timesFingerprintEmpty = 0; private static string lastLocalFingerprint = ""; public static async void LocalPlaybackDataReceived(NowPlayingData data) { try { if (string.IsNullOrWhiteSpace(data.TrackFingerprint)) { if (timesFingerprintEmpty == 20) { logger.Warn($"LocalPlaybackDataError #{timesFingerprintEmpty}"); AnalyticsHelper.Log("localPlaybackDataError", "fingerprintInvalid", JsonConvert.SerializeObject(data)); timesFingerprintEmpty++; } else if (timesFingerprintEmpty < 20) { timesFingerprintEmpty++; logger.Info($"LocalPlaybackDataError #{timesFingerprintEmpty}"); } } if (!data.Success && !string.IsNullOrWhiteSpace(data.TrackFingerprint) && data.TrackFingerprint != lastLocalFingerprint) { logger.Info("LocalPlaybackDataReceived, success = false, fingerprint changed to " + data.TrackFingerprint); await RefreshPlayStatus(); AnalyticsHelper.Log("localPlaybackDataError", "invalid", JsonConvert.SerializeObject(data)); } else if (data.Success) { bool changed = (LastPlayStatus.SongId != data.TrackId || LastPlayStatus.Volume != data.Volume || LastPlayStatus.IsNextTrackAvailable != data.IsNextTrackAvailable || LastPlayStatus.IsPrevTrackAvailable != data.IsPrevTrackAvailable); LastPlayStatus.AlbumId = data.AlbumId; LastPlayStatus.ArtistId = data.ArtistId; LastPlayStatus.ArtistName = data.ArtistName; LastPlayStatus.ProgressedMilliseconds = data.ElapsedTime; LastPlayStatus.SongLengthMilliseconds = data.TotalTime; LastPlayStatus.SongId = data.TrackId; LastPlayStatus.SongName = data.TrackName; LastPlayStatus.IsPlaying = data.IsPlaying; LastPlayStatus.Volume = data.Volume; LastPlayStatus.IsNextTrackAvailable = data.IsNextTrackAvailable; LastPlayStatus.IsPrevTrackAvailable = data.IsPrevTrackAvailable; try { var album = await GlobalCache.Album.GetItem(data.AlbumId); LastPlayStatus.AlbumName = album.name; } catch (Exception ex) { logger.Info("LocalPlaybackDataReceived:GetAlbumInfo failed: " + ex.ToString()); } if (changed) { LastPlayStatus.InvokeUpdated(); logger.Info("LocalPlaybackDataReceived and changed = true for " + data.TrackFingerprint); } lastStatusFetch = DateTime.UtcNow; IsLocalStatusTrackingOperational = true; } lastLocalFingerprint = data.TrackFingerprint; } catch (Exception ex) { logger.Info("LocalPlaybackDataReceived failed: " + ex.ToString()); } } public static async Task RefreshPlayStatus() { try { // Don't ask API if local status tracking is working correctly. if (IsLocalStatusTrackingOperational) return; lastStatusFetch = DateTime.UtcNow; var player = new Player(); var current = await player.GetCurrentlyPlaying(); //if (current == null) //{ // LastPlayStatus.AlbumId = ""; // LastPlayStatus.AlbumName = ""; // LastPlayStatus.ArtistId = ""; // LastPlayStatus.ArtistName = ""; // LastPlayStatus.ProgressedMilliseconds = 0; // LastPlayStatus.SongLengthMilliseconds = 0; // LastPlayStatus.SongId = ""; // LastPlayStatus.SongName = ""; // LastPlayStatus.IsPlaying = false; // LastPlayStatus.Volume = 0.0; // // LastPlayStatus.InvokeUpdated(); //} //else if (current != null) { LastPlayStatus.AlbumId = current.item.album.id; LastPlayStatus.AlbumName = current.item.album.name; LastPlayStatus.ArtistId = current.item.artists.FirstOrDefault().id ?? ""; LastPlayStatus.ArtistName = current.item.artists.FirstOrDefault().name ?? "Unknown Artist"; LastPlayStatus.ProgressedMilliseconds = current.progress_ms; LastPlayStatus.SongLengthMilliseconds = current.item.duration_ms; LastPlayStatus.SongId = current.item.id; LastPlayStatus.SongName = current.item.name; LastPlayStatus.IsPlaying = current.is_playing; LastPlayStatus.Volume = (current.device.volume_percent ?? 50) / 100.0; LastPlayStatus.IsNextTrackAvailable = true; LastPlayStatus.IsPrevTrackAvailable = true; LastPlayStatus.InvokeUpdated(); } } catch (Exception ex) { logger.Info("RefreshPlayStatus failed: " + ex.ToString()); } } } } ================================================ FILE: XpoMusic/Classes/SemaphoreQueue.cs ================================================ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace XpoMusic.Classes { public class SemaphoreQueue { private SemaphoreSlim semaphore; private ConcurrentQueue> queue = new ConcurrentQueue>(); public int WaitingCount => queue.Count; public SemaphoreQueue(int initialCount) { semaphore = new SemaphoreSlim(initialCount); } public SemaphoreQueue(int initialCount, int maxCount) { semaphore = new SemaphoreSlim(initialCount, maxCount); } public void Wait() { WaitAsync().Wait(); } public Task WaitAsync() { var tcs = new TaskCompletionSource(); queue.Enqueue(tcs); semaphore.WaitAsync().ContinueWith(t => { TaskCompletionSource popped; if (queue.TryDequeue(out popped)) popped.SetResult(true); }); return tcs.Task; } public void Release() { semaphore.Release(); } } } ================================================ FILE: XpoMusic/Classes/WebViewController.cs ================================================ using XpoMusic.Classes; using XpoMusic.Classes.Model; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Controls; using Windows.Web.Http; using Windows.Web.Http.Filters; using Newtonsoft.Json; using Windows.UI.Popups; using XpoMusic.SpotifyApi; using Windows.Networking.Connectivity; namespace XpoMusic.Helpers { public class WebViewController { private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public const string SpotifyPwaUrlBeginsWith = "https://open.spotify.com"; public string LastInitErrors { get; internal set; } = ""; private WebView mainWebView; public WebViewController(WebView webView) { mainWebView = webView; } public void Navigate(Uri targetUri) { Navigate(targetUri, LocalConfiguration.Language); } private void Navigate(Uri targetUri, Language language) { var request = new HttpRequestMessage(HttpMethod.Get, targetUri); var languageString = LanguageHelper.GetHeaderLanguageString(language); if (!string.IsNullOrWhiteSpace(languageString)) request.Headers.Add("Accept-Language", languageString); mainWebView.NavigateWithHttpRequestMessage(request); } /// true if just injected the script, false if it was already injected. public async Task InjectInitScript(bool lightTheme) { var checkIfInjected = "((document.getElementsByTagName('body')[0].getAttribute('data-scriptinjection') == null) ? '0' : '1');"; var injected = await mainWebView.InvokeScriptAsync("eval", new string[] { checkIfInjected }); if (injected != "1") { var script = await AssetManager.LoadAssetString(lightTheme ? "init-light.js" : "init-dark.js"); var styleCss = await AssetManager.LoadAssetString(lightTheme ? "style-light.min.css" : "style-dark.min.css"); var tokens = TokenHelper.GetTokens(); script = script .Replace("{{XPOTIFYCSSBASE64CONTENT}}", Convert.ToBase64String(Encoding.UTF8.GetBytes(styleCss))) .Replace("{{XPOTIFYISPROVERSION}}", PackageHelper.IsProVersion ? "1" : "0") .Replace("{{SPOTIFYACCESSTOKEN}}", tokens.AccessToken) .Replace("{{DEVICENAME}}", DeviceInfoHelper.GetDeviceName()); try { await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } catch (Exception ex) { logger.Warn("InjectInitScript failed: " + ex.ToString()); AnalyticsHelper.Log("injectException", ex.Message, $"{LastInitErrors}\n{ex}"); if (ex.ToString().Contains("80020101")) { MessageDialog md = new MessageDialog( content: $"Error details:\r\n\r\n{LastInitErrors}\r\n{ex}", title: "There was a problem while initializing Xpo Music. Some features might not work properly."); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed md.ShowAsync(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed } else { MessageDialog md = new MessageDialog( content: ex.ToString(), title: "Xpo Music initialization failed. Some features might not work properly."); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed md.ShowAsync(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed } } return true; } return false; } public async Task CheckLoggedIn() { var script = await AssetManager.LoadAssetString("isLoggedInCheck.js"); var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result != "0"); } public async Task TryPushingFacebookLoginButton() { var script = await AssetManager.LoadAssetString("clickOnFacebookLogin.js"); var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public async Task EnableNowPlaying() { var script = "window.XpoMusicScript.Common.Action.enableNowPlaying();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } public async Task GoBackIfPossible() { var script = "window.XpoMusicScript.Common.Action.goBackIfPossible();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public void ClearCookies() { // WebView.ClearTemporaryWebDataAsync() causes cookies (that will be added later) to not // be saved upon app exit during current session. It seems to be a bug. // So we can't use that to clear cookies. ClearCookies(new Uri("https://www.spotify.com")); ClearCookies(new Uri("https://spotify.com")); ClearCookies(new Uri("https://accounts.spotify.com")); ClearCookies(new Uri("https://open.spotify.com")); ClearCookies(new Uri("https://facebook.com")); ClearCookies(new Uri("https://www.facebook.com")); } private void ClearCookies(Uri uri) { HttpBaseProtocolFilter baseFilter = new HttpBaseProtocolFilter(); foreach (var cookie in baseFilter.CookieManager.GetCookies(uri)) { baseFilter.CookieManager.DeleteCookie(cookie); } } public async Task GetPageUrl() { return await mainWebView.InvokeScriptAsync("eval", new string[] { "window.location.href" }); } public async Task GetPageTitle() { var findPageTitleScript = "window.XpoMusicScript.Common.PageTitleFinder.getTitle();"; var pageTitle = await mainWebView.InvokeScriptAsync("eval", new string[] { findPageTitleScript }); return pageTitle; } public async Task NavigateToSpotifyUrl(string url) { var currentUrl = await mainWebView.InvokeScriptAsync("eval", new String[] { "document.location.href;" }); if (currentUrl.ToLower().StartsWith(SpotifyPwaUrlBeginsWith.ToLower())) { var script = $"window.XpoMusicScript.Common.Action.navigateToPage('{url.Replace("'", "\\'")}');"; await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } else { Navigate(new Uri(url)); } } internal async Task AutoPlay(AutoPlayAction action) { string script; if (action == AutoPlayAction.Track) script = "window.XpoMusicScript.Common.Action.autoPlayTrack();"; else script = "window.XpoMusicScript.Common.Action.autoPlayPlaylist();"; var currentPlaying = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } public async Task ClearPlaybackLocalStorage() { var script = await AssetManager.LoadAssetString("clearPlaybackLocalStorage.js"); var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return result; } public async Task PlayPause() { var script = "window.XpoMusicScript.Common.Action.playPause();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public async Task Play() { var script = "window.XpoMusicScript.Common.Action.play();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public async Task Pause() { var script = "window.XpoMusicScript.Common.Action.pause();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public async Task NextTrack() { var script = "window.XpoMusicScript.Common.Action.nextTrack();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } public async Task PreviousTrack(bool canGoToBeginningOfCurrentSong = true) { string script; if (canGoToBeginningOfCurrentSong) script = "window.XpoMusicScript.Common.Action.prevTrack();"; else script = "window.XpoMusicScript.Common.Action.prevTrackForce();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } internal async Task IsPlayingOnThisApp() { var script = "window.XpoMusicScript.Common.Action.isPlayingOnThisApp();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); return (result == "1"); } internal async Task SeekPlayback(double percentage) { var script = $"window.XpoMusicScript.Common.Action.seekPlayback({percentage});"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } internal async Task SeekVolume(double percentage) { var script = $"window.XpoMusicScript.Common.Action.seekVolume({percentage});"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } internal async Task OnKeyDown(int charCode, bool shiftPressed, bool ctrlPressed, bool altPressed) { var script = $"window.XpoMusicScript.Common.KeyboardShortcutListener.keyDownExternalCall" + $"({charCode}, {shiftPressed.ToString().ToLower()}, {ctrlPressed.ToString().ToLower()}, " + $"{altPressed.ToString().ToLower()});"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); logger.Info(result); return result == "1"; } internal async Task TryResolvePlaybackStartStuck() { var script = $"window.XpoMusicScript.Common.PlaybackStuckHelper.tryResolveStart();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } internal async Task TryResolvePlaybackMiddleStuck() { var script = $"window.XpoMusicScript.Common.PlaybackStuckHelper.tryResolveMiddle();"; var result = await mainWebView.InvokeScriptAsync("eval", new string[] { script }); } } } ================================================ FILE: XpoMusic/Controls/FlyoutContainer.xaml ================================================  ================================================ FILE: XpoMusic/Controls/FlyoutContainer.xaml.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading.Tasks; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using XpoMusic.Helpers; using XpoMusic.XpotifyApi.Model; namespace XpoMusic.Controls { public sealed partial class FlyoutContainer : UserControl { public FlyoutContainer() { this.InitializeComponent(); } public void OpenSettings() { OpenSettings(0); } public void OpenHelp() { OpenSettings(1); } public void OpenAbout() { OpenSettings(2); } public void OpenDonate() { OpenSettings(3); } private void OpenSettings(int tabId) { settingsFlyout.InitFlyout(tabId); settingsFlyout.Visibility = Visibility.Visible; VisualStateManager.GoToState(this, nameof(OverlayVisibleVisualState), false); } public async void OpenWhatsNew() { await Task.Delay(500); whatsNewFlyout.InitFlyout(); whatsNewFlyout.Visibility = Visibility.Visible; VisualStateManager.GoToState(this, nameof(OverlayVisibleVisualState), false); AnalyticsHelper.Log("flyoutShow", "whatsNew", PackageHelper.GetAppVersionString()); } public async void OpenDeveloperMessage(DeveloperMessage message) { await Task.Delay(700); while (whatsNewFlyout.Visibility == Visibility.Visible) await Task.Delay(500); developerMessageFlyout.InitFlyout(message); developerMessageFlyout.Visibility = Visibility.Visible; VisualStateManager.GoToState(this, nameof(OverlayVisibleVisualState), false); AnalyticsHelper.Log("flyoutShow", "developerMessage", message.id); } private void WhatsNewFlyout_FlyoutCloseRequest(object sender, EventArgs e) { CloseOverlays(); } private void SettingsFlyout_FlyoutCloseRequest(object sender, EventArgs e) { CloseOverlays(); } private void DeveloperMessageFlyout_FlyoutCloseRequest(object sender, EventArgs e) { CloseOverlays(); } private async void CloseOverlays() { VisualStateManager.GoToState(this, nameof(OverlayClosedVisualState), false); await Task.Delay(300); developerMessageFlyout.Visibility = Visibility.Collapsed; whatsNewFlyout.Visibility = Visibility.Collapsed; settingsFlyout.Visibility = Visibility.Collapsed; } } } ================================================ FILE: XpoMusic/Controls/NowPlayingView.xaml ================================================  ================================================ FILE: XpoMusic/Controls/NowPlayingView.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Foundation; using Windows.UI.ViewManagement; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; using XpoMusic.Classes; using XpoMusic.Classes.Cache; using XpoMusic.Classes.Model; using XpoMusic.Helpers; using XpoMusic.SpotifyApi; namespace XpoMusic.Controls { public sealed partial class NowPlayingView : UserControl { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); #region Enums public enum NowPlayingViewMode { Normal, CompactOverlay, } public enum Action { Back, PlayQueue, SeekPlayback, SeekVolume, } private enum AnimationState { None, HiddenToRightSide, HiddenToLeftSide, } #endregion #region Custom Properties public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof(bool), typeof(NowPlayingView), new PropertyMetadata(defaultValue: false, propertyChangedCallback: new PropertyChangedCallback(OnIsOpenPropertyChanged))); public bool IsOpen { get => (bool)GetValue(IsOpenProperty); set { if (IsOpen != value) SetValue(IsOpenProperty, value); if (IsOpen && !timer.IsEnabled) { songInfoCache.Clear(); HideNameAndAlbumArtQuick(); SetTopBar(); TryUpdate(); timer.Start(); } else if (!IsOpen && timer.IsEnabled) { OnViewClosed(); timer.Stop(); } mainGrid.Visibility = value ? Visibility.Visible : Visibility.Collapsed; } } private static void OnIsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { (d as NowPlayingView).IsOpen = (bool)e.NewValue; } public static readonly DependencyProperty ViewModeProperty = DependencyProperty.Register( "ViewMode", typeof(NowPlayingViewMode), typeof(NowPlayingView), new PropertyMetadata(defaultValue: NowPlayingViewMode.Normal, propertyChangedCallback: new PropertyChangedCallback(OnViewModePropertyChanged))); public NowPlayingViewMode ViewMode { get => (NowPlayingViewMode)GetValue(ViewModeProperty); set { if (ViewMode != value) SetValue(ViewModeProperty, value); ViewModel.ViewMode = value; } } private static void OnViewModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { (d as NowPlayingView).ViewMode = (NowPlayingViewMode)e.NewValue; } #endregion public event EventHandler ActionRequested; public FrameworkElement MainBackgroundControl => this.mainBackgroundGrid; /// /// If this variable is set, track change animation will run in reverse direction as a song change is detected. /// NOTE: DO NOT set this variable directly to true, use SetPrevTrackCommandIssued() method, which reverts the /// change automatically after 4 seconds. /// private bool prevTrackCommandIssued = false; private AnimationState animationState = AnimationState.None; private DateTime spinnerShowTime = DateTime.MaxValue; private readonly TimeSpan maximumSpinnerShowTime = TimeSpan.FromSeconds(7); private DispatcherTimer timer; private string currentSongId = ""; private bool? currentShowArtistArtState = null; private bool isCompactOverlayFromNowPlaying = false; private SemaphoreQueue volumeSetSemaphore = new SemaphoreQueue(1, 1); private SongExtraInfoStore songInfoCache = new SongExtraInfoStore(); public NowPlayingView() { this.InitializeComponent(); ViewModel.PropertyChanged += ViewModel_PropertyChanged; timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1), }; timer.Tick += Timer_Tick; timer.Start(); PlayStatusTracker.LastPlayStatus.Updated += LastPlayStatus_Updated; } private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "ShowArtistArt") TryUpdate(); } public void ActivateProgressRing() { ViewModel.ProgressRingActive = true; } private void LastPlayStatus_Updated(object sender, EventArgs e) { TryUpdate(); } private void Timer_Tick(object sender, object e) { TryUpdate(); } private async void TryUpdate() { try { if (!IsOpen) return; await Update(); } catch (Exception ex) { logger.Warn("Update failed: " + ex.ToString()); } } private async Task Update() { if (ViewModel.ProgressBarValue != ViewModel.ProgressBarMaximum && PlayStatusTracker.LastPlayStatus.ProgressedMilliseconds == ViewModel.ProgressBarMaximum) { // Song just reached the end. refresh status now. RefreshPlayStatus(); } ViewModel.ProgressBarMaximum = PlayStatusTracker.LastPlayStatus.SongLengthMilliseconds; ViewModel.ProgressBarValue = PlayStatusTracker.LastPlayStatus.ProgressedMilliseconds; ViewModel.Volume = PlayStatusTracker.LastPlayStatus.Volume * 100; ViewModel.IsPlaying = PlayStatusTracker.LastPlayStatus.IsPlaying; ViewModel.PrevButtonEnabled = true; ViewModel.NextButtonEnabled = PlayStatusTracker.LastPlayStatus.IsNextTrackAvailable; if (currentSongId != PlayStatusTracker.LastPlayStatus.SongId || currentShowArtistArtState != ViewModel.ShowArtistArt) { currentSongId = PlayStatusTracker.LastPlayStatus.SongId; currentShowArtistArtState = ViewModel.ShowArtistArt; if (animationState == AnimationState.None) { if (prevTrackCommandIssued) { prevTrackCommandIssued = false; animationState = AnimationState.HiddenToRightSide; await hideToRightStoryboard.RunAsync(); } else { animationState = AnimationState.HiddenToLeftSide; await hideToLeftStoryboard.RunAsync(); } } ViewModel.SongName = PlayStatusTracker.LastPlayStatus.SongName; ViewModel.AlbumName = PlayStatusTracker.LastPlayStatus.AlbumName; ViewModel.ArtistName = PlayStatusTracker.LastPlayStatus.ArtistName; var albumArtUrl = await SongImageProvider.GetAlbumArt(PlayStatusTracker.LastPlayStatus.AlbumId); if (!string.IsNullOrWhiteSpace(albumArtUrl)) ViewModel.AlbumArtUri = new Uri(albumArtUrl); if (ViewModel.ShowArtistArt) { var artistArtUrl = await SongImageProvider.GetArtistArt(PlayStatusTracker.LastPlayStatus.ArtistId); if (!string.IsNullOrWhiteSpace(artistArtUrl)) { ViewModel.BackgroundArtUri = new Uri(artistArtUrl); ViewModel.BlurEnabled = false; } } else { if (!string.IsNullOrWhiteSpace(albumArtUrl)) { ViewModel.BackgroundArtUri = new Uri(albumArtUrl); ViewModel.BlurEnabled = true; } } await Task.Delay(200); if (animationState == AnimationState.HiddenToRightSide) showFromLeftStoryboard.Begin(); else // None or HiddenToLeftSide showFromRightStoryboard.Begin(); ViewModel.ProgressRingActive = false; animationState = AnimationState.None; } else if ((DateTime.UtcNow - spinnerShowTime) > maximumSpinnerShowTime && ViewModel.ProgressRingActive) { // Workaround for when prev track gets pushed when no prev track is there, // or in general when a command fails. // (progress ring should not be shown forever!) if (animationState == AnimationState.HiddenToRightSide) showFromRightStoryboard.Begin(); else // None or HiddenToLeftSide showFromLeftStoryboard.Begin(); ViewModel.ProgressRingActive = false; animationState = AnimationState.None; } try { var extraInfo = await songInfoCache.GetItem(currentSongId); ViewModel.IsSavedToLibrary = extraInfo.IsSavedToLibrary; } catch (Exception ex) { logger.Warn("GetSongExtraInfo failed: " + ex.ToString()); } } private void SetTopBar() { Window.Current.SetTitleBar(titleBarArea); } private void OnViewClosed() { ViewModel.BackgroundArtUri = null; ViewModel.AlbumArtUri = null; HideNameAndAlbumArtQuick(); currentSongId = ""; currentShowArtistArtState = null; } private void HideNameAndAlbumArtQuick() { hideQuickStoryboard.Begin(); animationState = AnimationState.HiddenToLeftSide; } private async void RefreshPlayStatus() { await Task.Delay(1000); await PlayStatusTracker.RefreshPlayStatus(); } private async void BackButton_Click(object sender, RoutedEventArgs e) { var view = ApplicationView.GetForCurrentView(); if (view.IsFullScreenMode) { AnalyticsHelper.PageView("NowPlaying"); view.ExitFullScreenMode(); return; } if (isCompactOverlayFromNowPlaying) { HideNameAndAlbumArtQuick(); currentSongId = ""; await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default); isCompactOverlayFromNowPlaying = false; ViewMode = NowPlayingViewMode.Normal; AnalyticsHelper.PageView("NowPlaying"); return; } ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.Back, }); } private async void PauseButton_Click(object sender, RoutedEventArgs e) { try { ViewModel.IsPlaying = false; ViewModel.PlayPauseButtonEnabled = false; timer.Stop(); // This delay is a workaround for PlayPauseButtonEnabled to // update the newly appeared UI. Otherwize it appears after // running PlaybackActionHelper.Play(). await Task.Delay(100); if (await PlaybackActionHelper.Pause()) { RefreshPlayStatus(); ViewModel.PlayPauseButtonEnabled = true; } else { ViewModel.IsPlaying = true; ViewModel.PlayPauseButtonEnabled = true; RefreshPlayStatus(); } } catch (UnauthorizedAccessException) { UnauthorizedHelper.OnUnauthorizedError(); } finally { ViewModel.PlayPauseButtonEnabled = true; if (!timer.IsEnabled) timer.Start(); } } private async void PlayButton_Click(object sender, RoutedEventArgs e) { try { ViewModel.IsPlaying = true; ViewModel.PlayPauseButtonEnabled = false; timer.Stop(); // This delay is a workaround for PlayPauseButtonEnabled to // update the newly appeared UI. Otherwize it appears after // running PlaybackActionHelper.Play(). await Task.Delay(100); if (await PlaybackActionHelper.Play()) { RefreshPlayStatus(); ViewModel.PlayPauseButtonEnabled = true; } else { ViewModel.IsPlaying = false; ViewModel.PlayPauseButtonEnabled = true; RefreshPlayStatus(); } } catch (UnauthorizedAccessException) { UnauthorizedHelper.OnUnauthorizedError(); } finally { ViewModel.PlayPauseButtonEnabled = true; if (!timer.IsEnabled) timer.Start(); } } private async void PrevTrackButton_Click(object sender, RoutedEventArgs e) { if (PlayStatusTracker.LastPlayStatus.IsPrevTrackAvailable) await PrevTrack(canGoToBeginningOfCurrentSong: true); else ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.SeekPlayback, AdditionalData = 0.0, }); } private async Task PrevTrack(bool canGoToBeginningOfCurrentSong) { try { if (!canGoToBeginningOfCurrentSong) HideToRightAnimation(); if (!(await PlaybackActionHelper.PreviousTrack(canGoToBeginningOfCurrentSong))) { if (!canGoToBeginningOfCurrentSong) showFromRightStoryboard.Begin(); animationState = AnimationState.None; ViewModel.ProgressRingActive = false; return; } SetPrevTrackCommandIssued(); ViewModel.PrevButtonEnabled = false; RefreshPlayStatus(); ViewModel.PrevButtonEnabled = true; } catch (UnauthorizedAccessException) { UnauthorizedHelper.OnUnauthorizedError(); } } private async void NextTrackButton_Click(object sender, RoutedEventArgs e) { await NextTrack(); } private async Task NextTrack() { try { HideToLeftAnimation(); if (!(await PlaybackActionHelper.NextTrack())) { showFromLeftStoryboard.Begin(); animationState = AnimationState.None; ViewModel.ProgressRingActive = false; return; } ViewModel.NextButtonEnabled = false; RefreshPlayStatus(); ViewModel.NextButtonEnabled = PlayStatusTracker.LastPlayStatus.IsNextTrackAvailable; } catch (UnauthorizedAccessException) { UnauthorizedHelper.OnUnauthorizedError(); } } private async void HideToRightAnimation() { animationState = AnimationState.HiddenToRightSide; spinnerShowTime = DateTime.UtcNow; ViewModel.ProgressRingActive = true; await hideToRightStoryboard.RunAsync(); } private async void HideToLeftAnimation() { animationState = AnimationState.HiddenToLeftSide; spinnerShowTime = DateTime.UtcNow; ViewModel.ProgressRingActive = true; await hideToLeftStoryboard.RunAsync(); } public void PlayChangeTrackAnimation(bool reverse) { if (reverse) { SetPrevTrackCommandIssued(); } else { HideToLeftAnimation(); } } private Guid lastPrevTrackCommandGuid = Guid.Empty; private async void SetPrevTrackCommandIssued() { var commandGuid = Guid.NewGuid(); lastPrevTrackCommandGuid = commandGuid; // This is only valid if a change is detected in the next 4 seconds, // otherwise, its value is returned to false. prevTrackCommandIssued = true; await Task.Delay(TimeSpan.FromSeconds(4)); if (lastPrevTrackCommandGuid != commandGuid) return; // A newer prev command has arrived during the last seconds, so we won't invalidate the prevTrackCommandIssued now. prevTrackCommandIssued = false; } #region Swipe Gesture const double _minimumDeltaXForSwipe = 20.0; Point? pressStartPoint = null, lastPoint = null; private void UserControl_PointerPressed(object sender, PointerRoutedEventArgs e) { pressStartPoint = e.GetCurrentPoint(null).Position; } private void UserControl_PointerMoved(object sender, PointerRoutedEventArgs e) { if (!pressStartPoint.HasValue) return; lastPoint = e.GetCurrentPoint(null).Position; var movement = lastPoint.Value.X - pressStartPoint.Value.X; if ((!PlayStatusTracker.LastPlayStatus.IsPrevTrackAvailable && movement > 0) || (!PlayStatusTracker.LastPlayStatus.IsNextTrackAvailable && movement < 0)) { movement = 0; pressStartPoint = lastPoint; } swipeTranslateTransform.X = movement; } private void UserControl_PointerReleased(object sender, PointerRoutedEventArgs e) { if (!pressStartPoint.HasValue) return; SwipeFinished(e.GetCurrentPoint(null).Position.X); } private async void SwipeFinished(double finalX) { var deltaX = finalX - pressStartPoint.Value.X; pressStartPoint = null; if (Math.Abs(deltaX) > _minimumDeltaXForSwipe) { if (deltaX > 0) await PrevTrack(canGoToBeginningOfCurrentSong: false); else await NextTrack(); } else { swipeTranslateTransform.X = 0; } } private void UserControl_PointerExited(object sender, PointerRoutedEventArgs e) { if (!pressStartPoint.HasValue) return; if (!lastPoint.HasValue) return; SwipeFinished(lastPoint.Value.X); } #endregion private async void UserControl_Loaded(object sender, RoutedEventArgs e) { try { await Update(); RefreshPlayStatus(); } catch (Exception ex) { logger.Warn("Loaded event failed: " + ex.ToString()); } } private void FullScreenButton_Click(object sender, RoutedEventArgs e) { ToggleFullscreen(); } public void ToggleFullscreen() { var view = ApplicationView.GetForCurrentView(); if (view.IsFullScreenMode) { AnalyticsHelper.PageView("NowPlaying"); view.ExitFullScreenMode(); } else { AnalyticsHelper.PageView("NowPlayingFullScreen"); view.TryEnterFullScreenMode(); } } private async void MiniViewButton_Click(object sender, RoutedEventArgs e) { await SwitchToMiniView(); } public async Task SwitchToMiniView() { if (ViewMode == NowPlayingViewMode.CompactOverlay) return; var viewMode = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); viewMode.ViewSizePreference = ViewSizePreference.Custom; viewMode.CustomSize = LocalConfiguration.CompactOverlaySize; var modeSwitched = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, viewMode); if (modeSwitched) { HideNameAndAlbumArtQuick(); currentSongId = ""; ViewMode = NowPlayingViewMode.CompactOverlay; isCompactOverlayFromNowPlaying = true; AnalyticsHelper.PageView("CompactOverlay"); } } private void ShowNowPlayingListButton_Click(object sender, RoutedEventArgs e) { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.PlayQueue, }); } private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { ViewModel.StoryboardOffset = e.NewSize.Width; } private void PlaybackSlider_ValueChangedByUserManipulation(object sender, SliderExtendedValueChangedEventArgs e) { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.SeekPlayback, AdditionalData = (e.NewValue / ViewModel.ProgressBarMaximum), }); } private async void VolumeSlider_ValueChangedByUserManipulation(object sender, SliderExtendedValueChangedEventArgs e) { try { await volumeSetSemaphore.WaitAsync(); // There are new shiny requests waiting, so I'm not needed anymore :( if (volumeSetSemaphore.WaitingCount > 0) return; ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.SeekVolume, AdditionalData = e.NewValue / 100.0, }); // Don't overload the SeekVolume request. await Task.Delay(200); } finally { volumeSetSemaphore.Release(); } } private async void SaveToYourLibrary_Click(object sender, RoutedEventArgs e) { var extraInfo = await songInfoCache.GetItem(currentSongId); extraInfo.IsSavedToLibrary = true; ViewModel.IsSavedToLibrary = true; var library = new Library(); var result = await library.SaveTrackToLibrary(currentSongId); extraInfo.IsSavedToLibrary = result; ViewModel.IsSavedToLibrary = result; } private async void RemoveFromYourLibrary_Click(object sender, RoutedEventArgs e) { var extraInfo = await songInfoCache.GetItem(currentSongId); extraInfo.IsSavedToLibrary = false; ViewModel.IsSavedToLibrary = false; var library = new Library(); var result = await library.RemoveTrackFromLibrary(currentSongId); extraInfo.IsSavedToLibrary = !result; ViewModel.IsSavedToLibrary = !result; } private async void VolumeSlider_PointerWheelChanged(object sender, PointerRoutedEventArgs e) { SliderExtended sliderExtended = (SliderExtended)sender; int delta = e.GetCurrentPoint(null).Properties.MouseWheelDelta; try { await volumeSetSemaphore.WaitAsync(); // There are new shiny requests waiting, so I'm not needed anymore :( if (volumeSetSemaphore.WaitingCount > 0) return; double newValue = Math.Max(0.0, Math.Min(sliderExtended.Value + ((double)delta / 20.0), 100.0)); ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Action.SeekVolume, AdditionalData = newValue / 100.0, }); // Don't overload the SeekVolume request. await Task.Delay(50); } finally { volumeSetSemaphore.Release(); } } } public class ActionRequestedEventArgs { public NowPlayingView.Action Action { get; set; } public object AdditionalData { get; set; } } } ================================================ FILE: XpoMusic/Controls/ProxyConfiguration.xaml ================================================  System-wide proxy settings will be used. You'll need to close and reopen Xpo Music for this change to take effect. ================================================ FILE: XpoMusic/Controls/TopBar.xaml.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel.Core; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI; using Windows.UI.Core; using Windows.UI.ViewManagement; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using XpoMusic.Classes.Model; using XpoMusic.Helpers; using XpoMusic.SpotifyApi; namespace XpoMusic.Controls { public sealed partial class TopBar : UserControl { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public event EventHandler OpenSpotifyUriRequested; #region Custom Properties public static readonly DependencyProperty ShowExtraButtonsProperty = DependencyProperty.Register( "ShowExtraButtons", typeof(bool), typeof(TopBar), new PropertyMetadata(defaultValue: false, propertyChangedCallback: new PropertyChangedCallback(OnShowExtraButtonsPropertyChanged))); public bool ShowExtraButtons { get => (bool)GetValue(ShowExtraButtonsProperty); set { SetValue(ShowExtraButtonsProperty, value); ViewModel.ShowExtraButtons = value; if (ShowExtraButtons && !clipboardCheckTimer.IsEnabled) clipboardCheckTimer.Start(); else if (!ShowExtraButtons && clipboardCheckTimer.IsEnabled) clipboardCheckTimer.Stop(); } } private static void OnShowExtraButtonsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { (d as TopBar).ShowExtraButtons = (bool)e.NewValue; } #endregion private DispatcherTimer clipboardCheckTimer; public TopBar() { this.InitializeComponent(); clipboardCheckTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(4), }; clipboardCheckTimer.Tick += ClipboardCheckTimer_Tick; ShowExtraButtons = false; } private void UserControl_Loaded(object sender, RoutedEventArgs e) { var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.IsVisibleChanged += CoreTitleBar_IsVisibleChanged; coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged; Window.Current.CoreWindow.Activated += Window_Activated; InitTitleBar(); } private void ClipboardCheckTimer_Tick(object sender, object e) { // Ignore if not logged in if (!TokenHelper.HasTokens()) return; CheckForSpotifyUriInClipboard(); } private async void OpenLinkFromClipboard_Click(object sender, RoutedEventArgs e) { var uri = await ClipboardHelper.GetSpotifyUri(); if (!string.IsNullOrWhiteSpace(uri)) { OpenSpotifyUriRequested?.Invoke(this, uri); } } private void Window_Activated(object sender, WindowActivatedEventArgs e) { if (e.WindowActivationState != CoreWindowActivationState.Deactivated) { CheckForSpotifyUriInClipboard(); } } private async void CheckForSpotifyUriInClipboard() { try { var isSpotifyUriPresent = await ClipboardHelper.IsSpotifyUriPresent(); if (isSpotifyUriPresent && TokenHelper.HasTokens()) { ViewModel.OpenLinkFromClipboardVisibility = Visibility.Visible; } else { ViewModel.OpenLinkFromClipboardVisibility = Visibility.Collapsed; } } catch (Exception ex) { logger.Error("CheckForSpotifyUriInClipboard failed: " + ex.ToString()); } } private void CoreTitleBar_IsVisibleChanged(CoreApplicationViewTitleBar sender, object args) { UpdateTitleBarSize(); } private void CoreTitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) { UpdateTitleBarSize(); } private void UpdateTitleBarSize() { var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; if (!coreTitleBar.IsVisible) { ViewModel.TopBarButtonWidth = 0.0; ViewModel.TopBarButtonHeight = 0.0; return; } var isTabletMode = (UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Touch); ViewModel.TopBarButtonHeight = coreTitleBar.Height; ViewModel.TopBarButtonWidth = coreTitleBar.SystemOverlayRightInset / (isTabletMode ? 2.0 : 4.0); } public void InitTitleBar() { var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; Window.Current.SetTitleBar(topBarBackground); UpdateTitleBarColors(ThemeHelper.GetCurrentTheme()); } public void UpdateTitleBarColors(Theme theme) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; if (theme == Theme.Dark) { // Top bar buttons background color topBarButtonsAcrylicBrush.TintColor = Colors.Black; topBarButtonsAcrylicBrush.FallbackColor = Colors.Black; // Clipboard button style openLinkFromClipboard.Style = Application.Current.Resources["TopBarDarkButtonStyle"] as Style; // Set active window colors titleBar.ForegroundColor = Colors.White; titleBar.BackgroundColor = Colors.Transparent; titleBar.ButtonForegroundColor = Colors.White; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonHoverForegroundColor = Colors.White; titleBar.ButtonHoverBackgroundColor = Color.FromArgb(128, 100, 100, 100); titleBar.ButtonPressedForegroundColor = Colors.White; titleBar.ButtonPressedBackgroundColor = Color.FromArgb(128, 140, 140, 140); // Set inactive window colors titleBar.InactiveForegroundColor = Color.FromArgb(255, 200, 200, 200); titleBar.InactiveBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveForegroundColor = Color.FromArgb(255, 200, 200, 200); titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; } else { // Top bar buttons background color topBarButtonsAcrylicBrush.TintColor = Colors.White; topBarButtonsAcrylicBrush.FallbackColor = Colors.White; // Clipboard button style openLinkFromClipboard.Style = Application.Current.Resources["TopBarLightButtonStyle"] as Style; // Set active window colors titleBar.ForegroundColor = Colors.Black; titleBar.BackgroundColor = Colors.Transparent; titleBar.ButtonForegroundColor = Colors.Black; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonHoverForegroundColor = Colors.Black; titleBar.ButtonHoverBackgroundColor = Color.FromArgb(128, 200, 200, 200); titleBar.ButtonPressedForegroundColor = Colors.Black; titleBar.ButtonPressedBackgroundColor = Color.FromArgb(128, 160, 160, 160); // Set inactive window colors titleBar.InactiveForegroundColor = Color.FromArgb(255, 255 - 200, 255 - 200, 255 - 200); titleBar.InactiveBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveForegroundColor = Color.FromArgb(255, 255 - 200, 255 - 200, 255 - 200); titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; } } } } ================================================ FILE: XpoMusic/Controls/XpoMusicWebApp.xaml ================================================  '; compactOverlayButton.querySelector('a').onclick = function () { XpoMusic.openMiniView(); return false; }; UiInjector.injectNowPlayingRightButton(compactOverlayButton); } catch (ex) { XpoMusic.log("injectCompactOverlayFailed"); XpoMusic.log(ex.toString()); return "injectCompactOverlayFailed,"; } return ""; } export function addNowPlayingButton() { try { var nowPlayingButton = document.createElement('div'); nowPlayingButton.innerHTML = ''; nowPlayingButton.querySelector('a').onclick = function () { XpoMusic.openNowPlaying(); return false; }; UiInjector.injectNowPlayingNavBarButton(nowPlayingButton); } catch (ex) { XpoMusic.log("addNowPlayingButtonFailed"); XpoMusic.log(ex.toString()); return "addNowPlayingButtonFailed,"; } return ""; } export function addBackgroundClass() { // Find and add necessary class to background div try { setTimeout(function () { Color.addXpotifyClassToBackground(12); }, 250); // Sometimes the PWA changes the background element on loading, causing the // background class to be removed. We'll do this again after a few seconds // to make sure that does not happen. setTimeout(function () { Color.addXpotifyClassToBackground(0); }, 4000); } catch (ex) { XpoMusic.log("findBackgroundDivFailed"); XpoMusic.log(ex.toString()); return "findBackgroundDivFailed,"; } return ""; } export function createTrackListAddRemoveButtons(): boolean { try { var count = 0; var needsRefresh = false; var tracks = document.querySelectorAll(".tracklist .tracklist-row"); for (var i = 0; i < tracks.length; i++) { if (tracks[i].getAttribute("data-xpotify-addremovebuttonsadded") !== null) { if (!tracks[i].classList.contains("tracklistSongExistsInLibrary") && !tracks[i].classList.contains("tracklistSongNotExistsInLibrary") && tracks[i].getAttribute("data-trackid") !== null && tracks[i].querySelectorAll('.more').length > 0) { needsRefresh = true; } continue; } var addSongDiv = document.createElement('button'); addSongDiv.classList.add("tracklist-middle-align"); addSongDiv.classList.add("control-button"); addSongDiv.classList.add("spoticon-add-16"); addSongDiv.classList.add("trackListAddRemoveSongButton"); addSongDiv.classList.add("trackListAddSongButton"); addSongDiv.setAttribute("title", "Add to your Liked Songs"); addSongDiv.addEventListener('click', async function (e) { var row = (e.target).closest('.tracklist-row'); var trackId = row.getAttribute("data-trackid"); row.classList.add('tracklistSongExistsInLibrary'); row.classList.remove('tracklistSongNotExistsInLibrary'); var libraryApi = new SpotifyApi.Library(); var result = await libraryApi.saveTrack(trackId); if (!result) { row.classList.add('tracklistSongNotExistsInLibrary'); row.classList.remove('tracklistSongExistsInLibrary'); } }); var removeSongDiv = document.createElement('button'); removeSongDiv.classList.add("tracklist-middle-align"); removeSongDiv.classList.add("control-button"); removeSongDiv.classList.add("spoticon-added-16"); removeSongDiv.classList.add("trackListAddRemoveSongButton"); removeSongDiv.classList.add("trackListRemoveSongButton"); removeSongDiv.setAttribute("title", "Remove from your Liked Songs"); removeSongDiv.addEventListener('click', async function (e) { var row = (e.target).closest('.tracklist-row'); var trackId = row.getAttribute("data-trackid"); row.classList.add('tracklistSongNotExistsInLibrary'); row.classList.remove('tracklistSongExistsInLibrary'); var libraryApi = new SpotifyApi.Library(); var result = await libraryApi.removeTrack(trackId); if (!result) { row.classList.add('tracklistSongExistsInLibrary'); row.classList.remove('tracklistSongNotExistsInLibrary'); } }); var destContainer = tracks[i].querySelectorAll('.more')[0]; if (destContainer !== undefined) { destContainer.appendChild(addSongDiv); destContainer.appendChild(removeSongDiv); count++; } tracks[i].setAttribute("data-xpotify-addremovebuttonsadded", "1"); } return (count > 0) || needsRefresh; } catch (ex) { XpoMusic.log(ex.toString()); return false; } } } ================================================ FILE: XpoMusic/Scripts/Common/uiInjector.ts ================================================ namespace XpoMusicScript.Common.UiInjector { export function injectNavbarDownButton(button) { var sessionInfo = document.querySelectorAll(".Root__nav-bar nav > div:last-child"); if (sessionInfo.length === 0) { setTimeout(function () { injectNavbarDownButton(button); }, 500); } else { var navbar = sessionInfo[0].parentElement; navbar.insertBefore(button, sessionInfo[0]); ((sessionInfo[0])).style.display = 'none'; } } export function injectNowPlayingRightButton(button) { var extraControlsBar = document.querySelectorAll('.Root__now-playing-bar .ExtraControls'); if (extraControlsBar.length === 0) { setTimeout(function () { injectNowPlayingRightButton(button); }, 500); } else { extraControlsBar[0].prepend(button); } } export function injectNowPlayingNavBarButton(button) { var extraControlsBar = document.querySelectorAll('.Root__top-container .Root__nav-bar nav ul'); if (extraControlsBar.length === 0) { setTimeout(function () { injectNowPlayingNavBarButton(button); }, 500); } else { extraControlsBar[0].append(button); } } } ================================================ FILE: XpoMusic/Scripts/Common/uriHelper.ts ================================================ namespace XpoMusicScript.Common.UriHelper { export function getPwaUri(uri) { if (uri === undefined || uri.trim() === "") { return ""; } uri = uri.replace('http://', 'https://'); var uriLowerCase = uri.toLowerCase(); if (uriLowerCase.startsWith("https://open.spotify.com")) return uri; if (uriLowerCase.startsWith("spotify:")) { if (uriLowerCase.indexOf("spotify:artist:") >= 0) { var idx = uriLowerCase.indexOf("spotify:artist:") + "spotify:artist:".length; return "https://open.spotify.com/artist/" + uri.substring(idx); } else if (uriLowerCase.indexOf("spotify:album:") >= 0) { var idx = uriLowerCase.indexOf("spotify:album:") + "spotify:album:".length; return "https://open.spotify.com/album/" + uri.substring(idx); } else if (uriLowerCase.indexOf("spotify:playlist:") >= 0) { var idx = uriLowerCase.indexOf("spotify:playlist:") + "spotify:playlist:".length; return "https://open.spotify.com/playlist/" + uri.substring(idx); } else if (uriLowerCase.indexOf("spotify:track:") >= 0) { var idx = uriLowerCase.indexOf("spotify:track:") + "spotify:track:".length; return "https://open.spotify.com/track/" + uri.substring(idx); } } return ""; } } ================================================ FILE: XpoMusic/Scripts/Common/web-player-backup.ts ================================================ namespace XpoMusicScript.Common.WebPlayerBackup { declare var XpoMusic: any; export function runWebPlayerBackup() { if (document.querySelectorAll("#main").length > 0) { XpoMusic.log("runWebPlayerBackup requested but #main already exists."); return; } XpoMusic.log("web-player-backup is not present in the current script version."); } } ================================================ FILE: XpoMusic/Scripts/DarkTheme/initScript-dark.ts ================================================ /// namespace XpoMusicScript { document.getElementsByTagName('body')[0].setAttribute('data-xpotifyTheme', 'dark'); var errors = ""; errors += Common.init(); if (errors.length > 0) { try { // @ts-ignore XpoMusic.initFailed(errors); } catch (ex) { } throw errors; } } ================================================ FILE: XpoMusic/Scripts/DarkTheme/tsconfig.json ================================================ { "compileOnSave": true, "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "module": "system", "outFile": "../../InjectedAssets/init-dark.js", "target": "es6" }, "include": [ "*.ts", "../Common/*.ts", "../Lib/*.ts", "../SpotifyApi/*.ts" ] } ================================================ FILE: XpoMusic/Scripts/Lib/focus-visible.ts ================================================  namespace XpoMusicScript.Lib.FocusVisible { export function init() { /** * Applies the :focus-visible polyfill at the given scope. * A scope in this case is either the top-level Document or a Shadow Root. * * @param {(Document|ShadowRoot)} scope * @see https://github.com/WICG/focus-visible */ function applyFocusVisiblePolyfill(scope) { var hadKeyboardEvent = true; var hadFocusVisibleRecently = false; var hadFocusVisibleRecentlyTimeout = null; var inputTypesWhitelist = { text: true, search: true, url: true, tel: true, email: true, password: true, number: true, date: true, month: true, week: true, time: true, datetime: true, 'datetime-local': true }; /** * Helper function for legacy browsers and iframes which sometimes focus * elements like document, body, and non-interactive SVG. * @param {Element} el */ function isValidFocusTarget(el) { if ( el && el !== document && el.nodeName !== 'HTML' && el.nodeName !== 'BODY' && 'classList' in el && 'contains' in el.classList ) { return true; } return false; } /** * Computes whether the given element should automatically trigger the * `focus-visible` class being added, i.e. whether it should always match * `:focus-visible` when focused. * @param {Element} el * @return {boolean} */ function focusTriggersKeyboardModality(el) { var type = el.type; var tagName = el.tagName; if (tagName == 'INPUT' && inputTypesWhitelist[type] && !el.readOnly) { return true; } if (tagName == 'TEXTAREA' && !el.readOnly) { return true; } if (el.isContentEditable) { return true; } return false; } /** * Add the `focus-visible` class to the given element if it was not added by * the author. * @param {Element} el */ function addFocusVisibleClass(el) { if (el.classList.contains('focus-visible')) { return; } el.classList.add('focus-visible'); el.setAttribute('data-focus-visible-added', ''); } /** * Remove the `focus-visible` class from the given element if it was not * originally added by the author. * @param {Element} el */ function removeFocusVisibleClass(el) { if (!el.hasAttribute('data-focus-visible-added')) { return; } el.classList.remove('focus-visible'); el.removeAttribute('data-focus-visible-added'); } /** * If the most recent user interaction was via the keyboard; * and the key press did not include a meta, alt/option, or control key; * then the modality is keyboard. Otherwise, the modality is not keyboard. * Apply `focus-visible` to any current active element and keep track * of our keyboard modality state with `hadKeyboardEvent`. * @param {KeyboardEvent} e */ function onKeyDown(e) { if (e.metaKey || e.altKey || e.ctrlKey) { return; } if (isValidFocusTarget(scope.activeElement)) { addFocusVisibleClass(scope.activeElement); } hadKeyboardEvent = true; } /** * If at any point a user clicks with a pointing device, ensure that we change * the modality away from keyboard. * This avoids the situation where a user presses a key on an already focused * element, and then clicks on a different element, focusing it with a * pointing device, while we still think we're in keyboard modality. * @param {Event} e */ function onPointerDown(e) { hadKeyboardEvent = false; } /** * On `focus`, add the `focus-visible` class to the target if: * - the target received focus as a result of keyboard navigation, or * - the event target is an element that will likely require interaction * via the keyboard (e.g. a text box) * @param {Event} e */ function onFocus(e) { // Prevent IE from focusing the document or HTML element. if (!isValidFocusTarget(e.target)) { return; } if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) { addFocusVisibleClass(e.target); } } /** * On `blur`, remove the `focus-visible` class from the target. * @param {Event} e */ function onBlur(e) { if (!isValidFocusTarget(e.target)) { return; } if ( e.target.classList.contains('focus-visible') || e.target.hasAttribute('data-focus-visible-added') ) { // To detect a tab/window switch, we look for a blur event followed // rapidly by a visibility change. // If we don't see a visibility change within 100ms, it's probably a // regular focus change. hadFocusVisibleRecently = true; window.clearTimeout(hadFocusVisibleRecentlyTimeout); hadFocusVisibleRecentlyTimeout = window.setTimeout(function () { hadFocusVisibleRecently = false; window.clearTimeout(hadFocusVisibleRecentlyTimeout); }, 100); removeFocusVisibleClass(e.target); } } /** * If the user changes tabs, keep track of whether or not the previously * focused element had .focus-visible. * @param {Event} e */ function onVisibilityChange(e) { if (document.visibilityState == 'hidden') { // If the tab becomes active again, the browser will handle calling focus // on the element (Safari actually calls it twice). // If this tab change caused a blur on an element with focus-visible, // re-apply the class when the user switches back to the tab. if (hadFocusVisibleRecently) { hadKeyboardEvent = true; } addInitialPointerMoveListeners(); } } /** * Add a group of listeners to detect usage of any pointing devices. * These listeners will be added when the polyfill first loads, and anytime * the window is blurred, so that they are active when the window regains * focus. */ function addInitialPointerMoveListeners() { document.addEventListener('mousemove', onInitialPointerMove); document.addEventListener('mousedown', onInitialPointerMove); document.addEventListener('mouseup', onInitialPointerMove); document.addEventListener('pointermove', onInitialPointerMove); document.addEventListener('pointerdown', onInitialPointerMove); document.addEventListener('pointerup', onInitialPointerMove); document.addEventListener('touchmove', onInitialPointerMove); document.addEventListener('touchstart', onInitialPointerMove); document.addEventListener('touchend', onInitialPointerMove); } function removeInitialPointerMoveListeners() { document.removeEventListener('mousemove', onInitialPointerMove); document.removeEventListener('mousedown', onInitialPointerMove); document.removeEventListener('mouseup', onInitialPointerMove); document.removeEventListener('pointermove', onInitialPointerMove); document.removeEventListener('pointerdown', onInitialPointerMove); document.removeEventListener('pointerup', onInitialPointerMove); document.removeEventListener('touchmove', onInitialPointerMove); document.removeEventListener('touchstart', onInitialPointerMove); document.removeEventListener('touchend', onInitialPointerMove); } /** * When the polfyill first loads, assume the user is in keyboard modality. * If any event is received from a pointing device (e.g. mouse, pointer, * touch), turn off keyboard modality. * This accounts for situations where focus enters the page from the URL bar. * @param {Event} e */ function onInitialPointerMove(e) { // Work around a Safari quirk that fires a mousemove on whenever the // window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯ if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') { return; } hadKeyboardEvent = false; removeInitialPointerMoveListeners(); } // For some kinds of state, we are interested in changes at the global scope // only. For example, global pointer input, global key presses and global // visibility change should affect the state at every scope: document.addEventListener('keydown', onKeyDown, true); document.addEventListener('mousedown', onPointerDown, true); document.addEventListener('pointerdown', onPointerDown, true); document.addEventListener('touchstart', onPointerDown, true); document.addEventListener('visibilitychange', onVisibilityChange, true); addInitialPointerMoveListeners(); // For focus and blur, we specifically care about state changes in the local // scope. This is because focus / blur events that originate from within a // shadow root are not re-dispatched from the host element if it was already // the active element in its own scope: scope.addEventListener('focus', onFocus, true); scope.addEventListener('blur', onBlur, true); // We detect that a node is a ShadowRoot by ensuring that it is a // DocumentFragment and also has a host property. This check covers native // implementation and polyfill implementation transparently. If we only cared // about the native implementation, we could just check if the scope was // an instance of a ShadowRoot. if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) { // Since a ShadowRoot is a special kind of DocumentFragment, it does not // have a root element to add a class to. So, we add this attribute to the // host element instead: scope.host.setAttribute('data-js-focus-visible', ''); } else if (scope.nodeType === Node.DOCUMENT_NODE) { document.documentElement.classList.add('js-focus-visible'); } } // It is important to wrap all references to global window and document in // these checks to support server-side rendering use cases // @see https://github.com/WICG/focus-visible/issues/199 if (typeof window !== 'undefined') { // Make the polyfill helper globally available. This can be used as a signal // to interested libraries that wish to coordinate with the polyfill for e.g., // applying the polyfill to a shadow root: // @ts-ignore window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill; // Notify interested libraries of the polyfill's presence, in case the // polyfill was loaded lazily: var event; try { event = new CustomEvent('focus-visible-polyfill-ready'); } catch (error) { // IE11 does not support using CustomEvent as a constructor directly: event = document.createEvent('CustomEvent'); event.initCustomEvent('focus-visible-polyfill-ready', false, false, {}); } window.dispatchEvent(event); } if (typeof document !== 'undefined') { // Apply the polyfill to the global document, so that no JavaScript // coordination is required to use the polyfill in the top-level document: applyFocusVisiblePolyfill(document); } } } ================================================ FILE: XpoMusic/Scripts/Lib/vibrant.ts ================================================  namespace XpoMusicScript.Lib.Vibrant { export function init() { //@ts-ignore (function e$$0(x,z,l){function h(p,b){if(!z[p]){if(!x[p]){var a="function"==typeof require&&require;if(!b&&a)return a(p,!0);if(g)return g(p,!0);a=Error("Cannot find module '"+p+"'");throw a.code="MODULE_NOT_FOUND",a;}a=z[p]={exports:{}};x[p][0].call(a.exports,function(a){var b=x[p][1][a];return h(b?b:a)},a,a.exports,e$$0,x,z,l)}return z[p].exports}for(var g="function"==typeof require&&require,w=0;wg?1:0},sum:function(h,g){var l={};return h.reduce(g?function(h,b,a){l.index=a;return h+g.call(l,b)}:function(h,b){return h+b},0)},max:function(h,g){return Math.max.apply(null,g?l.map(h,g):h)}};A=function(){function h(f,c,a){return(f<<2*d)+(c<>e;m=f[1]>>e;r=f[2]>>e;a=h(b,m,r);c[a]=(c[a]||0)+1});return c} function a(f,c){var a=1E6,b=0,m=1E6,d=0,q=1E6,n=0,h,k,l;f.forEach(function(c){h=c[0]>>e;k=c[1]>>e;l=c[2]>>e;hb&&(b=h);kd&&(d=k);ln&&(n=l)});return new w(a,b,m,d,q,n,c)}function n(a,c){function b(a){var f=a+"1";a+="2";var v,d,m,e;d=0;for(k=c[f];k<=c[a];k++)if(y[k]>n/2){m=c.copy();e=c.copy();v=k-c[f];d=c[a]-k;for(v=v<=d?Math.min(c[a]-1,~~(k+d/2)):Math.max(c[f],~~(k-1-v/2));!y[v];)v++;for(d=s[v];!d&&y[v-1];)d=s[--v];m[a]=v;e[f]=m[a]+1;return[m,e]}}if(c.count()){var d=c.r2- //@ts-ignore c.r1+1,m=c.g2-c.g1+1,e=l.max([d,m,c.b2-c.b1+1]);if(1==c.count())return[c.copy()];var n=0,y=[],s=[],k,g,t,u,p;if(e==d)for(k=c.r1;k<=c.r2;k++){u=0;for(g=c.g1;g<=c.g2;g++)for(t=c.b1;t<=c.b2;t++)p=h(k,g,t),u+=a[p]||0;n+=u;y[k]=n}else if(e==m)for(k=c.g1;k<=c.g2;k++){u=0;for(g=c.r1;g<=c.r2;g++)for(t=c.b1;t<=c.b2;t++)p=h(g,k,t),u+=a[p]||0;n+=u;y[k]=n}else for(k=c.b1;k<=c.b2;k++){u=0;for(g=c.r1;g<=c.r2;g++)for(t=c.g1;t<=c.g2;t++)p=h(g,t,k),u+=a[p]||0;n+=u;y[k]=n}y.forEach(function(a,c){s[c]=n-a});return e== //@ts-ignore d?b("r"):e==m?b("g"):b("b")}}var d=5,e=8-d;w.prototype={volume:function(a){if(!this._volume||a)this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1);return this._volume},count:function(a){var c=this.histo;if(!this._count_set||a){a=0;var b,d,n;for(b=this.r1;b<=this.r2;b++)for(d=this.g1;d<=this.g2;d++)for(n=this.b1;n<=this.b2;n++)index=h(b,d,n),a+=c[index]||0;this._count=a;this._count_set=!0}return this._count},copy:function(){return new w(this.r1,this.r2,this.g1,this.g2,this.b1, //@ts-ignore this.b2,this.histo)},avg:function(a){var c=this.histo;if(!this._avg||a){a=0;var b=1<<8-d,n=0,e=0,g=0,q,l,s,k;for(l=this.r1;l<=this.r2;l++)for(s=this.g1;s<=this.g2;s++)for(k=this.b1;k<=this.b2;k++)q=h(l,s,k),q=c[q]||0,a+=q,n+=q*(l+0.5)*b,e+=q*(s+0.5)*b,g+=q*(k+0.5)*b;this._avg=a?[~~(n/a),~~(e/a),~~(g/a)]:[~~(b*(this.r1+this.r2+1)/2),~~(b*(this.g1+this.g2+1)/2),~~(b*(this.b1+this.b2+1)/2)]}return this._avg},contains:function(a){var c=a[0]>>e;gval=a[1]>>e;bval=a[2]>>e;return c>=this.r1&&c<=this.r2&& //@ts-ignore gval>=this.g1&&gval<=this.g2&&bval>=this.b1&&bval<=this.b2}};p.prototype={push:function(a){this.vboxes.push({vbox:a,color:a.avg()})},palette:function(){return this.vboxes.map(function(a){return a.color})},size:function(){return this.vboxes.size()},map:function(a){for(var c=this.vboxes,b=0;bb[0]&&5>b[1]&&5>b[2]&&(a[0].color=[0,0,0]);var b=a.length-1,n=a[b].color;251d;)if(f=a.pop(),f.count()){var m=n(h,f);f=m[0];m=m[1];if(!f)break; //@ts-ignore a.push(f);m&&(a.push(m),c++);if(c>=b)break;if(1E3c||256this.yiq?"#fff":"#000"};b.prototype.getBodyTextColor=function(){this._ensureTextColors();return 150>this.yiq?"#fff":"#000"};b.prototype._ensureTextColors=function(){if(!this.yiq)return this.yiq=(299*this.rgb[0]+587*this.rgb[1]+114*this.rgb[2])/1E3};return b}();window.Vibrant=g=function(){function b(a,b,d){this.swatches=w(this.swatches,this);var e,f, c,g,p,m,r,q;"undefined"===typeof b&&(b=64);"undefined"===typeof d&&(d=5);p=new l(a);r=p.getImageData().data;m=p.getPixelCount();a=[];for(g=0;g=f&&s<=c&&m>=b&&m<=d&&!this.isAlreadySelected(k)&&(m=this.createComparisonValue(s,e,m,a, k.getPopulation(),this.HighestPopulation),void 0===l||m>q))l=k,q=m;return l};b.prototype.createComparisonValue=function(a,b,d,e,f,c){return this.weightedMean(this.invertDiff(a,b),this.WEIGHT_SATURATION,this.invertDiff(d,e),this.WEIGHT_LUMA,f/c,this.WEIGHT_POPULATION)};b.prototype.invertDiff=function(a,b){return 1-Math.abs(a-b)};b.prototype.weightedMean=function(){var a,b,d,e,f,c;f=1<=arguments.length?p.call(arguments,0):[];for(a=d=b=0;ac&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a};0===b?c=f=e=d:(b=0.5>d?d*(1+b):d+b-d*b,d=2*d-b,c=e(d,b,a+1/3),f=e(d,b,a),e=e(d,b,a-1/3));return[255*c,255*f,255*e]};return b}();window.CanvasImage=l=function(){function b(a){this.canvas= document.createElement("canvas");this.context=this.canvas.getContext("2d");document.body.appendChild(this.canvas);this.width=this.canvas.width=a.width;this.height=this.canvas.height=a.height;this.context.drawImage(a,0,0,this.width,this.height)}b.prototype.clear=function(){return this.context.clearRect(0,0,this.width,this.height)};b.prototype.update=function(a){return this.context.putImageData(a,0,0)};b.prototype.getPixelCount=function(){return this.width*this.height};b.prototype.getImageData=function(){return this.context.getImageData(0, 0,this.width,this.height)};b.prototype.removeCanvas=function(){return this.canvas.parentNode.removeChild(this.canvas)};return b}()}).call(this)},{quantize:1}]},{},[2]); } } ================================================ FILE: XpoMusic/Scripts/LightTheme/initScript-light.ts ================================================ /// /// namespace XpoMusicScript { document.getElementsByTagName('body')[0].setAttribute('data-xpotifyTheme', 'light'); var errors = ""; errors += Common.init(); errors += Light.PageOverlay.createPageOverlay(); if (errors.length > 0) { try { // @ts-ignore XpoMusic.initFailed(errors); } catch (ex) { } throw errors; } } ================================================ FILE: XpoMusic/Scripts/LightTheme/pageOverlay.ts ================================================ namespace XpoMusicScript.Light.PageOverlay { export function createPageOverlay() { try { var body = document.getElementsByTagName('body')[0]; var overlayDiv = document.createElement('div'); overlayDiv.classList.add("whole-page-overlay"); body.appendChild(overlayDiv); } catch (ex) { return "injectOverlayFailed,"; } return ""; } } ================================================ FILE: XpoMusic/Scripts/LightTheme/tsconfig.json ================================================ { "compileOnSave": true, "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "module": "system", "outFile": "../../InjectedAssets/init-light.js", "target": "es6" }, "include": [ "*.ts", "../Common/*.ts", "../Lib/*.ts", "../SpotifyApi/*.ts" ] } ================================================ FILE: XpoMusic/Scripts/SpotifyApi/apiBase.ts ================================================ namespace XpoMusicScript.SpotifyApi { declare var XpoMusic: any; var accessToken = "{{SPOTIFYACCESSTOKEN}}"; export abstract class ApiBase { protected async sendJsonRequestWithToken(uri, method, body = undefined): Promise { if (accessToken.length === 0) { accessToken = await XpoMusic.getNewAccessTokenAsync(); } return await this.sendJsonRequestWithTokenInternal(uri, method, body, true); } private async sendJsonRequestWithTokenInternal(uri, method, body, allowRefreshingToken): Promise { var response = await fetch(uri, { method: method, body: JSON.stringify(body), headers: { 'Authorization': 'Bearer ' + accessToken, }, }); XpoMusic.log("SpotifyApi: " + uri + " (" + method + ") -> result status = " + response.status); if (response.status == 401 && allowRefreshingToken) { // Refresh access token and retry XpoMusic.log("Will ask for new token."); accessToken = await XpoMusic.getNewAccessTokenAsync(); return await this.sendJsonRequestWithTokenInternal(uri, method, body, false); } return response; } } } ================================================ FILE: XpoMusic/Scripts/SpotifyApi/library.ts ================================================ /// namespace XpoMusicScript.SpotifyApi { export class Library extends ApiBase { public async isTrackSaved(trackId: string): Promise { return (await this.isTracksSaved([trackId]))[0]; } public async isTracksSaved(trackIds: string[]): Promise { var output = []; for (var i = 0; i < trackIds.length; i += 50) { var slice = trackIds.slice(i, i + 50); output = output.concat(await this.isTracksSavedInternal(slice)); } return output; } private async isTracksSavedInternal(trackIds: string[]): Promise { var url = 'https://api.spotify.com/v1/me/tracks/contains?ids=' + trackIds.join(','); var result = await this.sendJsonRequestWithToken(url, 'get'); var data = await result.json(); return data; } public async saveTrack(trackId: string): Promise { var url = "https://api.spotify.com/v1/me/tracks?ids=" + trackId; var result = await this.sendJsonRequestWithToken(url, 'put'); return result.status >= 200 && result.status <= 299; } public async removeTrack(trackId: string): Promise { var url = "https://api.spotify.com/v1/me/tracks?ids=" + trackId; var result = await this.sendJsonRequestWithToken(url, 'delete'); return result.status >= 200 && result.status <= 299; } } } ================================================ FILE: XpoMusic/Scripts/SpotifyApi/player.ts ================================================ /// namespace XpoMusicScript.SpotifyApi { export class Player extends ApiBase { public async getCurrentlyPlaying(): Promise { var url = 'https://api.spotify.com/v1/me/player'; var result = await this.sendJsonRequestWithToken(url, 'get'); var data = await result.json(); return data; } } } ================================================ FILE: XpoMusic/SpotifyApi/Album.cs ================================================ using XpoMusic.Helpers; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi { public class Album : ApiBase { public async Task GetAlbum(string albumId) { var result = await SendRequestWithTokenAsync($"https://api.spotify.com/v1/albums/{albumId}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "getalbum::" + result.StatusCode.ToString()); return JsonConvert.DeserializeObject(resultString); } } } ================================================ FILE: XpoMusic/SpotifyApi/ApiBase.cs ================================================ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using XpoMusic.SpotifyApi.Model; namespace XpoMusic.SpotifyApi { public class ApiBase { protected static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public Task SendRequestWithTokenAsync(string url, HttpMethod httpMethod) { return SendRequestWithTokenAsync(url, httpMethod, new Dictionary(), canUseRefreshToken: true); } public Task SendRequestWithTokenAsync(string url, HttpMethod httpMethod, Dictionary data) { return SendRequestWithTokenAsync(url, httpMethod, data, canUseRefreshToken: true); } private async Task SendRequestWithTokenAsync(string url, HttpMethod httpMethod, Dictionary data, bool canUseRefreshToken) { try { var httpClient = new HttpClient(); HttpRequestMessage msg = new HttpRequestMessage(httpMethod, url); msg.Headers.Clear(); msg.Headers.Authorization = new AuthenticationHeaderValue("Bearer", TokenHelper.GetTokens().AccessToken); msg.Content = new FormUrlEncodedContent(data.Select(x => x).ToList()); var response = await httpClient.SendAsync(msg); if ((response.IsSuccessStatusCode == false) && (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)) throw new UnauthorizedAccessException(); if (response.IsSuccessStatusCode) logger.Info($"{httpMethod.Method} request to {url} returned with status code {response.StatusCode}."); else logger.Warn($"{httpMethod.Method} request to {url} returned with status code {response.StatusCode}."); return response; } catch (UnauthorizedAccessException) { if (!canUseRefreshToken) throw; await TokenHelper.GetAndSaveNewTokenAsync(); return await SendRequestWithTokenAsync(url, httpMethod, data, false); } } public Task SendJsonRequestWithTokenAsync(string url, HttpMethod httpMethod, string data) { return SendJsonRequestWithTokenAsync(url, httpMethod, data, canUseRefreshToken: true); } private async Task SendJsonRequestWithTokenAsync(string url, HttpMethod httpMethod, string data, bool canUseRefreshToken) { try { var httpClient = new HttpClient(); HttpRequestMessage msg = new HttpRequestMessage(httpMethod, url); msg.Headers.Clear(); msg.Headers.Authorization = new AuthenticationHeaderValue("Bearer", TokenHelper.GetTokens().AccessToken); msg.Content = new StringContent(data, Encoding.UTF8, "application/json"); var response = await httpClient.SendAsync(msg); if ((response.IsSuccessStatusCode == false) && (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)) throw new UnauthorizedAccessException(); if (response.IsSuccessStatusCode) logger.Info($"{httpMethod.Method} [json] request to {url} returned with status code {response.StatusCode}."); else logger.Warn($"{httpMethod.Method} [json] request to {url} returned with status code {response.StatusCode}."); return response; } catch (UnauthorizedAccessException) { if (!canUseRefreshToken) throw; await TokenHelper.GetAndSaveNewTokenAsync(); return await SendJsonRequestWithTokenAsync(url, httpMethod, data, false); } } public async Task> GetNextPage(Paging page) { if (!page.hasNext) return null; var result = await SendRequestWithTokenAsync( page.next, HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject>(resultString); } public async Task> GetPrevPage(Paging page) { if (!page.hasPrev) return null; var result = await SendRequestWithTokenAsync( page.previous, HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject>(resultString); } public async Task> GetNextPage(Paging page) { if (!page.hasNext) return null; var result = await SendRequestWithTokenAsync( page.next, HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(resultString).artists; } public async Task> GetPrevPage(Paging page) { if (!page.hasPrev) return null; var result = await SendRequestWithTokenAsync( page.previous, HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(resultString).artists; } } } ================================================ FILE: XpoMusic/SpotifyApi/Artist.cs ================================================ using XpoMusic.Helpers; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi { public class Artist : ApiBase { public async Task GetArtist(string artistId) { var result = await SendRequestWithTokenAsync($"https://api.spotify.com/v1/artists/{artistId}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "getartist::" + result.StatusCode.ToString()); return JsonConvert.DeserializeObject(resultString); } } } ================================================ FILE: XpoMusic/SpotifyApi/Authorization.cs ================================================ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using XpoMusic.Classes; namespace XpoMusic.SpotifyApi { public static class Authorization { internal static readonly string Scopes = "user-read-recently-played playlist-read-private playlist-read-collaborative playlist-modify-private playlist-modify-public user-read-email user-library-read user-library-modify user-read-playback-state user-modify-playback-state user-read-private user-read-currently-playing user-follow-read user-follow-modify streaming user-top-read app-remote-control"; internal static readonly string SpotifyLoginUri = "https://accounts.spotify.com/"; internal static readonly string FacebookLoginFinishRedirectUri = "https://accounts.spotify.com/api/facebook/oauth/access_token"; internal static readonly string RedirectUri = "https://xpomusic.ghiasi.net/login/redirect"; internal static readonly string FacebookLoginUri = "https://www.facebook.com/login.php"; public static string GetAuthorizationUrl(string state) { return "https://accounts.spotify.com/authorize?" + $"client_id={WebUtility.UrlEncode(Secrets.SpotifyClientId)}&" + $"response_type=code&" + $"redirect_uri={WebUtility.UrlEncode(RedirectUri)}&" + $"state={WebUtility.UrlEncode(state)}&" + $"scope={WebUtility.UrlEncode(Scopes)}&" + $"show_dialog=false"; } public static async Task RetrieveAndSaveTokensFromAuthCode(string code) { var httpClient = new HttpClient(); HttpRequestMessage msg = new HttpRequestMessage(HttpMethod.Post, "https://accounts.spotify.com/api/token"); msg.Headers.Clear(); msg.Content = new FormUrlEncodedContent(new KeyValuePair[] { new KeyValuePair("grant_type", "authorization_code"), new KeyValuePair("code", code), new KeyValuePair("redirect_uri", RedirectUri), new KeyValuePair("client_id", Secrets.SpotifyClientId), new KeyValuePair("client_secret", Secrets.SpotifyClientSecret), }); var response = await httpClient.SendAsync(msg); var responseString = await response.Content.ReadAsStringAsync(); var responseData = JsonConvert.DeserializeObject>(responseString); var accessToken = responseData["access_token"].ToString(); var refreshToken = responseData["refresh_token"].ToString(); TokenHelper.SaveTokens(accessToken, refreshToken); LocalConfiguration.ApiTokenVersion = 2; } } } ================================================ FILE: XpoMusic/SpotifyApi/Library.cs ================================================ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using XpoMusic.SpotifyApi.Model; namespace XpoMusic.SpotifyApi { public class Library : ApiBase { public async Task IsTrackSaved(string trackId) { return (await IsTrackSaved(new[] { trackId }))[0]; } public async Task IsTrackSaved(string[] trackIds) { List output = new List(); for (int i = 0; i < trackIds.Length; i += 50) { var slice = trackIds.Skip(i).Take(50).ToArray(); output.AddRange(await IsTrackSavedInternal(slice)); } return output.ToArray(); } private async Task IsTrackSavedInternal(string[] trackIds) { trackIds = trackIds.Where(x => x != null && x.Length > 0).ToArray(); if (trackIds.Length == 0) return new bool[] { }; var result = await SendRequestWithTokenAsync( "https://api.spotify.com/v1/me/tracks/contains?" + $"ids={string.Join(',', trackIds)}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(resultString); } public async Task SaveTrackToLibrary(string trackId) { var result = await SendRequestWithTokenAsync( "https://api.spotify.com/v1/me/tracks?" + $"ids={trackId}", HttpMethod.Put); return result.IsSuccessStatusCode; } public async Task RemoveTrackFromLibrary(string trackId) { var result = await SendRequestWithTokenAsync( "https://api.spotify.com/v1/me/tracks?" + $"ids={trackId}", HttpMethod.Delete); return result.IsSuccessStatusCode; } public async Task> GetAlbums(int offset, int limit = 50) { var result = await SendRequestWithTokenAsync( $"https://api.spotify.com/v1/me/albums?limit={limit}&offset={offset}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject>(resultString); } public async Task> GetPlaylists(int offset, int limit = 50) { var result = await SendRequestWithTokenAsync( $"https://api.spotify.com/v1/me/playlists?limit={limit}&offset={offset}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject>(resultString); } public async Task> GetArtists(int offset, int limit = 50) { var result = await SendRequestWithTokenAsync( $"https://api.spotify.com/v1/me/following?type=artist&limit={limit}&offset={offset}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(resultString).artists; } } } ================================================ FILE: XpoMusic/SpotifyApi/Model/AlbumSimplified.cs ================================================ namespace XpoMusic.SpotifyApi.Model { public class AlbumSimplified { public ArtistSimplified[] artists; public string href; public string id; public Image[] images; public string name; public string uri; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Artist.cs ================================================ namespace XpoMusic.SpotifyApi.Model { public class Artist { public string href; public string id; public string name; public string uri; public Image[] images; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/ArtistSimplified.cs ================================================ namespace XpoMusic.SpotifyApi.Model { public class ArtistSimplified { public string href; public string id; public string name; public string uri; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/CurrentlyPlayingContext.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class CurrentlyPlayingContext { public int progress_ms; public bool is_playing; public string currently_playing_type; public Track item; public Device device; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Device.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class Device { public string id; public bool is_active; public bool is_private_session; public bool is_restricted; public string name; public string type; public int? volume_percent; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Devices.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class Devices { public Device[] devices; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/FollowedArtistsResponse.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class FollowedArtistsResponse { public Paging artists { get; set; } } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Image.cs ================================================ namespace XpoMusic.SpotifyApi.Model { public class Image { public string url; public int? height; public int? width; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Paging.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class Paging { public string href { get; set; } public T[] items { get; set; } public int limit { get; set; } public int offset { get; set; } public string next { get; set; } public string previous { get; set; } public int total { get; set; } public bool hasNext => next != null; public bool hasPrev => previous != null; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Playlist.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class Playlist { public bool collaborative; public string description; public string href; public string id; public Image[] images; public string name; public string uri; } } ================================================ FILE: XpoMusic/SpotifyApi/Model/SavedAlbum.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi.Model { public class SavedAlbum { public string added_at { get; set; } public AlbumSimplified album { get; set; } } } ================================================ FILE: XpoMusic/SpotifyApi/Model/Track.cs ================================================ namespace XpoMusic.SpotifyApi.Model { public class Track { public int duration_ms; public string id; public string name; public ArtistSimplified[] artists; public AlbumSimplified album; } } ================================================ FILE: XpoMusic/SpotifyApi/Player.cs ================================================ using XpoMusic.Helpers; using XpoMusic.SpotifyApi.Model; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi { public class Player : ApiBase { public async Task GetCurrentlyPlaying() { //AnalyticsHelper.Log("api:me/getplayer"); var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/getplayer::" + result.StatusCode.ToString()); return JsonConvert.DeserializeObject(resultString); } public async Task NextTrack() { var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player/next", HttpMethod.Post); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player/next::" + result.StatusCode.ToString()); return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } public async Task PreviousTrack() { var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player/previous", HttpMethod.Post); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player/previous::" + result.StatusCode.ToString()); return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } public async Task ResumePlaying() { var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player/play", HttpMethod.Put); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player/play::" + result.StatusCode.ToString()); if (result.StatusCode == System.Net.HttpStatusCode.NotFound) { logger.Info("ResumePlaying api returned NotFound."); var resultText = await result.Content.ReadAsStringAsync(); if (resultText.Contains("NO_ACTIVE_DEVICE")) { logger.Info("ResumePlaying api content included NO_ACTIVE_DEVICE. The complete text was:\n" + resultText); logger.Info("Will try to mark current device as active."); var devices = await GetDevices(); var thisDevice = devices.devices.FirstOrDefault(x => x.name.Contains("Edge") && x.name.Contains("Web")); if (thisDevice != null) { logger.Info("Guessed " + thisDevice.name + " to be the current device. Will try to transfer playback to it."); var transferResult = await TransferPlayback(thisDevice.id, ensurePlayback: true); logger.Info("Transfer playback to " + thisDevice.name + " " + (transferResult ? "succeded." : "failed.")); return transferResult; } } } return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } public async Task Pause() { var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player/pause", HttpMethod.Put); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player/pause::" + result.StatusCode.ToString()); return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } public async Task GetDevices() { var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player/devices", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player/getdevices::" + result.StatusCode.ToString()); return JsonConvert.DeserializeObject(resultString); } public async Task TransferPlayback(string deviceId, bool ensurePlayback) { var ensurePlaybackString = ensurePlayback ? "true" : "false"; var data = $"{{\"device_ids\":[\"{deviceId}\"], \"play\": \"{ensurePlaybackString}\"}}"; var result = await SendJsonRequestWithTokenAsync("https://api.spotify.com/v1/me/player", HttpMethod.Put, data); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player:transferplayback::" + result.StatusCode.ToString()); return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } public async Task SetVolume(string deviceId, double volume) { var volume_percent = (int)Math.Round(volume * 100.0); var result = await SendRequestWithTokenAsync($"https://api.spotify.com/v1/me/player/volume?volume_percent={volume_percent}&device_id={deviceId}", HttpMethod.Put); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "me/player:setvolume::" + result.StatusCode.ToString()); return (result.StatusCode == System.Net.HttpStatusCode.NoContent); } } } ================================================ FILE: XpoMusic/SpotifyApi/Playlist.cs ================================================ using XpoMusic.Helpers; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi { public class Playlist : ApiBase { public async Task GetPlaylist(string playlistId) { var result = await SendRequestWithTokenAsync($"https://api.spotify.com/v1/playlists/{playlistId}", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) AnalyticsHelper.Log("api", "getplaylist::" + result.StatusCode.ToString()); return JsonConvert.DeserializeObject(resultString); } } } ================================================ FILE: XpoMusic/SpotifyApi/TokenHelper.cs ================================================ using XpoMusic.Helpers; using Plugin.SecureStorage; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.SpotifyApi { public static class TokenHelper { const string accessTokenKey = "accessToken"; const string refreshTokenKey = "refreshToken"; public static async Task GetAndSaveNewTokenAsync() { var formContent = new FormUrlEncodedContent(new[] { new KeyValuePair("grant_type", "refresh_token"), new KeyValuePair("refresh_token", GetTokens().RefreshToken), new KeyValuePair("client_id", Secrets.SpotifyClientId), new KeyValuePair("client_secret", Secrets.SpotifyClientSecret), }); var httpClient = new HttpClient(); var response = await httpClient.PostAsync("https://accounts.spotify.com/api/token", formContent); var json = await response.Content.ReadAsStringAsync(); var results = Newtonsoft.Json.JsonConvert.DeserializeObject>(json); if (!results.ContainsKey("access_token")) throw new UnauthorizedAccessException(); var accessToken = results["access_token"].ToString(); SaveTokens(accessToken, GetTokens().RefreshToken); } internal static void ClearTokens() { if (CrossSecureStorage.Current.HasKey(accessTokenKey)) CrossSecureStorage.Current.DeleteKey(accessTokenKey); if (CrossSecureStorage.Current.HasKey(refreshTokenKey)) CrossSecureStorage.Current.DeleteKey(refreshTokenKey); } public static TokenResult GetTokens() { return new TokenResult { AccessToken = CrossSecureStorage.Current.GetValue(accessTokenKey) ?? "", RefreshToken = CrossSecureStorage.Current.GetValue(refreshTokenKey) ?? "", }; } public static void SaveTokens(string newAccessToken, string newRefreshToken) { CrossSecureStorage.Current.SetValue(accessTokenKey, newAccessToken); CrossSecureStorage.Current.SetValue(refreshTokenKey, newRefreshToken); } private static bool isLoggedHasTokensException = false; public static bool HasTokens() { try { return CrossSecureStorage.Current.HasKey(accessTokenKey) && CrossSecureStorage.Current.HasKey(refreshTokenKey); } catch (Exception ex) { if (!isLoggedHasTokensException) { AnalyticsHelper.Log("hasTokensException", ex.Message, ex.ToString()); isLoggedHasTokensException = true; } return false; } } } public class TokenResult { public string AccessToken { get; set; } public string RefreshToken { get; set; } } } ================================================ FILE: XpoMusic/Styles/CircleButtonStyle.xaml ================================================  ================================================ FILE: XpoMusic/Styles/MinimalButtonStyle.xaml ================================================  ================================================ FILE: XpoMusic/Styles/TopBarDarkButtonStyle.xaml ================================================  ================================================ FILE: XpoMusic/Styles/TopBarLightButtonStyle.xaml ================================================  ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/artistPage.scss ================================================  .artist h1 { opacity: 0; animation: animation-entrance-artist-section-header-item 0.4s ease-out 0s forwards; } .artist header { opacity: 0; animation: animation-entrance-artist-header 0.5s ease-out 0.2s forwards; } .artist header h1 { opacity: 0; animation: animation-entrance-artist-header-content 0.5s ease-out 0.4s forwards; } .artist header button { opacity: 0; animation: animation-entrance-artist-header-content 0.5s ease-out 0.7s forwards; } /* Keyframes */ @keyframes animation-entrance-artist-section-header-item { 0% { opacity: 0; transform: translateX(-24px); } 100% { opacity: 1; transform: translateX(0); } } @keyframes animation-entrance-artist-header { 0% { opacity: 0; transform: translateY(-100px); } 100% { opacity: 1; transform: translateY(0); } } @keyframes animation-entrance-artist-header-content { 0% { opacity: 0; transform: translateY(-24px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/navbarStartup.scss ================================================ @for $i from 1 through 3 { .Root__nav-bar .navBar ul li:nth-child(#{$i}) { opacity: 0; animation: animation-entrance-nav-bar-item 0.4s ease #{0.5 + ($i - 1) * 0.05}s forwards; } } .Root__nav-bar .navBar .recently-played ul li { opacity: 1; animation: none !important; } .Root__nav-bar .navBar .recently-played, .Root__nav-bar .navBar .Rootlist { opacity: 0; animation: animation-entrance-nav-bar-item 0.4s ease 0.75s forwards; } .NavBarFooter .navBar-item { opacity: 0; animation: animation-entrance-nav-bar-item 0.4s ease 0.85s forwards; } /* Keyframes */ @keyframes animation-entrance-nav-bar-item { 0% { opacity: 0; transform: translateY(-12px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/nowPlayingStartup.scss ================================================ .now-playing-bar__left { opacity: 0; animation: animation-entrance-now-playing-item 0.4s ease forwards; } .playback-bar { opacity: 0; animation: animation-entrance-now-playing-item 0.4s ease 0.7s forwards; } @for $i from 1 through 5 { .player-controls__buttons > .control-button:nth-child(#{$i}), .player-controls__buttons > .react-contextmenu-wrapper:nth-child(#{$i}) { opacity: 0; animation: animation-entrance-now-playing-item 0.4s ease #{0.6 + ($i - 1) * 0.05}s forwards; } } @for $i from 1 through 4 { .now-playing-bar__right .ExtraControls > div:nth-child(#{$i}) { opacity: 0; animation: animation-entrance-now-playing-item 0.4s ease #{0.9 + ($i - 1) * 0.05}s forwards; } } /* Keyframes */ @keyframes animation-entrance-now-playing-item { 0% { opacity: 0; transform: translateX(-12px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/pageEntrance.scss ================================================ /* Tab/page change entrance animation */ .HeaderedGrid__header, .container-fluid, .search-history { animation: animation-entrance-content 0.4s ease; } .asideButton { animation: animation-entrance-fade-in 0.4s ease; } .TrackListHeader__entity-long-description { animation: animation-entrance-fade-in-60 0.4s ease forwards; } @for $i from 1 through 32 { .Root__main-view section > div > div:nth-child(#{$i}) { opacity: 0; animation: animation-entrance-content 0.4s ease #{($i - 1) * 0.03}s forwards; } } /* Keyframes */ @keyframes animation-entrance-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @keyframes animation-entrance-fade-in-60 { 0% { opacity: 0; } 100% { opacity: .6; } } @keyframes animation-entrance-content { 0%, 25% { opacity: 0; transform: translateY(32px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/pivotEntrance.scss ================================================ /* Pivot item animation */ .Root__main-view nav ul li { opacity: 0; } @for $i from 1 through 12 { .Root__main-view nav ul li:nth-child(#{$i}) { animation: animation-entrance-pivot-item 0.4s ease #{($i - 1) * 0.05}s forwards; } } @for $i from 1 through 12 { .Root__main-view .artist nav ul li:nth-child(#{$i}) { animation: animation-entrance-pivot-item 0.4s ease #{($i - 1) * 0.05 + 0.2}s forwards; } } /* Keyframes */ @keyframes animation-entrance-pivot-item { 0% { opacity: 0; transform: translateX(-16px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/searchPage.scss ================================================  @for $i from 1 through 5 { #searchPage section:nth-child(#{$i}) { opacity: 0; animation: animation-entrance-search-section 0.3s ease #{($i - 1) * 0.1}s forwards; } } @keyframes animation-entrance-search-section { 0% { opacity: 0; transform: translateY(32px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/Animation/tracklistEntrance.scss ================================================ /* Tracklist item animation */ @for $i from 1 through 11 { .tracklist > div:nth-child(#{$i}) .tracklist-row { opacity: 0; animation: animation-entrance-tracklist-item 0.4s ease #{($i - 1) * 0.03}s forwards; } } @for $i from 12 through 30 { .tracklist > div:nth-child(#{$i}) .tracklist-row { opacity: 0; animation: animation-entrance-tracklist-item 0.4s ease #{0.30 + ($i - 11) * 0.02}s forwards; } } /* Keyframes */ @keyframes animation-entrance-tracklist-item { 0% { opacity: 0; transform: translateX(-24px); } 100% { opacity: 1; transform: translateY(0); } } ================================================ FILE: XpoMusic/Stylesheets/Common/adsContainer.scss ================================================  .Root__main-view--has-ads > div:nth-child(3) { z-index: 10000; } .Root__main-view--has-ads > div:nth-child(3) > div { background-color: rgba(24, 24, 24, 0.6); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-top: 0px; } .AdsContainer { background-color: transparent; overflow: hidden; } .now-playing-bar__right { padding-right: 8px; } @media (min-width: 721px) { .now-playing-bar__right__inner { width: 200px; } } ================================================ FILE: XpoMusic/Stylesheets/Common/artistPage.scss ================================================  .content.artist header::before { /* background: -webkit-gradient(linear,left top,left bottom,color-stop(-30%,transparent),to(#121212)); */ background: linear-gradient(transparent 40%, #121212); } .content.artist header h1 { max-width: 100% !important; font-weight: bolder !important; text-shadow: 0 0 10px #000, 0 0 20px #000, 0 0 30px #000, 0 0 40px #000, 0 0 50px #000, 0 0 60px #000, 0 0 70px #000; } .Root__main-view .artist .contentSpacing > span { /* Monthly listeners */ text-align: center; color: white; text-shadow: 0 0 10px #000, 0 0 20px #000, 0 0 30px #000, 0 0 40px #000, 0 0 50px #000, 0 0 60px #000, 0 0 70px #000; font-weight: 500; } .content.artist header h1, .content.artist header .contentSpacing > div { text-align: center; } .Root__main-view .artist .contentSpacing { margin-bottom: 0 !important; padding-top: 0 !important; } ================================================ FILE: XpoMusic/Stylesheets/Common/backButton.scss ================================================  .backButtonContainer { position: fixed; left: 0; top: 0; z-index: 10; width: 46px; height: 32px; text-align: center; cursor: default; } .backButtonContainer:hover { background: rgba(70, 70, 70, 0.5); } .backButtonContainer-disabled { opacity: 0.4; pointer-events: none; cursor: default; } .backButtonContainer-disabled:hover { background: unset; } .backButtonContainer span { font-family: Segoe MDL2 Assets; font-size: 14px; padding-top: 6px; display: inline-block; } ================================================ FILE: XpoMusic/Stylesheets/Common/common.scss ================================================ @import "general.scss"; @import "adsContainer.scss"; @import "backButton.scss"; @import "contextMenu.scss"; @import "fontStyle.scss"; @import "navBar.scss"; @import "nowPlayingBar.scss"; @import "pivotTabStyle.scss"; @import "smallWidthWindow.scss"; @import "windowTitle.scss"; @import "trackList.scss"; @import "searchPage.scss"; @import "artistPage.scss"; @import "themedScrollbar.scss"; @import "Animation/pageEntrance.scss"; @import "Animation/pivotEntrance.scss"; @import "Animation/tracklistEntrance.scss"; @import "Animation/nowPlayingStartup.scss"; @import "Animation/navBarStartup.scss"; @import "Animation/searchPage.scss"; @import "Animation/artistPage.scss"; ================================================ FILE: XpoMusic/Stylesheets/Common/contextMenu.scss ================================================ /* Context menu */ .react-contextmenu { border: 0; border: 1px solid #505050; border-radius: 0; background-color: rgba(30, 30, 30, 0.7); } .react-contextmenu.react-contextmenu--visible { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 0 20px 4px rgba(0,0,0,0.25); } .react-contextmenu-item { color: #eeeeee; opacity: 0; transition: opacity ease-out .15s; } .react-contextmenu.react-contextmenu--visible .react-contextmenu-item { opacity: 1; } ================================================ FILE: XpoMusic/Stylesheets/Common/fontStyle.scss ================================================ /* Font style changes */ body { --glue-font-weight-normal: 400; --glue-font-weight-bold: 500; --glue-font-weight-black: 700; -webkit-font-smoothing: antialiased; font-family: Segoe UI,spotify-circular,spotify-circular-cyrillic,spotify-circular-arabic,spotify-circular-hebrew,Helvetica Neue,Helvetica,Arial,Hiragino Kaku Gothic Pro,Meiryo,MS Gothic,sans-serif; } h1 { font-family: Segoe UI !important; font-weight: 100 !important; font-size: 40px !important; line-height: 60px !important; } .navBar-item { font-weight: var(--glue-font-weight-black); } .ResponsiveViewMoreButton { margin-top: 10px; } .artist-header h1.large { font-size: 72px !important; font-weight: var(--glue-font-weight-black) !important; } .artist-header h1.medium { font-size: 48px !important; font-weight: var(--glue-font-weight-black) !important; } .view-header__header-title--xxxl { font-size: 48px !important; font-weight: var(--glue-font-weight-black) !important; } .TrackListHeader__entity-name h2 { font-weight: 300; } ================================================ FILE: XpoMusic/Stylesheets/Common/general.scss ================================================  html { /* Color of the bounce effect of page when using touch or touchpad. */ background-color: #181818; /* Disable horizontal scrollbar which appears occasionally */ overflow-x: hidden; /* Disable overscrolling navbar and now playing bar */ overflow-y: hidden; } body { background-color: #181818; /* Disable zooming by pinch on touch screen or presicion touchpad */ -ms-content-zooming: none; /* Disable text selection */ -webkit-user-select: none; /* Disable horizontal scrollbar which appears occasionally */ overflow-x: hidden; /* Disable overscrolling navbar and now playing bar */ overflow-y: hidden; } .main-view-container__content, .main-view-container__scroll-node { /* Auto hide new scrollbar */ -ms-overflow-style: -ms-autohiding-scrollbar; /* Don't show scrollbar when not necessary */ overflow-y: auto; } .logo { display: none; } div[role=banner] { min-height: 30px; } .Root__main-view .row .contentSpacing { margin-bottom: 0 !important; padding-top: 0 !important; } .Root__main-view .Search .contentSpacing { margin-bottom: 0px !important; padding-top: 20px !important; } .Root__main-view .view-header { margin-top: -20px; } .Root__main-view h2 { font-weight: 100; } .cover-art { /* Fixed a bug where some images show up as inverted in Edge. */ filter: invert(0); } .NavBar__download-item { display: none; } .navBar-item .segoe-icon, .nowPlaying-icon { float: left; padding: 0px 20px; } .navBar-link-text-with-icon-wrapper { padding: 10px 0px; } .segoe-icon { font-size: 16px; } @media (max-width: 720px) { .segoe-icon { font-size: 18px; } } .btn { font-size: 14px; font-family: Segoe UI; text-transform: lowercase; letter-spacing: unset; } .btn:first-letter { text-transform: uppercase; } .btn:not(.disabled):hover { transform: scale(1); } .btn.btn-transparent:not(.disabled):hover { opacity: 0.7; } /* By [artistName] padding */ .TrackListHeader__entity-by { margin-right: 4px; } .nowPlaying-icon { width: 22px; height: 22px; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAYtJREFUeF7t3D1OA0EQBWHfgIPwEziGgANCBFchdQa3WngrhoCRZhwsJZt2fdIk3l6rp1JL3kmSJEk6T8uyPOW8dee5PdZWifn+2clnH+2xtjIwzMAwA8MMDDMwzMAwA8MMDDMwzMAwA8MMDDMwzMAwA8MMDDMwzMAwA8MMDNsaOLPXOf2v0uu5aSOXLSE2Bc74/fdbv+U7HtrIZTMwzMAwA8MMDDMwzMAwA8MMDDMwzMAwA8MMDDMwzMATucdVLvLYn/XzNnJU5k8eOLP7de/u7Nvj08k9/uJy5xB40w6Y7GFgUvYwMCl7GJiUPQxMyh4GJmUPA5Oyh4FJ2cPApOxhYFL2MDApexiYlD0MTMoeBiZlDwOTsoeBZ/Ilm/5SK3sYeKbC5TJu4JkKOwxVuFzGDTxTYYehCpfLuIFnKuwwVOFyGTfwTIUdhipcLuMGnqmww1CFy2XcwDMVdhiqcLmMG3imwg5DFS6X8bMO/JJz6M5re3xUZm+7d3/OXRs5KrP/fgdJkiTpcux2X+XA1jrUxBuXAAAAAElFTkSuQmCC'); background-size: contain; background-repeat: no-repeat; opacity: 0.7; transition: opacity ease-out .2s; } .nowPlaying-navBar-item { transition: opacity .3s ease-out; margin-left: 22px; } .nowPlaying-navBar-item:hover .nowPlaying-icon { opacity: 1; } .nowPlaying-navBar-item-disabled { opacity: 0.35; } .nowPlaying-navBar-item-disabled .navBar-link { cursor: default; } .nowPlaying-navBar-item-disabled:hover .nowPlaying-icon { opacity: 0.7; } .nowPlaying-navBar-item-disabled .navbar-link__text, .nowPlaying-navBar-item-disabled:hover .navbar-link__text { color: #b3b3b3; } a.focus-visible, button.focus-visible { outline-color: #555; outline-style: solid; outline-width: 1px; } li[role=button].focus-visible { outline-color: #555; outline-style: solid; outline-width: 1px; background: #333; } a.mo-info-name.focus-visible { outline-color: transparent; outline-width: 0; color: #222; background-color: #eee; } .Root__main-view nav ul li a.focus-visible { outline-color: #eee; outline-style: solid; outline-width: 2px; } a.search-history-result.focus-visible h1, a.search-history-result.focus-visible span { opacity: 1; border-left: 3px solid #fff; padding-left: 10px; } .Root__top-bar header { padding-top: 60px; padding-bottom: 25px; /*background: rgba(30, 30, 30, 0.7); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); */ } .xpo-top-bar-hidden { display: none !important; } .xpo-transparent-top-bar-background { /* Hide background */ display: none !important; } .Root__top-bar header > div:nth-child(2) > button:nth-child(1), .Root__top-bar header > div:nth-child(2) > button:nth-child(2) { /* Hide back/forward buttons in top menu */ display: none !important; } .xpo-collection-page { /* Added to .Root__main-view when on /collection/* pages */ padding-top: 40px; } .xpo-collection-page h1 { display: none; } [aria-label='Upgrade to Premium'] { display:none; } .main-view-container__scroll-node-child > section { /* Add padding to page content because of top-bar shift */ padding-top: 60px !important; } .main-view-container__scroll-node-child #searchPage { /* Add padding to page content because of top-bar shift */ padding-top: 80px !important; } .main-view-container__scroll-node-child-spacer { height: 0px; } .Rootlist { /* Navbar bottom items placement fix on short window size */ min-height: 0; margin-bottom: 16px; } .NowPlayingCoverSlotExpanded__container { display: none; } /* Recently played items */ @media (max-height:820px) { .recently-played__item-5 { display: none; } } @media (max-height:766px) { .recently-played__item-4 { display: none; } } @media (max-height:717px) { .recently-played__item-3 { display: none; } } @media (max-height:673px) { .recently-played__item-2 { display: none; } } @media (max-height:630px) { .recently-played { display: none; } } @media (max-height:660px) { .Rootlist__playlists { display: none; } } ================================================ FILE: XpoMusic/Stylesheets/Common/navBar.scss ================================================  .Root__nav-bar { background-color: rgba(45, 45, 45, 0.45) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); position: relative; overflow: hidden; z-index: 1; } .navBar { position: absolute; bottom: 0; top: 0; padding-top: 36px; width: 100%; } .main-view-container__content, .main-view-container__scroll-node { /* Acrylic behind navbar in artist page */ margin-left: -230px; padding-left: 230px; } .navBar-header { margin-bottom: 12px; } @media (max-width: 720px) { .Root__nav-bar .sessionInfo .UserWidget__user-link { display: none; } } .navBar-logo--size-large { display: none; } .navBar-logo--size-small { display: none; } .NavBarFooter { margin-top: 16px; } @media (max-width: 720px) { .navBar ul { margin-bottom: 40px; } } @media (max-height: 560px) { .navBar ul { margin-bottom: 10px; } } li.navBar-item span { font-weight: 500 !important; } .Rootlist__playlists-header { font-weight: 700 !important; font-size: 16px !important; letter-spacing: 0 !important; } ================================================ FILE: XpoMusic/Stylesheets/Common/nowPlayingBar.scss ================================================  .Root__now-playing-bar { background-color: transparent; z-index: 10; } .now-playing-bar-container { border: 0; z-index: 10; } .now-playing-bar { background-color: rgba(40, 40, 40, 0.6); transition: background-color ease-in-out 2s; z-index: 10; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); } .now-playing-bar__right__inner .CompactOverlayButton { margin-top: -1px; } .now-playing-bar__right__inner .CompactOverlayButton a { transition: opacity .3s ease-out; } .now-playing-bar__right__inner .CompactOverlayButton-disabled a { opacity: 0.35; } .now-playing-bar__right__inner .CompactOverlayButton-disabled .control-button:hover { color: #b3b3b3; } /* Fluent blur behind now playing bar */ .main-view-container { margin-bottom: -90px; } .main-view-container__scroll-node, .main-view-container__scroll-node-child { padding-bottom: 90px; } .Root__main-view--has-ads .main-view-container { margin-bottom: -190px; } .Root__main-view--has-ads .main-view-container__scroll-node, .Root__main-view--has-ads .main-view-container__scroll-node-child { padding-bottom: 190px; } /* END Fluent blur behind now playing bar */ ================================================ FILE: XpoMusic/Stylesheets/Common/pivotTabStyle.scss ================================================ /* Pivot tab style */ .Root__main-view nav ul li a, .Root__top-bar nav ul li a { /* text-transform: lowercase !important; */ font-family: Segoe UI !important; font-weight: 400 !important; font-size: 16px !important; letter-spacing: normal !important; margin: 10px 12px !important; background: transparent !important; border-bottom: 2px transparent solid; border-radius: 0; padding: 0 !important; width: auto !important; color: white; line-height: 28px !important; } /* .Root__main-view nav ul li a::first-letter { text-transform: uppercase !important; } */ .Root__main-view nav ul li a[aria-current=page], .Root__top-bar nav ul li a[aria-current=page] { border-bottom-color: #1DB954; } .Root__main-view nav ul, .Root__top-bar nav ul { text-align: left !important; } .Root__main-view .Search__content nav ul, .Root__top-bar .Search__content nav ul { margin-left: 16px; } .Root__main-view .artist-header nav ul, .Root__top-bar .artist-header nav ul { margin-left: -12px; } @media (min-width: 1100px) { .asideButton { position: absolute; right: 0; top: 8px; } .Root__main-view nav ul, .Root__top-bar nav ul { margin-right: 150px !important; } } ================================================ FILE: XpoMusic/Stylesheets/Common/searchPage.scss ================================================  #searchPage h2 { font-weight: 100; } ================================================ FILE: XpoMusic/Stylesheets/Common/smallWidthWindow.scss ================================================ /* Making UI usable for width < 720px, as UWP needs to support 500px+ */ body { min-width: 500px; min-height: 500px; } .now-playing-bar-container { min-width: 500px; } @media (max-width: 720px) { .now-playing-bar__center .player-controls__buttons { width: 180px; } .now-playing-bar__center .playback-bar { width: 214px; } .now-playing-bar__left .track-info { margin-right: 4px; margin-left: 8px; } .now-playing-bar__left .control-button { width: 22px; min-width: 22px; } .Root__main-view { padding-left: 0 !important; padding-right: 0 !important; width: 100%; } .Root__nav-bar { width: 46px; } .Root__nav-bar .navBar-item .navbar-link__text { display: none; } .sessionInfo { margin-left: 7px; margin-right: 0px; } .Root__nav-bar .navBar-item .icon, .UserWidget__container { transform: scale(0.75); } [dir=ltr] .SearchInputBox { left: 80px; } .navBar-link { padding: 0 11px; } .navBar-item--with-icon-left .navBar-link-text-with-icon-wrapper, .navBar-item--with-icon-right .navBar-link-text-with-icon-wrapper { justify-content: initial; } .recently-played { display: none; } .Rootlist__playlists { display: none; } .NavBar__xpotifysettings-item { padding-left: 2px; } .xpotifyWindowTitle { display: none; } } @media (max-width: 640px) { .now-playing-bar__left { width: 45%; } .now-playing-bar__center { width: 50%; } .now-playing-bar__right { width: 90px; min-width: 90px; } .now-playing-bar__right__inner { width: 90px; min-width: 90px; } .now-playing-bar__right__inner .ExtraControls { flex-wrap: wrap; margin-top: 4px; } .now-playing-bar__right__inner .control-button { width: 22px; min-width: 22px; margin-right: 2px; margin-left: 2px; } .now-playing-bar__right__inner .volume-bar { width: 81px; margin-top: 4px; } .now-playing-bar__right__inner .CompactOverlayButton { margin-right: 6px; } .now-playing-bar__right__inner .ExtraControls__connect-device-picker .connect-device-list-container { right: 0; bottom: 72px; } .now-playing-bar__right__inner .ExtraControls__connect-device-picker .connect-device-list-container:before { width: 0; height: 0; bottom: 0; } .HeaderedGrid__header h1 { font-size: 30px; } .HeaderedGrid__header .ResponsiveViewMoreButton { padding-top: 6px; } } @media (max-width: 820px) { header.artist-header h1.large { font-size: 48px !important; } } @media (max-width: 550px) { .now-playing-bar__right { width: 80px; min-width: 80px; } .now-playing-bar__right__inner { width: 80px; min-width: 80px; } .now-playing-bar__right__inner .control-button { width: 22px; min-width: 22px; margin-right: 0px; margin-left: 0px; } .now-playing-bar__right__inner .volume-bar { width: 69px; } .now-playing-bar__right__inner .volume-bar .control-button { margin-right: 2px; } .contentSpacing { padding-left: 24px !important; padding-right: 24px !important; } } @media (max-width: 870px) and (min-width: 771px) { .TrackListHeader { width: 400px; } } @media (max-width: 770px) { .Root__main-view .TrackListHeader { display: block; } .Root__main-view .TrackListHeader__body { text-align: center; margin-left: auto; margin-right: auto; width: 320px; } .Root__main-view .TrackListHeader__children { margin-left: auto; margin-right: auto; max-width: 320px; justify-content: center; } } ================================================ FILE: XpoMusic/Stylesheets/Common/themedScrollbar.scss ================================================  .xpo-scroll-container { overflow-y: auto; overflow-x: hidden; -ms-overflow-style: none; } .xpo-extra-scrollbar-fixed { position: absolute; top: 0px; right: 0px; bottom: 0px; width: 20px; /*-ms-overflow-style: -ms-autohiding-scrollbar;*/ -ms-overflow-style: scrollbar; filter: invert(1) /*brightness(1.25)*/; transform: translate3d(0, 0, 0); } ================================================ FILE: XpoMusic/Stylesheets/Common/trackList.scss ================================================  .tracklist-top-align { /* No top align, will always be middle aligned. */ position: relative; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); margin-top: 0; } .tracklist-col.more > div:nth-child(1) { float: left; } .trackListAddRemoveSongButton { float: right; padding: 8px; margin-top: -2px; animation: animation-tracklist-addremove-entrance 0.3s ease-out; display: none; } .trackListAddRemoveSongButton:hover { opacity: 0.8; } .tracklistSongNotExistsInLibrary .trackListAddSongButton { display: block; } .tracklistSongExistsInLibrary .trackListRemoveSongButton { display: block; color: #1DB954; } /* Keyframes */ @keyframes animation-tracklist-addremove-entrance { 0% { opacity: 0; } 100% { opacity: 1; } } ================================================ FILE: XpoMusic/Stylesheets/Common/windowTitle.scss ================================================ /* Window title */ .xpotifyWindowTitle { position: fixed; font-family: Segoe UI; font-weight: 400; padding-top: 5px; padding-left: 54px; color: white; font-size: 12px; pointer-events: none; z-index: 100; } ================================================ FILE: XpoMusic/Stylesheets/DarkTheme/dark.scss ================================================ @import "../Common/common.scss"; ================================================ FILE: XpoMusic/Stylesheets/LightTheme/artistPage.scss ================================================  .content.artist > div:nth-child(1) { filter: invert(1); } .content.artist button[aria-label=Play], .content.artist button[title=Play] { filter: invert(1); } .content.artist img { filter: invert(0); } .Root__main-view .react-contextmenu-wrapper button { filter: invert(0); } .content.artist header > div { filter: invert(1); } .content.artist header::before { /* background: -webkit-gradient(linear,left top,left bottom,color-stop(-30%,transparent),to(#121212)); */ background: linear-gradient(transparent 40%,#f2f2f2); } .content.artist header h1, .content.artist header .contentSpacing > div { filter: invert(1); } .Root__main-view .artist .contentSpacing > span { /* Monthly listeners */ filter: invert(1); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/contextMenu.scss ================================================ .react-contextmenu.react-contextmenu--visible { /* Context menu shadow should be dark in light mode as well */ box-shadow: 0 0 28px 4px rgba(255,255,255,0.2) !important; } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/general.scss ================================================ html { /* Color of the bounce effect of page when using touch or touchpad. */ background-color: #E7E7E7; } #main div[data-xpoBackground] { /* Make background the same color as the original one, not inverted of it. (As Spotify PWA chooses color based on the page that is currently open, with 'invert + hueRotate' we can have almost the same color, only lightened) */ filter: hue-rotate(180deg) brightness(0.7); } .cover-art, .artist-header, .view-header, .ConnectBar, .btn-green, .btn-fg-green, div[aria-live=polite], .control-button--active, .Root__nav-bar .sessionInfo .avatar, .UserWidget__link--is-active span, .AdsContainer__inner, img[src*=profilepic], img[src*=p200x200], .akh8GUlQiyVVqyYbwYzyr { filter: invert(1); } .tracklist-row--active .position, .tracklist-row--active .tracklist-duration, .tracklist-row--active .tracklist-name, .tracklist-row--active .tracklist-play-pause { color: #1DB954 !important; filter: invert(1); } .navBar-link--active:after, .RecentlyPlayedWidget__link--active:after { background-color: #1DB954; filter: invert(1); } #searchPage .react-contextmenu-wrapper button { filter: invert(1); } .Root__main-view nav { filter: invert(1); } .Root__main-view nav a { color: black !important; } .media-object .media-object-hoverable.playing .cover-art-image, .media-object .media-object-hoverable.playing .daily-mix-decoration, .media-object .media-object-hoverable:focus .cover-art-image, .media-object .media-object-hoverable:focus .daily-mix-decoration, .media-object .media-object-hoverable:hover .cover-art-image, .media-object .media-object-hoverable:hover .daily-mix-decoration { filter: brightness(.6); } .Search__content nav ul li a { /* Fixed a bug in search page content header in white theme in Edge. */ color: white !important; } .Search__content nav ul li a::before { /* Fixed a bug in search page content header in white theme in Edge. */ background-color: #e246ab !important; } .Root__main-view nav ul li a:focus { outline-color: #111; } .Root__top-bar figure { filter: invert(1); } .Root__main-view img { filter: invert(1); } .Root__main-view .react-contextmenu-wrapper button { filter: invert(1); } .Root__main-view .TrackListHeader .react-contextmenu-wrapper button { filter: invert(0); } input, svg[role=img] { /* Search input box */ filter: invert(1); } .dialog input { /* New playlist input box */ filter: invert(0); } /* Workaround for an Edge bug where Search page comes in front of now playing bar on tall screens */ .Search, .Search__content { position: initial; z-index: initial; } /* Ad */ .Root__main-view iframe { filter: invert(1); } /* Error page image */ #main .dialog img { filter: invert(1); transform: translate3d(0, 0, 0); } /* Show emojis in playlist names correctly */ /* DISABLED BECAUSE OF EDGE FILTER RENDERING BUG */ /* .RootlistItemPlaylist__text-wrapper, .mo-info-name, .TrackListHeader .mo-info-name, .TrackListHeader__entity-name h2 { color: black; filter: invert(1); transform: translate3d(0, 0, 0); } */ ================================================ FILE: XpoMusic/Stylesheets/LightTheme/light.scss ================================================ @import "../Common/common.scss"; @import "general.scss"; @import "artistPage.scss"; @import "contextMenu.scss"; @import "navBar.scss"; @import "nowPlayingBar.scss"; @import "progressBar.scss"; @import "windowTitle.scss"; @import "podcastEpisodeDetails.scss"; @import "searchPage.scss"; @import "trackList.scss"; @import "pivotTabStyle.scss"; ================================================ FILE: XpoMusic/Stylesheets/LightTheme/navBar.scss ================================================ .Root__nav-bar { background-color: rgba(40, 40, 40, 0.6) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); } .RootlistItem--is-active:before { background-color: #E246AB; } .navBar-link--active:before { background-color: #E246AB; } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/nowPlayingBar.scss ================================================ .now-playing-bar-container { background-color: rgba(30, 33, 40, 0.65); } .connect-device-list-item--active .connect-device-list-item__icon, .connect-device-list-item--active .connect-device-list-item__info, .connect-device-list-content .btn-blue { filter: invert(1); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/pivotTabStyle.scss ================================================ .Root__main-view nav ul li a[aria-current=page], .Root__top-bar nav ul li a[aria-current=page] { border-bottom-color: #E246AB; } .Root__main-view .artist nav ul li a[aria-current=page] { border-bottom-color: #1DB954; } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/podcastEpisodeDetails.scss ================================================ .ad6f7074db563f98f848cc3ffdbd8190\.scss img, .ad6f7074db563f98f848cc3ffdbd8190\.scss button { filter: invert(1); } .ad6f7074db563f98f848cc3ffdbd8190\.scss button._81a88e0d61622b328f181589e4074b12\.scss { filter: invert(0); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/progressBar.scss ================================================ .progress-bar .progress-bar__fg { transition-duration: 0s; background-color: #b3b3b3; } .progress-bar--is-active .progress-bar__fg { background-color: #1db954; filter: invert(1); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/searchPage.scss ================================================  #searchPage div[role=search] { filter: invert(1); } #searchPage img { filter: invert(1); } #searchPage a[href^="/genre"] { filter: invert(1); } #searchPage a[href^="/genre"] img { filter: invert(0); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/trackList.scss ================================================  .tracklistSongExistsInLibrary .trackListRemoveSongButton { color: #E246AB; } .tracklist-row .more { filter: invert(1); } .TrackListHeader__actions > button { filter: invert(1); } ================================================ FILE: XpoMusic/Stylesheets/LightTheme/windowTitle.scss ================================================  .xpotifyWindowTitle { font-weight: 300; } ================================================ FILE: XpoMusic/Themes/Generic.xaml ================================================ ================================================ FILE: XpoMusic/ViewModels/MainPageViewModel.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.ViewManagement; namespace XpoMusic.ViewModels { public class MainPageViewModel : ViewModelBase { private double topBarButtonWidth; public double TopBarButtonWidth { get => topBarButtonWidth; set { topBarButtonWidth = value; FirePropertyChangedEvent(nameof(TopBarButtonWidth)); FirePropertyChangedEvent(nameof(TopBarBehindSystemControlsAreaWidth)); } } private double topBarButtonHeight; public double TopBarButtonHeight { get => topBarButtonHeight; set { topBarButtonHeight = value; FirePropertyChangedEvent(nameof(TopBarButtonHeight)); } } public double TopBarBehindSystemControlsAreaWidth { get { var isTabletMode = (UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Touch); return TopBarButtonWidth * (isTabletMode ? 1.0 : 3.0); } } } } ================================================ FILE: XpoMusic/ViewModels/NowPlayingViewModel.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Imaging; using XpoMusic.Classes; using static XpoMusic.Controls.NowPlayingView; namespace XpoMusic.ViewModels { public class NowPlayingViewModel : ViewModelBase { private NowPlayingViewMode viewMode; public NowPlayingViewMode ViewMode { get { return viewMode; } set { viewMode = value; FirePropertyChangedEvent(nameof(ViewMode)); FirePropertyChangedEvent(nameof(IsCompactOverlayViewMode)); FirePropertyChangedEvent(nameof(IsNormalViewMode)); FirePropertyChangedEvent(nameof(ShowArtistArt)); } } public bool IsCompactOverlayViewMode => ViewMode == NowPlayingViewMode.CompactOverlay; public bool IsNormalViewMode => ViewMode == NowPlayingViewMode.Normal; private string artistName; public string ArtistName { get { return artistName; } set { if (artistName != value) { artistName = value; FirePropertyChangedEvent(nameof(ArtistName)); } } } private string albumName; public string AlbumName { get { return albumName; } set { if (albumName != value) { albumName = value; FirePropertyChangedEvent(nameof(AlbumName)); } } } private string songName; public string SongName { get { return songName; } set { if (songName != value) { songName = value; FirePropertyChangedEvent(nameof(SongName)); } } } private Uri backgroundArtUri; public Uri BackgroundArtUri { get { return backgroundArtUri; } set { if (backgroundArtUri != value) { backgroundArtUri = value; backgroundArt = (value == null) ? null : new BitmapImage(value); FirePropertyChangedEvent(nameof(BackgroundArtUri)); FirePropertyChangedEvent(nameof(BackgroundArt)); } } } private ImageSource backgroundArt; public ImageSource BackgroundArt { get { return backgroundArt; } } private Uri albumArtUri; public Uri AlbumArtUri { get { return albumArtUri; } set { if (albumArtUri != value) { AlbumArtContainerOpacity = 0.0; albumArtUri = value; albumArt = (value == null) ? null : new BitmapImage(value); FirePropertyChangedEvent(nameof(AlbumArtUri)); FirePropertyChangedEvent(nameof(AlbumArt)); } } } private ImageSource albumArt; public ImageSource AlbumArt { get { return albumArt; } } private bool isPlaying = false; public bool IsPlaying { get { return isPlaying; } set { isPlaying = value; FirePropertyChangedEvent(nameof(PlayButtonVisibility)); FirePropertyChangedEvent(nameof(PauseButtonVisibility)); } } public Visibility PlayButtonVisibility => IsPlaying ? Visibility.Collapsed : Visibility.Visible; public Visibility PauseButtonVisibility => IsPlaying ? Visibility.Visible : Visibility.Collapsed; private double progressBarValue = 0.0; public double ProgressBarValue { get { return progressBarValue; } set { progressBarValue = value; if (progressBarValue <= ProgressBarMaximum) { FirePropertyChangedEvent(nameof(ProgressBarValue)); FirePropertyChangedEvent(nameof(ProgressBarMaximum)); } } } private double progressBarMaximum = 100.0; public double ProgressBarMaximum { get { return progressBarMaximum; } set { progressBarMaximum = value; if (ProgressBarValue <= progressBarMaximum) { FirePropertyChangedEvent(nameof(ProgressBarValue)); FirePropertyChangedEvent(nameof(ProgressBarMaximum)); } } } private bool progressRingActive = false; public bool ProgressRingActive { get { return progressRingActive; } set { progressRingActive = value; FirePropertyChangedEvent(nameof(ProgressRingActive)); } } private bool prevButtonEnabled = true; public bool PrevButtonEnabled { get { return prevButtonEnabled; } set { prevButtonEnabled = value; FirePropertyChangedEvent(nameof(PrevButtonEnabled)); } } private bool nextButtonEnabled = true; public bool NextButtonEnabled { get { return nextButtonEnabled; } set { nextButtonEnabled = value; FirePropertyChangedEvent(nameof(NextButtonEnabled)); } } private bool playPauseButtonEnabled = true; public bool PlayPauseButtonEnabled { get { return playPauseButtonEnabled; } set { playPauseButtonEnabled = value; FirePropertyChangedEvent(nameof(PlayPauseButtonEnabled)); } } private double albumArtContainerOpacity = 0.0; public double AlbumArtContainerOpacity { get { return albumArtContainerOpacity; } set { albumArtContainerOpacity = value; FirePropertyChangedEvent(nameof(AlbumArtContainerOpacity)); } } double storyboardOffset; public double StoryboardOffset { get => storyboardOffset; set { storyboardOffset = value; FirePropertyChangedEvent(nameof(StoryboardOffset)); FirePropertyChangedEvent(nameof(StoryboardOffsetNegative)); } } public double StoryboardOffsetNegative => -StoryboardOffset; public bool ShowArtistArt { get { if (ViewMode == NowPlayingViewMode.CompactOverlay) return LocalConfiguration.MiniViewShowArtistArt; else return LocalConfiguration.NowPlayingShowArtistArt; } set { if (ViewMode == NowPlayingViewMode.CompactOverlay) LocalConfiguration.MiniViewShowArtistArt = value; else LocalConfiguration.NowPlayingShowArtistArt = value; FirePropertyChangedEvent(nameof(ShowArtistArt)); } } private bool blurEnabled = false; public bool BlurEnabled { get => blurEnabled; set { blurEnabled = value; FirePropertyChangedEvent(nameof(BlurEnabled)); } } public double volume = 50; public double Volume { get => volume; set { volume = value; FirePropertyChangedEvent(nameof(Volume)); FirePropertyChangedEvent(nameof(VolumeIconGlyph)); } } public string VolumeIconGlyph { get { if (Volume > 66) return "\uE995"; else if (Volume > 33) return "\uE994"; else if (Volume > 0) return "\uE993"; else return "\uE992"; } } private bool isSavedToLibrary = false; public bool IsSavedToLibrary { get => isSavedToLibrary; set { isSavedToLibrary = value; FirePropertyChangedEvent(nameof(IsSavedToLibrary)); } } } } ================================================ FILE: XpoMusic/ViewModels/ProxyConfigurationViewModel.cs ================================================ using XpoMusic.Classes; using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.UI.Xaml; namespace XpoMusic.ViewModels { public class ProxyConfigurationViewModel : ViewModelBase { private bool customProxyEnabled = LocalConfiguration.IsCustomProxyEnabled; public bool IsCustomProxyEnabled { get => customProxyEnabled; set { customProxyEnabled = value; // But if true, it'll be set on Apply Settings button click. if (value == false) LocalConfiguration.IsCustomProxyEnabled = false; FirePropertyChangedEvent(nameof(IsCustomProxyEnabled)); FirePropertyChangedEvent(nameof(RestartNeededNoticeVisibility)); FirePropertyChangedEvent(nameof(ProxyConfigurationVisibility)); FirePropertyChangedEvent(nameof(SystemProxyNoticeVisibility)); } } public Visibility RestartNeededNoticeVisibility => (ProxyHelper.IsCustomProxyEverEnabledInThisSession && !IsCustomProxyEnabled) ? Visibility.Visible : Visibility.Collapsed; public Visibility ProxyConfigurationVisibility => IsCustomProxyEnabled ? Visibility.Visible : Visibility.Collapsed; public Visibility SystemProxyNoticeVisibility => IsCustomProxyEnabled ? Visibility.Collapsed : Visibility.Visible; public ProxyHelper.ProxyType ProxyType { get; private set; } = LocalConfiguration.CustomProxyType; public bool IsSocksProxy { get => ProxyType == ProxyHelper.ProxyType.Socks; set { if (value) { ProxyType = ProxyHelper.ProxyType.Socks; } } } public bool IsHttpProxy { get => ProxyType == ProxyHelper.ProxyType.HttpHttps; set { if (value) { ProxyType = ProxyHelper.ProxyType.HttpHttps; } } } private string proxyAddress = LocalConfiguration.CustomProxyAddress; public string ProxyAddress { get => proxyAddress; set { if (value != ProxyAddress) { proxyAddress = value; FirePropertyChangedEvent(nameof(ProxyAddress)); } } } private string proxyPort = LocalConfiguration.CustomProxyPort; public string ProxyPort { get => proxyPort; set { if (value != ProxyPort) { proxyPort = value; FirePropertyChangedEvent(nameof(ProxyPort)); } } } } } ================================================ FILE: XpoMusic/ViewModels/SettingsViewModel.cs ================================================ using XpoMusic.Classes; using XpoMusic.Classes.Model; using XpoMusic.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml; namespace XpoMusic.ViewModels { public class SettingsViewModel : ViewModelBase { public SettingsViewModel() { Themes = ThemeHelper.GetThemes(); Languages = LanguageHelper.GetLanguages(); LiveTileDesigns = LiveTileHelper.GetLiveTileDesigns().ToList(); CheckPrimaryTileStatus(); } public async void CheckPrimaryTileStatus() { PinToStartLinkVisibility = (await LiveTileHelper.CanPinToStart() && !await LiveTileHelper.IsPinnedToStart()) ? Visibility.Visible : Visibility.Collapsed; } public List Languages { get; set; } private Language selectedLanguage = LocalConfiguration.Language; public Language SelectedLanguage { get { return selectedLanguage; } set { if (selectedLanguage == value) return; selectedLanguage = value; FirePropertyChangedEvent(nameof(SelectedLanguage)); LocalConfiguration.Language = value; LanguageRestartNeededNoticeVisibility = Visibility.Visible; AnalyticsHelper.Log("settingChange", "language", value.ToString()); } } private Visibility languageRestartNeededNoticeVisibility = Visibility.Collapsed; public Visibility LanguageRestartNeededNoticeVisibility { get { return languageRestartNeededNoticeVisibility; } set { languageRestartNeededNoticeVisibility = value; FirePropertyChangedEvent(nameof(LanguageRestartNeededNoticeVisibility)); } } public List Themes { get; set; } private Theme selectedTheme = LocalConfiguration.Theme; public Theme SelectedTheme { get { return selectedTheme; } set { if (selectedTheme == value) return; selectedTheme = value; FirePropertyChangedEvent(nameof(SelectedTheme)); LocalConfiguration.Theme = value; ThemeRestartNeededNoticeVisibility = Visibility.Visible; AnalyticsHelper.Log("settingChange", "theme", value.ToString()); } } private Visibility themeRestartNeededNoticeVisibility = Visibility.Collapsed; public Visibility ThemeRestartNeededNoticeVisibility { get { return themeRestartNeededNoticeVisibility; } set { themeRestartNeededNoticeVisibility = value; FirePropertyChangedEvent(nameof(ThemeRestartNeededNoticeVisibility)); } } public bool OpenInMiniViewByCortana { get { return LocalConfiguration.OpenInMiniViewByCortana; } set { LocalConfiguration.OpenInMiniViewByCortana = value; FirePropertyChangedEvent(nameof(OpenInMiniViewByCortana)); AnalyticsHelper.Log("settingChange", "openInMiniViewByCortana", value.ToString()); } } public List LiveTileDesigns { get; set; } private LiveTileHelper.LiveTileDesign selectedLiveTileDesign = LocalConfiguration.LiveTileDesign; public LiveTileHelper.LiveTileDesign SelectedLiveTileDesign { get { return selectedLiveTileDesign; } set { if (selectedLiveTileDesign == value) return; selectedLiveTileDesign = value; FirePropertyChangedEvent(nameof(SelectedLiveTileDesign)); LocalConfiguration.LiveTileDesign = value; LiveTileHelper.UpdateLiveTile(); AnalyticsHelper.Log("settingChange", "liveTileDesign", value.ToString()); } } private Visibility pinToStartLinkVisibility = Visibility.Collapsed; public Visibility PinToStartLinkVisibility { get { return pinToStartLinkVisibility; } set { pinToStartLinkVisibility = value; FirePropertyChangedEvent(nameof(PinToStartLinkVisibility)); } } } } ================================================ FILE: XpoMusic/ViewModels/TopBarViewModel.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.ViewManagement; using Windows.UI.Xaml; namespace XpoMusic.ViewModels { public class TopBarViewModel : ViewModelBase { private double topBarButtonWidth; public double TopBarButtonWidth { get => topBarButtonWidth; set { topBarButtonWidth = value; FirePropertyChangedEvent(nameof(TopBarButtonWidth)); FirePropertyChangedEvent(nameof(TopBarBehindSystemControlsAreaWidth)); } } private double topBarButtonHeight; public double TopBarButtonHeight { get => topBarButtonHeight; set { topBarButtonHeight = value; FirePropertyChangedEvent(nameof(TopBarButtonHeight)); } } public double TopBarBehindSystemControlsAreaWidth { get { var isTabletMode = (UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Touch); return TopBarButtonWidth * (isTabletMode ? 1.0 : 3.0); } } private Visibility openLinkFromClipboardVisibility; public Visibility OpenLinkFromClipboardVisibility { get { if (!ShowExtraButtons) return Visibility.Collapsed; return openLinkFromClipboardVisibility; } set { openLinkFromClipboardVisibility = value; FirePropertyChangedEvent(nameof(OpenLinkFromClipboardVisibility)); } } private bool showExtraButtons; public bool ShowExtraButtons { get => showExtraButtons; set { showExtraButtons = value; FirePropertyChangedEvent(nameof(ShowExtraButtons)); FirePropertyChangedEvent(nameof(OpenLinkFromClipboardVisibility)); } } } } ================================================ FILE: XpoMusic/ViewModels/ViewModelBase.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.ViewModels { public abstract class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void FirePropertyChangedEvent(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } } ================================================ FILE: XpoMusic/XpoMusic.csproj ================================================  Debug x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC} AppContainerExe Properties XpoMusic XpoMusic en-US UAP 10.0.18362.0 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true XpoMusic_TemporaryKey.pfx True False Always x86 8F18CEE4DB82F386156DD07A482E2A743846E045 1 OnApplicationRun C:\Users\Mahdi\source\repos\ModernSpotifyUWP\XpoMusic\AppPackages\Sideload https://xpomusic.com/get/ true bin\x86\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full x86 false prompt true bin\x86\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly x86 false prompt true true true bin\ARM\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full ARM false prompt true bin\ARM\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly ARM false prompt true true true bin\ARM64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full ARM64 false prompt true true bin\ARM64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly ARM64 false prompt true true true bin\x64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full x64 false prompt true bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly x64 false prompt true true PackageReference FlyoutContainer.xaml SplashScreen.xaml TopBar.xaml XpoMusicWebApp.xaml AboutPage.xaml App.xaml Designer Designer Designer ProxyConfiguration.xaml DonatePage.xaml DeveloperMessageFlyout.xaml SettingsFlyout.xaml WhatsNewFlyout.xaml HelpPage.xaml SettingsPage.xaml MainPage.xaml NowPlayingView.xaml Designer Designer compilerconfig.json Always MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer 1.12.394 3.2.1 3.2.1 6.2.10 3.5.2 runtime; build; native; contentfiles; analyzers all 2.1.190405004.1 12.0.2 1.5.2 Microsoft Engagement Framework 10.1901.28001 10.1705.16001 5.1.1 5.1.1 5.1.1 4.6.2 4.6.2 2.5.0 {15faca69-c86a-4447-97dc-b6cb59056075} XpoMusicWebAgent 14.0 ================================================ FILE: XpoMusic/XpotifyApi/AppConstantsApi.cs ================================================ using XpoMusic.Helpers; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.XpotifyApi { public static class AppConstantsApi { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static string UpdateUri { get { var endpoint = "https://xpomusic.com/constants"; var version = PackageHelper.GetAppVersion().ToString(3); var fileName = "constants.json"; var query = "?date=" + DateTime.Now.ToString("yyyyMMddHHmmss"); var proSuffix = PackageHelper.IsProVersion ? "pro" : ""; return $"{endpoint}/{version}{proSuffix}/{fileName}{query}"; } } public static async Task GetAppConstantsString() { try { using (var client = new HttpClient()) { var response = await client.GetAsync(UpdateUri); if (response.IsSuccessStatusCode == false) { if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { // If this happens, first session will contain the previous updated values since it's cached. // But the next sessions will have the values defined in code. logger.Info("GetAppConstantsString could not find a constants file on the server. Will return an empty json."); return "{}"; } else { logger.Warn($"GetAppConstantsString failed because request failed with status code {response.StatusCode}."); return null; } } var result = await response.Content.ReadAsStringAsync(); return result; } } catch (Exception ex) { logger.Warn("GetAppConstantsString failed: " + ex.ToString()); return null; } } } } ================================================ FILE: XpoMusic/XpotifyApi/AssetUpdatesApi.cs ================================================ using XpoMusic.Classes; using XpoMusic.Helpers; using XpoMusic.XpotifyApi.Model; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using Windows.Storage; namespace XpoMusic.XpotifyApi { public static class AssetUpdatesApi { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static readonly string assetUpdateCacheFolderName = "AssetUpdateDownloadCache"; private static string UpdateUri { get { var endpoint = "https://xpomusic.com/assets"; var version = PackageHelper.GetAppVersion().ToString(3); var fileName = "assetPackageInfo.json"; var query = "?date=" + DateTime.Now.ToString("yyyyMMddHHmmss"); var proSuffix = PackageHelper.IsProVersion ? "pro" : ""; return $"{endpoint}/{version}{proSuffix}/{fileName}{query}"; } } private static async Task GetLatestAssetPackageUri() { try { using (var client = new HttpClient()) { var response = await client.GetAsync(UpdateUri); if (response.IsSuccessStatusCode == false) { logger.Warn($"GetLatestAssetPackageUri failed because request failed with status code {response.StatusCode}."); return null; } var result = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(result); } } catch (Exception ex) { logger.Warn("GetLatestAssetPackageUri failed: " + ex.ToString()); return null; } } public static async Task GetLatestAssetPackage() { try { var assetPackageInfo = await GetLatestAssetPackageUri(); if (assetPackageInfo == null) return null; if (assetPackageInfo.version <= LocalConfiguration.LatestAssetUpdateVersion) { logger.Info($"Latest asset package version is {assetPackageInfo.version} and the latest downloaded version is {LocalConfiguration.LatestAssetUpdateVersion}. Will not download."); return null; } using (var client = new HttpClient()) { var response = await client.GetAsync(assetPackageInfo.downloadUri); if (response.IsSuccessStatusCode == false) { logger.Warn($"GetLatestAssetPackage failed because request failed with status code {response.StatusCode}."); return null; } var result = await response.Content.ReadAsByteArrayAsync(); var folder = await GetAssetUpdateCacheFolder(); var file = await folder.CreateFileAsync($"{assetPackageInfo.version}.zip"); await FileIO.WriteBytesAsync(file, result); return new AssetPackage { AssetPackageInfo = assetPackageInfo, File = file, }; } } catch (Exception ex) { logger.Warn("GetLatestAssetPackage failed: " + ex.ToString()); return null; } } private static async Task GetAssetUpdateCacheFolder() { var folder = (await ApplicationData.Current.LocalFolder.TryGetItemAsync(assetUpdateCacheFolderName)) as StorageFolder; if (folder == null) folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(assetUpdateCacheFolderName); return folder; } } } ================================================ FILE: XpoMusic/XpotifyApi/DeveloperMessageApi.cs ================================================ using XpoMusic.Helpers; using XpoMusic.XpotifyApi.Model; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace XpoMusic.XpotifyApi { public static class DeveloperMessageApi { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static string DevMessagesUri { get { var endpoint = "https://xpomusic.com/devmessages"; var version = PackageHelper.GetAppVersion().ToString(3); var fileName = "messages.json"; var query = "?date=" + DateTime.Now.ToString("yyyyMMddHHmmss"); var proSuffix = PackageHelper.IsProVersion ? "pro" : ""; return $"{endpoint}/{version}{proSuffix}/{fileName}{query}"; } } public static async Task GetDeveloperMessages() { try { using (var client = new HttpClient()) { var response = await client.GetAsync(DevMessagesUri); if (response.IsSuccessStatusCode == false) { logger.Warn($"GetDeveloperMessages failed because request failed with status code {response.StatusCode}."); return null; } var result = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(result); } } catch (Exception ex) { logger.Warn("GetDeveloperMessages failed: " + ex.ToString()); return null; } } } } ================================================ FILE: XpoMusic/XpotifyApi/Model/AssetPackage.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Storage; namespace XpoMusic.XpotifyApi.Model { public class AssetPackage { public AssetPackageInfo AssetPackageInfo { get; set; } public StorageFile File { get; set; } } } ================================================ FILE: XpoMusic/XpotifyApi/Model/AssetPackageInfo.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.XpotifyApi.Model { public class AssetPackageInfo { public int version { get; set; } public string downloadUri { get; set; } } } ================================================ FILE: XpoMusic/XpotifyApi/Model/DeveloperMessage.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.XpotifyApi.Model { public class DeveloperMessage { public string id { get; set; } public string title { get; set; } public string content { get; set; } public long timestamp { get; set; } public DateTime messageDate => DateTimeOffset.FromUnixTimeSeconds(timestamp).DateTime.ToLocalTime(); } } ================================================ FILE: XpoMusic/XpotifyApi/Model/DeveloperMessageCollection.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusic.XpotifyApi.Model { public class DeveloperMessageCollection { public DeveloperMessage[] messages { get; set; } } } ================================================ FILE: XpoMusic/compilerconfig.json ================================================ [ { "outputFile": "InjectedAssets/style-light.css", "inputFile": "Stylesheets/LightTheme/light.scss", "includeInProject": true }, { "outputFile": "InjectedAssets/style-dark.css", "inputFile": "Stylesheets/DarkTheme/dark.scss", "includeInProject": true } ] ================================================ FILE: XpoMusic/compilerconfig.json.defaults ================================================ { "compilers": { "less": { "autoPrefix": "", "cssComb": "none", "ieCompat": true, "strictMath": false, "strictUnits": false, "relativeUrls": true, "rootPath": "", "sourceMapRoot": "", "sourceMapBasePath": "", "sourceMap": false }, "sass": { "autoPrefix": "", "includePath": "", "indentType": "space", "indentWidth": 2, "outputStyle": "nested", "Precision": 5, "relativeUrls": true, "sourceMapRoot": "", "lineFeed": "", "sourceMap": false }, "stylus": { "sourceMap": false }, "babel": { "sourceMap": false }, "coffeescript": { "bare": false, "runtimeMode": "node", "sourceMap": false }, "handlebars": { "root": "", "noBOM": false, "name": "", "namespace": "", "knownHelpersOnly": false, "forcePartial": false, "knownHelpers": [], "commonjs": "", "amd": false, "sourceMap": false } }, "minifiers": { "css": { "enabled": true, "termSemicolons": true, "gzip": false }, "javascript": { "enabled": true, "termSemicolons": true, "gzip": false } } } ================================================ FILE: XpoMusic.sln ================================================  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28306.52 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XpoMusic", "XpoMusic\XpoMusic.csproj", "{CF732FD1-9200-423A-8BB6-1685B598A3DC}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XpoMusicWebAgent", "XpoMusicWebAgent\XpoMusicWebAgent.csproj", "{15FACA69-C86A-4447-97DC-B6CB59056075}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XpoMusicInstaller", "XpoMusicInstaller\XpoMusicInstaller.csproj", "{36C336EE-BE94-4085-9F0F-262F7B200DBD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|Any CPU.ActiveCfg = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|Any CPU.Build.0 = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|Any CPU.Deploy.0 = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM.ActiveCfg = Debug|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM.Build.0 = Debug|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM.Deploy.0 = Debug|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM64.ActiveCfg = Debug|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM64.Build.0 = Debug|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|ARM64.Deploy.0 = Debug|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x64.ActiveCfg = Debug|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x64.Build.0 = Debug|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x64.Deploy.0 = Debug|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x86.ActiveCfg = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x86.Build.0 = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Debug|x86.Deploy.0 = Debug|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|Any CPU.ActiveCfg = Release|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM.ActiveCfg = Release|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM.Build.0 = Release|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM.Deploy.0 = Release|ARM {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM64.ActiveCfg = Release|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM64.Build.0 = Release|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|ARM64.Deploy.0 = Release|ARM64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x64.ActiveCfg = Release|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x64.Build.0 = Release|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x64.Deploy.0 = Release|x64 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x86.ActiveCfg = Release|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x86.Build.0 = Release|x86 {CF732FD1-9200-423A-8BB6-1685B598A3DC}.Release|x86.Deploy.0 = Release|x86 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|Any CPU.Build.0 = Debug|Any CPU {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|ARM.ActiveCfg = Debug|ARM {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|ARM.Build.0 = Debug|ARM {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|ARM64.ActiveCfg = Debug|ARM64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|ARM64.Build.0 = Debug|ARM64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|x64.ActiveCfg = Debug|x64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|x64.Build.0 = Debug|x64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|x86.ActiveCfg = Debug|x86 {15FACA69-C86A-4447-97DC-B6CB59056075}.Debug|x86.Build.0 = Debug|x86 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|Any CPU.ActiveCfg = Release|Any CPU {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|Any CPU.Build.0 = Release|Any CPU {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|ARM.ActiveCfg = Release|ARM {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|ARM.Build.0 = Release|ARM {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|ARM64.ActiveCfg = Release|ARM64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|ARM64.Build.0 = Release|ARM64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|x64.ActiveCfg = Release|x64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|x64.Build.0 = Release|x64 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|x86.ActiveCfg = Release|x86 {15FACA69-C86A-4447-97DC-B6CB59056075}.Release|x86.Build.0 = Release|x86 {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|ARM.ActiveCfg = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|ARM.Build.0 = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|ARM64.ActiveCfg = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|ARM64.Build.0 = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|x64.ActiveCfg = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|x64.Build.0 = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|x86.ActiveCfg = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Debug|x86.Build.0 = Debug|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|Any CPU.Build.0 = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|ARM.ActiveCfg = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|ARM.Build.0 = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|ARM64.ActiveCfg = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|ARM64.Build.0 = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|x64.ActiveCfg = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|x64.Build.0 = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|x86.ActiveCfg = Release|Any CPU {36C336EE-BE94-4085-9F0F-262F7B200DBD}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E0099F66-369A-4936-A6B9-64A0DB688C4D} EndGlobalSection EndGlobal ================================================ FILE: XpoMusicInstaller/App.config ================================================  ================================================ FILE: XpoMusicInstaller/App.xaml ================================================  ================================================ FILE: XpoMusicInstaller/App.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace XpoMusicInstaller { /// /// Interaction logic for App.xaml /// public partial class App : Application { } } ================================================ FILE: XpoMusicInstaller/MainWindow.xaml ================================================  ================================================ FILE: XpoMusicInstaller/MainWindow.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace XpoMusicInstaller { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { private readonly string appInstallerUri = "ms-appinstaller:?source=https://ghiasi.net/XpoMusic/install/XpoMusic.appinstaller"; public MainWindow() { InitializeComponent(); } private void Window_ContentRendered(object sender, EventArgs e) { (this.FindResource("mainLogoStoryboard") as Storyboard).Begin(); StartInstallation(); } private async void StartInstallation() { if (!VerifyOSVersion()) return; if (!InstallCertificate()) return; OpenAppInstaller(); (this.FindResource("mainLogoExitStoryboard") as Storyboard).Begin(); await Task.Delay(1500); Application.Current.Shutdown(); } private static void ShowOSVersionAlertAndExit() { MessageBox.Show("To install Xpo Music, you must first update your operating system to Windows 10 version 1803 or above.", "Xpo Music Installer", MessageBoxButton.OK, MessageBoxImage.Exclamation); Application.Current.Shutdown(); } private static void ShowPermissionAlertAndExit() { MessageBox.Show("Please run Xpo Music Installer as an administrator.", "Xpo Music Installer", MessageBoxButton.OK, MessageBoxImage.Exclamation); Application.Current.Shutdown(); } private bool VerifyOSVersion() { var osVersion = Environment.OSVersion.Version; var minSupportedVersion = new Version("10.0.17134.0"); return osVersion >= minSupportedVersion; } private void OpenAppInstaller() { Process.Start(appInstallerUri); } private bool InstallCertificate() { try { var cert = new X509Certificate2(Properties.Resources.XpoMusic); X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadWrite); store.Add(cert); store.Close(); return true; } catch (CryptographicException) { ShowPermissionAlertAndExit(); return false; } } } } ================================================ FILE: XpoMusicInstaller/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XpoMusicInstaller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("XpoMusicInstaller")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //CultureYouAreCodingWith in your .csproj file //inside a . For example, if you are using US english //in your source files, set the to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: XpoMusicInstaller/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace XpoMusicInstaller.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XpoMusicInstaller.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized resource of type System.Byte[]. /// internal static byte[] XpoMusic { get { object obj = ResourceManager.GetObject("XpoMusic", resourceCulture); return ((byte[])(obj)); } } } } ================================================ FILE: XpoMusicInstaller/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\XpoMusic.cer;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: XpoMusicInstaller/Properties/Settings.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace XpoMusicInstaller.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ================================================ FILE: XpoMusicInstaller/Properties/Settings.settings ================================================  ================================================ FILE: XpoMusicInstaller/XpoMusicInstaller.csproj ================================================  Debug AnyCPU {36C336EE-BE94-4085-9F0F-262F7B200DBD} WinExe XpoMusicInstaller XpoMusicInstaller v4.7.1 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true true AnyCPU true full false bin\Debug\ DEBUG;TRACE prompt 4 AnyCPU pdbonly true bin\Release\ TRACE prompt 4 app.manifest XpoMusicInstallerLogo.ico 4.0 MSBuild:Compile Designer MSBuild:Compile Designer App.xaml Code MainWindow.xaml Code Code True True Resources.resx True Settings.settings True ResXFileCodeGenerator Resources.Designer.cs SettingsSingleFileGenerator Settings.Designer.cs ================================================ FILE: XpoMusicInstaller/app.manifest ================================================  ================================================ FILE: XpoMusicWebAgent/Model/ActionRequestedEventArgs.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class ActionRequestedEventArgs { public Action Action { get; set; } } public enum Action { PinToStart, OpenSettings, OpenDonate, OpenAbout, OpenMiniView, OpenNowPlaying, NavigateToClipboardUri, } } ================================================ FILE: XpoMusicWebAgent/Model/InitFailedEventArgs.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class InitFailedEventArgs { public string Errors { get; set; } } } ================================================ FILE: XpoMusicWebAgent/Model/LogMessageReceivedEventArgs.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class LogMessageReceivedEventArgs { public string Message { get; set; } } } ================================================ FILE: XpoMusicWebAgent/Model/NowPlayingData.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class NowPlayingData { public string TrackName { get; set; } public string TrackId { get; set; } public string AlbumId { get; set; } public string ArtistName { get; set; } public string ArtistId { get; set; } public string TrackFingerprint { get; set; } public double Volume { get; set; } public int ElapsedTime { get; set; } public int TotalTime { get; set; } public bool IsPrevTrackAvailable { get; set; } public bool IsNextTrackAvailable { get; set; } public bool IsPlaying { get; set; } public bool IsTrackSavedToLibrary { get; set; } public bool Success { get; set; } } } ================================================ FILE: XpoMusicWebAgent/Model/ProgressBarCommandEventArgs.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class ProgressBarCommandEventArgs { public ProgressBarCommand Command { get; set; } public double Left { get; set; } public double Top { get; set; } public double Width { get; set; } } public enum ProgressBarCommand { Show, Hide, } } ================================================ FILE: XpoMusicWebAgent/Model/StatusReportReceivedEventArgs.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class StatusReportReceivedEventArgs { public WebAppStatus Status { get; set; } } } ================================================ FILE: XpoMusicWebAgent/Model/WebAppStatus.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XpoMusicWebAgent.Model { public sealed class WebAppStatus { public bool BackButtonEnabled { get; set; } public NowPlayingData NowPlaying { get; set; } } } ================================================ FILE: XpoMusicWebAgent/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XpotifyWebAgent")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("XpotifyWebAgent")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)] ================================================ FILE: XpoMusicWebAgent/WebAgent.cs ================================================ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Foundation; using Windows.Foundation.Metadata; using XpoMusicWebAgent.Model; namespace XpoMusicWebAgent { [AllowForWeb] public sealed class WebAgent { // NOTE: // It seems that WebView automatically changes PascalCase method names to // camelCase on the Javascript side. public event EventHandler ProgressBarCommandReceived; public event EventHandler StatusReportReceived; public event EventHandler ActionRequested; public event EventHandler InitializationFailed; public event EventHandler LogMessageReceived; public event EventHandler NewAccessTokenRequested; private TaskCompletionSource newAccessTokenTcs; public bool WebPlayerBackupEnabled { get; set; } public string OSVersion { get; set; } public void ShowProgressBar(double left, double top, double width) { ProgressBarCommandReceived?.Invoke(this, new ProgressBarCommandEventArgs { Command = ProgressBarCommand.Show, Left = left, Top = top, Width = width, }); } public void HideProgressBar() { ProgressBarCommandReceived?.Invoke(this, new ProgressBarCommandEventArgs { Command = ProgressBarCommand.Hide, }); } public void StatusReport(string data) { StatusReportReceived?.Invoke(this, new StatusReportReceivedEventArgs { Status = JsonConvert.DeserializeObject(data), }); } public void OpenSettings() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.OpenSettings, }); } public void OpenAbout() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.OpenAbout, }); } public void OpenDonate() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.OpenDonate, }); } public void OpenMiniView() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.OpenMiniView, }); } public void OpenNowPlaying() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.OpenNowPlaying, }); } public void PinToStart() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.PinToStart, }); } public void NavigateToClipboardUri() { ActionRequested?.Invoke(this, new ActionRequestedEventArgs { Action = Model.Action.NavigateToClipboardUri, }); } public void InitFailed(string errors) { InitializationFailed?.Invoke(this, new InitFailedEventArgs { Errors = errors, }); } public IAsyncOperation GetNewAccessTokenAsync() { return GetNewAccessToken().AsAsyncOperation(); } private Task GetNewAccessToken() { newAccessTokenTcs = new TaskCompletionSource(); NewAccessTokenRequested?.Invoke(this, new EventArgs()); return newAccessTokenTcs.Task; } public void SetNewAccessToken(string accessToken) { newAccessTokenTcs.TrySetResult(accessToken); } public void Log(string message) { LogMessageReceived?.Invoke(this, new LogMessageReceivedEventArgs { Message = message, }); } public bool IsWebPlayerBackupEnabled() { return WebPlayerBackupEnabled; } public int GetOSBuildVersion() { try { return new Version(OSVersion).Build; } catch (Exception ex) { Log("Exception in WebAgent.GetOSBuildVersion(): " + ex.ToString()); return 0; } } } } ================================================ FILE: XpoMusicWebAgent/XpoMusicWebAgent.csproj ================================================  Debug AnyCPU {15FACA69-C86A-4447-97DC-B6CB59056075} winmdobj Properties XpoMusicWebAgent XpoMusicWebAgent en-US UAP 10.0.18362.0 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} false AnyCPU true full false bin\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP prompt 4 AnyCPU pdbonly true bin\Release\ TRACE;NETFX_CORE;WINDOWS_UWP prompt 4 x86 true bin\x86\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full false prompt x86 bin\x86\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly false prompt ARM true bin\ARM\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full false prompt ARM bin\ARM\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly false prompt ARM64 true bin\ARM64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full false prompt ARM64 bin\ARM64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly false prompt x64 true bin\x64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full false prompt x64 bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true ;2008 pdbonly false prompt PackageReference 6.2.10 12.0.2 14.0