提交 7d13ca51 编写于 作者: AndroidLeaves's avatar AndroidLeaves

update

上级 22ca21b2
......@@ -8,7 +8,7 @@
*/
// 当前环境版本号
const VERSION = 20221208
const VERSION = 20221209
// 组件配置文件名
const settingConfigName = 'settings.json';
// 组件默认配置
......@@ -53,11 +53,12 @@ class BaseWidget {
return settings;
} catch (error) {
console.error(error);
this.ERRS.push(error);
if (!config.runsInApp) {
this.notify('配置读取失败', `${error}`);
} else {
throw error
}
this.ERRS.push(error);
throw error
}
}
......@@ -66,11 +67,12 @@ class BaseWidget {
this.useFileManager().writeJSONCache(settingConfigName, data);
} catch (error) {
console.error(error);
this.ERRS.push(error);
if (!config.runsInApp) {
this.notify('配置写入失败', `${error}`);
} else {
throw error
}
this.ERRS.push(error);
throw error
}
}
......@@ -79,11 +81,12 @@ class BaseWidget {
this.useFileManager().cleanWidgetCache();
} catch (error) {
console.error(error);
this.ERRS.push(error);
if (!config.runsInApp) {
this.notify('配置移除失败', `${error}`);
} else {
throw error
}
this.ERRS.push(error);
throw error
}
}
......@@ -230,7 +233,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
this.notify('文件操作', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -244,11 +251,12 @@ class BaseWidget {
return true;
} catch (error) {
console.error(error);
this.ERRS.push(error);
if (!config.runsInApp) {
this.notify('文件保存', `${error}`);
} else {
throw error;
}
this.ERRS.push(error);
throw error;
}
};
......@@ -350,7 +358,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
this.notify('渐变色', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -432,7 +444,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
await this.notify('icon绘制', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -454,11 +470,7 @@ class BaseWidget {
return image;
} catch (error) {
console.error(error);
if (!config.runsInApp) {
this.notify('字体加载', `${error}`);
}
this.ERRS.push(error);
throw error
}
}
......@@ -749,11 +761,12 @@ class BaseWidget {
}
} catch (e) {
console.error(`🚫 Get请求失败:${e}${url}`);
this.ERRS.push(e);
if (!config.runsInApp) {
await this.notify('网络请求失败', `🚫 ${e}`);
} else {
throw e
}
this.ERRS.push(e);
throw e
}
this.logDivider();
return data;
......@@ -831,11 +844,12 @@ class BaseWidget {
}
} catch (error) {
console.error(`🚫 Post请求失败:${error}${url}`);
this.ERRS.push(error);
if (!config.runsInApp) {
await this.notify('网络请求失败', `🚫 ${error}`);
} else {
throw error
}
this.ERRS.push(error);
throw error
}
this.logDivider();
return data;
......@@ -917,11 +931,12 @@ class BaseWidget {
if (locationCache && locationCache.length > 0) {
locationData = JSON.parse(locationCache);
}
this.ERRS.push(error);
if (!config.runsInApp) {
await this.notify('定位出错', `🚫 ${error}`);
} else {
throw error
}
this.ERRS.push(error);
throw error
}
this.logDivider();
return locationData;
......@@ -940,9 +955,13 @@ class BaseWidget {
return await drawContext.getImage()
} catch (error) {
console.error(error);
this.logDivider();
this.ERRS.push(error);
throw error
this.logDivider();
if (!config.runsInApp) {
await this.notify('蒙层添加', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -1680,7 +1699,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
await this.notify('透明背景', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -2325,20 +2348,30 @@ class BaseWidget {
const injectListener = async () => {
const event = await previewWebView.evaluateJavaScript(
`(() => {
const controller = new AbortController()
const listener = (e) => {
completion(e.detail)
controller.abort()
try {
const controller = new AbortController()
const listener = (e) => {
completion(e.detail)
controller.abort()
}
window.addEventListener(
'JBridge',
listener,
{ signal: controller.signal }
)
} catch (e) {
alert("预览界面出错:" + e);
throw new Error("界面处理出错: " + e);
return;
}
window.addEventListener(
'JBridge',
listener,
{ signal: controller.signal }
)
})()`, true).catch((err) => {
console.error(err);
this.ERRS.push(err);
throw err
if (!config.runsInApp) {
this.notify('APP主界面', `🚫 ${err}`);
} else {
throw err
}
});
////////////////////////////////////
let widgetSetting = this.readWidgetSetting();
......@@ -2422,7 +2455,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
await this.notify('背景处理', `🚫 ${error}`);
} else {
throw error
}
}
this.dismissLoading(previewWebView);
break
......@@ -2534,7 +2571,11 @@ class BaseWidget {
injectListener().catch((e) => {
console.error(e);
this.ERRS.push(e);
throw e
if (!config.runsInApp) {
this.notify('主界面', `🚫 ${e}`);
} else {
throw e
}
});
previewWebView.present();
......@@ -2651,7 +2692,11 @@ class BaseWidget {
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
if (!config.runsInApp) {
await this.notify('小组件运行出错', `🚫 ${error}`);
} else {
throw error
}
}
}
......@@ -2972,8 +3017,6 @@ class CustomFont {
return Image.fromData(imageData)
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
}
}
......@@ -3013,8 +3056,6 @@ class CustomFont {
`)
} catch (error) {
console.error(error);
this.ERRS.push(error);
throw error
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册