mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-24 18:42:05 +00:00
use borealis' swkbd functions
This commit is contained in:
parent
dcab389016
commit
755bd8dfc1
3 changed files with 34 additions and 59 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 22b62c7bee7a156400d5109fcb8459bab0bee78a
|
Subproject commit 1e331f7a0fd628eeaa5865d2878e466c59c3ee24
|
|
@ -159,25 +159,10 @@ void ListDownloadTab::createCheatSlipItem() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SwkbdConfig kbd;
|
std::string usr, pwd;
|
||||||
char usr[0x100] = {0};
|
//Result rc = swkbdCreate(&kbd, 0);
|
||||||
char pwd[0x100] = {0};
|
brls::Swkbd::openForText([&](std::string text) { usr = text; }, "cheatslips.com e-mail", "", 64, "", 0, "Submit", "cheatslips.com e-mail");
|
||||||
Result rc = swkbdCreate(&kbd, 0);
|
brls::Swkbd::openForText([&](std::string text) { pwd = text; }, "cheatslips.com password", "", 64, "", 0, "Submit", "cheatslips.com password", true);
|
||||||
if (R_SUCCEEDED(rc)) {
|
|
||||||
swkbdConfigMakePresetDefault(&kbd);
|
|
||||||
swkbdConfigSetOkButtonText(&kbd, "Submit");
|
|
||||||
swkbdConfigSetGuideText(&kbd, "www.cheatslips.com e-mail");
|
|
||||||
swkbdShow(&kbd, usr, sizeof(usr));
|
|
||||||
swkbdClose(&kbd);
|
|
||||||
rc = swkbdCreate(&kbd, 0);
|
|
||||||
if(R_SUCCEEDED(rc)){
|
|
||||||
swkbdConfigMakePresetPassword(&kbd);
|
|
||||||
swkbdConfigSetOkButtonText(&kbd, "Submit");
|
|
||||||
swkbdConfigSetGuideText(&kbd, "www.cheatslips.com password");
|
|
||||||
swkbdShow(&kbd, pwd, sizeof(pwd));
|
|
||||||
swkbdClose(&kbd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::string body = "{\"email\":\"" + std::string(usr)
|
std::string body = "{\"email\":\"" + std::string(usr)
|
||||||
+ "\",\"password\":\"" + std::string(pwd) + "\"}";
|
+ "\",\"password\":\"" + std::string(pwd) + "\"}";
|
||||||
nlohmann::ordered_json token;
|
nlohmann::ordered_json token;
|
||||||
|
|
|
@ -111,45 +111,35 @@ ToolsTab::ToolsTab(const std::string& tag, bool erista) : brls::List()
|
||||||
|
|
||||||
browser = new brls::ListItem("menus/tools/browser"_i18n);
|
browser = new brls::ListItem("menus/tools/browser"_i18n);
|
||||||
browser->getClickEvent()->subscribe([&](brls::View* view){
|
browser->getClickEvent()->subscribe([&](brls::View* view){
|
||||||
char url[0xc00] = {0};
|
std::string url;
|
||||||
SwkbdConfig kbd;
|
if (brls::Swkbd::openForText([&](std::string text) { url = text; }, "cheatslips.com e-mail", "", 64, "https://duckduckgo.com", 0, "Submit", "https://website.tld")) {
|
||||||
Result rc = swkbdCreate(&kbd, 0);
|
std::string error = "";
|
||||||
if (R_SUCCEEDED(rc)) {
|
int at = appletGetAppletType();
|
||||||
swkbdConfigMakePresetDefault(&kbd);
|
if(at == AppletType_Application) { // Running as a title
|
||||||
swkbdConfigSetGuideText(&kbd, "www.cheatslips.com e-mail");
|
WebCommonConfig conf;
|
||||||
swkbdConfigSetInitialText(&kbd, "https://duckduckgo.com");
|
WebCommonReply out;
|
||||||
swkbdShow(&kbd, url, sizeof(url));
|
Result rc = webPageCreate(&conf, url.c_str());
|
||||||
swkbdClose(&kbd);
|
if (R_FAILED(rc))
|
||||||
}
|
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||||
else {
|
webConfigSetJsExtension(&conf, true);
|
||||||
strcpy(url, "https://duckduckgo.com");
|
webConfigSetPageCache(&conf, true);
|
||||||
}
|
webConfigSetBootLoadingIcon(&conf, true);
|
||||||
std::string error = "";
|
webConfigSetWhitelist(&conf, ".*");
|
||||||
int at = appletGetAppletType();
|
rc = webConfigShow(&conf, &out);
|
||||||
if(at == AppletType_Application) { // Running as a title
|
if (R_FAILED(rc))
|
||||||
WebCommonConfig conf;
|
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||||
WebCommonReply out;
|
} else { // Running under applet
|
||||||
rc = webPageCreate(&conf, url);
|
error += "\uE016 Running in applet mode/through a forwarder.\n\uE016 Please launch hbmenu by holding [R] on a game";
|
||||||
if (R_FAILED(rc))
|
}
|
||||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
if(!error.empty()){
|
||||||
webConfigSetJsExtension(&conf, true);
|
brls::Dialog* dialog = new brls::Dialog(error);
|
||||||
webConfigSetPageCache(&conf, true);
|
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
|
||||||
webConfigSetBootLoadingIcon(&conf, true);
|
dialog->close();
|
||||||
webConfigSetWhitelist(&conf, ".*");
|
};
|
||||||
rc = webConfigShow(&conf, &out);
|
dialog->addButton("menus/common/ok"_i18n, callback);
|
||||||
if (R_FAILED(rc))
|
dialog->setCancelable(true);
|
||||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
dialog->open();
|
||||||
} else { // Running under applet
|
}
|
||||||
error += "\uE016 Running in applet mode/through a forwarder.\n\uE016 Please launch hbmenu by holding [R] on a game";
|
|
||||||
}
|
|
||||||
if(!error.empty()){
|
|
||||||
brls::Dialog* dialog = new brls::Dialog(error);
|
|
||||||
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
|
|
||||||
dialog->close();
|
|
||||||
};
|
|
||||||
dialog->addButton("menus/common/ok"_i18n, callback);
|
|
||||||
dialog->setCancelable(true);
|
|
||||||
dialog->open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue