-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalized trackers refactor (+AniList) (#631)
* Begin AniList support Mostly functional. Many large, sweeping changes to the data model used, so it may be worth looking into migrating the existing data structures. Otherwise it's a bad time for people already using MAL to track. Much of the data model is documented with JSDoc, mostly for my sanity. I've never used JSDoc before so idk how correct these defs are 🤷 MAL has been mostly migrated over to the new format. There's a few straggling bits that seem to reference the old code that need to be cleared out. Things to do: * Status selector needs to respect AniList values/options when AL is in use * Rating selector should respect the user's chosen rating format * AniList option in the Discover section * Use new MAL revalidator * Clean up tracker creation/getting * Generalize name for tracker cards file * Normalize user list status * Initialize trackers at app start Fixes issues where things are initialized in the wrong order * Tracker specific score implementations MAL is effectively unchanged AL supports all available formats. The UI leaves a bit to be desired, but it's functional. * AniList browsing in discover * Move AniList on top in settings for abc consistency * Update tracker notifier when finishing chapter * Migrate new tracker changes to TS Additional cleanup pass * Tracker data migration * Fix AniList top novels info display
- Loading branch information
Showing
31 changed files
with
1,132 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createMigrate } from 'redux-persist'; | ||
import { malToNormalized } from '../services/Trackers/myAnimeList'; | ||
|
||
export default createMigrate({ | ||
// Migrates old tracker data to new format | ||
0: migrateTrackerDataToNormalized, | ||
}); | ||
|
||
function migrateTrackerDataToNormalized(state: any): any { | ||
// Migrate `tracker` | ||
let tracker = state.tracker; | ||
if (tracker) { | ||
tracker = { | ||
name: tracker.name, | ||
auth: { | ||
accessToken: tracker.access_token, | ||
refreshToken: tracker.refresh_token, | ||
expiresAt: tracker.expires_in, | ||
meta: undefined, | ||
}, | ||
}; | ||
} | ||
state.tracker = tracker; | ||
|
||
// Migrate `trackedNovels` | ||
const trackedNovels = state.trackedNovels.map((oldNovel: any) => { | ||
return { | ||
novelId: oldNovel.novelId, | ||
id: oldNovel.id, | ||
totalChapters: oldNovel.num_chapters, | ||
userData: { | ||
progress: oldNovel.my_list_status.num_chapters_read, | ||
score: oldNovel.my_list_status.score, | ||
status: malToNormalized[oldNovel.my_list_status.status], | ||
}, | ||
}; | ||
}); | ||
state.trackedNovels = trackedNovels; | ||
|
||
return state; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.