66#include < unordered_map>
77#include < variant>
88
9- #include < matjson.hpp>
109#include < Geode/Result.hpp>
1110#include < Geode/loader/Event.hpp>
1211#include < Geode/utils/Task.hpp>
1312#include < Geode/utils/general.hpp>
13+ #include < matjson.hpp>
1414
1515#include < jukebox/events/start_download.hpp>
1616#include < jukebox/nong/index.hpp>
1717#include < jukebox/nong/nong.hpp>
1818
19- using namespace geode ::prelude;
20-
2119namespace jukebox {
2220
2321class IndexManager {
2422protected:
2523 bool m_initialized = false ;
2624
27- using FetchIndexTask = Task<Result<>, float >;
28- using DownloadSongTask = Task<Result<ByteVector>, float >;
25+ using FetchIndexTask = geode::Task<geode::Result<>, float >;
26+ using DownloadSongTask =
27+ geode::Task<geode::Result<geode::ByteVector>, float >;
2928
3029 IndexManager () = default ;
3130
@@ -36,30 +35,31 @@ class IndexManager {
3635 IndexManager& operator =(IndexManager&&) = delete ;
3736
3837 // index url -> task listener
39- std::unordered_map<std::string, EventListener<FetchIndexTask>>
38+ std::unordered_map<std::string, geode:: EventListener<FetchIndexTask>>
4039 m_indexListeners;
4140
4241 std::unordered_map<int , std::vector<index::IndexSongMetadata*>>
4342 m_nongsForId;
4443 // song id -> download song task
45- std::unordered_map<std::string, EventListener<DownloadSongTask>>
44+ std::unordered_map<std::string, geode:: EventListener<DownloadSongTask>>
4645 m_downloadSongListeners;
4746 // song id -> current download progress (used when opening NongDropdownLayer
4847 // while a song is being downloaded)
4948 std::unordered_map<std::string, float > m_downloadProgress;
5049
51- EventListener<EventFilter<event::StartDownload>> m_downloadSignalListener{
52- this , &IndexManager::onDownloadStart};
50+ geode:: EventListener<geode:: EventFilter<jukebox:: event::StartDownload>>
51+ m_downloadSignalListener{ this , &IndexManager::onDownloadStart};
5352
54- geode::ListenerResult onDownloadStart (event::StartDownload* e);
53+ geode::ListenerResult onDownloadStart (jukebox:: event::StartDownload* e);
5554 void onDownloadProgress (int gdSongID, const std::string& uniqueId,
5655 float progress);
5756 void onDownloadFinish (
5857 std::variant<index::IndexSongMetadata*, Song*>&& source,
59- Nongs* destination, ByteVector&& data);
60- Task<Result<matjson::Value>, float > fetchIndex (
58+ Nongs* destination, geode:: ByteVector&& data);
59+ geode:: Task<geode:: Result<matjson::Value>, float > fetchIndex (
6160 const index::IndexSource& index);
62- void onIndexFetched (const std::string& url, Result<matjson::Value>* r);
61+ void onIndexFetched (const std::string& url,
62+ geode::Result<matjson::Value>* r);
6363
6464public:
6565 bool init ();
@@ -69,12 +69,12 @@ class IndexManager {
6969
7070 bool initialized () const { return m_initialized; }
7171
72- Result<> fetchIndexes ();
72+ geode:: Result<> fetchIndexes ();
7373
74- Result<> loadIndex (std::filesystem::path path);
75- Result<> loadIndex (matjson::Value&& jsonObj);
74+ geode:: Result<> loadIndex (std::filesystem::path path);
75+ geode:: Result<> loadIndex (matjson::Value&& jsonObj);
7676
77- Result<std::vector<index::IndexSource>> getIndexes ();
77+ geode:: Result<std::vector<index::IndexSource>> getIndexes ();
7878
7979 std::optional<float > getSongDownloadProgress (const std::string& uniqueID);
8080 std::optional<std::string> getIndexName (const std::string& indexID);
@@ -83,7 +83,7 @@ class IndexManager {
8383
8484 std::filesystem::path baseIndexesPath ();
8585
86- Result<> downloadSong (int gdSongID, const std::string& uniqueID);
86+ geode:: Result<> downloadSong (int gdSongID, const std::string& uniqueID);
8787
8888 void registerIndexNongs (Nongs* destination);
8989
0 commit comments