diff --git a/plugins/locksreen/LockscreenActivity.cpp b/plugins/lockscreen/LockscreenActivity.cpp similarity index 100% rename from plugins/locksreen/LockscreenActivity.cpp rename to plugins/lockscreen/LockscreenActivity.cpp diff --git a/plugins/locksreen/LockscreenActivity.h b/plugins/lockscreen/LockscreenActivity.h similarity index 100% rename from plugins/locksreen/LockscreenActivity.h rename to plugins/lockscreen/LockscreenActivity.h diff --git a/plugins/locksreen/LockscreenPlugin.cpp b/plugins/lockscreen/LockscreenPlugin.cpp similarity index 100% rename from plugins/locksreen/LockscreenPlugin.cpp rename to plugins/lockscreen/LockscreenPlugin.cpp diff --git a/plugins/locksreen/LockscreenPlugin.h b/plugins/lockscreen/LockscreenPlugin.h similarity index 100% rename from plugins/locksreen/LockscreenPlugin.h rename to plugins/lockscreen/LockscreenPlugin.h diff --git a/plugins/locksreen/LockscreenSettingsPage.cpp b/plugins/lockscreen/LockscreenSettingsPage.cpp similarity index 100% rename from plugins/locksreen/LockscreenSettingsPage.cpp rename to plugins/lockscreen/LockscreenSettingsPage.cpp diff --git a/plugins/locksreen/LockscreenSettingsPage.h b/plugins/lockscreen/LockscreenSettingsPage.h similarity index 100% rename from plugins/locksreen/LockscreenSettingsPage.h rename to plugins/lockscreen/LockscreenSettingsPage.h diff --git a/plugins/locksreen/patch.py b/plugins/lockscreen/patch.py similarity index 95% rename from plugins/locksreen/patch.py rename to plugins/lockscreen/patch.py index 0185a99..995f2b0 100644 --- a/plugins/locksreen/patch.py +++ b/plugins/lockscreen/patch.py @@ -375,21 +375,11 @@ def patch_main_cpp(repo_dir): path = find_first("main.cpp", repo_dir) content = read_file(path) - if "LockscreenPlugin" in content: - if "shouldLockOnWake" in content or "shouldLockOnPower" in content or "wasInReader" in content: - content = content.replace( - ' const bool wasInReader = APP_STATE.lastSleepFromReader;\n' - ' const bool shouldLock =\n' - ' hasPinSet &&\n' - ' ((lsMode == LockscreenMode::ENABLED) ||\n' - ' (lsMode == LockscreenMode::ON_POWER && !wasInReader) ||\n' - ' (lsMode == LockscreenMode::ON_WAKE && wasInReader));\n', - ' const bool shouldLock = hasPinSet && LockscreenPlugin::shouldLock(lsMode);\n' - ) - write_file(path, content) - print(" main.cpp patched (updated shouldLock call).") - else: - print(" main.cpp already patched, skipping.") + already_has_includes = "LockscreenPlugin" in content + already_has_block = "LockscreenActivity lockAct" in content + + if already_has_includes and already_has_block: + print(" main.cpp already patched, skipping.") return content = content.replace( @@ -430,11 +420,11 @@ def patch_main_cpp(repo_dir): content = content.replace( ' RECENT_BOOKS.loadFromFile();\n' '\n' - ' // Boot to home screen if no book is open', + ' if (HalSystem::isRebootFromPanic())', ' RECENT_BOOKS.loadFromFile();\n' + lockscreen_block + '\n' - ' // Boot to home screen if no book is open' + ' if (HalSystem::isRebootFromPanic())' ) write_file(path, content)