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

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->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 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;
rc = webPageCreate(&conf, url);
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);
@ -151,6 +140,7 @@ ToolsTab::ToolsTab(const std::string& tag, bool erista) : brls::List()
dialog->setCancelable(true);
dialog->open();
}
}
});
browser->setHeight(LISTITEM_HEIGHT);