diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b284f655..d80d89859 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,3 +23,4 @@ job:build: - output/release/device/n0100/epsilon.bin - omega-auto-increment/version.txt name: artifact:build:simulator + diff --git a/apps/external/Makefile b/apps/external/Makefile index 6f1c598a0..82e6541f9 100644 --- a/apps/external/Makefile +++ b/apps/external/Makefile @@ -27,6 +27,7 @@ i18n_files += $(addprefix apps/external/,\ base.fr.i18n\ base.pt.i18n\ base.hu.i18n\ + base.universal.i18n\ ) $(eval $(call depends_on_image,apps/external/app.cpp,apps/external/external_icon.png)) diff --git a/apps/external/archive.cpp b/apps/external/archive.cpp index 3472aabe5..d25c888e0 100644 --- a/apps/external/archive.cpp +++ b/apps/external/archive.cpp @@ -118,7 +118,7 @@ size_t numberOfFiles() { #else bool fileAtIndex(size_t index, File &entry) { - entry.name = "App"; + entry.name = "No apps installed "; entry.data = NULL; entry.dataLength = 0; entry.isExecutable = true; @@ -137,7 +137,7 @@ int indexFromName(const char *name) { } size_t numberOfFiles() { - return 1; + return 0; } #endif diff --git a/apps/external/base.de.i18n b/apps/external/base.de.i18n index 6072a563a..fb566db70 100644 --- a/apps/external/base.de.i18n +++ b/apps/external/base.de.i18n @@ -2,3 +2,8 @@ ExternalApp = "External" ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" +ExternalNotCompatible = "External ist nicht kompatibel" +WithSimulator = "mit dem Simulator" +WithN0100 = "mit n0100" +GetMoreAppsAt = "Weitere Apps erhalten Sie auf" +NoAppsInstalled = "Keine Apps installiert" diff --git a/apps/external/base.en.i18n b/apps/external/base.en.i18n index 6072a563a..49b8a2173 100644 --- a/apps/external/base.en.i18n +++ b/apps/external/base.en.i18n @@ -2,3 +2,8 @@ ExternalApp = "External" ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" +ExternalNotCompatible = "External is not compatible" +WithSimulator = "with the simulator" +WithN0100 = "with n0100" +GetMoreAppsAt = "Get more apps at" +NoAppsInstalled = "No apps installed" diff --git a/apps/external/base.es.i18n b/apps/external/base.es.i18n index 6072a563a..2b0dcd3be 100644 --- a/apps/external/base.es.i18n +++ b/apps/external/base.es.i18n @@ -2,3 +2,8 @@ ExternalApp = "External" ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" +ExternalNotCompatible = "Externo no es compatible" +WithSimulator = "con el simulador" +WithN0100 = "con n0100" +GetMoreAppsAt = "Obtenga más aplicaciones en" +NoAppsInstalled = "No hay aplicaciones instaladas" diff --git a/apps/external/base.fr.i18n b/apps/external/base.fr.i18n index 6072a563a..a505cddc6 100644 --- a/apps/external/base.fr.i18n +++ b/apps/external/base.fr.i18n @@ -2,3 +2,8 @@ ExternalApp = "External" ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" +ExternalNotCompatible = "External n'est pas compatible" +WithSimulator = "avec le simulateur" +WithN0100 = "avec n0100" +GetMoreAppsAt = "Télécharge d'autres apps sur" +NoAppsInstalled = "Aucune applications installées" diff --git a/apps/external/base.hu.i18n b/apps/external/base.hu.i18n index 881956eb5..957b39946 100644 --- a/apps/external/base.hu.i18n +++ b/apps/external/base.hu.i18n @@ -2,3 +2,8 @@ ExternalApp = "Külsö" ExternalAppCapital = "KÜLSö" ExternalAppApiMismatch = "API eltérés" ExternalAppExecError = "A fájl nem futtatható" +ExternalNotCompatible = "External is not compatible" +WithSimulator = "with the simulator" +WithN0100 = "with n0100" +GetMoreAppsAt = "Get more apps at" +NoAppsInstalled = "No apps installed" diff --git a/apps/external/base.pt.i18n b/apps/external/base.pt.i18n index 6072a563a..ae08d7478 100644 --- a/apps/external/base.pt.i18n +++ b/apps/external/base.pt.i18n @@ -2,3 +2,8 @@ ExternalApp = "External" ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" +ExternalNotCompatible = "Externo no es compatiblee" +WithSimulator = "con el simulador" +WithN0100 = "con n0100" +GetMoreAppsAt = "Obtenga más aplicaciones en" +NoAppsInstalled = "No hay aplicaciones instaladas" diff --git a/apps/external/base.universal.i18n b/apps/external/base.universal.i18n new file mode 100644 index 000000000..bd64604ea --- /dev/null +++ b/apps/external/base.universal.i18n @@ -0,0 +1 @@ +URL = "zardam.github.io/nw-external-apps/" \ No newline at end of file diff --git a/apps/external/main_controller.cpp b/apps/external/main_controller.cpp index 627fbca08..b2b1d06df 100644 --- a/apps/external/main_controller.cpp +++ b/apps/external/main_controller.cpp @@ -4,6 +4,8 @@ #include #include "archive.h" #include "app.h" +#include +#include using namespace Poincare; @@ -30,7 +32,7 @@ void MainController::didBecomeFirstResponder() { } bool MainController::handleEvent(Ion::Events::Event event) { - if (numberOfRows() > 0 && (event == Ion::Events::OK || event == Ion::Events::EXE)) { + if ((event == Ion::Events::OK || event == Ion::Events::EXE) && ((selectedRow() < k_numberOfCells - 2) && numberOfFiles() > 0)) { uint32_t res = executeFile(m_cells[selectedRow()].text(), ((App *)m_app)->heap(), ((App *)m_app)->heapSize()); ((App*)m_app)->redraw(); switch(res) { @@ -82,15 +84,66 @@ int MainController::typeAtLocation(int i, int j) { void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) { PointerTextTableCell * myTextCell = (PointerTextTableCell *)cell; + myTextCell->setHighlighted(myTextCell->isHighlighted()); struct File f; - if(fileAtIndex(index, f)) { - myTextCell->setText(f.name); - myTextCell->setTextColor(f.isExecutable ? KDColorBlack : Palette::GreyDark); + #ifdef DEVICE + if(Ion::fccId() == "2ALWP-N0100"){ + if(index == 0){ + myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); + myTextCell->setTextColor(Palette::Red); + } else { + myTextCell->setText(I18n::translate(I18n::Message::WithN0100)); + myTextCell->setTextColor(Palette::Red); + } + }else{ + if(index == k_numberOfCells-1){ + myTextCell->setText(I18n::translate(I18n::Message::URL)); + myTextCell->setTextColor(Palette::AccentText); + return; } + if(index == k_numberOfCells-2){ + myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt)); + myTextCell->setTextColor(Palette::AccentText); + return; + } + if(index == 0 && numberOfFiles() == 0){ + myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled)); + myTextCell->setTextColor(Palette::Red); + } + if(numberOfFiles() > 0){ + if(fileAtIndex(index, f)) { + myTextCell->setText(f.name); + myTextCell->setTextColor(f.isExecutable ? Palette::PrimaryText : Palette::Palette::SecondaryText); + } + } + } + #else + if(index == 0){ + myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); + myTextCell->setTextColor(Palette::Red); + } else { + myTextCell->setText(I18n::translate(I18n::Message::WithSimulator)); + myTextCell->setTextColor(Palette::Red); + } + #endif } void MainController::viewWillAppear() { - int count = numberOfFiles(); + int count; + #ifdef DEVICE + if(Ion::fccId() == "2ALWP-N0100"){ + count = 2; + }else { + if(numberOfFiles() > 0){ + count = numberOfFiles()+2; + } else { + count = 3; + } + } + + #else + count = 2; + #endif k_numberOfCells = count <= k_maxNumberOfCells ? count : k_maxNumberOfCells; m_selectableTableView.reloadData(); }