mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-05-14 18:37:42 +00:00
use temp dir for cache
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
66346de898
commit
c1bbe6886d
1 changed files with 20 additions and 14 deletions
|
@ -19,7 +19,10 @@ async function loadScript(url) {
|
|||
let content = await req.loadString()
|
||||
let filename = url.split('/').pop()
|
||||
|
||||
return {content, filename}
|
||||
return {
|
||||
content,
|
||||
filename
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadWidget(widget) {
|
||||
|
@ -29,7 +32,10 @@ async function downloadWidget(widget) {
|
|||
downloadAlert.addCancelAction('No')
|
||||
|
||||
if (await downloadAlert.presentAlert() === 0) {
|
||||
let {content, filename} = await loadScript(widget.scriptURL)
|
||||
let {
|
||||
content,
|
||||
filename
|
||||
} = await loadScript(widget.scriptURL)
|
||||
|
||||
const scriptPath = fmCloud.joinPath(fmCloud.documentsDirectory(), filename)
|
||||
const scriptExists = fmCloud.fileExists(scriptPath)
|
||||
|
@ -90,7 +96,7 @@ function populateWidgetTable(table, widgets){
|
|||
|
||||
module.exports.present = async () => {
|
||||
// Set up cache .
|
||||
const cachePath = fmLocal.joinPath(fmLocal.documentsDirectory(), "widget-catalog")
|
||||
const cachePath = fmLocal.joinPath(fmLocal.temporaryDirectory(), "cache-widget-catalog")
|
||||
const cacheExists = fmLocal.fileExists(cachePath)
|
||||
const cacheDate = cacheExists ? fmLocal.modificationDate(cachePath) : 0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue