1
0
Fork 0
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:
flb 2021-07-19 23:06:40 +02:00
parent dcab389016
commit 755bd8dfc1
3 changed files with 34 additions and 59 deletions

@ -1 +1 @@
Subproject commit 22b62c7bee7a156400d5109fcb8459bab0bee78a Subproject commit 1e331f7a0fd628eeaa5865d2878e466c59c3ee24

View file

@ -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;

View file

@ -111,25 +111,14 @@ 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);
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 = ""; std::string error = "";
int at = appletGetAppletType(); int at = appletGetAppletType();
if(at == AppletType_Application) { // Running as a title if(at == AppletType_Application) { // Running as a title
WebCommonConfig conf; WebCommonConfig conf;
WebCommonReply out; WebCommonReply out;
rc = webPageCreate(&conf, url); Result rc = webPageCreate(&conf, url.c_str());
if (R_FAILED(rc)) if (R_FAILED(rc))
error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc; error += "\uE016 Error starting Browser\n\uE016 Lookup error code for more info " + rc;
webConfigSetJsExtension(&conf, true); webConfigSetJsExtension(&conf, true);
@ -151,6 +140,7 @@ ToolsTab::ToolsTab(const std::string& tag, bool erista) : brls::List()
dialog->setCancelable(true); dialog->setCancelable(true);
dialog->open(); dialog->open();
} }
}
}); });
browser->setHeight(LISTITEM_HEIGHT); browser->setHeight(LISTITEM_HEIGHT);