[Feature] Made external app testable on simu again. (#333)

Build with make PLATFORM=simulator FORCE_EXTERNAL=1 EXTERNAL_BUILTIN=1
This commit is contained in:
Maxime FRIESS
2020-04-24 16:00:06 +02:00
committed by GitHub
parent 13874cd2e0
commit bb9f52b355
5 changed files with 54 additions and 44 deletions

View File

@@ -18,6 +18,10 @@ else
include $(EXTAPP_PATH)/sources.mak
endif
ifdef EXTERNAL_BUILTIN
SFLAGS += -DEXTERNAL_BUILTIN
endif
apps_src += $(app_external_src)
i18n_files += $(addprefix apps/external/,\

View File

@@ -118,7 +118,7 @@ size_t numberOfFiles() {
#else
bool fileAtIndex(size_t index, File &entry) {
entry.name = "No apps installed ";
entry.name = "Built-in";
entry.data = NULL;
entry.dataLength = 0;
entry.isExecutable = true;
@@ -133,11 +133,11 @@ uint32_t executeFile(const char *name, void * heap, const uint32_t heapSize) {
}
int indexFromName(const char *name) {
return 0;
return 1;
}
size_t numberOfFiles() {
return 0;
return 1;
}
#endif

View File

@@ -86,37 +86,37 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
PointerTextTableCell * myTextCell = (PointerTextTableCell *)cell;
myTextCell->setHighlighted(myTextCell->isHighlighted());
struct File f;
#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);
}
}
}
#if defined(DEVICE) || defined(EXTERNAL_BUILTIN)
#if defined(DEVICE_N0100) && !defined(EXTERNAL_BUILTIN)
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);
}
}
#endif
#else
if(index == 0){
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
@@ -130,16 +130,16 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
void MainController::viewWillAppear() {
int count;
#ifdef DEVICE
if(Ion::fccId() == "2ALWP-N0100"){
#if defined(DEVICE) || defined(EXTERNAL_BUILTIN)
#if defined(DEVICE_N0100) || !defined(EXTERNAL_BUILTIN)
count = 2;
}else {
if(numberOfFiles() > 0){
count = numberOfFiles()+2;
} else {
count = 3;
}
}
#else
if(numberOfFiles() > 0){
count = numberOfFiles()+2;
} else {
count = 3;
}
#endif
#else
count = 2;

View File

@@ -58,6 +58,12 @@ endif
ifeq ("$(PLATFORM)", "device")
SFLAGS += -DPLATFORM_DEVICE
ifeq ("$(MODEL)", "n0110")
SFLAGS += -DDEVICE_N0110
endif
ifeq ("$(MODEL)", "n0100")
SFLAGS += -DDEVICE_N0100
endif
endif
# Host detection

View File

@@ -17,4 +17,4 @@ SFLAGS += -DEPSILON_SIMULATOR_HAS_LIBPNG=$(EPSILON_SIMULATOR_HAS_LIBPNG)
ifeq ($(EPSILON_SIMULATOR_HAS_LIBPNG),1)
SFLAGS += `libpng-config --cflags`
LDFLAGS += `libpng-config --ldflags`
endif
endif