mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-06-07 05:57:41 +00:00
design improvment and add ordernumber to cache name
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
7b44dc1d31
commit
a9f9741d42
1 changed files with 27 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
// Variables used by Scriptable.
|
// Variables used by Scriptable.
|
||||||
// These must be at the very top of the file. Do not edit.
|
// These must be at the very top of the file. Do not edit.
|
||||||
// icon-color: deep-blue; icon-glyph: shopping-cart;
|
// icon-color: deep-blue; icon-glyph: shopping-cart;
|
||||||
// Version 1.0.2
|
// Version 1.0.3
|
||||||
|
|
||||||
const cacheMinutes = 60 * 2
|
const cacheMinutes = 60 * 2
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
|
@ -12,7 +12,7 @@ const debug = false
|
||||||
if (config.widgetFamily === 'small') {
|
if (config.widgetFamily === 'small') {
|
||||||
width = 100
|
width = 100
|
||||||
} else {
|
} else {
|
||||||
width = 200
|
width = 300
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -30,7 +30,7 @@ if (widgetInputRAW !== null) {
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const files = FileManager.local()
|
const files = FileManager.local()
|
||||||
|
|
||||||
const path = files.joinPath(files.cacheDirectory(), "widget-apple-store-order")
|
const path = files.joinPath(files.cacheDirectory(), "widget-apple-store-order-" + widgetInput[0])
|
||||||
|
|
||||||
const cacheExists = files.fileExists(path)
|
const cacheExists = files.fileExists(path)
|
||||||
|
|
||||||
|
@ -233,6 +233,7 @@ if (!orderDetails) {
|
||||||
const headlineText = widget.addText(' Order Status')
|
const headlineText = widget.addText(' Order Status')
|
||||||
headlineText.font = Font.regularSystemFont(14)
|
headlineText.font = Font.regularSystemFont(14)
|
||||||
headlineText.textColor = Color.black()
|
headlineText.textColor = Color.black()
|
||||||
|
headlineText.centerAlignText()
|
||||||
|
|
||||||
widget.addSpacer()
|
widget.addSpacer()
|
||||||
|
|
||||||
|
@ -240,16 +241,23 @@ if (!orderDetails) {
|
||||||
productStack.layoutHorizontally()
|
productStack.layoutHorizontally()
|
||||||
|
|
||||||
itemImageElement = productStack.addImage(itemImage)
|
itemImageElement = productStack.addImage(itemImage)
|
||||||
itemImageElement.imageSize = new Size(30, 30)
|
itemImageElement.imageSize = new Size(35, 35)
|
||||||
|
itemImageElement.applyFillingContentMode()
|
||||||
|
|
||||||
productStack.addSpacer(10)
|
productStack.addSpacer(20)
|
||||||
|
|
||||||
const itemNameText = productStack.addText(itemName)
|
rightProductStack = productStack.addStack()
|
||||||
itemNameText.font = Font.regularSystemFont(16)
|
rightProductStack.layoutVertically()
|
||||||
|
rightProductStack.addSpacer()
|
||||||
|
|
||||||
|
const itemNameText = rightProductStack.addText(itemName)
|
||||||
|
itemNameText.font = Font.regularSystemFont(10)
|
||||||
itemNameText.textColor = Color.black()
|
itemNameText.textColor = Color.black()
|
||||||
itemNameText.minimumScaleFactor = 0.3
|
itemNameText.minimumScaleFactor = 0.5
|
||||||
itemNameText.lineLimit = 2
|
itemNameText.lineLimit = 2
|
||||||
|
|
||||||
|
rightProductStack.addSpacer()
|
||||||
|
|
||||||
widget.addSpacer()
|
widget.addSpacer()
|
||||||
|
|
||||||
const languageCode = Device.preferredLanguages()[0].match(/^[\a-z]{2}/)
|
const languageCode = Device.preferredLanguages()[0].match(/^[\a-z]{2}/)
|
||||||
|
@ -266,22 +274,26 @@ if (!orderDetails) {
|
||||||
const total = (deliveryDate - orderDate) / (1000 * 60 * 60 * 24)
|
const total = (deliveryDate - orderDate) / (1000 * 60 * 60 * 24)
|
||||||
const daysGone = total - remainingDays
|
const daysGone = total - remainingDays
|
||||||
|
|
||||||
widget.addImage(creatProgress(total, daysGone))
|
const progressStack = widget.addStack()
|
||||||
|
progressStack.layoutVertically()
|
||||||
|
progressStack.addImage(creatProgress(total, daysGone))
|
||||||
|
|
||||||
widget.addSpacer(5)
|
progressStack.spacing = 2
|
||||||
|
|
||||||
const footerStack = widget.addStack()
|
const footerStack = progressStack.addStack()
|
||||||
footerStack.layoutHorizontally()
|
footerStack.layoutHorizontally()
|
||||||
|
|
||||||
const orderDateText = footerStack.addDate(orderDate)
|
const orderDateText = footerStack.addText(orderDate.toLocaleDateString())
|
||||||
orderDateText.textColor = Color.black()
|
orderDateText.textColor = Color.black()
|
||||||
orderDateText.font = Font.regularSystemFont(8)
|
orderDateText.font = Font.regularSystemFont(10)
|
||||||
|
orderDateText.lineLimit = 1
|
||||||
|
|
||||||
footerStack.addSpacer()
|
footerStack.addSpacer()
|
||||||
|
|
||||||
const deliveryDateText = footerStack.addDate(deliveryDate)
|
const deliveryDateText = footerStack.addText(deliveryDate.toLocaleDateString())
|
||||||
deliveryDateText.textColor = Color.black()
|
deliveryDateText.textColor = Color.black()
|
||||||
deliveryDateText.font = Font.regularSystemFont(8)
|
deliveryDateText.font = Font.regularSystemFont(10)
|
||||||
|
deliveryDateText.lineLimit = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.runsInWidget) {
|
if (!config.runsInWidget) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue