feat(composer): custom self destruct snap delay

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
rhunk 2025-06-01 14:59:58 +02:00
parent 3ff163c600
commit cbf69b239c
6 changed files with 58 additions and 2 deletions

View File

@ -986,6 +986,10 @@
"name": "Bypass Camera Roll Limit",
"description": "Increases the maximum amount of media you can send from the camera roll"
},
"custom_self_destruct_snap_delay": {
"name": "Custom Self Destruct Snap Delay",
"description": "Gives more options for the self-destruct timer when sending a Snap"
},
"composer_console": {
"name": "Composer Console",
"description": "Allows you to execute JavaScript code in Composer (arm64 only)"

View File

@ -27,6 +27,7 @@ class Experimental : ConfigContainer() {
class ComposerHooksConfig: ConfigContainer(hasGlobalState = true) {
val showFirstCreatedUsername = boolean("show_first_created_username")
val bypassCameraRollLimit = boolean("bypass_camera_roll_limit")
val customSelfDestructSnapDelay = boolean("custom_self_destruct_snap_delay")
val composerConsole = boolean("composer_console")
val composerLogs = boolean("composer_logs")
}

View File

@ -4,6 +4,7 @@ import { modules } from "./types";
import "./modules/operaDownloadButton";
import "./modules/firstCreatedUsername";
import "./modules/bypassCameraRollSelectionLimit";
import "./modules/selfDestructSnapDelay";
try {
@ -21,12 +22,13 @@ try {
}
try {
m.init();
console.debug(`module ${m.name} initialized`);
} catch (e) {
console.error(`failed to initialize module ${m.name}`, e, e.stack);
}
});
console.log("modules loaded!");
console.debug("modules loaded!");
} catch (e) {
log("error", "Failed to load composer modules\n" + e + "\n" + e.stack)
}

View File

@ -0,0 +1,47 @@
import { defineModule } from "../types";
import { interceptComponent } from "../utils";
export default defineModule({
name: "Self Destruct Snap Delay",
enabled: config => config.customSelfDestructSnapDelay,
init() {
interceptComponent(
'snap_editor_timer_tool/src/TimerPickerView',
'TimerPickerView',
{
"<init>": (args: any[], superCall: () => void) => {
if (args[1].options[0] == 30) {
args[1].style = 0; // seconds format
args[1].options = [
5, // 5 seconds
10, // 10 seconds
20, // 20 seconds
30, // 30 seconds
60, // 1 minute
120, // 2 minutes
180, // 3 minutes
240, // 4 minutes
300, // 5 minutes
600, // 10 minutes
900, // 15 minutes
1200, // 20 minutes
1800, // 30 minutes
3600, // 1 hour
7200, // 2 hours
10800, // 3 hours
14400, // 4 hours
21600, // 6 hours
28800, // 8 hours
43200, // 12 hours
86400, // 1 day
172800, // 2 days
]
}
superCall();
}
}
)
}
});

View File

@ -3,6 +3,7 @@ export interface Config {
readonly bypassCameraRollLimit: boolean
readonly showFirstCreatedUsername: boolean
readonly composerLogs: boolean
readonly customSelfDestructSnapDelay: boolean
}
export interface FriendInfo {

View File

@ -120,7 +120,8 @@ class ComposerHooks: Feature("ComposerHooks") {
"operaDownloadButton" to context.config.downloader.operaDownloadButton.get(),
"bypassCameraRollLimit" to config.bypassCameraRollLimit.get(),
"showFirstCreatedUsername" to config.showFirstCreatedUsername.get(),
"composerLogs" to config.composerLogs.get()
"composerLogs" to config.composerLogs.get(),
"customSelfDestructSnapDelay" to config.customSelfDestructSnapDelay.get(),
))
}