-
Notifications
You must be signed in to change notification settings - Fork 16
/
News Widget Clear Cache.js
33 lines (29 loc) · 1.05 KB
/
News Widget Clear Cache.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: trash-alt;
/********************************************
* *
* DELETE NEWS WIDGET CACHE *
* *
* v1.1.3 - made by @saudumm *
* https://twitter.com/saudumm *
* *
*******************************************/
// GitHub Repo:
// https://github.com/Saudumm/scriptable-News-Widget
let fm = FileManager.local();
let docDir = fm.documentsDirectory();
let alertMsg = "No files to delete";
if (await fm.fileExists(docDir+"/saudumm-news-widget-data")) {
try {
await fm.remove(docDir+"/saudumm-news-widget-data");
alertMsg = "All cache files deleted!";
} catch(err) {
alertMsg = "Error while deleting cache files\n\n"+err;
}
}
let alert = new Alert();
alert.message = "\n"+alertMsg;
alert.title = "Clear News Widget Cache";
alert.addAction("OK");
alert.presentAlert();