[Makefile] Create a build option: EPSILON_BOOT_PROMPT that can be

'update' or 'beta' to display a prompt informing about new update or
beta version
This commit is contained in:
Émilie Feral
2018-10-12 14:07:58 +02:00
committed by LeaNumworks
parent c8d7ee46d9
commit 3f711da8e4
15 changed files with 77 additions and 48 deletions

View File

@@ -6,7 +6,7 @@ default: epsilon.$(EXE)
info:
@echo "EPSILON_VERSION = $(EPSILON_VERSION)"
@echo "EPSILON_ONBOARDING_APP = $(EPSILON_ONBOARDING_APP)"
@echo "EPSILON_SOFTWARE_UPDATE_PROMPT = $(EPSILON_SOFTWARE_UPDATE_PROMPT)"
@echo "EPSILON_BOOT_PROMPT = $(EPSILON_BOOT_PROMPT)"
@echo "EPSILON_APPS = $(EPSILON_APPS)"
@echo "EPSILON_I18N = $(EPSILON_I18N)"

View File

@@ -10,9 +10,27 @@ extern "C" {
using namespace Shared;
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#if EPSILON_BOOT_PROMPT == EPSILON_BETA_PROMPT
static I18n::Message sOnBoardingMessages[] = {
static I18n::Message sPromptMessages[] = {
I18n::Message::BetaVersion,
I18n::Message::BetaVersionMessage1,
I18n::Message::BlankMessage,
I18n::Message::BetaVersionMessage2,
I18n::Message::BetaVersionMessage3,
I18n::Message::UpdateMessage4};
static KDColor sPromptColors[] = {
KDColorBlack,
KDColorBlack,
KDColorBlack,
KDColorBlack,
KDColorBlack,
Palette::YellowDark};
#elif EPSILON_BOOT_PROMPT == EPSILON_UPDATE_PROMPT
static I18n::Message sPromptMessages[] = {
I18n::Message::UpdateAvailable,
I18n::Message::UpdateMessage1,
I18n::Message::UpdateMessage2,
@@ -20,7 +38,7 @@ static I18n::Message sOnBoardingMessages[] = {
I18n::Message::UpdateMessage3,
I18n::Message::UpdateMessage4};
static KDColor sOnBoardingColors[] = {
static KDColor sPromptColors[] = {
KDColorBlack,
KDColorBlack,
KDColorBlack,
@@ -37,8 +55,8 @@ AppsContainer::AppsContainer() :
m_globalContext(),
m_variableBoxController(&m_globalContext),
m_examPopUpController(this),
#if EPSILON_SOFTWARE_UPDATE_PROMPT
m_updateController(sOnBoardingMessages, sOnBoardingColors, 6),
#ifdef EPSILON_BOOT_PROMPT
m_promptController(sPromptMessages, sPromptColors, 6),
#endif
m_batteryTimer(BatteryTimer(this)),
m_suspendTimer(SuspendTimer(this)),
@@ -90,9 +108,9 @@ VariableBoxController * AppsContainer::variableBoxController() {
void AppsContainer::suspend(bool checkIfPowerKeyReleased) {
resetShiftAlphaStatus();
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
if (activeApp()->snapshot()!= onBoardingAppSnapshot() && activeApp()->snapshot() != hardwareTestAppSnapshot() && GlobalPreferences::sharedGlobalPreferences()->showPopUp()) {
activeApp()->displayModalViewController(&m_updateController, 0.f, 0.f);
activeApp()->displayModalViewController(&m_promptController, 0.f, 0.f);
}
#endif
Ion::Power::suspend(checkIfPowerKeyReleased);
@@ -247,9 +265,9 @@ bool AppsContainer::updateAlphaLock() {
return m_window.updateAlphaLock();
}
#if EPSILON_SOFTWARE_UPDATE_PROMPT
OnBoarding::PopUpController * AppsContainer::updatePopUpController() {
return &m_updateController;
#ifdef EPSILON_BOOT_PROMPT
OnBoarding::PopUpController * AppsContainer::promptController() {
return &m_promptController;
}
#endif

View File

@@ -20,7 +20,7 @@
#include "picview/picview_app.h"
#endif
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
#include "on_boarding/pop_up_controller.h"
#endif
@@ -48,8 +48,8 @@ public:
void displayExamModePopUp(bool activate);
void shutdownDueToLowBattery();
void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus);
#if EPSILON_SOFTWARE_UPDATE_PROMPT
OnBoarding::PopUpController * updatePopUpController();
#ifdef EPSILON_BOOT_PROMPT
OnBoarding::PopUpController * promptController();
#endif
void redrawWindow();
// Exam pop-up controller delegate
@@ -73,8 +73,8 @@ private:
MathToolbox m_mathToolbox;
VariableBoxController m_variableBoxController;
ExamPopUpController m_examPopUpController;
#if EPSILON_SOFTWARE_UPDATE_PROMPT
OnBoarding::PopUpController m_updateController;
#ifdef EPSILON_BOOT_PROMPT
OnBoarding::PopUpController m_promptController;
#endif
BatteryTimer m_batteryTimer;
SuspendTimer m_suspendTimer;

View File

@@ -3,7 +3,7 @@
GlobalPreferences::GlobalPreferences() :
m_language(I18n::Language::EN),
m_examMode(ExamMode::Desactivate),
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
m_showPopUp(true),
#endif
m_brightnessLevel(Ion::Backlight::MaxBrightness)
@@ -35,16 +35,14 @@ void GlobalPreferences::setExamMode(ExamMode examMode) {
}
}
#if EPSILON_SOFTWARE_UPDATE_PROMPT
bool GlobalPreferences::showPopUp() const {
return m_showPopUp;
}
#ifdef EPSILON_BOOT_PROMPT
void GlobalPreferences::setShowPopUp(bool showPopUp) {
if (showPopUp != m_showPopUp) {
m_showPopUp = showPopUp;
}
}
#endif
int GlobalPreferences::brightnessLevel() const {

View File

@@ -15,8 +15,8 @@ public:
void setLanguage(I18n::Language language);
ExamMode examMode() const;
void setExamMode(ExamMode examMode);
#if EPSILON_SOFTWARE_UPDATE_PROMPT
bool showPopUp() const;
#ifdef EPSILON_BOOT_PROMPT
bool showPopUp() const { return m_showPopUp; }
void setShowPopUp(bool showPopUp);
#endif
int brightnessLevel() const;
@@ -25,7 +25,7 @@ public:
private:
I18n::Language m_language;
ExamMode m_examMode;
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
bool m_showPopUp;
#endif
int m_brightnessLevel;

View File

@@ -17,11 +17,10 @@ void LanguageController::reinitOnBoarding() {
bool LanguageController::handleEvent(Ion::Events::Event event) {
if (Shared::LanguageController::handleEvent(event)) {
#if EPSILON_SOFTWARE_UPDATE_PROMPT
AppsContainer * container = (AppsContainer *)(app()->container());
app()->displayModalViewController(container->updatePopUpController(), 0.5f, 0.5f);
#else
AppsContainer * appsContainer = (AppsContainer *)app()->container();
#ifdef EPSILON_BOOT_PROMPT
app()->displayModalViewController(appsContainer->promptController(), 0.5f, 0.5f);
#else
appsContainer->switchTo(appsContainer->appSnapshotAtIndex(0));
#endif
return true;

View File

@@ -4,7 +4,7 @@
namespace OnBoarding {
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
PopUpController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor * colors, uint8_t numberOfMessages) :
MessageView(messages, colors, numberOfMessages),

View File

@@ -8,7 +8,7 @@
namespace OnBoarding {
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
class PopUpController : public ViewController {
public:

View File

@@ -14,7 +14,7 @@ const SettingsMessageTree complexFormatChildren[2] = {SettingsMessageTree(I18n::
const SettingsMessageTree examChildren[1] = {SettingsMessageTree(I18n::Message::ActivateExamMode)};
const SettingsMessageTree aboutChildren[3] = {SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId)};
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
const SettingsMessageTree menu[9] =
#else
const SettingsMessageTree menu[8] =
@@ -26,11 +26,13 @@ const SettingsMessageTree menu[8] =
SettingsMessageTree(I18n::Message::Brightness),
SettingsMessageTree(I18n::Message::Language),
SettingsMessageTree(I18n::Message::ExamMode, examChildren, 1),
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#if EPSILON_BOOT_PROMPT == EPSILON_BETA_PROMPT
SettingsMessageTree(I18n::Message::BetaPopUp),
#elif EPSILON_BOOT_PROMPT == EPSILON_UPDATE_PROMPT
SettingsMessageTree(I18n::Message::UpdatePopUp),
#endif
SettingsMessageTree(I18n::Message::About, aboutChildren, 3)};
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 9);
#else
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 8);
@@ -38,8 +40,8 @@ const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp
MainController::MainController(Responder * parentResponder) :
ViewController(parentResponder),
#if EPSILON_SOFTWARE_UPDATE_PROMPT
m_updateCell(I18n::Message::Default, KDFont::LargeFont),
#ifdef EPSILON_BOOT_PROMPT
m_popUpCell(I18n::Message::Default, KDFont::LargeFont),
#endif
m_brightnessCell(I18n::Message::Default, KDFont::LargeFont),
m_selectableTableView(this),
@@ -68,8 +70,12 @@ void MainController::didBecomeFirstResponder() {
bool MainController::handleEvent(Ion::Events::Event event) {
if (m_messageTreeModel->children(selectedRow())->numberOfChildren() == 0) {
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#if EPSILON_BOOT_PROMPT == EPSILON_BETA_PROMPT
if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::BetaPopUp) {
#elif EPSILON_BOOT_PROMPT == EPSILON_UPDATE_PROMPT
if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::UpdatePopUp) {
#endif
#ifdef EPSILON_BOOT_PROMPT
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
GlobalPreferences::sharedGlobalPreferences()->setShowPopUp(!GlobalPreferences::sharedGlobalPreferences()->showPopUp());
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
@@ -108,7 +114,7 @@ bool MainController::handleEvent(Ion::Events::Event event) {
case 6:
subController = &m_examModeController;
break;
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
case 8:
#else
case 7:
@@ -149,9 +155,9 @@ HighlightCell * MainController::reusableCell(int index, int type) {
return &m_cells[index];
}
assert(index == 0);
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
if (type == 2) {
return &m_updateCell;
return &m_popUpCell;
}
#endif
assert(type == 1);
@@ -169,7 +175,7 @@ int MainController::typeAtLocation(int i, int j) {
if (j == 4) {
return 1;
}
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
if (j == 7) {
return 2;
}
@@ -191,7 +197,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(I18n::LanguageNames[index]);
return;
}
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
if (index == 7) {
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();

View File

@@ -28,9 +28,9 @@ public:
void viewWillAppear() override;
private:
StackViewController * stackController() const;
#if EPSILON_SOFTWARE_UPDATE_PROMPT
#ifdef EPSILON_BOOT_PROMPT
constexpr static int k_totalNumberOfCell = 9;
MessageTableCellWithSwitch m_updateCell;
MessageTableCellWithSwitch m_popUpCell;
#else
constexpr static int k_totalNumberOfCell = 8;
#endif

View File

@@ -5,7 +5,8 @@ DEBUG ?= 0
EPSILON_VERSION ?= 1.7.0
EPSILON_ONBOARDING_APP ?= 1
EPSILON_SOFTWARE_UPDATE_PROMPT ?= 1
# Valid values are "none", "update", "beta"
EPSILON_BOOT_PROMPT ?= none
EPSILON_APPS ?= calculation graph code statistics probability solver sequence regression settings
EPSILON_I18N ?= en fr es de pt
EPSILON_GETOPT ?= 0
@@ -22,5 +23,14 @@ include build/toolchain.$(TOOLCHAIN).mak
SFLAGS += -DDEBUG=$(DEBUG)
SFLAGS += -DEPSILON_ONBOARDING_APP=$(EPSILON_ONBOARDING_APP)
SFLAGS += -DEPSILON_SOFTWARE_UPDATE_PROMPT=$(EPSILON_SOFTWARE_UPDATE_PROMPT)
SFLAGS += -DEPSILON_GETOPT=$(EPSILON_GETOPT)
EPSILON_BETA_PROMPT := 1
EPSILON_UPDATE_PROMPT := 2
SFLAGS += -DEPSILON_BETA_PROMPT=$(EPSILON_BETA_PROMPT)
SFLAGS += -DEPSILON_UPDATE_PROMPT=$(EPSILON_UPDATE_PROMPT)
ifeq (beta,$(EPSILON_BOOT_PROMPT))
SFLAGS += -DEPSILON_BOOT_PROMPT=$(EPSILON_BETA_PROMPT)
endif
ifeq (update,$(EPSILON_BOOT_PROMPT))
SFLAGS += -DEPSILON_BOOT_PROMPT=$(EPSILON_UPDATE_PROMPT)
endif

View File

@@ -2,7 +2,6 @@ TOOLCHAIN ?= host-gcc
USE_LIBA ?= 0
EXE = bin
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0
ifeq ($(DEBUG),1)
else

View File

@@ -1,6 +1,7 @@
TOOLCHAIN ?= arm-gcc
USE_LIBA = 1
EXE = elf
EPSILON_SOFTWARE_PROMPT = update
EPSILON_DEVICE_BENCH ?= 1
SFLAGS += -DEPSILON_DEVICE_BENCH=$(EPSILON_DEVICE_BENCH)

View File

@@ -2,5 +2,4 @@ TOOLCHAIN = emscripten
USE_LIBA = 0
EXE = js
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0
EPSILON_GETOPT = 1

View File

@@ -5,5 +5,4 @@ endif
USE_LIBA = 0
EXE = elf
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0
SFLAGS += -fPIE