From 45c081d6ce76731f696508892d044877009e3d13 Mon Sep 17 00:00:00 2001 From: Jacob Thomas <41988041+bocajthomas@users.noreply.github.com> Date: Thu, 9 May 2024 01:01:30 +0100 Subject: [PATCH] new script: custom toast --- examples/custom_toast.js | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 examples/custom_toast.js diff --git a/examples/custom_toast.js b/examples/custom_toast.js new file mode 100644 index 0000000..56f38bf --- /dev/null +++ b/examples/custom_toast.js @@ -0,0 +1,51 @@ +// ==SE_module== +// name: custom_toast +// displayName: Custom Toast +// description: A Script that shows a custom toast on the startup of Snapchat. +// version: 1.0 +// author: Gabe Modz & Jacob Thomas +// ==/SE_module== + +var networking = require("networking"); +var messaging = require("messaging"); +var config = require("config"); +var im = require("interface-manager"); +var ipc = require("ipc"); +var javaInterfaces = require("java-interfaces"); +var hooker = require("hooker"); +var events = require("events"); + +var settingsContext = { + events: [], +}; + +var defaultPrompt = "Type You're Welcome Message"; +function createManagerToolBoxUI() { + settingsContext.events.push({ + start: function (builder) { + builder.row(function (builder) { + builder.textInput("Type You're Welcome Message", config.get("customPrompt", defaultPrompt), function (value) { + config.set("customPrompt", value, true); + }) .maxLines(8) + .singleLine(false); + }); + }, + }); +} + +module.onSnapMainActivityCreate = activity => { + const customPrompt = String(config.get("customPrompt")) || "Type You're Welcome Message"; + shortToast(customPrompt); +} +function createInterface() { + createManagerToolBoxUI(); +} +function start(_) { + createInterface(); +} +start(); +im.create("settings" /* EnumUI.SETTINGS */, function (builder, args) { + settingsContext.events.forEach(function (event) { + event.start(builder, args); + }); +});