├── .gitattributes ├── .github └── workflows │ └── ci_develop.yml ├── .gitignore ├── AniMoe.App ├── AniMoe.App.csproj ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── AniMoeLogo.ico │ ├── AniMoeLogo.png │ ├── AniMoeTBLogo.png │ ├── auth_success_ui.html │ ├── installer_large_image.bmp │ └── installer_small_image.bmp ├── Controls │ ├── Common │ │ ├── LazyElement.xaml │ │ ├── LazyElement.xaml.cs │ │ ├── LoadButton.xaml │ │ ├── LoadButton.xaml.cs │ │ ├── LoadingIndicator.xaml │ │ └── LoadingIndicator.xaml.cs │ └── ListControls │ │ ├── AnimeListCard.xaml │ │ ├── AnimeListCard.xaml.cs │ │ ├── AnimeListFilterDialog.xaml │ │ └── AnimeListFilterDialog.xaml.cs ├── Converters │ ├── BoolNegationToOpacityConverter.cs │ ├── EnumDisplayAttrConverter.cs │ ├── EnumToStringConverter.cs │ ├── LoadingTextConverter.cs │ └── NullObjConverter.cs ├── Extensions │ └── StringExtensions.cs ├── Helpers │ ├── AnimeListFilterBuilder.cs │ └── MixedLangaugeComparer.cs ├── Messaging │ ├── ErrorDialogMessage.cs │ └── InlineNotificationMessage.cs ├── Properties │ └── launchSettings.json ├── Services │ ├── INavigationService.cs │ └── NavigationService.cs ├── ViewModels │ ├── CommonViewModels │ │ └── MediaDetailViewModel.cs │ ├── LoginViewModel.cs │ ├── MainViewModel.cs │ ├── SectionViewModels │ │ ├── AnimeListViewModel.cs │ │ └── MangaListViewModel.cs │ ├── SettingsViewModel.cs │ └── SplashViewModel.cs ├── Views │ ├── Common │ │ ├── MediaDetailView.xaml │ │ └── MediaDetailView.xaml.cs │ ├── LoginView.xaml │ ├── LoginView.xaml.cs │ ├── MainView.xaml │ ├── MainView.xaml.cs │ ├── RootWindow.xaml │ ├── RootWindow.xaml.cs │ ├── Sections │ │ ├── AnimeListView.xaml │ │ ├── AnimeListView.xaml.cs │ │ ├── MangaListView.xaml │ │ ├── MangaListView.xaml.cs │ │ ├── NotificationView.xaml │ │ ├── NotificationView.xaml.cs │ │ ├── SettingsView.xaml │ │ └── SettingsView.xaml.cs │ ├── SplashView.xaml │ └── SplashView.xaml.cs ├── app.manifest └── appsettings.json ├── AniMoe.Core ├── AniMoe.Core.csproj ├── Common │ ├── AuthSuccessWebHtml.cs │ ├── Enums.cs │ ├── JsonConverters.cs │ ├── MutationStrings.cs │ └── Queries.cs ├── Constants.cs ├── Helpers │ ├── AppUpdater.cs │ ├── CacheService.cs │ ├── ErrorDialog.cs │ ├── ImageDownloader.cs │ ├── RequestHandler.cs │ ├── SettingsProvider.cs │ └── WebLoginHandler.cs ├── Interfaces │ ├── IAppUpdater.cs │ ├── ICacheService.cs │ ├── IErrorDialog.cs │ ├── IGraphqlMutation.cs │ ├── IGraphqlQuery.cs │ ├── IImageDownloader.cs │ ├── IRequestHandler.cs │ ├── ISettingsProvider.cs │ └── IWebLoginHandler.cs ├── Models │ ├── AuthCodeModel.cs │ ├── ErrorResponseModel.cs │ ├── MediaListModel.cs │ └── ViewerModel.cs ├── Mutations │ └── UpdateMediaListService.cs └── Repositories │ ├── AnimeListRepository.cs │ ├── MangaListRepository.cs │ └── ViewerRepository.cs ├── AniMoe.sln ├── LICENSE.txt ├── README.md ├── changelog.md ├── installer_scripts └── animoe_setup.iss └── update.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/workflows/ci_develop.yml: -------------------------------------------------------------------------------- 1 | name: Development Build 2 | 3 | on: 4 | pull_request: 5 | branches: [ develop ] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | MSBuild: 10 | 11 | strategy: 12 | matrix: 13 | configuration: [ Release ] 14 | platform: [ x86, x64, ARM64 ] 15 | 16 | runs-on: windows-latest 17 | 18 | env: 19 | winui_labs_index: https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json 20 | solution_name: AniMoe.sln 21 | output_dir: output\ 22 | 23 | steps: 24 | - name: Git Checkout 25 | uses: actions/checkout@v4 26 | with: 27 | fetch-depth: 0 28 | 29 | - name: Install .NET8.0 30 | uses: actions/setup-dotnet@v4 31 | with: 32 | dotnet-version: 8.0.x 33 | 34 | - name: Setup MSBuild 35 | uses: microsoft/setup-msbuild@v2 36 | 37 | - name: Add CommunityToolkit.Labs.WinUI NuGet Source 38 | run: dotnet nuget add source $env:winui_labs_index -n CommunityToolkitLabs 39 | 40 | - name: msbuild restore 41 | run: msbuild $env:solution_name /t:Restore /p:Configuration=$env:configuration 42 | env: 43 | configuration: ${{ matrix.configuration }} 44 | 45 | - name: msbuild build solution 46 | run: msbuild $env:solution_name /p:Configuration=$env:configuration 47 | /p:Platform=$env:platform 48 | /p:OutDir=$env:output_dir 49 | env: 50 | configuration: ${{ matrix.configuration }} 51 | platform: ${{ matrix.platform }} 52 | 53 | - name: Create Windows Installer 54 | uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 55 | with: 56 | path: installer_scripts\animoe_setup.iss 57 | options: /O+ 58 | 59 | - name: Upload Installer Artifact 60 | uses: actions/upload-artifact@v4 61 | with: 62 | name: Develop_${{ matrix.platform }} 63 | retention-days: 10 64 | path: | 65 | ${{ github.workspace }}\AniMoe_setup.exe 66 | ${{ github.workspace }}\AniMoe.App\output\* 67 | 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | 365 | output/ 366 | 367 | AniMoe_setup.exe -------------------------------------------------------------------------------- /AniMoe.App/AniMoe.App.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | True 4 | Dynamic 5 | 6 | 7 | WinExe 8 | 1.0.0 9 | net8.0-windows10.0.22621.0 10 | AniMoe.App 11 | app.manifest 12 | x86;x64;ARM64 13 | win-x86;win-x64;win-arm64 14 | win10-x86;win10-x64;win10-arm64 15 | win-$(Platform).pubxml 16 | true 17 | None 18 | true 19 | 10.0.19041.0 20 | enable 21 | AniMoe.App.Program 22 | Assets\AniMoeLogo.ico 23 | AniMoe 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Always 83 | 84 | 85 | Always 86 | 87 | 88 | Always 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Always 98 | 99 | 100 | Always 101 | 102 | 103 | 104 | 105 | Always 106 | 107 | 108 | Always 109 | 110 | 111 | MSBuild:Compile 112 | 113 | 114 | MSBuild:Compile 115 | 116 | 117 | MSBuild:Compile 118 | 119 | 120 | MSBuild:Compile 121 | 122 | 123 | MSBuild:Compile 124 | 125 | 126 | MSBuild:Compile 127 | 128 | 129 | MSBuild:Compile 130 | 131 | 132 | MSBuild:Compile 133 | 134 | 135 | MSBuild:Compile 136 | 137 | 138 | MSBuild:Compile 139 | 140 | 141 | MSBuild:Compile 142 | 143 | 144 | 145 | 146 | MSBuild:Compile 147 | 148 | 149 | 150 | 151 | MSBuild:Compile 152 | 153 | 154 | 155 | 156 | MSBuild:Compile 157 | 158 | 159 | -------------------------------------------------------------------------------- /AniMoe.App/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 0, 40, 0, 0 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /AniMoe.App/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using AniMoe.App.Services; 4 | using AniMoe.App.ViewModels; 5 | using AniMoe.App.ViewModels.SectionViewModels; 6 | using AniMoe.App.Views; 7 | using AniMoe.Core.Helpers; 8 | using AniMoe.Core.Interfaces; 9 | using AniMoe.Core.Models.MediaListModel; 10 | using AniMoe.Core.Models.ViewerModel; 11 | using AniMoe.Core.Mutations; 12 | using AniMoe.Core.Repositories; 13 | using CommunityToolkit.Mvvm.DependencyInjection; 14 | using Microsoft.Extensions.Configuration; 15 | using Microsoft.Extensions.DependencyInjection; 16 | using Microsoft.UI.Xaml; 17 | using Serilog; 18 | 19 | namespace AniMoe.App; 20 | 21 | public partial class App : Application 22 | { 23 | public App() 24 | { 25 | InitializeComponent(); 26 | Ioc.Default.ConfigureServices(ConfigureServices()); 27 | Log.Debug("Registered services to Ioc"); 28 | } 29 | 30 | private IServiceProvider ConfigureServices() 31 | { 32 | var configuration = new ConfigurationBuilder() 33 | .AddJsonFile("appsettings.json", optional: false) 34 | .Build(); 35 | 36 | ConfigureLogger(configuration["Logger:LogTemplate"]!); 37 | Log.Information("Loaded configuration"); 38 | Log.Information("Created logger"); 39 | 40 | ServiceCollection collection = new ServiceCollection(); 41 | collection.AddSingleton(configuration); 42 | collection.AddTransient(); 43 | collection.AddMemoryCache(); 44 | 45 | // Services and Handlers 46 | collection.AddSingleton(); 47 | collection.AddSingleton(); 48 | collection.AddSingleton(); 49 | collection.AddSingleton(); 50 | collection.AddSingleton(); 51 | collection.AddSingleton(); 52 | collection.AddSingleton(); 53 | collection.AddSingleton(); 54 | collection.AddTransient(); 55 | 56 | // Singleton Models 57 | collection.AddSingleton(); 58 | collection.AddSingleton(); 59 | 60 | // ViewModels 61 | collection.AddSingleton(); 62 | collection.AddSingleton(); 63 | collection.AddSingleton(); 64 | collection.AddSingleton(); 65 | collection.AddSingleton(); 66 | collection.AddSingleton(); 67 | 68 | // Repositories 69 | collection.AddScoped(); 70 | collection.AddScoped(); 71 | collection.AddScoped(); 72 | 73 | return collection.BuildServiceProvider(); 74 | } 75 | 76 | private void ConfigureLogger(string template) 77 | { 78 | Log.Logger = new LoggerConfiguration() 79 | .MinimumLevel.Debug() 80 | .Enrich.WithAssemblyName() 81 | .WriteTo.Debug(outputTemplate: template) 82 | .WriteTo.File(outputTemplate: template, path: "./AniMoe.log") 83 | .CreateLogger(); 84 | } 85 | 86 | protected override void OnLaunched(LaunchActivatedEventArgs args) 87 | { 88 | RootWindow = new RootWindow(); 89 | RootWindow.Activate(); 90 | 91 | Log.Debug("RootWindow activated"); 92 | } 93 | 94 | public static Window? RootWindow; 95 | } -------------------------------------------------------------------------------- /AniMoe.App/Assets/AniMoeLogo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CosmicPredator/AniMoe/be14405401bf58331f963203e86cd7d23a74cd44/AniMoe.App/Assets/AniMoeLogo.ico -------------------------------------------------------------------------------- /AniMoe.App/Assets/AniMoeLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CosmicPredator/AniMoe/be14405401bf58331f963203e86cd7d23a74cd44/AniMoe.App/Assets/AniMoeLogo.png -------------------------------------------------------------------------------- /AniMoe.App/Assets/AniMoeTBLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CosmicPredator/AniMoe/be14405401bf58331f963203e86cd7d23a74cd44/AniMoe.App/Assets/AniMoeTBLogo.png -------------------------------------------------------------------------------- /AniMoe.App/Assets/auth_success_ui.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AniMoe Login Confirmation 7 | 36 | 37 | 38 |
39 | 40 |
AniMoe
41 |
42 | You are successfully logged in.
43 | You can now close this page and go back to the app 44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /AniMoe.App/Assets/installer_large_image.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CosmicPredator/AniMoe/be14405401bf58331f963203e86cd7d23a74cd44/AniMoe.App/Assets/installer_large_image.bmp -------------------------------------------------------------------------------- /AniMoe.App/Assets/installer_small_image.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CosmicPredator/AniMoe/be14405401bf58331f963203e86cd7d23a74cd44/AniMoe.App/Assets/installer_small_image.bmp -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LazyElement.xaml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LazyElement.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | using Microsoft.UI.Xaml.Controls; 3 | 4 | namespace AniMoe.App.Controls.Common; 5 | 6 | public sealed partial class LazyElement : UserControl 7 | { 8 | public bool IsLoading 9 | { 10 | get { return (bool)GetValue(IsLoadingProperty); } 11 | set { SetValue(IsLoadingProperty, value); } 12 | } 13 | 14 | public new UIElement Content 15 | { 16 | get { return (UIElement)GetValue(ContentProperty); } 17 | set { SetValue(ContentProperty, value); } 18 | } 19 | 20 | public static new readonly DependencyProperty ContentProperty = 21 | DependencyProperty.Register("Content", typeof(UIElement), typeof(LazyElement), new PropertyMetadata(null)); 22 | 23 | public static readonly DependencyProperty IsLoadingProperty = 24 | DependencyProperty.Register("IsLoading", typeof(bool), typeof(LazyElement), new PropertyMetadata(true)); 25 | 26 | public LazyElement() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LoadButton.xaml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 38 | 39 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LoadButton.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using Microsoft.UI.Xaml; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Controls.Common 6 | { 7 | public sealed partial class LoadButton : UserControl 8 | { 9 | public ICommand Command 10 | { 11 | get { return (ICommand)GetValue(CommandProperty); } 12 | set { SetValue(CommandProperty, value); } 13 | } 14 | 15 | public bool IsLoading 16 | { 17 | get { return (bool)GetValue(IsLoadingProperty); } 18 | set { SetValue(IsLoadingProperty, value); } 19 | } 20 | 21 | public string ButtonText 22 | { 23 | get { return (string)GetValue(ButtonTextProperty); } 24 | set { SetValue(ButtonTextProperty, value); } 25 | } 26 | 27 | public static readonly DependencyProperty IsLoadingProperty = 28 | DependencyProperty.Register("IsLoading", typeof(bool), typeof(LoadButton), new PropertyMetadata(false)); 29 | 30 | public static readonly DependencyProperty CommandProperty = 31 | DependencyProperty.Register("MyProperty", typeof(int), typeof(LoadButton), new PropertyMetadata(null)); 32 | 33 | public static readonly DependencyProperty ButtonTextProperty = 34 | DependencyProperty.Register("ButtonText", typeof(string), typeof(LoadButton), new PropertyMetadata(string.Empty)); 35 | 36 | public LoadButton() 37 | { 38 | InitializeComponent(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LoadingIndicator.xaml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 30 | 33 | 34 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/Common/LoadingIndicator.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | using Microsoft.UI.Xaml.Controls; 3 | 4 | namespace AniMoe.App.Controls.Common; 5 | public sealed partial class LoadingIndicator : UserControl 6 | { 7 | public bool IsLoading 8 | { 9 | get { return (bool)GetValue(IsLoadingProperty); } 10 | set { SetValue(IsLoadingProperty, value); } 11 | } 12 | public bool IsStillLoading 13 | { 14 | get { return (bool)GetValue(IsStillLoadingProperty); } 15 | set 16 | { SetValue(IsStillLoadingProperty, value); } 17 | } 18 | 19 | public static readonly DependencyProperty IsLoadingProperty = 20 | DependencyProperty.Register("IsLoading", typeof(bool), typeof(LoadingIndicator), new PropertyMetadata(false)); 21 | 22 | public static readonly DependencyProperty IsStillLoadingProperty = 23 | DependencyProperty.Register("IsStillLoading", typeof(bool), typeof(LoadingIndicator), new PropertyMetadata(false)); 24 | 25 | public LoadingIndicator() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/ListControls/AnimeListCard.xaml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 35 | 40 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 61 | 67 | 68 | 72 | 76 | 81 | 82 | 83 | 101 | 107 | 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/ListControls/AnimeListCard.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using AniMoe.App.ViewModels.SectionViewModels; 4 | using AniMoe.Core.Common; 5 | using AniMoe.Core.Models.MediaListModel; 6 | using CommunityToolkit.Mvvm.DependencyInjection; 7 | using Microsoft.UI; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | using Microsoft.UI.Xaml.Media; 11 | 12 | namespace AniMoe.App.Controls.ListControls; 13 | 14 | public sealed partial class AnimeListCard : UserControl 15 | { 16 | 17 | private readonly AnimeListViewModel ViewModel; 18 | 19 | public string Title 20 | { 21 | get { return (string)GetValue(TitleProperty); } 22 | set { SetValue(TitleProperty, value); } 23 | } 24 | 25 | public MediaFormat? Format 26 | { 27 | get { return (MediaFormat?)GetValue(FormatProperty); } 28 | set { SetValue(FormatProperty, value); } 29 | } 30 | 31 | public MediaStatus Status 32 | { 33 | get { return (MediaStatus)GetValue(StatusProperty); } 34 | set { SetValue(StatusProperty, value); } 35 | } 36 | 37 | public int? CurrentEpChapters 38 | { 39 | get { return (int?)GetValue(CurrentEpChaptersProperty); } 40 | set { SetValue(CurrentEpChaptersProperty, value); } 41 | } 42 | 43 | public int? TotalEpChapters 44 | { 45 | get { return (int?)GetValue(TotalEpChaptersProperty); } 46 | set { SetValue(TotalEpChaptersProperty, value); } 47 | } 48 | 49 | public Uri CoverImage 50 | { 51 | get { return (Uri)GetValue(CoverImageProperty); } 52 | set { SetValue(CoverImageProperty, value); } 53 | } 54 | 55 | public Uri LargeCoverImage 56 | { 57 | get { return (Uri)GetValue(LargeCoverImageProperty); } 58 | set { SetValue(LargeCoverImageProperty, value); } 59 | } 60 | 61 | public int? MediaId 62 | { 63 | get { return (int?)GetValue(MediaIdProperty); } 64 | set { SetValue(MediaIdProperty, value); } 65 | } 66 | 67 | public string? SiteUrl 68 | { 69 | get { return (string?)GetValue(SiteUrlProperty); } 70 | set { SetValue(SiteUrlProperty, value); } 71 | } 72 | 73 | public MediaListStatus? ListStatus 74 | { 75 | get { return (MediaListStatus?)GetValue(ListStatusProperty); } 76 | set { SetValue(ListStatusProperty, value); } 77 | } 78 | 79 | public NextAiringEpisode NextAiringEp 80 | { 81 | get { return (NextAiringEpisode)GetValue(NextAiringEpProperty); } 82 | set { SetValue(NextAiringEpProperty, value); } 83 | } 84 | 85 | public static readonly DependencyProperty ListStatusProperty = 86 | DependencyProperty.Register("ListStatus", typeof(MediaListStatus?), typeof(AnimeListCard), new PropertyMetadata(null)); 87 | 88 | public static readonly DependencyProperty SiteUrlProperty = 89 | DependencyProperty.Register("SiteUrl", typeof(string), typeof(AnimeListCard), new PropertyMetadata(null)); 90 | 91 | public static readonly DependencyProperty CoverImageProperty = 92 | DependencyProperty.Register("CoverImage", typeof(Uri), typeof(AnimeListCard), new PropertyMetadata(null)); 93 | 94 | public static readonly DependencyProperty LargeCoverImageProperty = 95 | DependencyProperty.Register("LargeCoverImage", typeof(Uri), typeof(AnimeListCard), new PropertyMetadata(null)); 96 | 97 | public static readonly DependencyProperty StatusProperty = 98 | DependencyProperty.Register("Status", typeof(MediaStatus), typeof(AnimeListCard), new PropertyMetadata(MediaStatus.FINISHED)); 99 | 100 | public static readonly DependencyProperty TitleProperty = 101 | DependencyProperty.Register("Title", typeof(string), typeof(AnimeListCard), new PropertyMetadata("?")); 102 | 103 | public static readonly DependencyProperty FormatProperty = 104 | DependencyProperty.Register("Format", typeof(MediaFormat?), typeof(AnimeListCard), new PropertyMetadata(null)); 105 | 106 | public static readonly DependencyProperty CurrentEpChaptersProperty = 107 | DependencyProperty.Register("CurrentEpChapters", typeof(int?), typeof(AnimeListCard), new PropertyMetadata(null)); 108 | 109 | public static readonly DependencyProperty TotalEpChaptersProperty = 110 | DependencyProperty.Register("TotalEpChapters", typeof(int?), typeof(AnimeListCard), new PropertyMetadata(null)); 111 | 112 | public static readonly DependencyProperty MediaIdProperty = 113 | DependencyProperty.Register("MediaId", typeof(int?), typeof(AnimeListCard), new PropertyMetadata(null)); 114 | 115 | public static readonly DependencyProperty NextAiringEpProperty = 116 | DependencyProperty.Register("NextAiringEp", typeof(NextAiringEpisode), typeof(AnimeListCard), new PropertyMetadata(null)); 117 | 118 | public AnimeListCard() 119 | { 120 | InitializeComponent(); 121 | ViewModel = Ioc.Default.GetRequiredService(); 122 | } 123 | 124 | private bool StatusToBool(MediaListStatus? status) 125 | { 126 | if (status is null) return true; 127 | return status switch 128 | { 129 | MediaListStatus.COMPLETED => false, 130 | _ => true, 131 | }; 132 | } 133 | 134 | private Visibility MediaStatusToVisibility(MediaStatus status) 135 | { 136 | return status switch 137 | { 138 | MediaStatus.NOT_YET_RELEASED or MediaStatus.RELEASING => Visibility.Visible, 139 | _ => Visibility.Collapsed 140 | }; 141 | } 142 | 143 | private SolidColorBrush MediaStatusToColor(MediaStatus status) 144 | { 145 | return status switch 146 | { 147 | MediaStatus.NOT_YET_RELEASED => new SolidColorBrush(Colors.OrangeRed), 148 | MediaStatus.RELEASING => new SolidColorBrush(Colors.LimeGreen), 149 | _ => new SolidColorBrush(Colors.Transparent) 150 | }; 151 | } 152 | 153 | private Visibility CanLoadNextAiringText(NextAiringEpisode? nextAiringEpisode, int? currentPorgress) 154 | { 155 | if (nextAiringEpisode is not null && (((nextAiringEpisode.Episode - 1) - CurrentEpChapters) > 0)) 156 | return Visibility.Visible; 157 | return Visibility.Collapsed; 158 | } 159 | 160 | private string EpBehindDiff(NextAiringEpisode? nextAiringEpisode, int? currentPorgress) 161 | { 162 | if (nextAiringEpisode is null) return string.Empty; 163 | return $"{(nextAiringEpisode.Episode - 1) - CurrentEpChapters} Behind"; 164 | } 165 | } -------------------------------------------------------------------------------- /AniMoe.App/Controls/ListControls/AnimeListFilterDialog.xaml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 76 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 97 | 98 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 117 | 118 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 137 | 138 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 157 | 158 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 178 | 179 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 221 | 222 | 223 | 224 | 251 | 252 | 253 | 254 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 305 | 306 | 307 | 308 | 312 | 313 | 318 | 324 | 329 | 330 | 331 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | -------------------------------------------------------------------------------- /AniMoe.App/Controls/ListControls/AnimeListFilterDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using AniMoe.App.ViewModels; 5 | using AniMoe.App.ViewModels.SectionViewModels; 6 | using AniMoe.Core.Common; 7 | using AniMoe.Core.Models.ViewerModel; 8 | using CommunityToolkit.Mvvm.ComponentModel; 9 | using CommunityToolkit.Mvvm.DependencyInjection; 10 | using CommunityToolkit.WinUI.Controls; 11 | using Microsoft.UI.Xaml; 12 | using Microsoft.UI.Xaml.Controls; 13 | using Microsoft.UI.Xaml.Data; 14 | using Windows.Foundation.Collections; 15 | 16 | namespace AniMoe.App.Controls.ListControls; 17 | 18 | /// 19 | /// A generic content dialog which handles filtering of MediaList in 20 | /// both UserList section and ExploreList section. 21 | /// 22 | public sealed partial class AnimeListFilterDialog : ContentDialog 23 | { 24 | private const string genreCategoryName = "Genres"; 25 | 26 | private readonly string viewModelType; 27 | private List TagGenres = new(); 28 | 29 | private List? SortList; 30 | private List? FormatList; 31 | private List? CountryList; 32 | private List? StatusList; 33 | private List? SeasonList; 34 | private List? MediaSourceList; 35 | private string EpisodeChapterTitle = string.Empty; 36 | private string DurationVolumeTitle = string.Empty; 37 | private bool IsAdult; 38 | 39 | public MediaListSortType? SelectedSortType; 40 | public MediaFormat? SelectedFormat; 41 | public CountryCode? SelectedCountryCode; 42 | public MediaStatus? SelectedStatus; 43 | public MediaSource? SelectedMediaSource; 44 | public MediaSeason? SelectedSeason; 45 | public List SelectedGenres = new(); 46 | public List SelectedNotInGenres = new(); 47 | public List SelectedTags = new(); 48 | public List SelectedNotInTags = new(); 49 | public bool SelectedIsAdult; 50 | 51 | private bool mediaSeasonIsLoaded = false; 52 | 53 | private SplashViewModel SplashViewModel = Ioc.Default.GetRequiredService(); 54 | 55 | public AnimeListFilterDialog(string viewModelType) 56 | { 57 | this.InitializeComponent(); 58 | this.viewModelType = viewModelType; 59 | populateControls(); 60 | SplashViewModel.PropertyChanged += (s, e) => 61 | { 62 | if (e.PropertyName == nameof(ViewerModel)) 63 | { 64 | if (TagGenres is not null && TagGenres.Any()) return; 65 | 66 | } 67 | }; 68 | loadMediaTagsAndGenres(); 69 | TagGenreSegmented.SelectionChanged += (s, e) => 70 | { 71 | Segmented seg = (Segmented)s; 72 | TagGenreListView.ItemsSource = (seg.SelectedValue as MediaTagsAndGenres)!.Values; 73 | }; 74 | } 75 | 76 | private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) 77 | { 78 | LoadDataFromControls(); 79 | } 80 | 81 | private void populateControls() 82 | { 83 | SortList = Enum.GetValues(typeof(MediaListSortType)).Cast().ToList(); 84 | FormatList = Enum.GetValues(typeof(MediaFormat)).Cast().ToList(); 85 | CountryList = Enum.GetValues(typeof(CountryCode)).Cast().ToList(); 86 | StatusList = Enum.GetValues(typeof(MediaStatus)).Cast().ToList(); 87 | MediaSourceList = Enum.GetValues(typeof(MediaSource)).Cast().ToList(); 88 | IsAdult = false; 89 | 90 | if (viewModelType == nameof(AnimeListViewModel)) 91 | { 92 | FormatList.RemoveRange(7, 3); // Remove manga specific formats. 93 | StatusList.Remove(StatusList[^1]); // Remove manga specific statuses 94 | 95 | // Not Applicable for Manga Filters 96 | SeasonList = Enum.GetValues(typeof(MediaSeason)).Cast().ToList(); 97 | 98 | EpisodeChapterTitle = "Episodes Range"; 99 | DurationVolumeTitle = "Duration"; 100 | mediaSeasonIsLoaded = true; 101 | } 102 | 103 | if (viewModelType == nameof(MangaListViewModel)) 104 | { 105 | FormatList = [.. FormatList.TakeLast(3)]; 106 | EpisodeChapterTitle = "Chapters Range"; 107 | DurationVolumeTitle = "Volumes"; 108 | } 109 | } 110 | 111 | private void loadMediaTagsAndGenres() 112 | { 113 | // Load Genre lists first 114 | TagGenres.Add(new MediaTagsAndGenres 115 | { 116 | CategoryName = "Genres", 117 | Values = SplashViewModel!.ViewerModel!.Data!.GenreCollection.Select( 118 | x => new TagGenreInfo 119 | { 120 | Name = x, 121 | IsChecked = false, 122 | Description = string.Empty 123 | }).ToList() 124 | }); 125 | 126 | // Load Media Tags 127 | var groupedTags = SplashViewModel!.ViewerModel!.Data!.MediaTagCollections.GroupBy( 128 | x => x.Category); 129 | TagGenres.AddRange(groupedTags.Select( 130 | x => new MediaTagsAndGenres 131 | { 132 | CategoryName = x.Key, 133 | Values = x.Select( 134 | tag => new TagGenreInfo 135 | { 136 | Name = tag.Name, 137 | IsChecked = false, 138 | Description = tag.Description 139 | }).ToList() 140 | })); 141 | } 142 | 143 | public void ClearFilters() 144 | { 145 | SelectedCountryCode = null; 146 | SelectedFormat = null; 147 | SelectedStatus = null; 148 | SelectedMediaSource = null; 149 | SelectedSeason = null; 150 | 151 | SelectedGenres = new(); 152 | SelectedTags = new(); 153 | SelectedNotInGenres = new(); 154 | SelectedNotInTags = new(); 155 | SelectedIsAdult = false; 156 | 157 | SelectedSortType = MediaListSortType.SCORE_DESC; 158 | } 159 | 160 | private void ResetFilterControls() 161 | { 162 | // Iterate through TagGenre list 163 | // and switch all checkbox value to false. 164 | TagGenres.ForEach( 165 | category => category.Values.ForEach( 166 | value => value.IsChecked = false)); 167 | 168 | SortComboBox.SelectedIndex = 1; 169 | FormatComboBox.SelectedIndex = -1; 170 | CountryCodeComboBox.SelectedIndex = -1; 171 | StatusComboBox.SelectedIndex = -1; 172 | SourceMaterialComboBox.SelectedIndex = -1; 173 | SeasonComboBox.SelectedIndex = -1; 174 | IsAdultCheckBox.IsChecked = IsAdult; 175 | //IsDoujinCheckBox.IsChecked = false; 176 | } 177 | 178 | private void LoadDataFromControls() 179 | { 180 | SelectedSortType = SortComboBox.SelectedValue as MediaListSortType?; 181 | SelectedFormat = FormatComboBox.SelectedValue as MediaFormat?; 182 | SelectedCountryCode = CountryCodeComboBox.SelectedValue as CountryCode?; 183 | SelectedStatus = StatusComboBox.SelectedValue as MediaStatus?; 184 | SelectedMediaSource = SourceMaterialComboBox.SelectedValue as MediaSource?; 185 | SelectedSeason = SeasonComboBox.SelectedValue as MediaSeason?; 186 | 187 | SelectedGenres = TagGenres 188 | .First(mediaTagsGenres => mediaTagsGenres.CategoryName is genreCategoryName) 189 | .Values 190 | .Where(tagGenreInfo => tagGenreInfo.IsChecked is true) 191 | .Select(tagGenreInfo => tagGenreInfo.Name) 192 | .ToList(); 193 | 194 | SelectedNotInGenres = TagGenres 195 | .First(mediaTagsGenres => mediaTagsGenres.CategoryName is genreCategoryName) 196 | .Values 197 | .Where(tagGenreInfo => tagGenreInfo.IsChecked is null) 198 | .Select(tagGenreInfo => tagGenreInfo.Name) 199 | .ToList(); 200 | 201 | SelectedTags = TagGenres 202 | .Where(x => x.CategoryName is not genreCategoryName) 203 | .SelectMany(x => x.Values) 204 | .Where(x => x.IsChecked is true) 205 | .Select(x => x.Name) 206 | .ToList(); 207 | 208 | SelectedNotInTags = TagGenres 209 | .Where(x => x.CategoryName is not genreCategoryName) 210 | .SelectMany(x => x.Values) 211 | .Where(x => x.IsChecked is null) 212 | .Select(x => x.Name) 213 | .ToList(); 214 | 215 | SelectedIsAdult = IsAdultCheckBox.IsChecked == true; 216 | } 217 | 218 | private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) 219 | { 220 | ClearFilters(); 221 | ResetFilterControls(); 222 | } 223 | } 224 | 225 | /// 226 | /// A master collection, which stores the filter category and 227 | /// their respective value. Used as List of MediaTagsAndGenres 228 | /// 229 | public class MediaTagsAndGenres : ObservableObject 230 | { 231 | private string categoryName = string.Empty; 232 | 233 | public string CategoryName 234 | { 235 | get => categoryName; 236 | set => SetProperty(ref categoryName, value); 237 | } 238 | 239 | public List Values = new(); 240 | } 241 | 242 | /// 243 | /// Represents a Model, which holds info about tag name, 244 | /// description and whether it is checked for filteration. 245 | /// 246 | public class TagGenreInfo : ObservableObject 247 | { 248 | private string name = string.Empty; 249 | 250 | public string Name 251 | { 252 | get => name; 253 | set => SetProperty(ref name, value); 254 | } 255 | 256 | // CheckBox IsChecked => true | NotChecked => false | Intermediate => null 257 | private bool? isChecked; 258 | 259 | public bool? IsChecked 260 | { 261 | get => isChecked; 262 | set => SetProperty(ref isChecked, value); 263 | } 264 | 265 | public string Description { get; set; } = string.Empty; 266 | } 267 | 268 | public class PrettifyCategoryStr : IValueConverter 269 | { 270 | public object Convert(object value, Type targetType, object parameter, string language) 271 | { 272 | var valueStr = value.ToString(); 273 | if (!valueStr!.Contains('-')) return valueStr; 274 | return valueStr.Replace("-", "/"); 275 | } 276 | 277 | public object ConvertBack(object value, Type targetType, object parameter, string language) 278 | { 279 | throw new NotImplementedException(); 280 | } 281 | } -------------------------------------------------------------------------------- /AniMoe.App/Converters/BoolNegationToOpacityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.UI.Xaml.Data; 3 | 4 | namespace AniMoe.App.Converters; 5 | 6 | public class BoolNegationToOpacityConverter : IValueConverter 7 | { 8 | public object Convert(object value, Type targetType, object parameter, string language) 9 | { 10 | double opacity = (bool)value ? 0 : 1; 11 | return opacity; 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, string language) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AniMoe.App/Converters/EnumDisplayAttrConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using Microsoft.UI.Xaml.Data; 4 | 5 | namespace AniMoe.App.Converters; 6 | 7 | public class EnumDisplayAttrConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, string language) 10 | { 11 | if (value is null) return value!; 12 | var enumType = value.GetType(); 13 | var member = enumType.GetMember(value.ToString()!)[0]; 14 | var displayAttribute = 15 | member.GetCustomAttributes(typeof(DisplayAttribute), false)[0] as DisplayAttribute; 16 | return displayAttribute?.Name ?? value.ToString()!; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, string language) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AniMoe.App/Converters/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AniMoe.App.Extensions; 3 | using Microsoft.UI.Xaml.Data; 4 | 5 | namespace AniMoe.App.Converters; 6 | 7 | public class EnumToStringConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, string language) 10 | { 11 | if (value is null) return string.Empty; 12 | return value.ToString()!.ToTitleCase(); 13 | } 14 | 15 | public object ConvertBack(object value, Type targetType, object parameter, string language) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | } -------------------------------------------------------------------------------- /AniMoe.App/Converters/LoadingTextConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.UI.Xaml.Data; 3 | 4 | namespace AniMoe.App.Converters 5 | { 6 | public class LoadingTextConverter : IValueConverter 7 | { 8 | public object Convert(object value, Type targetType, object parameter, string language) 9 | { 10 | if (bool.TryParse(value.ToString(), out bool boolValue)) 11 | { 12 | return boolValue ? "Still Loading..." : "Loading..."; 13 | } 14 | return "Loading..."; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, string language) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AniMoe.App/Converters/NullObjConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.UI.Xaml.Data; 3 | 4 | namespace AniMoe.App.Converters; 5 | 6 | public class NullObjConverter : IValueConverter 7 | { 8 | public object Convert(object value, Type targetType, object parameter, string language) 9 | { 10 | return value switch 11 | { 12 | null => "-", 13 | _ => value.ToString()! 14 | }; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, string language) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AniMoe.App/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace AniMoe.App.Extensions; 4 | 5 | public static class StringExtensions 6 | { 7 | public static string ToTitleCase(this string value) 8 | { 9 | TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; 10 | return textInfo.ToTitleCase(value.Replace("_", " ").ToLower()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AniMoe.App/Helpers/AnimeListFilterBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using AniMoe.Core.Common; 6 | using AniMoe.Core.Models.MediaListModel; 7 | 8 | namespace AniMoe.App.Helpers; 9 | 10 | /// 11 | /// A Filter Builder used to create filter conditions 12 | /// for Anime List. 13 | /// 14 | public class AnimeListFilterBuilder 15 | { 16 | // The original unfiltered list of anime entries, used as a base for all filtering operations 17 | private readonly IEnumerable sourceList; 18 | 19 | private MediaFormat? selectedFormat; 20 | private MediaStatus? selectedStatus; 21 | private CountryCode? selectedCountryCode; 22 | private MediaSource? selectedMediaSource; 23 | private MediaSeason? selectedSeason; 24 | private bool? selectedIsAdult; 25 | private bool? selectedIsDoujin; 26 | 27 | private List? selectedInGenres; 28 | private List? selectedNotInGenres; 29 | 30 | private List? selectedInTags; 31 | private List? selectedNotInTags; 32 | 33 | private string? searchTerm; 34 | 35 | private MediaListSortType selectedSort = MediaListSortType.SCORE_DESC; 36 | 37 | private int? selectedEpChapterMin; 38 | private int? selectedEpChapterMax; 39 | 40 | private int? selectedDurVolumeMin; 41 | private int? selectedDurVolumeMax; 42 | 43 | public AnimeListFilterBuilder(IEnumerable animeList) 44 | { 45 | this.sourceList = animeList ?? Enumerable.Empty(); 46 | } 47 | 48 | public AnimeListFilterBuilder WithFormat(MediaFormat? format) { this.selectedFormat = format; return this; } 49 | public AnimeListFilterBuilder WithStatus(MediaStatus? status) { this.selectedStatus = status; return this; } 50 | public AnimeListFilterBuilder WithMediaSource(MediaSource? source) { this.selectedMediaSource = source; return this; } 51 | public AnimeListFilterBuilder WithMediaSeason(MediaSeason? season) { this.selectedSeason = season; return this; } 52 | public AnimeListFilterBuilder WithGenresInclude(List? genres) { this.selectedInGenres = genres; return this; } 53 | public AnimeListFilterBuilder WithGenresExclude(List? genres) { this.selectedNotInGenres = genres; return this; } 54 | public AnimeListFilterBuilder WithTagsInclude(List? tags) { this.selectedInTags = tags; return this; } 55 | public AnimeListFilterBuilder WithTagsExclude(List? tags) { this.selectedNotInTags = tags; return this; } 56 | public AnimeListFilterBuilder WithCountry(CountryCode? country) { this.selectedCountryCode = country; return this; } 57 | public AnimeListFilterBuilder WithSort(MediaListSortType? sortType) { this.selectedSort = sortType ?? MediaListSortType.SCORE_DESC; return this; } 58 | public AnimeListFilterBuilder WithSearch(string? searchTerm) { this.searchTerm = searchTerm; return this; } 59 | public AnimeListFilterBuilder WithEpChapterRange(int? minValue, int? maxValue) { this.selectedEpChapterMin = minValue; this.selectedEpChapterMax = maxValue; return this; } 60 | public AnimeListFilterBuilder WithDurationVolumeRange(int? minValue, int? maxValue) { this.selectedDurVolumeMin = minValue; this.selectedDurVolumeMax = maxValue; return this; } 61 | public AnimeListFilterBuilder WithIsDoujin(bool? isDoujin) { this.selectedIsDoujin = isDoujin; return this; } 62 | public AnimeListFilterBuilder WithIsAdult(bool? isAdult) { this.selectedIsAdult = isAdult; return this; } 63 | 64 | public ObservableCollection Apply() 65 | { 66 | // Start with the full source list each time Apply is called 67 | // IEnumerable animeList = this.sourceList; 68 | IList animeList = new List(); 69 | 70 | for (int i = 0; i < this.sourceList.Count(); i++) 71 | { 72 | var mediaEntry = sourceList.ElementAt(i); 73 | var media = mediaEntry.Media; 74 | 75 | if (media == null) 76 | continue; 77 | 78 | if (selectedInGenres != null && selectedInGenres.Any()) 79 | { 80 | if (!(media.Genres != null && selectedInGenres.All(g => media.Genres.Contains(g)))) 81 | continue; 82 | } 83 | 84 | if (selectedNotInGenres != null && selectedNotInGenres.Any()) 85 | { 86 | if (!(media.Genres == null || !selectedNotInGenres.Any(g => media.Genres.Contains(g)))) 87 | continue; 88 | } 89 | 90 | if (selectedInTags != null && selectedInTags.Any()) 91 | { 92 | if (!(media.Tags != null && selectedInTags.All(t => media.Tags.Any(mt => mt.Name == t)))) 93 | continue; 94 | } 95 | 96 | if (selectedNotInTags != null && selectedNotInTags.Any()) 97 | { 98 | if (!(media.Tags == null || !selectedNotInTags.Any(t => media.Tags.Any(mt => mt.Name == t)))) 99 | continue; 100 | } 101 | 102 | if (selectedStatus != null) 103 | { 104 | if (media.Status != selectedStatus) 105 | continue; 106 | } 107 | 108 | if (selectedFormat != null) 109 | { 110 | if (media.Format != selectedFormat) 111 | continue; 112 | } 113 | 114 | if (selectedMediaSource != null) 115 | { 116 | if (media.Source != selectedMediaSource) 117 | continue; 118 | } 119 | 120 | if (selectedSeason != null) 121 | { 122 | if (media.Season != selectedSeason) 123 | continue; 124 | } 125 | 126 | if (selectedCountryCode != null) 127 | { 128 | if (media.CountryOfOrigin != selectedCountryCode) 129 | continue; 130 | } 131 | 132 | if (selectedIsAdult.HasValue) 133 | { 134 | if (media.IsAdult != selectedIsAdult.Value) 135 | continue; 136 | } 137 | 138 | if (!string.IsNullOrWhiteSpace(searchTerm)) 139 | { 140 | var lowerSearchInput = searchTerm.ToLowerInvariant(); 141 | if (!( 142 | (media.MediaTitle?.UserPreferred?.ToLowerInvariant().Contains(lowerSearchInput) ?? false) || 143 | (media.MediaTitle?.English?.ToLowerInvariant().Contains(lowerSearchInput) ?? false) || 144 | (media.MediaTitle?.Native?.ToLowerInvariant().Contains(lowerSearchInput) ?? false) || 145 | (media.MediaTitle?.Romaji?.ToLowerInvariant().Contains(lowerSearchInput) ?? false) 146 | )) 147 | { 148 | continue; 149 | } 150 | } 151 | 152 | // Passed all filters 153 | animeList.Add(mediaEntry); 154 | } 155 | 156 | animeList = animeList.OrderBy(x => x.Media?.MediaTitle?.UserPreferred ?? string.Empty, new MixedLanguageComparer()).ToList(); 157 | 158 | switch (selectedSort) 159 | { 160 | case MediaListSortType.TITLE: 161 | animeList = animeList.OrderBy(x => x.Media?.MediaTitle?.UserPreferred ?? string.Empty, new MixedLanguageComparer()).ToList(); 162 | break; 163 | case MediaListSortType.TITLE_DESC: 164 | animeList = animeList.OrderByDescending(x => x.Media?.MediaTitle?.UserPreferred ?? string.Empty, new MixedLanguageComparer()).ToList(); 165 | break; 166 | case MediaListSortType.SCORE: 167 | animeList = animeList.OrderBy(x => x.Score).ToList(); 168 | break; 169 | case MediaListSortType.PROGRESS: 170 | animeList = animeList.OrderBy(x => x.Progress).ToList(); 171 | break; 172 | case MediaListSortType.PROGRESS_DESC: 173 | animeList = animeList.OrderByDescending(x => x.Progress).ToList(); 174 | break; 175 | case MediaListSortType.SCORE_DESC: 176 | default: 177 | animeList = animeList.OrderByDescending(x => x.Score).ToList(); 178 | break; 179 | } 180 | 181 | return [..animeList]; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /AniMoe.App/Helpers/MixedLangaugeComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | 6 | namespace AniMoe.App.Helpers; 7 | 8 | /// 9 | /// MixedLangaugeComparer is a combination of 4 language comparers 10 | /// which is used mainly when sorting Anime or Manga List by Title. 11 | /// 12 | public class MixedLanguageComparer : IComparer 13 | { 14 | private readonly CompareInfo englishComparer = CompareInfo.GetCompareInfo("en-US"); 15 | private readonly CompareInfo japaneseComparer = CompareInfo.GetCompareInfo("ja-JP"); 16 | private readonly CompareInfo koreanComparer = CompareInfo.GetCompareInfo("ko-KR"); 17 | private readonly CompareInfo chineseComparer = CompareInfo.GetCompareInfo("zh-CN"); 18 | 19 | public int Compare(string? x, string? y) 20 | { 21 | if (x is null || y is null) return 0; 22 | x = NormalizeString(x); 23 | y = NormalizeString(y); 24 | if (IsJapanese(x) && IsJapanese(y)) 25 | return japaneseComparer.Compare(x, y); 26 | if (IsKorean(x) && IsKorean(y)) 27 | return koreanComparer.Compare(x, y); 28 | if (IsEnglish(x) && IsEnglish(y)) 29 | return englishComparer.Compare(x, y); 30 | if (IsChinese(x) && IsChinese(y)) 31 | return chineseComparer.Compare(x, y); 32 | return string.Compare(x, y, StringComparison.Ordinal); 33 | } 34 | 35 | private bool IsJapanese(string str) 36 | { 37 | return japaneseComparer.IsPrefix(str, ""); 38 | } 39 | 40 | private bool IsKorean(string str) 41 | { 42 | return koreanComparer.IsPrefix(str, ""); 43 | } 44 | 45 | private bool IsEnglish(string str) 46 | { 47 | return englishComparer.IsPrefix(str, ""); 48 | } 49 | 50 | private bool IsChinese(string str) 51 | { 52 | return chineseComparer.IsPrefix(str, ""); 53 | } 54 | 55 | private string NormalizeString(string str) 56 | { 57 | return str.Normalize(NormalizationForm.FormKC); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /AniMoe.App/Messaging/ErrorDialogMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CommunityToolkit.Mvvm.Messaging.Messages; 3 | 4 | namespace AniMoe.App.Messaging; 5 | 6 | public class ErrorDialogMessage : ValueChangedMessage 7 | { 8 | public ErrorDialogMessage(ErrorMessage message) : base(message) { } 9 | } 10 | 11 | public class ErrorMessage 12 | { 13 | public required string Title { get; set; } 14 | public required string Description { get; set; } 15 | public required string PrimaryButtonText { get; set; } 16 | public required string SecondaryButtonText { get; set; } 17 | public required Action OnPrimaryButtonClick { get; set; } 18 | public required Action OnSecondaryButtonClick { get; set; } 19 | } -------------------------------------------------------------------------------- /AniMoe.App/Messaging/InlineNotificationMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CommunityToolkit.Mvvm.Messaging.Messages; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Messaging 6 | { 7 | public class SimpleNotificationMessage : ValueChangedMessage 8 | { 9 | public SimpleNotificationMessage(SimpleNotificationMessageParams value) : base(value) { } 10 | } 11 | 12 | public class ComplexNotificationMessage : ValueChangedMessage 13 | { 14 | public ComplexNotificationMessage(ComplexNotificationMessageParams value) : base(value) { } 15 | } 16 | } 17 | 18 | public class SimpleNotificationMessageParams 19 | { 20 | public InfoBarSeverity Severity { get; set; } = InfoBarSeverity.Success; 21 | public required string Title { get; set; } 22 | public required string Description { get; set; } 23 | } 24 | 25 | public class ComplexNotificationMessageParams : SimpleNotificationMessageParams 26 | { 27 | public required string HyperlinkText { get; set; } 28 | public Action HyperlinkAction { get; set; } = () => { }; // Empty Action by default 29 | } -------------------------------------------------------------------------------- /AniMoe.App/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AniMoe.App": { 4 | "commandName": "Project" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /AniMoe.App/Services/INavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.UI.Xaml.Controls; 3 | 4 | namespace AniMoe.App.Services; 5 | public interface INavigationService 6 | { 7 | void SetFrame(Frame frame); 8 | void Navigate(Type pageType, object? args); 9 | void ClearNavigationStack(); 10 | void GoBack(); 11 | bool CanGoBack(); 12 | } 13 | -------------------------------------------------------------------------------- /AniMoe.App/Services/NavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.UI.Xaml.Controls; 3 | using Microsoft.UI.Xaml.Media.Animation; 4 | 5 | namespace AniMoe.App.Services; 6 | public class NavigationService : INavigationService 7 | { 8 | private Frame? frame; 9 | private DrillInNavigationTransitionInfo transitionInfo = new(); 10 | 11 | public bool CanGoBack() 12 | { 13 | return frame!.CanGoBack; 14 | } 15 | 16 | public void GoBack() 17 | { 18 | frame?.GoBack(); 19 | } 20 | 21 | public void Navigate(Type pageType, object? args) 22 | { 23 | frame?.Navigate(pageType, args, transitionInfo); 24 | } 25 | 26 | public void ClearNavigationStack() 27 | { 28 | frame?.BackStack.Clear(); 29 | } 30 | 31 | public void SetFrame(Frame frame) 32 | { 33 | this.frame = frame; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/CommonViewModels/MediaDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AniMoe.App.ViewModels.CommonViewModels; 2 | 3 | public class MediaDetailViewModel 4 | { 5 | } -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/LoginViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using AniMoe.App.Services; 4 | using AniMoe.App.Views; 5 | using AniMoe.Core.Interfaces; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.UI.Dispatching; 10 | using Microsoft.UI.Xaml.Controls; 11 | 12 | namespace AniMoe.App.ViewModels; 13 | public partial class LoginViewModel : ObservableObject 14 | { 15 | [ObservableProperty] 16 | private bool isLoading = false; 17 | 18 | [ObservableProperty] 19 | private string loginButtonText = "Login to Anilist"; 20 | 21 | private readonly IConfiguration configuration; 22 | private readonly IWebLoginHandler webLoginHandler; 23 | private readonly INavigationService navigationService; 24 | private readonly DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread(); 25 | 26 | public LoginViewModel(IConfiguration configuration, 27 | IWebLoginHandler webLoginHandler, INavigationService navigationService) 28 | { 29 | this.configuration = configuration; 30 | this.webLoginHandler = webLoginHandler; 31 | this.navigationService = navigationService; 32 | 33 | webLoginHandler.StartOAuthServer(); 34 | webLoginHandler.LoggedIn += WebLoginHandler_LoggedIn; 35 | } 36 | 37 | private void WebLoginHandler_LoggedIn(object? sender, EventArgs e) 38 | { 39 | dispatcherQueue.TryEnqueue(() => navigationService.Navigate(typeof(SplashView), null)); 40 | webLoginHandler.CloseOAuthServer(); 41 | } 42 | 43 | [RelayCommand] 44 | private void InitiateLogin() 45 | { 46 | IsLoading = true; 47 | OpenAuthURL(); 48 | } 49 | 50 | private void OpenAuthURL() 51 | { 52 | Process.Start(new ProcessStartInfo(configuration["AniMoe:AuthURL"]!) 53 | { 54 | UseShellExecute = true 55 | }); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using AniMoe.App.Messaging; 7 | using AniMoe.App.Services; 8 | using AniMoe.App.Views.Common; 9 | using AniMoe.App.Views.Sections; 10 | using AniMoe.Core.Models.MediaListModel; 11 | using AniMoe.Core.Models.ViewerModel; 12 | using AniMoe.Core.Repositories; 13 | using CommunityToolkit.Mvvm.ComponentModel; 14 | using CommunityToolkit.Mvvm.Input; 15 | using CommunityToolkit.Mvvm.Messaging; 16 | using Microsoft.UI.Dispatching; 17 | using Microsoft.UI.Xaml.Controls; 18 | 19 | namespace AniMoe.App.ViewModels; 20 | public partial class MainViewModel : ObservableObject 21 | { 22 | [ObservableProperty] 23 | private bool isBackButtonEnabled = false; 24 | 25 | private NavigationView? navView; 26 | 27 | private List navItems = 28 | [ 29 | new() { 30 | Content = new TextBlock { Text = "Anime"}, 31 | Icon = new SymbolIcon(symbol: Symbol.Video), 32 | Tag = "AnimeView" 33 | }, 34 | new() { 35 | Content = new TextBlock { Text = "Manga" }, 36 | Icon = new SymbolIcon(symbol: Symbol.Bookmarks), 37 | Tag = "MangaView" 38 | }, 39 | new() { 40 | Content = new TextBlock { Text = "Explore" }, 41 | Icon = new SymbolIcon(symbol: Symbol.AllApps), 42 | Tag = "ExploreView" 43 | }, 44 | new() { 45 | Content = new TextBlock { Text = "Notifications" }, 46 | Icon = new SymbolIcon(symbol: Symbol.Account), 47 | Tag = "NotificationsView" 48 | } 49 | ]; 50 | 51 | private readonly INavigationService navigationService; 52 | 53 | public MainViewModel(INavigationService navigationService) 54 | { 55 | this.navigationService = navigationService; 56 | } 57 | 58 | public void NavBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) 59 | { 60 | if (navigationService.CanGoBack()) 61 | { 62 | navigationService.GoBack(); 63 | } 64 | } 65 | 66 | public void MapNavigationView(NavigationView navView) 67 | { 68 | this.navView = navView; 69 | navItems.ForEach(navView.MenuItems.Add); 70 | navView.SelectedItem = navItems[0]; 71 | } 72 | 73 | public void NavSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) 74 | { 75 | if (args.SelectedItemContainer is not NavigationViewItem navItem) return; 76 | string tag = navItem!.Tag.ToString()!; 77 | switch (tag) 78 | { 79 | case "AnimeView": 80 | navigationService.Navigate(typeof(AnimeListView), null); 81 | break; 82 | case "MangaView": 83 | navigationService.Navigate(typeof(MangaListView), null); 84 | break; 85 | case "NotificationsView": 86 | navigationService.Navigate(typeof(MediaDetailView), null); 87 | break; 88 | case "Settings": 89 | navigationService.Navigate(typeof(SettingsView), null); 90 | break; 91 | } 92 | } 93 | 94 | public void FrameNavChanged(object sender, Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) 95 | { 96 | switch ((sender as Frame)!.Content) 97 | { 98 | case AnimeListView: 99 | navView!.SelectedItem = navItems.First(x => x.Tag.ToString() == "AnimeView"); 100 | break; 101 | case MangaListView: 102 | navView!.SelectedItem = navItems.First(x => x.Tag.ToString() == "MangaView"); 103 | break; 104 | case NotificationView: 105 | navView!.SelectedItem = navItems.First(x => x.Tag.ToString() == "NotificationsView"); 106 | break; 107 | case SettingsView: 108 | navView!.SelectedItem = navView.SettingsItem; 109 | break; 110 | } 111 | IsBackButtonEnabled = navigationService.CanGoBack(); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/SectionViewModels/AnimeListViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using AniMoe.App.Controls.ListControls; 8 | using AniMoe.App.Helpers; 9 | using AniMoe.App.Messaging; 10 | using AniMoe.Core.Common; 11 | using AniMoe.Core.Interfaces; 12 | using AniMoe.Core.Models.MediaListModel; 13 | using AniMoe.Core.Mutations; 14 | using CommunityToolkit.Mvvm.ComponentModel; 15 | using CommunityToolkit.Mvvm.DependencyInjection; 16 | using CommunityToolkit.Mvvm.Input; 17 | using CommunityToolkit.Mvvm.Messaging; 18 | using CommunityToolkit.WinUI; 19 | using Microsoft.UI.Dispatching; 20 | using Microsoft.UI.Xaml; 21 | using Microsoft.UI.Xaml.Controls; 22 | using Windows.ApplicationModel.DataTransfer; 23 | 24 | namespace AniMoe.App.ViewModels.SectionViewModels; 25 | 26 | public partial class AnimeListViewModel : ObservableObject 27 | { 28 | private readonly UpdateMediaListService updateMediaListService; 29 | private readonly IImageDownloader imageDownloader; 30 | public List SortTypeList = 31 | Enum.GetValues(typeof(MediaListSortType)).Cast().ToList(); 32 | private DispatcherQueueTimer _debounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); 33 | private AnimeListFilterDialog filterDialog = new(nameof(AnimeListViewModel)); 34 | private XamlRoot? dialogXamlRoot; 35 | 36 | [ObservableProperty] 37 | private MediaListModel? animeListModel; 38 | 39 | [ObservableProperty] 40 | private ObservableCollection? currentEntry; 41 | 42 | [ObservableProperty] 43 | private ObservableCollection? userLists; 44 | 45 | [ObservableProperty] 46 | private string? selectedStatus; 47 | 48 | [ObservableProperty] 49 | private bool gridViewIsLoaded = false; 50 | 51 | [ObservableProperty] 52 | private string? downloadedImagePath = string.Empty; 53 | 54 | public AnimeListViewModel(UpdateMediaListService updateMediaListService, 55 | IImageDownloader imageDownloader) 56 | { 57 | this.updateMediaListService = updateMediaListService; 58 | this.imageDownloader = imageDownloader; 59 | } 60 | 61 | public void LoadVM() 62 | { 63 | AnimeListModel = Ioc.Default.GetRequiredService(); 64 | 65 | if (UserLists is null || !UserLists!.Any()) 66 | UserLists = [.. AnimeListModel!.Data!.MediaListCollections!.Lists!.Select(x => x.ListName!.ToString())]; 67 | 68 | if (SelectedStatus is null) 69 | SelectedStatus = UserLists!.Where(x => x == "Watching").First(); 70 | updateCurrentEntry(); 71 | } 72 | 73 | public void MapXamlRoot(XamlRoot root) 74 | { 75 | this.dialogXamlRoot = root; 76 | } 77 | 78 | [RelayCommand] 79 | private void UpdateProgress(int? mediaId) 80 | { 81 | var media = AnimeListModel?.Data?.MediaListCollections?.Lists!.First( 82 | x => x.ListName!.ToString() == SelectedStatus).Entries!.First(x => x.Media!.Id == mediaId); 83 | if (media!.Progress + 1 >= media!.Media!.Episodes) return; 84 | media!.Progress++; 85 | Task.Run(async () => 86 | { 87 | bool result = await updateMediaListService.MutateAsync(dict => 88 | { 89 | dict["mediaId"] = mediaId!; 90 | dict["progress"] = media!.Progress!; 91 | }); 92 | if (!result) 93 | { 94 | WeakReferenceMessenger.Default.Send(new SimpleNotificationMessage(new() 95 | { 96 | Severity = InfoBarSeverity.Error, 97 | Title = "Error", 98 | Description = "Failed to update. Check Log!" 99 | })); 100 | media!.Progress--; 101 | } 102 | }); 103 | } 104 | 105 | [RelayCommand] 106 | private void OpenLinkInBrowser(string url) 107 | { 108 | Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); 109 | } 110 | 111 | [RelayCommand] 112 | private void CopyLink(string url) 113 | { 114 | DataPackage package = new() { RequestedOperation = DataPackageOperation.Copy }; 115 | package.SetText(url); 116 | Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(package); 117 | WeakReferenceMessenger.Default.Send(new SimpleNotificationMessage(new() 118 | { 119 | Severity = InfoBarSeverity.Success, 120 | Title = "Success", 121 | Description = "Link copied to clipboard!" 122 | })); 123 | } 124 | 125 | [RelayCommand] 126 | private async Task DownloadCoverImage(string imageUrl) 127 | { 128 | var fileName = imageUrl.Split("/")[^1]; 129 | DownloadedImagePath = await imageDownloader.DownloadImageAsync(imageUrl, fileName); 130 | WeakReferenceMessenger.Default.Send(new ComplexNotificationMessage(new() 131 | { 132 | Severity = InfoBarSeverity.Success, 133 | Title = "Success", 134 | Description = "Cover image downloaded successfully!", 135 | HyperlinkText = "Open", 136 | HyperlinkAction = () => 137 | Process.Start(new ProcessStartInfo(DownloadedImagePath) { UseShellExecute = true }) 138 | })); 139 | } 140 | 141 | [RelayCommand] 142 | private void ChangeListToStatus(string listName) 143 | { 144 | SelectedStatus = listName; 145 | updateCurrentEntry(); 146 | } 147 | 148 | [RelayCommand] 149 | private async Task OpenFilterDialog() 150 | { 151 | filterDialog.XamlRoot = dialogXamlRoot!; 152 | var dialogResult = await filterDialog.ShowAsync(); 153 | 154 | if (dialogResult is ContentDialogResult.None) return; 155 | 156 | updateCurrentEntry(); 157 | } 158 | 159 | [RelayCommand] 160 | private void ExecuteSearch(string searchText) 161 | { 162 | _debounceTimer.Debounce(() => 163 | { 164 | updateCurrentEntry(true, searchText); 165 | }, TimeSpan.FromMilliseconds(300), searchText.Length <= 1); 166 | } 167 | 168 | private void updateCurrentEntry(bool includeSearchText = false, string searchText = "") 169 | { 170 | GridViewIsLoaded = false; 171 | 172 | var entryLists = AnimeListModel!.Data!.MediaListCollections!.Lists!.Where( 173 | x => x!.ListName!.ToString() == SelectedStatus).First().Entries; 174 | 175 | var filter = new AnimeListFilterBuilder(entryLists!) 176 | .WithIsAdult(filterDialog.SelectedIsAdult) 177 | .WithStatus(filterDialog.SelectedStatus) 178 | .WithFormat(filterDialog.SelectedFormat) 179 | .WithCountry(filterDialog.SelectedCountryCode) 180 | .WithMediaSeason(filterDialog.SelectedSeason) 181 | .WithMediaSource(filterDialog.SelectedMediaSource) 182 | .WithGenresInclude(filterDialog.SelectedGenres) 183 | .WithGenresExclude(filterDialog.SelectedNotInGenres) 184 | .WithTagsInclude(filterDialog.SelectedTags) 185 | .WithTagsExclude(filterDialog.SelectedNotInTags) 186 | .WithSort(filterDialog.SelectedSortType); 187 | 188 | if (includeSearchText) 189 | { 190 | filter.WithSearch(searchText); 191 | } 192 | 193 | CurrentEntry = filter.Apply(); 194 | 195 | GridViewIsLoaded = true; 196 | } 197 | } -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/SectionViewModels/MangaListViewModel.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.Controls.ListControls; 2 | using AniMoe.Core.Common; 3 | using AniMoe.Core.Interfaces; 4 | using AniMoe.Core.Mutations; 5 | using CommunityToolkit.Mvvm.ComponentModel; 6 | using Microsoft.UI.Xaml; 7 | using System.Collections.Generic; 8 | using System; 9 | using System.Linq; 10 | using Microsoft.UI.Dispatching; 11 | using System.Collections.ObjectModel; 12 | using CommunityToolkit.Mvvm.Input; 13 | using System.Threading.Tasks; 14 | using CommunityToolkit.Mvvm.Messaging; 15 | using AniMoe.Core.Models.MediaListModel; 16 | using AniMoe.App.Messaging; 17 | using Microsoft.UI.Xaml.Controls; 18 | using System.Diagnostics; 19 | using Windows.ApplicationModel.DataTransfer; 20 | using CommunityToolkit.WinUI; 21 | using AniMoe.App.Helpers; 22 | using CommunityToolkit.Mvvm.DependencyInjection; 23 | 24 | namespace AniMoe.App.ViewModels.SectionViewModels; 25 | 26 | public partial class MangaListViewModel : ObservableObject 27 | { 28 | private readonly UpdateMediaListService updateMediaListService; 29 | private readonly IImageDownloader imageDownloader; 30 | public List SortTypeList = 31 | Enum.GetValues(typeof(MediaListSortType)).Cast().ToList(); 32 | private DispatcherQueueTimer _debounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); 33 | private AnimeListFilterDialog filterDialog = new(nameof(MangaListViewModel)); 34 | private XamlRoot? dialogXamlRoot; 35 | 36 | [ObservableProperty] 37 | private MediaListModel? mangaListModel; 38 | 39 | [ObservableProperty] 40 | private ObservableCollection? currentEntry; 41 | 42 | [ObservableProperty] 43 | private ObservableCollection? userLists; 44 | 45 | [ObservableProperty] 46 | private string? selectedStatus; 47 | 48 | [ObservableProperty] 49 | private bool gridViewIsLoaded = false; 50 | 51 | [ObservableProperty] 52 | private string? downloadedImagePath = string.Empty; 53 | 54 | public MangaListViewModel(UpdateMediaListService updateMediaListService, 55 | IImageDownloader imageDownloader) 56 | { 57 | this.updateMediaListService = updateMediaListService; 58 | this.imageDownloader = imageDownloader; 59 | } 60 | 61 | public void LoadVM() 62 | { 63 | MangaListModel = Ioc.Default.GetRequiredService(); 64 | if (UserLists is null || !UserLists.Any()) 65 | UserLists = [.. MangaListModel!.Data!.MediaListCollections!.Lists!.Select(x => x.ListName!.ToString())]; 66 | 67 | if (SelectedStatus is null) 68 | SelectedStatus = UserLists!.Where(x => x == "Reading").First(); 69 | updateCurrentEntry(); 70 | } 71 | 72 | public void MapXamlRoot(XamlRoot root) 73 | { 74 | this.dialogXamlRoot = root; 75 | } 76 | 77 | [RelayCommand] 78 | private void UpdateProgress(int? mediaId) 79 | { 80 | var media = MangaListModel?.Data?.MediaListCollections?.Lists!.First( 81 | x => x.ListName!.ToString() == SelectedStatus).Entries!.First(x => x.Media!.Id == mediaId); 82 | if (media!.Progress + 1 >= media!.Media!.Chapters!) return; 83 | media!.Progress++; 84 | Task.Run(async () => 85 | { 86 | bool result = await updateMediaListService.MutateAsync(dict => 87 | { 88 | dict["mediaId"] = mediaId!; 89 | dict["progress"] = media!.Progress!; 90 | }); 91 | if (!result) 92 | { 93 | WeakReferenceMessenger.Default.Send(new SimpleNotificationMessage(new() 94 | { 95 | Severity = InfoBarSeverity.Error, 96 | Title = "Error", 97 | Description = "Failed to update. Check Log!" 98 | })); 99 | media!.Progress--; 100 | } 101 | }); 102 | } 103 | 104 | [RelayCommand] 105 | private void OpenLinkInBrowser(string url) 106 | { 107 | Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); 108 | } 109 | 110 | [RelayCommand] 111 | private void CopyLink(string url) 112 | { 113 | DataPackage package = new() { RequestedOperation = DataPackageOperation.Copy }; 114 | package.SetText(url); 115 | Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(package); 116 | WeakReferenceMessenger.Default.Send(new SimpleNotificationMessage(new() 117 | { 118 | Severity = InfoBarSeverity.Success, 119 | Title = "Success", 120 | Description = "Link copied to clipboard!" 121 | })); 122 | } 123 | 124 | [RelayCommand] 125 | private async Task DownloadCoverImage(string imageUrl) 126 | { 127 | var fileName = imageUrl.Split("/")[^1]; 128 | DownloadedImagePath = await imageDownloader.DownloadImageAsync(imageUrl, fileName); 129 | WeakReferenceMessenger.Default.Send(new ComplexNotificationMessage(new() 130 | { 131 | Severity = InfoBarSeverity.Success, 132 | Title = "Success", 133 | Description = "Cover image downloaded successfully!", 134 | HyperlinkText = "Open", 135 | HyperlinkAction = () => 136 | Process.Start(new ProcessStartInfo(DownloadedImagePath) { UseShellExecute = true }) 137 | })); 138 | } 139 | 140 | [RelayCommand] 141 | private void ChangeListToStatus(string listName) 142 | { 143 | SelectedStatus = listName; 144 | updateCurrentEntry(); 145 | } 146 | 147 | [RelayCommand] 148 | private async Task OpenFilterDialog() 149 | { 150 | filterDialog.XamlRoot = dialogXamlRoot!; 151 | var dialogResult = await filterDialog.ShowAsync(); 152 | 153 | if (dialogResult is ContentDialogResult.None) return; 154 | 155 | updateCurrentEntry(); 156 | } 157 | 158 | [RelayCommand] 159 | private void ExecuteSearch(string searchText) 160 | { 161 | _debounceTimer.Debounce(() => 162 | { 163 | updateCurrentEntry(true, searchText); 164 | }, TimeSpan.FromMilliseconds(300), searchText.Length <= 1); 165 | } 166 | 167 | private void updateCurrentEntry(bool includeSearchText = false, string searchText = "") 168 | { 169 | GridViewIsLoaded = false; 170 | 171 | var entryLists = MangaListModel!.Data!.MediaListCollections!.Lists!.Where( 172 | x => x!.ListName!.ToString() == SelectedStatus).First().Entries; 173 | 174 | var filter = new AnimeListFilterBuilder(entryLists!) 175 | .WithIsAdult(filterDialog.SelectedIsAdult) 176 | .WithStatus(filterDialog.SelectedStatus) 177 | .WithFormat(filterDialog.SelectedFormat) 178 | .WithCountry(filterDialog.SelectedCountryCode) 179 | .WithMediaSeason(filterDialog.SelectedSeason) 180 | .WithMediaSource(filterDialog.SelectedMediaSource) 181 | .WithGenresInclude(filterDialog.SelectedGenres) 182 | .WithGenresExclude(filterDialog.SelectedNotInGenres) 183 | .WithTagsInclude(filterDialog.SelectedTags) 184 | .WithTagsExclude(filterDialog.SelectedNotInTags) 185 | .WithSort(filterDialog.SelectedSortType); 186 | 187 | if (includeSearchText) 188 | { 189 | filter.WithSearch(searchText); 190 | } 191 | 192 | CurrentEntry = filter.Apply(); 193 | 194 | GridViewIsLoaded = true; 195 | } 196 | } -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/SettingsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | 4 | namespace AniMoe.App.ViewModels; 5 | 6 | public partial class SettingsViewModel : ObservableObject 7 | { 8 | [ObservableProperty] 9 | private string versionString = string.Empty; 10 | 11 | public SettingsViewModel() 12 | { 13 | VersionString = Assembly.GetExecutingAssembly().GetName().Version!.ToString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AniMoe.App/ViewModels/SplashViewModel.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.Services; 2 | using AniMoe.App.Views; 3 | using AniMoe.Core.Models.MediaListModel; 4 | using AniMoe.Core.Models.ViewerModel; 5 | using AniMoe.Core.Repositories; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | using CommunityToolkit.Mvvm.DependencyInjection; 8 | using CommunityToolkit.Mvvm.Input; 9 | using System; 10 | using System.Diagnostics; 11 | using System.Threading.Tasks; 12 | 13 | namespace AniMoe.App.ViewModels; 14 | 15 | public partial class SplashViewModel : ObservableObject 16 | { 17 | [ObservableProperty] 18 | private ViewerModel? viewerModel; 19 | 20 | [ObservableProperty] 21 | private string? loadStatus; 22 | 23 | private ViewerRepository viewerRepository; 24 | private AnimeListRepository animeListRepository; 25 | private MangaListRepository mangaListRepository; 26 | private INavigationService navigationService; 27 | private AnimeListModel animeListModel; 28 | private MangaListModel mangaListModel; 29 | 30 | public SplashViewModel(ViewerRepository viewerRepository, 31 | AnimeListRepository animeListRepository, 32 | MangaListRepository mangaListRepository, 33 | INavigationService navigationService, 34 | AnimeListModel animeListModel, 35 | MangaListModel mangaListModel) 36 | { 37 | this.viewerRepository = viewerRepository; 38 | this.animeListRepository = animeListRepository; 39 | this.mangaListRepository = mangaListRepository; 40 | this.navigationService = navigationService; 41 | this.animeListModel = animeListModel; 42 | this.mangaListModel = mangaListModel; 43 | 44 | LoadStatus = "Please Wait..."; 45 | } 46 | 47 | [RelayCommand] 48 | private async Task LoadData() 49 | { 50 | try 51 | { 52 | LoadStatus = "Logging in..."; 53 | ViewerModel = await viewerRepository.QueryAsync(null); 54 | 55 | LoadStatus = "Getting Anime list..."; 56 | await animeListModel.ReloadModelAsync(async () => 57 | { 58 | return await animeListRepository.QueryAsync(dict => 59 | { 60 | dict["userId"] = ViewerModel?.Data?.Viewer?.Id!; 61 | }); 62 | }); 63 | 64 | LoadStatus = "Getting Manga list..."; 65 | await mangaListModel.ReloadModelAsync(async () => 66 | { 67 | return await mangaListRepository.QueryAsync(dict => 68 | { 69 | dict["userId"] = ViewerModel?.Data?.Viewer?.Id!; 70 | }); 71 | }); 72 | 73 | navigationService.Navigate(typeof(MainView), null); 74 | } 75 | catch (Exception ex) 76 | { 77 | Debug.WriteLine(ex.Message); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /AniMoe.App/Views/Common/MediaDetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | using Microsoft.UI.Xaml.Controls; 3 | using Microsoft.UI.Xaml.Controls.Primitives; 4 | using Microsoft.UI.Xaml.Data; 5 | using Microsoft.UI.Xaml.Input; 6 | using Microsoft.UI.Xaml.Media; 7 | using Microsoft.UI.Xaml.Navigation; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Runtime.InteropServices.WindowsRuntime; 13 | using Windows.Foundation; 14 | using Windows.Foundation.Collections; 15 | 16 | // To learn more about WinUI, the WinUI project structure, 17 | // and more about our project templates, see: http://aka.ms/winui-project-info. 18 | 19 | namespace AniMoe.App.Views.Common 20 | { 21 | /// 22 | /// An empty page that can be used on its own or navigated to within a Frame. 23 | /// 24 | public sealed partial class MediaDetailView : Page 25 | { 26 | public MediaDetailView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /AniMoe.App/Views/LoginView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 60 | 61 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /AniMoe.App/Views/LoginView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.ViewModels; 2 | using CommunityToolkit.Mvvm.DependencyInjection; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Views; 6 | public sealed partial class LoginView : Page 7 | { 8 | private readonly LoginViewModel ViewModel; 9 | public LoginView() 10 | { 11 | InitializeComponent(); 12 | App.RootWindow?.SetTitleBar(TitleBar); 13 | ViewModel = Ioc.Default.GetRequiredService(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AniMoe.App/Views/MainView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /AniMoe.App/Views/MainView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AniMoe.App.Messaging; 3 | using AniMoe.App.Services; 4 | using AniMoe.App.ViewModels; 5 | using AniMoe.Core.Interfaces; 6 | using CommunityToolkit.Mvvm.DependencyInjection; 7 | using CommunityToolkit.Mvvm.Messaging; 8 | using CommunityToolkit.WinUI.Behaviors; 9 | using Microsoft.UI.Dispatching; 10 | using Microsoft.UI.Xaml; 11 | using Microsoft.UI.Xaml.Controls; 12 | namespace AniMoe.App.Views; 13 | 14 | public sealed partial class MainView : 15 | Page, 16 | IRecipient, 17 | IRecipient, 18 | IRecipient 19 | { 20 | private readonly INavigationService navigationService; 21 | private readonly MainViewModel ViewModel; 22 | private readonly SplashViewModel SplashViewModel; 23 | private readonly IAppUpdater appUpdater; 24 | private readonly DispatcherQueue dispatcherQueue; 25 | private StackedNotificationsBehavior? stackedNotificationsBehavior; 26 | private TimeSpan notifyShowDuration = TimeSpan.FromSeconds(3); 27 | 28 | public MainView() 29 | { 30 | InitializeComponent(); 31 | dispatcherQueue = DispatcherQueue.GetForCurrentThread(); 32 | navigationService = Ioc.Default.GetRequiredService(); 33 | App.RootWindow?.SetTitleBar(TitleBar); 34 | navigationService.SetFrame(MasterFrame); 35 | appUpdater = Ioc.Default.GetRequiredService(); 36 | ViewModel = Ioc.Default.GetRequiredService(); 37 | SplashViewModel = Ioc.Default.GetRequiredService(); 38 | ViewModel.MapNavigationView(NavView); 39 | WeakReferenceMessenger.Default.RegisterAll(this); 40 | } 41 | 42 | public void Receive(ErrorDialogMessage message) => 43 | CreateAndSendErrorDialogAsync(message); 44 | 45 | public void Receive(SimpleNotificationMessage message) => 46 | ShowInlineNotification(message.Value); 47 | 48 | public void Receive(ComplexNotificationMessage message) => 49 | ShowInlineNotification(message.Value); 50 | 51 | private void Page_Loaded(object sender, RoutedEventArgs e) 52 | { 53 | Ioc.Default.GetRequiredService().MapXamlRoot(this.XamlRoot); 54 | stackedNotificationsBehavior = NotificationQueue; 55 | 56 | appUpdater.CheckForUpdates(XamlRoot); 57 | } 58 | 59 | private void CreateAndSendErrorDialogAsync(ErrorDialogMessage message) 60 | { 61 | var errorMessageParams = message.Value; 62 | var contentDialog = new ContentDialog 63 | { 64 | XamlRoot = this.XamlRoot, 65 | Title = errorMessageParams.Title, 66 | Content = errorMessageParams.Description, 67 | PrimaryButtonText = errorMessageParams.PrimaryButtonText, 68 | SecondaryButtonText = errorMessageParams.SecondaryButtonText 69 | }; 70 | 71 | contentDialog.PrimaryButtonClick += (_, _) => errorMessageParams.OnPrimaryButtonClick(); 72 | 73 | contentDialog.SecondaryButtonClick += (_, _) => errorMessageParams.OnSecondaryButtonClick(); 74 | 75 | dispatcherQueue.TryEnqueue(async () => 76 | { 77 | await contentDialog.ShowAsync(); 78 | }); 79 | } 80 | 81 | private void ShowInlineNotification(SimpleNotificationMessageParams messageParams) 82 | { 83 | if (stackedNotificationsBehavior is null) return; 84 | stackedNotificationsBehavior.Show(new Notification() 85 | { 86 | Severity = messageParams.Severity, 87 | Title = messageParams.Title, 88 | Message = messageParams.Description, 89 | Duration = notifyShowDuration 90 | }); 91 | } 92 | 93 | private void ShowInlineNotification(ComplexNotificationMessageParams messageParams) 94 | { 95 | if (stackedNotificationsBehavior is null) return; 96 | var hyperLinkButton = new HyperlinkButton() 97 | { 98 | Content = messageParams.HyperlinkText, 99 | }; 100 | hyperLinkButton.Click += (s, e) => messageParams.HyperlinkAction(); 101 | stackedNotificationsBehavior.Show(new Notification() 102 | { 103 | Severity = messageParams.Severity, 104 | Title = messageParams.Title, 105 | ActionButton = hyperLinkButton, 106 | Duration = notifyShowDuration, 107 | Message = messageParams.Description 108 | }); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /AniMoe.App/Views/RootWindow.xaml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AniMoe.App/Views/RootWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.Services; 2 | using AniMoe.App.ViewModels; 3 | using AniMoe.Core.Interfaces; 4 | using CommunityToolkit.Mvvm.DependencyInjection; 5 | using Microsoft.UI.Windowing; 6 | using Microsoft.UI.Xaml; 7 | 8 | namespace AniMoe.App.Views; 9 | 10 | /// 11 | /// The main window where all the content is hosted. 12 | /// Can be a multiple instance window. 13 | /// 14 | public sealed partial class RootWindow : Window 15 | { 16 | private readonly ISettingsProvider settingsProvider; 17 | private readonly LoginViewModel loginViewModel; 18 | private readonly INavigationService navigationService; 19 | public RootWindow() 20 | { 21 | InitializeComponent(); 22 | 23 | // Setting per window Icon 24 | AppWindow.SetIcon("Assets/AniMoeLogo.ico"); 25 | 26 | ExtendsContentIntoTitleBar = true; 27 | settingsProvider = Ioc.Default.GetRequiredService(); 28 | loginViewModel = Ioc.Default.GetRequiredService(); 29 | navigationService = Ioc.Default.GetRequiredService(); 30 | } 31 | 32 | private void ContentFrame_Loaded(object sender, RoutedEventArgs e) 33 | { 34 | navigationService.SetFrame(ContentFrame); 35 | bool isAccessTokenExists = settingsProvider.IsSettingExists("accessToken"); 36 | if (isAccessTokenExists) navigationService.Navigate(typeof(SplashView), null); 37 | else 38 | { 39 | navigationService.Navigate(typeof(LoginView), null); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/AnimeListView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 92 | 93 | 94 | 95 | 96 | 97 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 129 | 130 | 131 | 132 | 133 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/AnimeListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.ViewModels.SectionViewModels; 2 | using CommunityToolkit.Mvvm.DependencyInjection; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Views.Sections; 6 | 7 | public sealed partial class AnimeListView : Page 8 | { 9 | private AnimeListViewModel ViewModel; 10 | public AnimeListView() 11 | { 12 | this.InitializeComponent(); 13 | ViewModel = Ioc.Default.GetRequiredService(); 14 | DataContext = ViewModel; 15 | 16 | ViewModel.LoadVM(); 17 | } 18 | 19 | private void AnimeListPage_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) 20 | { 21 | ViewModel.MapXamlRoot(this.XamlRoot); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/MangaListView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 91 | 92 | 93 | 94 | 95 | 96 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 128 | 129 | 130 | 131 | 132 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/MangaListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.ViewModels.SectionViewModels; 2 | using CommunityToolkit.Mvvm.DependencyInjection; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Views.Sections 6 | { 7 | public sealed partial class MangaListView : Page 8 | { 9 | private MangaListViewModel ViewModel; 10 | public MangaListView() 11 | { 12 | this.InitializeComponent(); 13 | ViewModel = Ioc.Default.GetRequiredService(); 14 | DataContext = ViewModel; 15 | 16 | ViewModel.LoadVM(); 17 | } 18 | 19 | private void Page_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) 20 | { 21 | ViewModel.MapXamlRoot(this.XamlRoot); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/NotificationView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/NotificationView.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml.Controls; 2 | 3 | namespace AniMoe.App.Views.Sections; 4 | public sealed partial class NotificationView : Page 5 | { 6 | public NotificationView() 7 | { 8 | this.InitializeComponent(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/SettingsView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AniMoe.App/Views/Sections/SettingsView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.ViewModels; 2 | using CommunityToolkit.Mvvm.DependencyInjection; 3 | using Microsoft.UI.Xaml.Controls; 4 | 5 | namespace AniMoe.App.Views.Sections; 6 | 7 | public sealed partial class SettingsView : Page 8 | { 9 | private readonly SettingsViewModel ViewModel; 10 | public SettingsView() 11 | { 12 | InitializeComponent(); 13 | ViewModel = Ioc.Default.GetRequiredService(); 14 | DataContext = ViewModel; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AniMoe.App/Views/SplashView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /AniMoe.App/Views/SplashView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.App.ViewModels; 2 | using CommunityToolkit.Mvvm.DependencyInjection; 3 | using Microsoft.UI.Dispatching; 4 | using Microsoft.UI.Xaml; 5 | using Microsoft.UI.Xaml.Controls; 6 | 7 | namespace AniMoe.App.Views 8 | { 9 | public sealed partial class SplashView : Page 10 | { 11 | private readonly SplashViewModel ViewModel = Ioc.Default.GetRequiredService(); 12 | private DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread(); 13 | public SplashView() 14 | { 15 | this.InitializeComponent(); 16 | this.DataContext = ViewModel; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AniMoe.App/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | PerMonitorV2 17 | 18 | 19 | -------------------------------------------------------------------------------- /AniMoe.App/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logger": { 3 | "LogTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{AssemblyName}] -> {Message:lj}{NewLine}{Exception}" 4 | }, 5 | "AniMoe": { 6 | "ClientId": "13389", 7 | "ClientSecret": "rNSf6nalKVt1tRCvXmbBrEIk0FblVE46F75wyuRN", 8 | "AuthURL": "https://anilist.co/api/v2/oauth/authorize?client_id=13389&redirect_uri=http://localhost:2013&response_type=code", 9 | "RedirectPort": 2013, 10 | "RedirectURI": "http://localhost:2013", 11 | "AuthCodeUrl": "https://anilist.co/api/v2/oauth/token", 12 | "ApiURL": "https://graphql.anilist.co" 13 | } 14 | } -------------------------------------------------------------------------------- /AniMoe.Core/AniMoe.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0-windows10.0.22621.0 4 | AniMoe.Core 5 | win-x86;win-x64;win-arm64 6 | win10-x86;win10-x64;win10-arm64 7 | true 8 | 10.0.19041.0 9 | enable 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /AniMoe.Core/Common/AuthSuccessWebHtml.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | namespace AniMoe.Core.Common; 5 | public class AuthSuccessWebHtml 6 | { 7 | public string Html() 8 | { 9 | using (StreamReader streamReader = new StreamReader("Assets/auth_success_ui.html", Encoding.UTF8)) 10 | { 11 | return streamReader.ReadToEnd(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /AniMoe.Core/Common/Enums.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace AniMoe.Core.Common; 5 | 6 | public enum MediaType 7 | { 8 | ANIME, 9 | MANGA 10 | } 11 | 12 | public enum MediaStatus 13 | { 14 | [Display(Name = "Finished")] 15 | FINISHED, 16 | [Display(Name = "Releasing")] 17 | RELEASING, 18 | [Display(Name = "Not Yet Released")] 19 | NOT_YET_RELEASED, 20 | [Display(Name = "Cancelled")] 21 | CANCELLED, 22 | [Display(Name = "Hiatus")] 23 | HIATUS 24 | } 25 | 26 | public enum MediaListStatus 27 | { 28 | [Display(Name = "Watching")] 29 | CURRENT, 30 | [Display(Name = "Planning")] 31 | PLANNING, 32 | [Display(Name = "Completed")] 33 | COMPLETED, 34 | [Display(Name = "Dropped")] 35 | DROPPED, 36 | [Display(Name = "Paused")] 37 | PAUSED, 38 | [Display(Name = "Repeating")] 39 | REPEATING 40 | } 41 | 42 | public enum MediaFormat 43 | { 44 | [Display(Name = "TV Show")] 45 | TV, 46 | [Display(Name = "TV Short")] 47 | TV_SHORT, 48 | [Display(Name = "Movie")] 49 | MOVIE, 50 | [Display(Name = "Special")] 51 | SPECIAL, 52 | [Display(Name = "OVA")] 53 | OVA, 54 | [Display(Name = "ONA")] 55 | ONA, 56 | [Display(Name = "Music")] 57 | MUSIC, 58 | [Display(Name = "Manga")] 59 | MANGA, 60 | [Display(Name = "Light Novel")] 61 | NOVEL, 62 | [Display(Name = "One Shot")] 63 | ONE_SHOT 64 | } 65 | 66 | public enum CountryCode 67 | { 68 | [Display(Name = "Japan")] 69 | JP, 70 | [Display(Name = "China")] 71 | CN, 72 | [Display(Name = "Korea")] 73 | KR, 74 | [Display(Name = "Taiwan")] 75 | TW 76 | } 77 | 78 | public enum MediaSeason 79 | { 80 | [Display(Name = "Winter")] 81 | WINTER, 82 | [Display(Name = "Spring")] 83 | SPRING, 84 | [Display(Name = "Summer")] 85 | SUMMER, 86 | [Display(Name = "Fall")] 87 | FALL 88 | } 89 | 90 | public enum MediaSource 91 | { 92 | [Display(Name = "Original")] 93 | ORIGINAL, 94 | [Display(Name = "Manga")] 95 | MANGA, 96 | [Display(Name = "Light Novel")] 97 | LIGHT_NOVEL, 98 | [Display(Name = "Visual Novel")] 99 | VISUAL_NOVEL, 100 | [Display(Name = "Video Game")] 101 | VIDEO_GAME, 102 | [Display(Name = "Other")] 103 | OTHER, 104 | [Display(Name = "Novel")] 105 | NOVEL, 106 | [Display(Name = "Doujinshi")] 107 | DOUJINSHI, 108 | [Display(Name = "Anime")] 109 | ANIME, 110 | [Display(Name = "Web Novel")] 111 | WEB_NOVEL, 112 | [Display(Name = "Live Action")] 113 | LIVE_ACTION, 114 | [Display(Name = "Game")] 115 | GAME, 116 | [Display(Name = "Comic")] 117 | COMIC, 118 | [Display(Name = "Multimedia Project")] 119 | MULTIMEDIA_PROJECT, 120 | [Display(Name = "Picture Book")] 121 | PICTURE_BOOK 122 | } 123 | 124 | public enum MediaListSortType 125 | { 126 | [Display(Name = "Score ↑")] 127 | SCORE, 128 | [Display(Name = "Score ↓")] 129 | SCORE_DESC, 130 | [Display(Name = "Title ↑")] 131 | TITLE, 132 | [Display(Name = "Title ↓")] 133 | TITLE_DESC, 134 | [Display(Name = "Progress ↑")] 135 | PROGRESS, 136 | [Display(Name = "Progress ↓")] 137 | PROGRESS_DESC, 138 | } -------------------------------------------------------------------------------- /AniMoe.Core/Common/JsonConverters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace AniMoe.Core.Common; 6 | 7 | public class UnixTimestampConverter : JsonConverter 8 | { 9 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | var ok = reader.TryGetInt32(out int unixTime); 12 | if (ok) return DateTimeOffset.FromUnixTimeSeconds(unixTime).DateTime; 13 | return default; 14 | } 15 | 16 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 17 | { 18 | long unixTime = ((DateTimeOffset)value).ToUnixTimeSeconds(); 19 | writer.WriteNumberValue(unixTime); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AniMoe.Core/Common/MutationStrings.cs: -------------------------------------------------------------------------------- 1 | namespace AniMoe.Core.Common; 2 | 3 | public static class MutationStrings 4 | { 5 | public const string UpdateMediaListMutation = """ 6 | mutation ( 7 | $mediaId: Int 8 | $progress: Int 9 | $score: Float 10 | $notes: String 11 | $status: MediaListStatus 12 | $repeat: Int 13 | $customLists: [String] 14 | $advancedScores: [Float] 15 | $startedAt: FuzzyDateInput 16 | $completedAt: FuzzyDateInput 17 | ) { 18 | SaveMediaListEntry( 19 | mediaId: $mediaId 20 | progress: $progress 21 | score: $score 22 | notes: $notes 23 | repeat: $repeat 24 | status: $status 25 | customLists: $customLists 26 | advancedScores: $advancedScores 27 | startedAt: $startedAt 28 | completedAt: $completedAt 29 | ) { 30 | media { 31 | id 32 | } 33 | } 34 | } 35 | """; 36 | } 37 | -------------------------------------------------------------------------------- /AniMoe.Core/Common/Queries.cs: -------------------------------------------------------------------------------- 1 | namespace AniMoe.Core.Common; 2 | 3 | public static class Queries 4 | { 5 | public const string ViewerQuery = """ 6 | query { 7 | Viewer { 8 | id 9 | name 10 | bannerImage 11 | avatar{ 12 | large 13 | } 14 | } 15 | GenreCollection, 16 | MediaTagCollection { 17 | name 18 | id 19 | description 20 | category 21 | } 22 | } 23 | """; 24 | 25 | public const string MediaListQuery = """ 26 | query ($userId: Int, $mediaType: MediaType, $sort: [MediaListSort]) { 27 | MediaListCollection(userId: $userId, type: $mediaType, sort: $sort) { 28 | lists { 29 | ...mediaList 30 | } 31 | } 32 | } 33 | 34 | fragment mediaList on MediaListGroup { 35 | isCustomList 36 | name 37 | status 38 | entries { 39 | media { 40 | ...mediaInfo 41 | } 42 | progress 43 | progressVolumes 44 | status 45 | score 46 | } 47 | } 48 | 49 | fragment mediaInfo on Media { 50 | id 51 | siteUrl 52 | title { 53 | userPreferred 54 | romaji 55 | english 56 | native 57 | } 58 | coverImage { 59 | large 60 | extraLarge 61 | } 62 | status 63 | nextAiringEpisode { 64 | airingAt 65 | timeUntilAiring 66 | episode 67 | id 68 | } 69 | tags { 70 | name 71 | } 72 | isAdult 73 | season 74 | source 75 | episodes 76 | chapters 77 | format 78 | genres 79 | countryOfOrigin 80 | seasonYear 81 | } 82 | """; 83 | } 84 | -------------------------------------------------------------------------------- /AniMoe.Core/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AniMoe.Core; 4 | internal static class Constants 5 | { 6 | public static readonly Uri DefaultImageUri = 7 | new("https://s4.anilist.co/file/anilistcdn/staff/large/n106021-FLMkCwlPH4BK.jpg"); 8 | public const string UpdateIndexUrl = 9 | "https://raw.githubusercontent.com/CosmicPredator/AniMoe/refs/heads/develop/update.xml"; 10 | } 11 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/AppUpdater.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using AutoUpdaterDotNET; 3 | using Microsoft.UI.Xaml; 4 | using Microsoft.UI.Xaml.Controls; 5 | using System; 6 | using System.Diagnostics; 7 | using System.Net.Http; 8 | 9 | namespace AniMoe.Core.Helpers; 10 | 11 | public class AppUpdater : IAppUpdater 12 | { 13 | private HttpClient httpClient; 14 | 15 | public AppUpdater(HttpClient httpClient) 16 | { 17 | this.httpClient = httpClient; 18 | } 19 | 20 | public void CheckForUpdates(XamlRoot xamlRoot) 21 | { 22 | //AutoUpdater.Start(Constants.UpdateIndexUrl); 23 | 24 | AutoUpdater.CheckForUpdateEvent += async (e) => 25 | { 26 | if (!e.IsUpdateAvailable) return; 27 | 28 | ContentDialog dialog = new ContentDialog(); 29 | dialog.XamlRoot = xamlRoot; 30 | dialog.Title = $"New Update Available {e.CurrentVersion}"; 31 | 32 | var request = await httpClient.GetStringAsync(e.ChangelogURL); 33 | 34 | dialog.Content = request; 35 | dialog.CloseButtonText = "Not Now"; 36 | dialog.PrimaryButtonText = "Update"; 37 | 38 | dialog.PrimaryButtonClick += (s, arg) => 39 | { 40 | dialog.Hide(); 41 | if (AutoUpdater.DownloadUpdate(e)) 42 | { 43 | Environment.Exit(0); 44 | } 45 | }; 46 | 47 | await dialog.ShowAsync(); 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/CacheService.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using Microsoft.Extensions.Caching.Memory; 3 | using System; 4 | 5 | namespace AniMoe.Core.Helpers; 6 | 7 | public class CacheService : ICacheService 8 | { 9 | private readonly IMemoryCache memoryCache; 10 | 11 | public CacheService(IMemoryCache memoryCache) 12 | { 13 | this.memoryCache = memoryCache; 14 | } 15 | 16 | public bool Exists(string key) 17 | { 18 | return memoryCache.Get(key) != null; 19 | } 20 | 21 | public string? GetCache(string key) 22 | { 23 | return memoryCache.Get(key); 24 | } 25 | 26 | public void SetCache(string key, string value) 27 | { 28 | var memoryCacheOptions = new MemoryCacheEntryOptions 29 | { 30 | AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1) 31 | }; 32 | memoryCache.Set(key, value, memoryCacheOptions); 33 | } 34 | } -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/ErrorDialog.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using Microsoft.UI.Xaml; 3 | using Microsoft.UI.Xaml.Controls; 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace AniMoe.Core.Helpers; 8 | 9 | public class ErrorDialog : IErrorDialog 10 | { 11 | private ContentDialog? contentDialog; 12 | private XamlRoot? xamlRoot; 13 | 14 | public void MapXamlRoot(XamlRoot root) 15 | { 16 | xamlRoot = root; 17 | } 18 | 19 | public async Task ShowErrorDialog(string title, string message, 20 | string primaryButtonText, string secondaryButtonText, 21 | Action onPrimaryClick, Action onSecondaryClick) 22 | { 23 | contentDialog = new ContentDialog(); 24 | 25 | contentDialog.XamlRoot = xamlRoot; 26 | contentDialog.Title = title; 27 | contentDialog.Content = message; 28 | contentDialog.PrimaryButtonText = primaryButtonText; 29 | contentDialog.SecondaryButtonText = secondaryButtonText; 30 | 31 | contentDialog.PrimaryButtonClick += (_, _) => 32 | { 33 | onPrimaryClick(); 34 | }; 35 | 36 | contentDialog.SecondaryButtonClick += (_, _) => 37 | { 38 | onSecondaryClick(); 39 | }; 40 | 41 | await contentDialog.ShowAsync(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/ImageDownloader.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using System; 3 | using System.IO; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | 7 | namespace AniMoe.Core.Helpers; 8 | 9 | public class ImageDownloader : IImageDownloader 10 | { 11 | private readonly HttpClient httpClient; 12 | 13 | public ImageDownloader(HttpClient httpClient) 14 | { 15 | this.httpClient = httpClient; 16 | } 17 | 18 | public async Task DownloadImageAsync(string url, string fileName, string? path = null) 19 | { 20 | if (path is null) 21 | { 22 | var picFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); 23 | var imagePath = Path.Combine(picFolder, "AniMoe"); 24 | if (!Directory.Exists(imagePath)) Directory.CreateDirectory(imagePath); 25 | path = imagePath; 26 | } 27 | var imageFilePath = Path.Combine(path, $"{fileName}.png"); 28 | HttpResponseMessage response = await httpClient.GetAsync(url); 29 | byte[] imageBytes = await response.Content.ReadAsByteArrayAsync(); 30 | await File.WriteAllBytesAsync(imageFilePath, imageBytes); 31 | return path; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/RequestHandler.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using Microsoft.Extensions.Configuration; 3 | using Serilog; 4 | using System; 5 | using System.Diagnostics; 6 | using System.Net; 7 | using System.Net.Http; 8 | using System.Text; 9 | using System.Text.Json; 10 | using System.Text.Json.Serialization; 11 | using System.Threading.Tasks; 12 | 13 | namespace AniMoe.Core.Helpers; 14 | public class RequestHandler : IRequestHandler 15 | { 16 | private readonly HttpClient httpClient; 17 | private readonly IConfiguration configuration; 18 | private readonly ISettingsProvider settingsProvider; 19 | private readonly IErrorDialog errorDialog; 20 | 21 | public RequestHandler(HttpClient httpClient, IConfiguration configuration, 22 | ISettingsProvider settingsProvider, IErrorDialog errorDialog) 23 | { 24 | this.httpClient = httpClient; 25 | this.configuration = configuration; 26 | this.settingsProvider = settingsProvider; 27 | this.errorDialog = errorDialog; 28 | 29 | httpClient.DefaultRequestHeaders.Add("Authorization", 30 | $"Bearer {settingsProvider.GetSetting("accessToken")}"); 31 | } 32 | 33 | public async Task PostGraphqlAsync(string query, object? variables = null) 34 | { 35 | uint maxAttempts = 3; // retry 3 times 36 | uint currentAttempt = 0; 37 | bool giveUp = false; 38 | 39 | var payloadString = serializeJson(query, variables); 40 | while (currentAttempt < maxAttempts) 41 | { 42 | (T? response, HttpStatusCode code) = await makePostRequest(payloadString); 43 | if (code == HttpStatusCode.OK) return response!; 44 | 45 | currentAttempt++; 46 | await Task.Delay(1000); 47 | 48 | if (currentAttempt == maxAttempts) 49 | { 50 | await errorDialog.ShowErrorDialog( 51 | "Error", $"Connection to AniList failed.\nStatus Code: {((int)code)}", 52 | "Try Again", "Close", () => { currentAttempt = 0; }, () => giveUp = true); 53 | 54 | if (giveUp) break; 55 | } 56 | } 57 | return default; 58 | } 59 | 60 | private StringContent serializeJson(string query, object? variables = null) 61 | { 62 | var payload = new { query, variables = variables ?? "" }; 63 | StringContent stringContent = new StringContent( 64 | JsonSerializer.Serialize(payload), 65 | Encoding.UTF8, 66 | "application/json"); 67 | return stringContent; 68 | } 69 | 70 | private async Task<(T?, HttpStatusCode)> makePostRequest(StringContent payloadString) 71 | { 72 | var options = new JsonSerializerOptions() 73 | { 74 | DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, 75 | }; 76 | options.Converters.Add(new JsonStringEnumConverter()); 77 | HttpResponseMessage response = await httpClient.PostAsync( 78 | configuration["AniMoe:ApiURL"], payloadString); 79 | if (response.StatusCode != HttpStatusCode.OK) 80 | return (default(T), response.StatusCode); 81 | 82 | var data = await response.Content.ReadAsStringAsync(); 83 | 84 | var deserializedObj = JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync(), 85 | options); 86 | return (deserializedObj, response.StatusCode); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/SettingsProvider.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using LiteDB; 3 | using Microsoft.Win32; 4 | using Serilog; 5 | using System; 6 | using System.IO; 7 | 8 | namespace AniMoe.Core.Helpers; 9 | public class SettingsProvider : ISettingsProvider 10 | { 11 | private readonly LiteDatabase liteDatabase; 12 | private readonly ILiteCollection settingsCollection; 13 | 14 | public SettingsProvider() 15 | { 16 | liteDatabase = new LiteDatabase(GetDbPath()); 17 | settingsCollection = liteDatabase.GetCollection("settings"); 18 | } 19 | 20 | public string GetSetting(string key) 21 | { 22 | var result = settingsCollection 23 | .Query() 24 | .Where(x => x.Key == key) 25 | .First(); 26 | return result.Value; 27 | } 28 | 29 | public bool IsSettingExists(string key) 30 | { 31 | return settingsCollection.Exists(x => x.Key == key); 32 | } 33 | 34 | public void SetSetting(string key, string value) 35 | { 36 | if (IsSettingExists(key)) 37 | { 38 | Setting setting = settingsCollection.FindOne(x => x.Key == key); 39 | setting.Value = value; 40 | settingsCollection.Update(setting); 41 | } else 42 | { 43 | Setting setting = new Setting 44 | { 45 | Key = key, 46 | Value = value 47 | }; 48 | settingsCollection.Insert(setting); 49 | } 50 | Log.Debug("Set setting '{key}' successful", key); 51 | } 52 | 53 | private string GetDbPath() 54 | { 55 | string appDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); 56 | string directoryPath = Path.Combine(appDataFolderPath, "AniMoe"); 57 | if (!Directory.Exists(directoryPath)) 58 | { 59 | Directory.CreateDirectory(directoryPath); 60 | } 61 | string dbPath = Path.Combine(directoryPath, "user_settings.db"); 62 | return dbPath; 63 | } 64 | } 65 | 66 | public class Setting 67 | { 68 | public int Id { get; set; } 69 | public string Key { get; set; } = string.Empty; 70 | public string Value { get; set; } = string.Empty; 71 | } 72 | -------------------------------------------------------------------------------- /AniMoe.Core/Helpers/WebLoginHandler.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using AniMoe.Core.Common; 3 | using AniMoe.Core.Models; 4 | using Microsoft.Extensions.Configuration; 5 | using Serilog; 6 | using Sisk.Core.Http; 7 | using Sisk.Core.Http.Hosting; 8 | using System; 9 | using System.Net.Http; 10 | using System.Text; 11 | using System.Text.Json; 12 | using System.Threading.Tasks; 13 | using System.Collections.Generic; 14 | 15 | namespace AniMoe.Core.Helpers; 16 | public class WebLoginHandler : IWebLoginHandler 17 | { 18 | private readonly IConfiguration configuration; 19 | private readonly ISettingsProvider settingsProvider; 20 | private readonly HttpServerHostContext httpServerHost; 21 | private readonly HttpClient httpClient; 22 | 23 | public event EventHandler? LoggedIn; 24 | 25 | public WebLoginHandler(IConfiguration configuration, HttpClient client, ISettingsProvider settingsProvider) 26 | { 27 | this.configuration = configuration; 28 | httpClient = client; 29 | 30 | ushort port = Convert.ToUInt16(configuration["AniMoe:RedirectPort"]); 31 | httpServerHost = HttpServer.CreateBuilder(port).Build(); 32 | this.settingsProvider = settingsProvider; 33 | } 34 | 35 | public void StartOAuthServer() 36 | { 37 | _ = Task.Run(async () => 38 | { 39 | httpServerHost.Router.MapGet("/", request => 40 | { 41 | string token = request.Query["code"].Value!.ToString(); 42 | bool isAuthenticated = SaveAuthToken(token).GetAwaiter().GetResult(); 43 | if (isAuthenticated) 44 | { 45 | CloseOAuthServer(); 46 | return new HttpResponse(new StringContent(new AuthSuccessWebHtml().Html(), 47 | Encoding.UTF8, "text/html")); 48 | } 49 | return new HttpResponse("Login unsuccessful. Please restart the app and try again..."); 50 | }); 51 | await httpServerHost.StartAsync(); 52 | Log.Debug("OAuth sever started"); 53 | }); 54 | } 55 | 56 | public async Task SaveAuthToken(string code) 57 | { 58 | Log.Information("Attempting to get access_token from anilist"); 59 | AuthCodeRequestModel payload = new AuthCodeRequestModel 60 | { 61 | ClientId = configuration["AniMoe:ClientId"]!, 62 | ClientSecret = configuration["AniMoe:ClientSecret"]!, 63 | RedirectUri = configuration["AniMoe:RedirectURI"]!, 64 | Code = code 65 | }; 66 | 67 | StringContent payloadString = new StringContent(JsonSerializer.Serialize(payload), 68 | Encoding.UTF8, "application/json"); 69 | 70 | HttpResponseMessage request = 71 | await httpClient.PostAsync(configuration["AniMoe:AuthCodeUrl"], payloadString); 72 | 73 | Dictionary data = JsonSerializer.Deserialize>( 74 | await request.Content.ReadAsStringAsync())!; 75 | 76 | settingsProvider.SetSetting("accessToken", data["access_token"].ToString()!); 77 | settingsProvider.SetSetting("refreshToken", data["refresh_token"].ToString()!); 78 | settingsProvider.SetSetting("accessTokenExpiry", data["expires_in"].ToString()!); 79 | Log.Information("Token details successfully written to registry"); 80 | 81 | OnLoggedIn(EventArgs.Empty); 82 | 83 | return true; 84 | } 85 | 86 | protected virtual void OnLoggedIn(EventArgs e) 87 | { 88 | LoggedIn?.Invoke(this, e); 89 | } 90 | 91 | public void CloseOAuthServer() 92 | { 93 | Task.Run(async () => 94 | { 95 | // Wait 15 seconds before closing the server 96 | await Task.Delay(TimeSpan.FromSeconds(15)); 97 | httpServerHost.HttpServer.Stop(); 98 | Log.Debug("Disposed OAuth Server"); 99 | }); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IAppUpdater.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | 3 | namespace AniMoe.Core.Interfaces; 4 | public interface IAppUpdater 5 | { 6 | void CheckForUpdates(XamlRoot xamlRoot); 7 | } 8 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/ICacheService.cs: -------------------------------------------------------------------------------- 1 | namespace AniMoe.Core.Interfaces; 2 | 3 | public interface ICacheService 4 | { 5 | void SetCache(string key, string value); 6 | string? GetCache(string key); 7 | bool Exists(string key); 8 | } -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IErrorDialog.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | using System; 3 | using System.Threading.Tasks; 4 | 5 | namespace AniMoe.Core.Interfaces; 6 | 7 | public interface IErrorDialog 8 | { 9 | Task ShowErrorDialog(string title, string message, string primaryButtonText, string secondaryButtonText, 10 | Action onPrimaryClick, Action onSecondaryClick); 11 | void MapXamlRoot(XamlRoot root); 12 | } 13 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IGraphqlMutation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace AniMoe.Core.Interfaces; 6 | 7 | public interface IGraphQlMutation 8 | { 9 | Task MutateAsync(Action> variables); 10 | } 11 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IGraphqlQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace AniMoe.Core.Interfaces; 6 | 7 | public interface IGraphqlQuery 8 | { 9 | Task QueryAsync(Action>? addVars); 10 | } 11 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IImageDownloader.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace AniMoe.Core.Interfaces; 4 | 5 | public interface IImageDownloader 6 | { 7 | Task DownloadImageAsync(string url, string fileName, string? path = null); 8 | } 9 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace AniMoe.Core.Interfaces; 4 | public interface IRequestHandler 5 | { 6 | Task PostGraphqlAsync(string query, object? variables = null); 7 | } 8 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/ISettingsProvider.cs: -------------------------------------------------------------------------------- 1 | namespace AniMoe.Core.Interfaces; 2 | public interface ISettingsProvider 3 | { 4 | void SetSetting(string key, string value); 5 | string GetSetting(string key); 6 | bool IsSettingExists(string key); 7 | } 8 | -------------------------------------------------------------------------------- /AniMoe.Core/Interfaces/IWebLoginHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AniMoe.Core.Interfaces; 4 | public interface IWebLoginHandler 5 | { 6 | void StartOAuthServer(); 7 | event EventHandler? LoggedIn; 8 | void CloseOAuthServer(); 9 | } 10 | -------------------------------------------------------------------------------- /AniMoe.Core/Models/AuthCodeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace AniMoe.Core.Models; 4 | public class AuthCodeRequestModel 5 | { 6 | [JsonPropertyName("grant_type")] 7 | public string GrantType { get; } = "authorization_code"; 8 | [JsonPropertyName("client_id")] 9 | public string? ClientId { get; set; } 10 | [JsonPropertyName("client_secret")] 11 | public string? ClientSecret { get; set; } 12 | [JsonPropertyName("redirect_uri")] 13 | public string? RedirectUri { get; set; } 14 | [JsonPropertyName("code")] 15 | public string? Code { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /AniMoe.Core/Models/ErrorResponseModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace AniMoe.Core.Models; 4 | 5 | public class ErrorResponseModel 6 | { 7 | [JsonPropertyName("errors")] 8 | public ErrorObj[]? Errors { get; set; } 9 | } 10 | 11 | public class ErrorObj 12 | { 13 | [JsonPropertyName("message")] 14 | public string? Message { get; set; } 15 | [JsonPropertyName("status")] 16 | public ushort Status { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /AniMoe.Core/Models/MediaListModel.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Common; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Text.Json.Serialization; 7 | using System.Threading.Tasks; 8 | 9 | namespace AniMoe.Core.Models.MediaListModel; 10 | 11 | public class AnimeListModel : MediaListModel { } 12 | public class MangaListModel : MediaListModel { } 13 | 14 | public class MediaListModel 15 | { 16 | [JsonPropertyName("data")] 17 | public Data? Data { get; set; } 18 | 19 | public async Task ReloadModelAsync(Func> fetcher) 20 | { 21 | var updated = await fetcher(); 22 | if (updated?.Data is not null) 23 | Data = updated.Data; 24 | } 25 | } 26 | 27 | public class Data 28 | { 29 | [JsonPropertyName("MediaListCollection")] 30 | public MediaListCollection? MediaListCollections { get; set; } 31 | } 32 | 33 | public class MediaListCollection 34 | { 35 | [JsonPropertyName("lists")] 36 | public MediaListGroup[]? Lists { get; set; } 37 | } 38 | 39 | public class MediaListGroup 40 | { 41 | [JsonPropertyName("isCustomList")] 42 | public bool? IsCustomList { get; set; } 43 | 44 | [JsonPropertyName("name")] 45 | public string? ListName { get; set; } 46 | 47 | [JsonPropertyName("status")] 48 | public MediaListStatus? Status { get; set; } 49 | 50 | [JsonPropertyName("entries")] 51 | public ObservableCollection? Entries { get; set; } 52 | } 53 | 54 | public partial class Entry : ObservableObject 55 | { 56 | [JsonPropertyName("media")] 57 | public Media? Media { get; set; } 58 | 59 | [ObservableProperty] 60 | [property: JsonPropertyName("progress")] 61 | private int? progress; 62 | 63 | [JsonPropertyName("status")] 64 | public MediaListStatus? Status { get; set; } 65 | 66 | [JsonPropertyName("score")] 67 | public int Score { get; set; } 68 | } 69 | 70 | public class Media 71 | { 72 | [JsonPropertyName("id")] 73 | public int? Id { get; set; } 74 | [JsonPropertyName("siteUrl")] 75 | public string? SiteUrl { get; set; } 76 | [JsonPropertyName("title")] 77 | public required MediaTitle MediaTitle { get; set; } 78 | [JsonPropertyName("status")] 79 | public required MediaStatus Status { get; set; } 80 | [JsonPropertyName("nextAiringEpisode")] 81 | public NextAiringEpisode? NextAiringEpisode { get; set; } 82 | [JsonPropertyName("tags")] 83 | public List? Tags { get; set; } 84 | [JsonPropertyName("season")] 85 | public MediaSeason? Season { get; set; } 86 | [JsonPropertyName("isAdult")] 87 | public bool IsAdult { get; set; } 88 | [JsonPropertyName("source")] 89 | public MediaSource? Source { get; set; } 90 | [JsonPropertyName("episodes")] 91 | public int? Episodes { get; set; } 92 | [JsonPropertyName("chapters")] 93 | public int? Chapters { get; set; } 94 | [JsonPropertyName("format")] 95 | public required MediaFormat? Format { get; set; } 96 | [JsonPropertyName("genres")] 97 | public required string[] Genres { get; set; } 98 | [JsonPropertyName("countryOfOrigin")] 99 | public CountryCode? CountryOfOrigin { get; set; } 100 | [JsonPropertyName("seasonYear")] 101 | public int? SeasonYear { get; set; } 102 | [JsonPropertyName("coverImage")] 103 | public CoverImage CoverImage { get; set; } = new(); 104 | } 105 | 106 | public class MediaTitle 107 | { 108 | [JsonPropertyName("userPreferred")] 109 | public string UserPreferred { get; set; } = "?"; 110 | [JsonPropertyName("romaji")] 111 | public string Romaji { get; set; } = "?"; 112 | [JsonPropertyName("english")] 113 | public string English { get; set; } = "?"; 114 | [JsonPropertyName("native")] 115 | public string Native { get; set; } = "?"; 116 | } 117 | 118 | public class CoverImage 119 | { 120 | [JsonPropertyName("large")] 121 | public Uri Large { get; set; } = Constants.DefaultImageUri; 122 | [JsonPropertyName("extraLarge")] 123 | public Uri ExtraLarge { get; set; } = Constants.DefaultImageUri; 124 | } 125 | 126 | public class MediaTag 127 | { 128 | [JsonPropertyName("name")] 129 | public string Name { get; set; } = string.Empty; 130 | } 131 | 132 | public class NextAiringEpisode 133 | { 134 | [JsonPropertyName("airingAt")] 135 | public long? AiringAt { get; set; } 136 | [JsonPropertyName("timeUntilAiring")] 137 | public long? TimeUntilAiring { get; set; } 138 | [JsonPropertyName("episode")] 139 | public int? Episode { get; set; } 140 | [JsonPropertyName("id")] 141 | public int? Id { get; set; } 142 | } -------------------------------------------------------------------------------- /AniMoe.Core/Models/ViewerModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace AniMoe.Core.Models.ViewerModel; 6 | 7 | public class ViewerModel 8 | { 9 | [JsonPropertyName("data")] 10 | public Data? Data { get; set; } 11 | } 12 | 13 | public class Data 14 | { 15 | [JsonPropertyName("Viewer")] 16 | public Viewer? Viewer { get; set; } 17 | 18 | [JsonPropertyName("GenreCollection")] 19 | public List GenreCollection { get; set; } = new(); 20 | 21 | [JsonPropertyName("MediaTagCollection")] 22 | public List MediaTagCollections { get; set; } = new(); 23 | } 24 | 25 | public class MediaTagCollection 26 | { 27 | [JsonPropertyName("name")] 28 | public string Name { get; set; } = string.Empty; 29 | [JsonPropertyName("id")] 30 | public int id { get; set; } 31 | [JsonPropertyName("description")] 32 | public string Description { get; set; } = string.Empty; 33 | [JsonPropertyName("category")] 34 | public string Category { get; set; } = string.Empty; 35 | } 36 | 37 | public partial class Viewer : ObservableObject 38 | { 39 | [JsonPropertyName("id")] 40 | public uint? Id { get; set; } 41 | 42 | [JsonPropertyName("name")] 43 | public string? Name { get; set; } 44 | 45 | [JsonPropertyName("bannerImage")] 46 | public string? BannerImage { get; set; } 47 | 48 | [JsonPropertyName("avatar")] 49 | public Avatar? Avatar { get; set; } 50 | } 51 | 52 | public class Avatar 53 | { 54 | [JsonPropertyName("large")] 55 | public string? Large { get; set; } 56 | } 57 | -------------------------------------------------------------------------------- /AniMoe.Core/Mutations/UpdateMediaListService.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Interfaces; 2 | using System.Collections.Generic; 3 | using System; 4 | using System.Threading.Tasks; 5 | using AniMoe.Core.Common; 6 | 7 | namespace AniMoe.Core.Mutations; 8 | 9 | public class UpdateMediaListService : IGraphQlMutation 10 | { 11 | private readonly IRequestHandler requestHandler; 12 | 13 | public UpdateMediaListService(IRequestHandler requestHandler) 14 | { 15 | this.requestHandler = requestHandler; 16 | } 17 | 18 | public async Task MutateAsync(Action> variables) 19 | { 20 | Dictionary vars = new(); 21 | variables(vars); 22 | var requestMutation = await requestHandler.PostGraphqlAsync(MutationStrings.UpdateMediaListMutation, 23 | vars); 24 | return requestMutation != null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AniMoe.Core/Repositories/AnimeListRepository.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Common; 2 | using AniMoe.Core.Interfaces; 3 | using AniMoe.Core.Models.MediaListModel; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace AniMoe.Core.Repositories; 9 | 10 | public class AnimeListRepository : IGraphqlQuery 11 | { 12 | private readonly IRequestHandler requestHandler; 13 | 14 | public AnimeListRepository(IRequestHandler requestHandler) 15 | { 16 | this.requestHandler = requestHandler; 17 | } 18 | 19 | public async Task QueryAsync(Action>? addVars) 20 | { 21 | var payload = new Dictionary() 22 | { 23 | ["mediaType"] = MediaType.ANIME.ToString() 24 | }; 25 | if(addVars is not null) addVars(payload); 26 | MediaListModel? result = 27 | await requestHandler.PostGraphqlAsync(Queries.MediaListQuery, payload); 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AniMoe.Core/Repositories/MangaListRepository.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Common; 2 | using AniMoe.Core.Interfaces; 3 | using AniMoe.Core.Models.MediaListModel; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace AniMoe.Core.Repositories; 9 | 10 | public class MangaListRepository : IGraphqlQuery 11 | { 12 | 13 | private readonly IRequestHandler requestHandler; 14 | 15 | public MangaListRepository(IRequestHandler requestHandler) 16 | { 17 | this.requestHandler = requestHandler; 18 | } 19 | 20 | public async Task QueryAsync(Action>? addVars) 21 | { 22 | var payload = new Dictionary() 23 | { 24 | ["mediaType"] = MediaType.MANGA.ToString() 25 | }; 26 | if (addVars is not null) addVars(payload); 27 | MediaListModel? result = 28 | await requestHandler.PostGraphqlAsync(Queries.MediaListQuery, payload); 29 | return result; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /AniMoe.Core/Repositories/ViewerRepository.cs: -------------------------------------------------------------------------------- 1 | using AniMoe.Core.Common; 2 | using AniMoe.Core.Interfaces; 3 | using AniMoe.Core.Models.ViewerModel; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace AniMoe.Core.Repositories; 9 | 10 | public class ViewerRepository : IGraphqlQuery 11 | { 12 | public ViewerModel? Model; 13 | private readonly IRequestHandler requestHandler; 14 | 15 | public ViewerRepository(IRequestHandler handler) 16 | { 17 | requestHandler = handler; 18 | } 19 | 20 | public async Task QueryAsync(Action>? addVars) 21 | { 22 | Model = await requestHandler.PostGraphqlAsync(Queries.ViewerQuery, null); 23 | return Model; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AniMoe.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.11.35327.3 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AniMoe.App", "AniMoe.App\AniMoe.App.csproj", "{2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AniMoe.Core", "AniMoe.Core\AniMoe.Core.csproj", "{E4E8446F-D778-4E75-A721-C5D48E17844F}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|ARM64 = Debug|ARM64 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|Any CPU = Release|Any CPU 17 | Release|ARM64 = Release|ARM64 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|Any CPU.ActiveCfg = Debug|x64 23 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|Any CPU.Build.0 = Debug|x64 24 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|ARM64.ActiveCfg = Debug|ARM64 25 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|ARM64.Build.0 = Debug|ARM64 26 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|ARM64.Deploy.0 = Debug|ARM64 27 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x64.ActiveCfg = Debug|x64 28 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x64.Build.0 = Debug|x64 29 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x64.Deploy.0 = Debug|x64 30 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x86.ActiveCfg = Debug|x86 31 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x86.Build.0 = Debug|x86 32 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Debug|x86.Deploy.0 = Debug|x86 33 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|Any CPU.ActiveCfg = Release|x64 34 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|Any CPU.Build.0 = Release|x64 35 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|ARM64.Build.0 = Release|ARM64 37 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x64.ActiveCfg = Release|x64 39 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x64.Build.0 = Release|x64 40 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x64.Deploy.0 = Release|x64 41 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x86.ActiveCfg = Release|x86 42 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x86.Build.0 = Release|x86 43 | {2247AD77-D401-4CE4-9216-8AAC7C6FCDBC}.Release|x86.Deploy.0 = Release|x86 44 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|ARM64.ActiveCfg = Debug|Any CPU 47 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|ARM64.Build.0 = Debug|Any CPU 48 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|x64.ActiveCfg = Debug|Any CPU 49 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|x64.Build.0 = Debug|Any CPU 50 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|x86.ActiveCfg = Debug|Any CPU 51 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Debug|x86.Build.0 = Debug|Any CPU 52 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|ARM64.ActiveCfg = Release|Any CPU 55 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|ARM64.Build.0 = Release|Any CPU 56 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|x64.ActiveCfg = Release|Any CPU 57 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|x64.Build.0 = Release|Any CPU 58 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|x86.ActiveCfg = Release|Any CPU 59 | {E4E8446F-D778-4E75-A721-C5D48E17844F}.Release|x86.Build.0 = Release|Any CPU 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | GlobalSection(ExtensibilityGlobals) = postSolution 65 | SolutionGuid = {E742FACB-B92A-47DD-8824-C862E00806BD} 66 | EndGlobalSection 67 | EndGlobal 68 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025-Current CosmicPredator 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | **In addition, any redistributed or derivative works must include visible credit to the original author, CosmicPredator, in the user interface or documentation.** 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

AniMoe for AniList

4 | A Windows 10 & 11 Client for AniList. Track and Discover anime and manga with ease. 5 | 6 | 7 | [![Development Build](https://github.com/CosmicPredator/AniMoe/actions/workflows/ci_develop.yml/badge.svg)](https://github.com/CosmicPredator/AniMoe/actions/workflows/ci_develop.yml) 8 | 9 | 10 | 11 |
12 | 13 | > [!NOTE] 14 | > This is a Work in Progress Application 15 | 16 | # Features 17 | - Anime & Manga Tracker (about to complete). 18 | - Airing Notifications (under development). 19 | - Media Detection & Updation (future). 20 | - Custom Markdown renderer for forums (future). 21 | 22 | # Build from Source 23 | - Install Visual Studio 2022. 24 | - Install "WinUI application development" workload along with 25 | any version of Windows 11 SDK. 26 | - Clone the repository and checkout branch `develop`. 27 | - Add CommunityToolkit Windows Labs NuGet Repository. 28 | ``` 29 | https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json 30 | ``` 31 | - Open the solution with Visual Studio 32 | - Build it. 33 | 34 | ## NuGet Packages 35 | For `AniMoe.App`, 36 | ```xml 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | ``` 58 | 59 | For `AniMoe.Core` 60 | ```xml 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | ``` -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # New Features 2 | 3 | - Added Something 4 | - Added Some other things 5 | 6 | ![](https://static1.cbrimages.com/wordpress/wp-content/uploads/2019/12/Megumin-Crimson-Demon.jpg) 7 | 8 | Thanks for using AniMoe ❤️. -------------------------------------------------------------------------------- /installer_scripts/animoe_setup.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | #define MyAppName "AniMoe" 5 | #define MyAppVersion "1.0.0.0" 6 | #define MyAppPublisher "CosmicPredator" 7 | #define MyAppURL "https://github.com/CosmicPredator/AniMoe" 8 | #define MyAppExeName "AniMoe.exe" 9 | 10 | [Setup] 11 | ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. 12 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 13 | AppId={{090ABE21-37F4-4856-AE8B-5670BFE7B205} 14 | AppName={#MyAppName} 15 | AppVersion={#MyAppVersion} 16 | ;AppVerName={#MyAppName} {#MyAppVersion} 17 | AppPublisher={#MyAppPublisher} 18 | AppPublisherURL={#MyAppURL} 19 | AppSupportURL={#MyAppURL} 20 | AppUpdatesURL={#MyAppURL} 21 | DefaultDirName={autopf}\{#MyAppName} 22 | ; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run 23 | ; on anything but x64 and Windows 11 on Arm. 24 | ArchitecturesAllowed=x64compatible 25 | ; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the 26 | ; install be done in "64-bit mode" on x64 or Windows 11 on Arm, 27 | ; meaning it should use the native 64-bit Program Files directory and 28 | ; the 64-bit view of the registry. 29 | ArchitecturesInstallIn64BitMode=x64compatible 30 | DefaultGroupName={#MyAppName} 31 | AllowNoIcons=yes 32 | LicenseFile=..\LICENSE.txt 33 | ; Uncomment the following line to run in non administrative install mode (install for current user only.) 34 | ;PrivilegesRequired=lowest 35 | OutputDir=..\ 36 | OutputBaseFilename=AniMoe_setup 37 | SetupIconFile=..\AniMoe.App\Assets\AniMoeLogo.ico 38 | Compression=lzma 39 | SolidCompression=yes 40 | WizardStyle=modern 41 | WizardSmallImageFile=..\AniMoe.App\Assets\installer_small_image.bmp 42 | WizardImageFile=..\AniMoe.App\Assets\installer_large_image.bmp 43 | UninstallIconFile=..\AniMoe.App\Assets\AniMoeLogo.ico 44 | 45 | [Languages] 46 | Name: "english"; MessagesFile: "compiler:Default.isl" 47 | 48 | [Tasks] 49 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 50 | 51 | [Files] 52 | Source: "..\AniMoe.App\output\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion 53 | Source: "..\AniMoe.App\output\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs 54 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 55 | 56 | [Icons] 57 | Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" 58 | Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" 59 | Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon 60 | 61 | [UninstallDelete] 62 | Type: filesandordirs; Name: "{userappdata}\AniMoe" 63 | 64 | [Run] 65 | Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 66 | 67 | -------------------------------------------------------------------------------- /update.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0.0.1 4 | https://github.com/CosmicPredator/AniMoe/releases/latest/download/AniMoe_x64.zip 5 | https://raw.githubusercontent.com/CosmicPredator/AniMoe/refs/heads/develop/changelog.md 6 | false 7 | 8 | --------------------------------------------------------------------------------