Отсканируй на iPhone, чтобы установить
Просмотр
Simple tool to check your battery performance over time.
V1.1
- Added estimation of remaining battery time
V1.0
Parameters (they have to be added manually from Battery settings as there's no way to get it):
- Last time charge date
- Percentage of last charge (by default is 100 but this shortcut works with any percentage :D)
Что нового
Версия 1.1
Added estimation of remaining battery time
Что делает
Действий: 22-
Get Battery Level
-
Get File
-
If
-
Get Dictionary Value
-
Get Time Between Dates
-
Calculate Expression
-
Calculate Expression
-
Format Number
-
Text
-
Choose from Menu…
-
Choose from Menu🔢 Set new date
-
Nothing
-
Choose from Menu⏏️ Quit
-
Stop This Shortcut
-
Ask for InputLast charge date & time
-
Get Time Between Dates
-
Ask for InputPercentage
-
Dictionary
-
Save File
-
Calculate Expression
-
Text
-
Show Alert…
Посмотреть как код
Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.
#include 'actions/device'
#define color yellow
#define glyph battery
const BatteryLevel = getBatteryLevel()
const SettingsFile = getFileFromFolder(, "TimeElapsed/settings.json", false)
if SettingsFile {
const date = SettingsFile['date']
const SavedHoursSinceLastCharge = rawAction("is.workflow.actions.gettimebetweendates")
const BatteryConsumed = 100 - ((BatteryLevel*100)/SettingsFile['percentage'])
const PotentialBatteryTimeLeft = ((100 * SavedHoursSinceLastCharge) / BatteryConsumed) - SavedHoursSinceLastCharge
const BatteryLeftFormatted = formatNumber(PotentialBatteryTimeLeft)
const LastTimeHeader = "{SavedHoursSinceLastCharge} hours elapsed since {date}.\n\nYou've consumed {BatteryConsumed}% of your battery!\n\nYou have approximately {BatteryLeftFormatted} hour(s) of battery life left, use it wisely!"
menu LastTimeHeader {
item "🔢 Set new date":
nothing()
item "⏏️ Quit":
stop()
}
}
const LastCharge = prompt("Last charge date & time", "Date and Time")
const HoursSinceLastCharge = rawAction("is.workflow.actions.gettimebetweendates")
const Percentage = prompt("Percentage ", "Number")
const Dictionary = {
"date": "{LastCharge}",
"percentage": "{Percentage}"
}
saveFile("TimeElapsed/settings.json", Dictionary, true)
const NewBatteryConsumed = 100 - ((BatteryLevel* 100)/Percentage)
const BatteryMessage = "{HoursSinceLastCharge} hours elapsed since {LastCharge}.\n\nYou've cosumed {NewBatteryConsumed}% of your battery!"
alert("", BatteryMessage)
Открыть в Cherri Playground
Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.
Оценки и отзывы
Написать отзыв–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings
Пока нет отзывов. Поделись мнением первым!
Реклама
Ещё от cdmoro
Вам также может понравиться
Реклама