mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-06 09:59:28 +02:00
feat(composer): custom self destruct snap delay
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
parent
3ff163c600
commit
cbf69b239c
@ -986,6 +986,10 @@
|
|||||||
"name": "Bypass Camera Roll Limit",
|
"name": "Bypass Camera Roll Limit",
|
||||||
"description": "Increases the maximum amount of media you can send from the camera roll"
|
"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": {
|
"composer_console": {
|
||||||
"name": "Composer Console",
|
"name": "Composer Console",
|
||||||
"description": "Allows you to execute JavaScript code in Composer (arm64 only)"
|
"description": "Allows you to execute JavaScript code in Composer (arm64 only)"
|
||||||
|
@ -27,6 +27,7 @@ class Experimental : ConfigContainer() {
|
|||||||
class ComposerHooksConfig: ConfigContainer(hasGlobalState = true) {
|
class ComposerHooksConfig: ConfigContainer(hasGlobalState = true) {
|
||||||
val showFirstCreatedUsername = boolean("show_first_created_username")
|
val showFirstCreatedUsername = boolean("show_first_created_username")
|
||||||
val bypassCameraRollLimit = boolean("bypass_camera_roll_limit")
|
val bypassCameraRollLimit = boolean("bypass_camera_roll_limit")
|
||||||
|
val customSelfDestructSnapDelay = boolean("custom_self_destruct_snap_delay")
|
||||||
val composerConsole = boolean("composer_console")
|
val composerConsole = boolean("composer_console")
|
||||||
val composerLogs = boolean("composer_logs")
|
val composerLogs = boolean("composer_logs")
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import { modules } from "./types";
|
|||||||
import "./modules/operaDownloadButton";
|
import "./modules/operaDownloadButton";
|
||||||
import "./modules/firstCreatedUsername";
|
import "./modules/firstCreatedUsername";
|
||||||
import "./modules/bypassCameraRollSelectionLimit";
|
import "./modules/bypassCameraRollSelectionLimit";
|
||||||
|
import "./modules/selfDestructSnapDelay";
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -21,12 +22,13 @@ try {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
m.init();
|
m.init();
|
||||||
|
console.debug(`module ${m.name} initialized`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`failed to initialize module ${m.name}`, e, e.stack);
|
console.error(`failed to initialize module ${m.name}`, e, e.stack);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("modules loaded!");
|
console.debug("modules loaded!");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("error", "Failed to load composer modules\n" + e + "\n" + e.stack)
|
log("error", "Failed to load composer modules\n" + e + "\n" + e.stack)
|
||||||
}
|
}
|
||||||
|
47
composer/src/main/ts/modules/selfDestructSnapDelay.ts
Normal file
47
composer/src/main/ts/modules/selfDestructSnapDelay.ts
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
});
|
@ -3,6 +3,7 @@ export interface Config {
|
|||||||
readonly bypassCameraRollLimit: boolean
|
readonly bypassCameraRollLimit: boolean
|
||||||
readonly showFirstCreatedUsername: boolean
|
readonly showFirstCreatedUsername: boolean
|
||||||
readonly composerLogs: boolean
|
readonly composerLogs: boolean
|
||||||
|
readonly customSelfDestructSnapDelay: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FriendInfo {
|
export interface FriendInfo {
|
||||||
|
@ -120,7 +120,8 @@ class ComposerHooks: Feature("ComposerHooks") {
|
|||||||
"operaDownloadButton" to context.config.downloader.operaDownloadButton.get(),
|
"operaDownloadButton" to context.config.downloader.operaDownloadButton.get(),
|
||||||
"bypassCameraRollLimit" to config.bypassCameraRollLimit.get(),
|
"bypassCameraRollLimit" to config.bypassCameraRollLimit.get(),
|
||||||
"showFirstCreatedUsername" to config.showFirstCreatedUsername.get(),
|
"showFirstCreatedUsername" to config.showFirstCreatedUsername.get(),
|
||||||
"composerLogs" to config.composerLogs.get()
|
"composerLogs" to config.composerLogs.get(),
|
||||||
|
"customSelfDestructSnapDelay" to config.customSelfDestructSnapDelay.get(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user