mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Format
This commit is contained in:
10
applications/external/totp/application.fam
vendored
10
applications/external/totp/application.fam
vendored
@@ -3,15 +3,7 @@ App(
|
||||
name="Authenticator",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="totp_app",
|
||||
requires=[
|
||||
"gui",
|
||||
"cli",
|
||||
"dialogs",
|
||||
"storage",
|
||||
"input",
|
||||
"notification",
|
||||
"bt"
|
||||
],
|
||||
requires=["gui", "cli", "dialogs", "storage", "input", "notification", "bt"],
|
||||
stack_size=2 * 1024,
|
||||
order=20,
|
||||
fap_author="Alexander Kopachov (@akopachov)",
|
||||
|
||||
@@ -373,7 +373,8 @@ bool totp_scene_generate_token_handle_event(
|
||||
|
||||
SceneState* scene_state;
|
||||
if(event->input.type == InputTypeLong) {
|
||||
if(event->input.key == InputKeyDown && plugin_state->automation_method & AutomationMethodBadUsb) {
|
||||
if(event->input.key == InputKeyDown &&
|
||||
plugin_state->automation_method & AutomationMethodBadUsb) {
|
||||
scene_state = (SceneState*)plugin_state->current_scene_state;
|
||||
totp_usb_type_code_worker_notify(
|
||||
scene_state->usb_type_code_worker_context, TotpUsbTypeCodeWorkerEventType);
|
||||
@@ -383,7 +384,9 @@ bool totp_scene_generate_token_handle_event(
|
||||
return true;
|
||||
}
|
||||
#ifdef TOTP_BADBT_TYPE_ENABLED
|
||||
else if(event->input.key == InputKeyUp && plugin_state->automation_method & AutomationMethodBadBt) {
|
||||
else if(
|
||||
event->input.key == InputKeyUp &&
|
||||
plugin_state->automation_method & AutomationMethodBadBt) {
|
||||
scene_state = (SceneState*)plugin_state->current_scene_state;
|
||||
totp_bt_type_code_worker_notify(
|
||||
plugin_state->bt_type_code_worker_context, TotpBtTypeCodeWorkerEventType);
|
||||
|
||||
@@ -115,7 +115,8 @@ bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
|
||||
if(value) {
|
||||
text = "Disabling this requires\nremoving the hardware mod!\nIs it uninstalled?";
|
||||
} else {
|
||||
text = "This option requires installing\na hardware modification!\nIs it installed?";
|
||||
text =
|
||||
"This option requires installing\na hardware modification!\nIs it installed?";
|
||||
}
|
||||
DialogMessage* msg = dialog_message_alloc();
|
||||
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
|
||||
|
||||
@@ -65,41 +65,41 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
// case DesktopLockMenuEventPinLock:
|
||||
// if(desktop->settings.pin_code.length > 0) {
|
||||
// desktop_pin_lock(&desktop->settings);
|
||||
// desktop_lock(desktop);
|
||||
// } else {
|
||||
// LoaderStatus status =
|
||||
// loader_start(desktop->loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG);
|
||||
// if(status == LoaderStatusOk) {
|
||||
// scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1);
|
||||
// } else {
|
||||
// FURI_LOG_E(TAG, "Unable to start desktop settings");
|
||||
// }
|
||||
// }
|
||||
// consumed = true;
|
||||
// break;
|
||||
// case DesktopLockMenuEventPinLock:
|
||||
// if(desktop->settings.pin_code.length > 0) {
|
||||
// desktop_pin_lock(&desktop->settings);
|
||||
// desktop_lock(desktop);
|
||||
// } else {
|
||||
// LoaderStatus status =
|
||||
// loader_start(desktop->loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG);
|
||||
// if(status == LoaderStatusOk) {
|
||||
// scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1);
|
||||
// } else {
|
||||
// FURI_LOG_E(TAG, "Unable to start desktop settings");
|
||||
// }
|
||||
// }
|
||||
// consumed = true;
|
||||
// break;
|
||||
|
||||
// case DesktopLockMenuEventPinLockShutdown:
|
||||
// if(desktop->settings.pin_code.length > 0) {
|
||||
// desktop_pin_lock(&desktop->settings);
|
||||
// desktop_lock(desktop);
|
||||
// Power* power = furi_record_open(RECORD_POWER);
|
||||
// furi_delay_ms(666);
|
||||
// power_off(power);
|
||||
// furi_record_close(RECORD_POWER);
|
||||
// } else {
|
||||
// LoaderStatus status =
|
||||
// loader_start(desktop->loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG);
|
||||
// if(status == LoaderStatusOk) {
|
||||
// scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 2);
|
||||
// } else {
|
||||
// FURI_LOG_E(TAG, "Unable to start desktop settings");
|
||||
// }
|
||||
// }
|
||||
// consumed = true;
|
||||
// break;
|
||||
// case DesktopLockMenuEventPinLockShutdown:
|
||||
// if(desktop->settings.pin_code.length > 0) {
|
||||
// desktop_pin_lock(&desktop->settings);
|
||||
// desktop_lock(desktop);
|
||||
// Power* power = furi_record_open(RECORD_POWER);
|
||||
// furi_delay_ms(666);
|
||||
// power_off(power);
|
||||
// furi_record_close(RECORD_POWER);
|
||||
// } else {
|
||||
// LoaderStatus status =
|
||||
// loader_start(desktop->loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG);
|
||||
// if(status == LoaderStatusOk) {
|
||||
// scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 2);
|
||||
// } else {
|
||||
// FURI_LOG_E(TAG, "Unable to start desktop settings");
|
||||
// }
|
||||
// }
|
||||
// consumed = true;
|
||||
// break;
|
||||
|
||||
case DesktopLockMenuEventSettings:
|
||||
// loader_start(desktop->loader, "Settings", NULL);
|
||||
@@ -114,7 +114,8 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
|
||||
case DesktopLockMenuEventXtreme:
|
||||
loader_start(desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("apps/.Main/xtreme_app.fap"));
|
||||
loader_start(
|
||||
desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("apps/.Main/xtreme_app.fap"));
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
|
||||
@@ -81,37 +81,37 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
||||
}
|
||||
|
||||
switch(i) {
|
||||
case DesktopLockMenuIndexLefthandedMode:
|
||||
icon = &I_CC_LefthandedMode_16x16;
|
||||
enabled = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
||||
break;
|
||||
case DesktopLockMenuIndexSettings:
|
||||
icon = &I_CC_Settings_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexDarkMode:
|
||||
icon = &I_CC_DarkMode_16x16;
|
||||
enabled = XTREME_SETTINGS()->dark_mode;
|
||||
break;
|
||||
case DesktopLockMenuIndexLock:
|
||||
icon = &I_CC_Lock_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexBluetooth:
|
||||
icon = &I_CC_Bluetooth_16x16;
|
||||
enabled = m->lock_menu->bt->bt_settings.enabled;
|
||||
break;
|
||||
case DesktopLockMenuIndexXtreme:
|
||||
icon = &I_CC_Xtreme_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexBrightness:
|
||||
icon = &I_Pin_star_7x7;
|
||||
value = total - m->lock_menu->notification->settings.display_brightness * total;
|
||||
break;
|
||||
case DesktopLockMenuIndexVolume:
|
||||
icon = &I_Volup_8x6;
|
||||
value = total - m->lock_menu->notification->settings.speaker_volume * total;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DesktopLockMenuIndexLefthandedMode:
|
||||
icon = &I_CC_LefthandedMode_16x16;
|
||||
enabled = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
||||
break;
|
||||
case DesktopLockMenuIndexSettings:
|
||||
icon = &I_CC_Settings_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexDarkMode:
|
||||
icon = &I_CC_DarkMode_16x16;
|
||||
enabled = XTREME_SETTINGS()->dark_mode;
|
||||
break;
|
||||
case DesktopLockMenuIndexLock:
|
||||
icon = &I_CC_Lock_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexBluetooth:
|
||||
icon = &I_CC_Bluetooth_16x16;
|
||||
enabled = m->lock_menu->bt->bt_settings.enabled;
|
||||
break;
|
||||
case DesktopLockMenuIndexXtreme:
|
||||
icon = &I_CC_Xtreme_16x16;
|
||||
break;
|
||||
case DesktopLockMenuIndexBrightness:
|
||||
icon = &I_Pin_star_7x7;
|
||||
value = total - m->lock_menu->notification->settings.display_brightness * total;
|
||||
break;
|
||||
case DesktopLockMenuIndexVolume:
|
||||
icon = &I_Volup_8x6;
|
||||
value = total - m->lock_menu->notification->settings.speaker_volume * total;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(selected) {
|
||||
@@ -125,12 +125,20 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
||||
canvas_draw_rbox(canvas, x, y, w, h, 5);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
canvas_draw_icon(canvas, x + (w - icon_get_width(icon)) / 2, y + (h - icon_get_height(icon)) / 2, icon);
|
||||
canvas_draw_icon(
|
||||
canvas,
|
||||
x + (w - icon_get_width(icon)) / 2,
|
||||
y + (h - icon_get_height(icon)) / 2,
|
||||
icon);
|
||||
if(enabled) {
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
}
|
||||
} else {
|
||||
canvas_draw_icon(canvas, x + (w - icon_get_width(icon)) / 2, y + (h - icon_get_height(icon)) / 2, icon);
|
||||
canvas_draw_icon(
|
||||
canvas,
|
||||
x + (w - icon_get_width(icon)) / 2,
|
||||
y + (h - icon_get_height(icon)) / 2,
|
||||
icon);
|
||||
canvas_set_color(canvas, ColorXOR);
|
||||
canvas_draw_box(canvas, x + 1, y + 1 + value, w - 2, h - 2 - value);
|
||||
if(selected) {
|
||||
@@ -208,37 +216,37 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
|
||||
} else if(event->key == InputKeyOk && event->type == InputTypeShort) {
|
||||
DesktopEvent event = 0;
|
||||
switch(idx) {
|
||||
case DesktopLockMenuIndexLefthandedMode:
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient)) {
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
||||
} else {
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
||||
}
|
||||
break;
|
||||
case DesktopLockMenuIndexSettings:
|
||||
event = DesktopLockMenuEventSettings;
|
||||
break;
|
||||
case DesktopLockMenuIndexDarkMode:
|
||||
XTREME_SETTINGS()->dark_mode = !XTREME_SETTINGS()->dark_mode;
|
||||
lock_menu->save_xtreme = true;
|
||||
break;
|
||||
case DesktopLockMenuIndexLock:
|
||||
event = DesktopLockMenuEventLock;
|
||||
break;
|
||||
case DesktopLockMenuIndexBluetooth:
|
||||
lock_menu->bt->bt_settings.enabled = !lock_menu->bt->bt_settings.enabled;
|
||||
if(lock_menu->bt->bt_settings.enabled) {
|
||||
furi_hal_bt_start_advertising();
|
||||
} else {
|
||||
furi_hal_bt_stop_advertising();
|
||||
}
|
||||
lock_menu->save_bt = true;
|
||||
break;
|
||||
case DesktopLockMenuIndexXtreme:
|
||||
event = DesktopLockMenuEventXtreme;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DesktopLockMenuIndexLefthandedMode:
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient)) {
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
||||
} else {
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
||||
}
|
||||
break;
|
||||
case DesktopLockMenuIndexSettings:
|
||||
event = DesktopLockMenuEventSettings;
|
||||
break;
|
||||
case DesktopLockMenuIndexDarkMode:
|
||||
XTREME_SETTINGS()->dark_mode = !XTREME_SETTINGS()->dark_mode;
|
||||
lock_menu->save_xtreme = true;
|
||||
break;
|
||||
case DesktopLockMenuIndexLock:
|
||||
event = DesktopLockMenuEventLock;
|
||||
break;
|
||||
case DesktopLockMenuIndexBluetooth:
|
||||
lock_menu->bt->bt_settings.enabled = !lock_menu->bt->bt_settings.enabled;
|
||||
if(lock_menu->bt->bt_settings.enabled) {
|
||||
furi_hal_bt_start_advertising();
|
||||
} else {
|
||||
furi_hal_bt_stop_advertising();
|
||||
}
|
||||
lock_menu->save_bt = true;
|
||||
break;
|
||||
case DesktopLockMenuIndexXtreme:
|
||||
event = DesktopLockMenuEventXtreme;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(event) {
|
||||
lock_menu->callback(event, lock_menu->context);
|
||||
@@ -253,20 +261,22 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
|
||||
if(offset) {
|
||||
float value;
|
||||
switch(idx) {
|
||||
case DesktopLockMenuIndexBrightness:
|
||||
value = lock_menu->notification->settings.display_brightness + 0.05 * offset;
|
||||
lock_menu->notification->settings.display_brightness = value < 0.00f ? 0.00f : (value > 1.00f ? 1.00f : value);
|
||||
lock_menu->save_notification = true;
|
||||
notification_message(lock_menu->notification, &sequence_display_backlight_on);
|
||||
break;
|
||||
case DesktopLockMenuIndexVolume:
|
||||
value = lock_menu->notification->settings.speaker_volume + 0.05 * offset;
|
||||
lock_menu->notification->settings.speaker_volume = value < 0.00f ? 0.00f : (value > 1.00f ? 1.00f : value);
|
||||
lock_menu->save_notification = true;
|
||||
notification_message(lock_menu->notification, &sequence_note_c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DesktopLockMenuIndexBrightness:
|
||||
value = lock_menu->notification->settings.display_brightness + 0.05 * offset;
|
||||
lock_menu->notification->settings.display_brightness =
|
||||
value < 0.00f ? 0.00f : (value > 1.00f ? 1.00f : value);
|
||||
lock_menu->save_notification = true;
|
||||
notification_message(lock_menu->notification, &sequence_display_backlight_on);
|
||||
break;
|
||||
case DesktopLockMenuIndexVolume:
|
||||
value = lock_menu->notification->settings.speaker_volume + 0.05 * offset;
|
||||
lock_menu->notification->settings.speaker_volume =
|
||||
value < 0.00f ? 0.00f : (value > 1.00f ? 1.00f : value);
|
||||
lock_menu->save_notification = true;
|
||||
notification_message(lock_menu->notification, &sequence_note_c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,14 @@ def pack(
|
||||
)
|
||||
manifest = (source / "Anims/manifest.txt").read_bytes()
|
||||
for anim in re.finditer(rb"Name: (.*)", manifest):
|
||||
anim = anim.group(1).decode().replace("\\", "/").replace("/", os.sep).replace("\r", "\n").strip()
|
||||
anim = (
|
||||
anim.group(1)
|
||||
.decode()
|
||||
.replace("\\", "/")
|
||||
.replace("/", os.sep)
|
||||
.replace("\r", "\n")
|
||||
.strip()
|
||||
)
|
||||
logger(f"Compile: anim for pack '{source.name}': {anim}")
|
||||
pack_anim(source / "Anims" / anim, packed / "Anims" / anim)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user