22#include < Geode/binding/FLAlertLayer.hpp>
33#include < Geode/loader/GameEvent.hpp>
44#include < Geode/loader/Mod.hpp>
5- #include < Geode/utils/web.hpp>
65#include < hiimjasmine00.optional_settings/include/OptionalColor3BSetting.hpp>
6+ #include < jasmine/setting.hpp>
7+ #include < jasmine/web.hpp>
78
89using namespace geode ::prelude;
910using namespace optional_settings ;
@@ -22,12 +23,13 @@ constexpr std::array settings = {
2223 auto & data = mod->getSavedSettingsData ();
2324 if (!mod->setSavedValue (" migrated-colors" , true )) {
2425 for (auto [key, toggle] : settings) {
25- auto oldColorValue = data.get <ccColor3B>(key);
26- auto oldColorEnabled = data.get <bool >(toggle);
27- if (oldColorValue.isOk () && oldColorEnabled.isOk ()) {
28- auto setting = std::static_pointer_cast<OptionalColor3BSetting>(mod->getSetting (key));
29- setting->setStoredValue (oldColorValue.unwrap ());
30- setting->setEnabled (oldColorEnabled.unwrap ());
26+ if (auto setting = jasmine::setting::get<std::optional<ccColor3B>>(key)) {
27+ auto oldColorValue = data.get <ccColor3B>(key);
28+ auto oldColorEnabled = data.get <bool >(toggle);
29+ if (oldColorValue.isOk () && oldColorEnabled.isOk ()) {
30+ setting->setStoredValue (oldColorValue.unwrap ());
31+ setting->setEnabled (oldColorEnabled.unwrap ());
32+ }
3133 }
3234 }
3335 }
@@ -36,12 +38,7 @@ constexpr std::array settings = {
3638 web::WebRequest ().get (" https://badges.hiimjasmine00.com/developer" ).listen ([](web::WebResponse* res) {
3739 if (!res->ok ()) return ;
3840
39- Result<std::vector<matjson::Value>> json = res->json ().andThen ([](matjson::Value&& v) {
40- return std::move (v).asArray ();
41- });
42- if (!json.isOk ()) return ;
43-
44- for (auto & value : json.unwrap ()) {
41+ for (auto & value : jasmine::web::getArray (res)) {
4542 auto id = value.get <int >(" id" );
4643 if (!id.isOkAnd ([](int id) { return id > 0 ; })) continue ;
4744
0 commit comments