Refactor app loading and window management (#609)
This commit is contained in:
committed by
GitHub
parent
dc3f6104b8
commit
37c507544b
@@ -510,7 +510,7 @@ public:
|
||||
LOG_W(TAG, "No WiFi device found");
|
||||
}
|
||||
|
||||
if (system_event_subscribe(KERNEL_EVENT_BOOT_COMPLETED, onBootCompleted, nullptr) == ERROR_NONE) {
|
||||
if (system_event_callback_add(KERNEL_EVENT_BOOT_COMPLETED, onBootCompleted, nullptr) == ERROR_NONE) {
|
||||
state.bootEventSubscribed = true;
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ public:
|
||||
state.autoConnectTimer = nullptr; // Must release as it holds a reference via its callback.
|
||||
|
||||
if (state.bootEventSubscribed) {
|
||||
system_event_unsubscribe(KERNEL_EVENT_BOOT_COMPLETED, onBootCompleted);
|
||||
system_event_callback_remove(KERNEL_EVENT_BOOT_COMPLETED, onBootCompleted);
|
||||
state.bootEventSubscribed = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,20 +138,24 @@ bool contains(const std::string& ssid) {
|
||||
bool load(const std::string& ssid, WifiApSettings& apSettings) {
|
||||
auto service_context = findServiceContext();
|
||||
if (service_context == nullptr) {
|
||||
LOG_E(TAG, "No service context");
|
||||
return false;
|
||||
}
|
||||
const auto file_path = getApPropertiesFilePath(service_context->getPaths(), ssid);
|
||||
if (!file::isFile(file_path)) {
|
||||
LOG_E(TAG, "Not a file: %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> map;
|
||||
if (!file::loadPropertiesFile(file_path, map)) {
|
||||
LOG_E(TAG, "Failed to load properties from %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// SSID is required
|
||||
if (!map.contains(AP_PROPERTIES_KEY_SSID)) {
|
||||
LOG_E(TAG, "File does not contain SSID: %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -166,6 +170,7 @@ bool load(const std::string& ssid, WifiApSettings& apSettings) {
|
||||
} else if (decrypt(ssid, encrypted_password, password_decrypted)) {
|
||||
apSettings.password = password_decrypted;
|
||||
} else {
|
||||
LOG_E(TAG, "Failed to decrypt password from %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/DeprecatedPaths.h>
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
|
||||
Reference in New Issue
Block a user