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;
|
||||
}
|
||||
else {
|
||||
SwkbdConfig kbd;
|
||||
char usr[0x100] = {0};
|
||||
char pwd[0x100] = {0};
|
||||
Result rc = swkbdCreate(&kbd, 0);
|
||||
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 usr, pwd;
|
||||
//Result rc = swkbdCreate(&kbd, 0);
|
||||
brls::Swkbd::openForText([&](std::string text) { usr = text; }, "cheatslips.com e-mail", "", 64, "", 0, "Submit", "cheatslips.com e-mail");
|
||||
brls::Swkbd::openForText([&](std::string text) { pwd = text; }, "cheatslips.com password", "", 64, "", 0, "Submit", "cheatslips.com password", true);
|
||||
std::string body = "{\"email\":\"" + std::string(usr)
|
||||
+ "\",\"password\":\"" + std::string(pwd) + "\"}";
|
||||
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->getClickEvent()->subscribe([&](brls::View* view){
|
||||
char url[0xc00] = {0};
|
||||
SwkbdConfig kbd;
|
||||
Result rc = swkbdCreate(&kbd, 0);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
swkbdConfigMakePresetDefault(&kbd);
|
||||
swkbdConfigSetGuideText(&kbd, "www.cheatslips.com e-mail");
|
||||
swkbdConfigSetInitialText(&kbd, "https://duckduckgo.com");
|
||||
swkbdShow(&kbd, url, sizeof(url));
|
||||
swkbdClose(&kbd);
|
||||
}
|
||||
else {
|
||||
strcpy(url, "https://duckduckgo.com");
|
||||
}
|
||||
std::string error = "";
|
||||
int at = appletGetAppletType();
|
||||
if(at == AppletType_Application) { // Running as a title
|
||||
WebCommonConfig conf;
|
||||
WebCommonReply out;
|
||||
rc = webPageCreate(&conf, url);
|
||||
if (R_FAILED(rc))
|
||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||
webConfigSetJsExtension(&conf, true);
|
||||
webConfigSetPageCache(&conf, true);
|
||||
webConfigSetBootLoadingIcon(&conf, true);
|
||||
webConfigSetWhitelist(&conf, ".*");
|
||||
rc = webConfigShow(&conf, &out);
|
||||
if (R_FAILED(rc))
|
||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||
} 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();
|
||||
std::string url;
|
||||
if (brls::Swkbd::openForText([&](std::string text) { url = text; }, "cheatslips.com e-mail", "", 64, "https://duckduckgo.com", 0, "Submit", "https://website.tld")) {
|
||||
std::string error = "";
|
||||
int at = appletGetAppletType();
|
||||
if(at == AppletType_Application) { // Running as a title
|
||||
WebCommonConfig conf;
|
||||
WebCommonReply out;
|
||||
Result rc = webPageCreate(&conf, url.c_str());
|
||||
if (R_FAILED(rc))
|
||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||
webConfigSetJsExtension(&conf, true);
|
||||
webConfigSetPageCache(&conf, true);
|
||||
webConfigSetBootLoadingIcon(&conf, true);
|
||||
webConfigSetWhitelist(&conf, ".*");
|
||||
rc = webConfigShow(&conf, &out);
|
||||
if (R_FAILED(rc))
|
||||
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
|
||||
} 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