add UUID to Config and Cache Name

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2020-12-28 21:33:01 +01:00
parent 5395257a56
commit 57b7da9f88
No known key found for this signature in database
GPG key ID: 69DE3C3C097DB7F7

View file

@ -13,6 +13,7 @@ Changelog:
- use MSISDN for Cache-Name - use MSISDN for Cache-Name
- show amount for prepaid cards - show amount for prepaid cards
- show remaining days as progress-bar - show remaining days as progress-bar
- Setup assistent
v1.2.4: v1.2.4:
- use color.dynamic - use color.dynamic
v1.2.3: v1.2.3:
@ -82,7 +83,7 @@ config.widgetFamily = config.widgetFamily || 'small'
let widgetInputRAW = args.widgetParameter; let widgetInputRAW = args.widgetParameter;
let widgetInput = null; let widgetInput = null;
let user, pass, number, json let user, pass, number, json, cacheUUID
if (widgetInputRAW !== null) { if (widgetInputRAW !== null) {
const parameter = widgetInputRAW.toString().split("|") const parameter = widgetInputRAW.toString().split("|")
if(parameter.length > 1) { if(parameter.length > 1) {
@ -100,7 +101,7 @@ if (widgetInputRAW !== null) {
if (json) { if (json) {
try { try {
const c = JSON.parse(json) const c = JSON.parse(json)
cacheUUID = c.uuid || null
containerList = c.containerList || containerList containerList = c.containerList || containerList
codeList = c.codeList || codeList codeList = c.codeList || codeList
darkModeSupport = c.darkModeSupport !== undefined ? c.darkModeSupport : darkModeSupport darkModeSupport = c.darkModeSupport !== undefined ? c.darkModeSupport : darkModeSupport
@ -288,6 +289,7 @@ async function setupAssistant () {
const codeList = [...new Set(selectedList.map(x => x.code))] const codeList = [...new Set(selectedList.map(x => x.code))]
const options = { const options = {
uuid: UUID.string(),
containerList, containerList,
codeList codeList
} }
@ -576,7 +578,7 @@ var today = new Date()
const files = FileManager.local() const files = FileManager.local()
// Set up cache // Set up cache
const cacheNamePostfix = (number) ? number.substr(number.length - 4) : 'networkLogin' const cacheNamePostfix = ((number) ? number.substr(number.length - 4) : 'networkLogin') + ( cacheUUID ? `-${cacheUUID}` : '')
const cachePath = files.joinPath(files.documentsDirectory(), "widget-vodafone-" + cacheNamePostfix) const cachePath = files.joinPath(files.documentsDirectory(), "widget-vodafone-" + cacheNamePostfix)
const cacheExists = files.fileExists(cachePath) const cacheExists = files.fileExists(cachePath)
const cacheDate = cacheExists ? files.modificationDate(cachePath) : 0 const cacheDate = cacheExists ? files.modificationDate(cachePath) : 0