MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / callback

Function callback

src/settings/terminalSettings.js:262–321  ·  view source on GitHub ↗

* Callback for settings page when an item is clicked * @param {string} key * @param {string} value

(key, value)

Source from the content-addressed store, hash-verified

260 * @param {string} value
261 */
262 async function callback(key, value) {
263 switch (key) {
264 case "all_file_access":
265 if (ANDROID_SDK_INT >= 30) {
266 system.isManageExternalStorageDeclared((boolStr) => {
267 if (boolStr === "true") {
268 system.requestStorageManager(console.log, console.error);
269 } else {
270 alert(strings["feature not available"]);
271 }
272 }, alert);
273 } else {
274 alert(strings["feature not available"]);
275 }
276
277 return;
278 case "backup":
279 terminalBackup();
280 return;
281
282 case "restore":
283 terminalRestore();
284 return;
285
286 case "uninstall":
287 const confirmation = await confirm(
288 strings.confirm,
289 strings["settings-info-terminal-uninstall"],
290 );
291 if (confirmation) {
292 loader.showTitleLoader();
293 Terminal.uninstall()
294 .then(() => {
295 loader.removeTitleLoader();
296 alert(
297 strings.success.toUpperCase(),
298 `${strings["uninstalled successfully"]}.`,
299 );
300 })
301 .catch((error) => {
302 loader.removeTitleLoader();
303 console.error("Terminal uninstall failed:", error);
304 helpers.error(error);
305 });
306 }
307 return;
308
309 default:
310 appSettings.update({
311 terminalSettings: {
312 ...values.terminalSettings,
313 [key]: value,
314 },
315 });
316
317 // Update any active terminal instances
318 updateActiveTerminals(key, value);
319 break;

Callers

nothing calls this directly

Calls 7

alertFunction · 0.85
terminalBackupFunction · 0.85
terminalRestoreFunction · 0.85
confirmFunction · 0.85
updateActiveTerminalsFunction · 0.85
errorMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected