提交 983aa579 编写于 作者: AndroidLeaves's avatar AndroidLeaves

update

上级 4738e7a3
......@@ -8,7 +8,7 @@
*/
// 当前环境版本号
const VERSION = 20221215
const VERSION = 20221220
// 组件配置文件名
const settingConfigName = 'settings.json';
// 组件默认配置
......@@ -302,17 +302,21 @@ class BaseWidget {
notify = async (title, body, url, opts = {}) => {
const widgetSetting = await this.readWidgetSetting();
if (widgetSetting.notify) {
let n = new Notification();
n = Object.assign(n, opts);
n.title = title;
n.body = body;
if (url) n.openURL = url;
return await n.schedule();
return await this.realNotify(title, body, url, opts);
} else {
return null;
}
}
realNotify = async (title, body, url, opts = {}) => {
let n = new Notification();
n = Object.assign(n, opts);
n.title = title;
n.body = body;
if (url) n.openURL = url;
return await n.schedule();
}
scaleFontSize = (defaultFontSize, textLength, startLength) => {
let fontSize = defaultFontSize;
if (textLength >= startLength) {
......@@ -2894,7 +2898,7 @@ class BaseWidget {
// -----------------------------------
itemRow.dismissOnSelect = false;
itemRow.onSelect = async () => {
await this.notify("下载提示", `开始下载小组件『${item.title}』`);
await this.realNotify("下载提示", `开始下载小组件『${item.title}』`);
if (item.depend) {
try {
for (let index = 0; index < item.depend.length; index++) {
......@@ -2904,7 +2908,7 @@ class BaseWidget {
url: relyItem.scriptURL,
});
if (_isWrite) {
await this.notify("下载提示", `依赖插件:『${relyItem.name}』下载/更新成功`);
await this.realNotify("下载提示", `依赖插件:『${relyItem.name}』下载/更新成功`, `scriptable:///run/${encodeURIComponent(relyItem.name)}`);
}
}
} catch (e) {
......@@ -2918,7 +2922,7 @@ class BaseWidget {
url: item.scriptURL,
});
if (isWrite) {
await this.notify("下载提示", `小组件:『${item.title}』 下载/更新成功`);
await this.realNotify("下载提示", `小组件:『${item.title}』 下载/更新成功`, `scriptable:///run/${encodeURIComponent(relyItem.name)}`);
}
};
// -----------------------------------
......
此差异已折叠。
......@@ -47,7 +47,7 @@ class Widget extends BaseWidget {
widgetProvider: {
small: false, // 是否提供小号组件
medium: true, // 是否提供中号组件
large: true, // 是否提供大号组件
large: false, // 是否提供大号组件
},
// 预览界面的组件设置item
settingItems: [
......@@ -78,10 +78,6 @@ class Widget extends BaseWidget {
case 'medium':
widget = await this.provideMediumWidget(widgetSetting);
break;
case 'large':
widget = await this.provideLargeWidget(widgetSetting);
break;
}
widget.setPadding(6, 12, 6, 12);
return widget;
......@@ -178,9 +174,9 @@ class Widget extends BaseWidget {
rdStack.size = new Size(rightStackWidth - 20, perHeight);
rdStack.setPadding(0, 8, 0, 8);
rdStack.centerAlignContent();
let alpha = 0.05;
let alpha = 0.06;
if (rd.isOverdue) {
alpha = 0.2;
alpha = 0.3;
}
rdStack.backgroundColor = new Color(`${rd.color}`, alpha);
rdStack.cornerRadius = 4;
......@@ -199,13 +195,6 @@ class Widget extends BaseWidget {
return widget;
}
/**
* 大型组件
* @returns
*/
async provideLargeWidget() {
}
// --------------------------NET START--------------------------
async loadReminderList() {
const calendar = await Calendar.forReminders();
......
......@@ -56,9 +56,9 @@ class Widget extends BaseWidget {
scheme: 'alipay://platformapi/startapp?appId=200011235'
},
{
icon: 'https://gitee.com/enjoyee/img/raw/master/other/ali_scan.png',
name: '粤康码',
scheme: 'weixin://dl/business/?t=QDZVQEO2z9f'
icon: 'globe.asia.australia',
name: '蚂蚁森林',
scheme: 'alipay://platformapi/startapp?appId=60000002'
},
],
enFontUrl: "https://gitcode.net/enoyee/scriptable/-/raw/master/font/Facon.ttf",
......@@ -389,7 +389,7 @@ class Widget extends BaseWidget {
const quickStackBg = new Color('333', 0.2);
const quickPadding = 10;
const quickTextColor = new Color(this.quickFontColor(), 0.9);
const quickFont = Font.semiboldSystemFont(Number(this.quickFontSize()));
const quickFont = (textLength = 3) => Font.semiboldSystemFont(textLength < 3 ? Number(this.quickFontSize()) : Number(this.quickFontSize()) - 1);
const imageOpacity = 0.8;
//---------------------------------
let leftStack = stack.addStack();
......@@ -420,7 +420,7 @@ class Widget extends BaseWidget {
//
let image;
let imgUrl = item.icon;
if ((imgUrl).startsWith('http')) {
if (imgUrl.startsWith('http')) {
image = await this.getImageByUrl(imgUrl);
} else {
image = this.getSFSymbol(imgUrl);
......@@ -441,7 +441,7 @@ class Widget extends BaseWidget {
let textWidget = hStack.addText(item.name);
hStack.addSpacer();
textWidget.textColor = quickTextColor;
textWidget.font = quickFont;
textWidget.font = quickFont(item.name.length);
}
//////////////////////////////////////////////////
leftStack.addSpacer();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册