mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
When choosing a language and then pressing back from the country menu to get back to the language menu, the previously selected language remains selected. Change-Id: I018c51cce09d47b15bb4864c135d381a94b2a72f
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#include "localization_controller.h"
|
|
#include <algorithm>
|
|
#include <apps/apps_container.h>
|
|
#include <apps/global_preferences.h>
|
|
|
|
namespace OnBoarding {
|
|
|
|
int LocalizationController::indexOfCellToSelectOnReset() const {
|
|
return mode() == Mode::Language ?
|
|
Shared::LocalizationController::indexOfCellToSelectOnReset() :
|
|
IndexOfCountry(I18n::DefaultCountryForLanguage[static_cast<uint8_t>(GlobalPreferences::sharedGlobalPreferences()->language())]);
|
|
}
|
|
|
|
bool LocalizationController::handleEvent(Ion::Events::Event event) {
|
|
if (Shared::LocalizationController::handleEvent(event)) {
|
|
if (mode() == Mode::Language) {
|
|
setMode(Mode::Country);
|
|
viewWillAppear();
|
|
} else {
|
|
assert(mode() == Mode::Country);
|
|
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
|
if (appsContainer->promptController()) {
|
|
Container::activeApp()->displayModalViewController(appsContainer->promptController(), 0.5f, 0.5f);
|
|
} else {
|
|
appsContainer->switchTo(appsContainer->appSnapshotAtIndex(0));
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
if (event == Ion::Events::Back) {
|
|
if (mode() == Mode::Country) {
|
|
setMode(Mode::Language);
|
|
viewWillAppear();
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|