diff --git a/examples/disable_camera.js b/examples/disable_camera.js new file mode 100644 index 0000000..38b2068 --- /dev/null +++ b/examples/disable_camera.js @@ -0,0 +1,32 @@ +// ==SE_module== +// name: Camera Disabler +// version: 1.0 +// author: John Doe +// ==/SE_module== + +var hooker = require("hooker") +var im = require("interface-manager") +var config = require("config") + +module.onSnapEnhanceLoad = context => { + im.create("settings", builder => { + builder.row(builder => { + builder.text("Disable camera") + builder.switch(config.getBoolean("disableCamera", false), value => { + config.setBoolean("disableCamera", value, true) + }) + }).spacedBy(10).fillMaxWidth() + }) +} + +module.onSnapMainActivityCreate = activity => { + var getCameraDisabledMethod = hooker.findMethodWithParameters("android.app.admin.DevicePolicyManager", "getCameraDisabled", ["android.content.ComponentName"]) + + hooker.hook(getCameraDisabledMethod, hooker.stage.BEFORE, param => { + if (!config.getBoolean("disableCamera", false)) { + return + } + logInfo("getCameraDisabled called!") + param.result = true + }) +} \ No newline at end of file diff --git a/examples/simple_ipc.js b/examples/simple_ipc.js new file mode 100644 index 0000000..b400151 --- /dev/null +++ b/examples/simple_ipc.js @@ -0,0 +1,17 @@ +// ==SE_module== +// name: IPC Test +// version: 1.0 +// author: John Doe +// ==/SE_module== + +var ipc = require("ipc") + +module.onSnapEnhanceLoad = context => { + ipc.on("myEvent", (args) => { + longToast("received event: " + args) + }) +} + +module.onSnapMainActivityCreate = activity => { + ipc.emit("myEvent", "hello", 255, activity.packageName) +} \ No newline at end of file diff --git a/examples/toast.js b/examples/toast.js new file mode 100644 index 0000000..2a7adc0 --- /dev/null +++ b/examples/toast.js @@ -0,0 +1,22 @@ +// ==SE_module== +// name: Toasts +// description: Shows various toast messages +// version: 1.0 +// author: John Doe +// ==/SE_module== + +module.onSnapMainActivityCreate = activity => { + shortToast("Snapchat opened!") +} + +module.onSnapApplicationLoad = context => { + shortToast("Snapchat loaded!") +} + +module.onSnapEnhanceLoad = context => { + shortToast("SnapEnhance loaded!") +} + +module.onUnload = () => { + shortToast("Script unloaded!") +} \ No newline at end of file