mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-06-06 13:37:41 +00:00
small change vodafone
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
90d108a622
commit
8021750a6a
1 changed files with 57 additions and 69 deletions
|
@ -3,9 +3,11 @@
|
|||
// icon-color: red; icon-glyph: broadcast-tower;
|
||||
|
||||
/**************
|
||||
Version 1.2.3
|
||||
Version 1.2.4
|
||||
|
||||
Changelog:
|
||||
v1.2.4:
|
||||
- use color.dynamic
|
||||
v1.2.3:
|
||||
- Fix typo (thanks @CuzImStantac)
|
||||
v1.2.2:
|
||||
|
@ -46,12 +48,6 @@ const containerList = ['Daten', 'D_EU_DATA', 'C_DIY_Data_National']
|
|||
const codeList = ['-1', '45500', '40100']
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
let backColor; //Widget background color
|
||||
let backColor2; //Widget background color
|
||||
let textColor; //Widget text color
|
||||
let fillColor;
|
||||
let strokeColor;
|
||||
|
||||
let widgetInputRAW = args.widgetParameter;
|
||||
let widgetInput = null;
|
||||
|
||||
|
@ -68,19 +64,11 @@ if (widgetInputRAW !== null) {
|
|||
}
|
||||
}
|
||||
|
||||
if (Device.isUsingDarkAppearance()) {
|
||||
backColor = '111111';
|
||||
backColor2 = '222222';
|
||||
textColor = 'EDEDED';
|
||||
fillColor = 'EDEDED';
|
||||
strokeColor = '121212';
|
||||
} else {
|
||||
backColor = 'D32D1F';
|
||||
backColor2 = '76150C';
|
||||
textColor = 'EDEDED';
|
||||
fillColor = 'EDEDED';
|
||||
strokeColor = 'B0B0B0';
|
||||
}
|
||||
const backColor = Color.dynamic(new Color('D32D1F'), new Color('111111'));
|
||||
const backColor2 = Color.dynamic(new Color('76150C'), new Color('222222'));
|
||||
const textColor = Color.dynamic(new Color('EDEDED'), new Color('EDEDED'));
|
||||
const fillColor = Color.dynamic(new Color('EDEDED'), new Color('EDEDED'));
|
||||
const strokeColor = Color.dynamic(new Color('B0B0B0'), new Color('121212'));
|
||||
|
||||
const canvas = new DrawContext();
|
||||
const canvSize = 200;
|
||||
|
@ -107,8 +95,8 @@ function drawArc(ctr, rad, w, deg) {
|
|||
bgd = 2 * rad;
|
||||
bgr = new Rect(bgx, bgy, bgd, bgd);
|
||||
|
||||
canvas.setFillColor(new Color(fillColor));
|
||||
canvas.setStrokeColor(new Color(strokeColor));
|
||||
canvas.setFillColor(fillColor);
|
||||
canvas.setStrokeColor(strokeColor);
|
||||
canvas.setLineWidth(w);
|
||||
canvas.strokeEllipse(bgr);
|
||||
|
||||
|
@ -249,7 +237,7 @@ async function getUsage(user, pass, number) {
|
|||
|
||||
let endDate = datenvolumen.endDate;
|
||||
if (endDate == null) {
|
||||
endDate = res['serviceUsageVBO']['billDetails']['billCycleEndDate'] || null
|
||||
endDate = res['serviceUsageVBO']['billDetails']['billCycleEndDate'] || null
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -317,8 +305,8 @@ if (data !== undefined) {
|
|||
const gradient = new LinearGradient()
|
||||
gradient.locations = [0, 1]
|
||||
gradient.colors = [
|
||||
new Color(backColor),
|
||||
new Color(backColor2)
|
||||
backColor,
|
||||
backColor2
|
||||
]
|
||||
widget.backgroundGradient = gradient
|
||||
|
||||
|
@ -326,7 +314,7 @@ if (data !== undefined) {
|
|||
|
||||
let provider = firstLineStack.addText("Vodafone")
|
||||
provider.font = Font.mediumSystemFont(12)
|
||||
provider.textColor = new Color(textColor)
|
||||
provider.textColor = textColor
|
||||
|
||||
// Last Update
|
||||
firstLineStack.addSpacer()
|
||||
|
@ -354,7 +342,7 @@ if (data !== undefined) {
|
|||
canvTextSize
|
||||
);
|
||||
canvas.setTextAlignedCenter();
|
||||
canvas.setTextColor(new Color(textColor));
|
||||
canvas.setTextColor(textColor);
|
||||
canvas.setFont(Font.boldSystemFont(canvTextSize));
|
||||
canvas.drawTextInRect(`${remainingPercentage}%`, canvTextRect);
|
||||
|
||||
|
@ -376,7 +364,7 @@ if (data !== undefined) {
|
|||
let totalValuesText = widget.addText(totalValues)
|
||||
totalValuesText.font = Font.mediumSystemFont(12)
|
||||
totalValuesText.centerAlignText()
|
||||
totalValuesText.textColor = new Color(textColor)
|
||||
totalValuesText.textColor = textColor
|
||||
|
||||
// Remaining Days
|
||||
if (data.endDate) {
|
||||
|
@ -385,13 +373,13 @@ if (data !== undefined) {
|
|||
let remainingDaysText = widget.addText(`${remainingDays} Tage verbleibend`)
|
||||
remainingDaysText.font = Font.mediumSystemFont(8)
|
||||
remainingDaysText.centerAlignText()
|
||||
remainingDaysText.textColor = new Color(textColor)
|
||||
remainingDaysText.textColor = textColor
|
||||
}
|
||||
|
||||
} else {
|
||||
let fallbackText = widget.addText("Es ist ein Fehler aufgetreten! Bitte prüfen Sie die Logs direkt in der App.")
|
||||
fallbackText.font = Font.mediumSystemFont(12)
|
||||
fallbackText.textColor = new Color(textColor)
|
||||
fallbackText.textColor = textColor
|
||||
}
|
||||
|
||||
if (!config.runsInWidget) {
|
||||
|
|
Loading…
Add table
Reference in a new issue