Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UsabilityImprovements #12

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![](https://img.shields.io/badge/Fitbit%20App%20Gallery-%2300B0B9?style=flat&logo=fitbit&logoColor=white)](https://gallery.fitbit.com/details/ae441b73-2660-407f-b796-a98d1d0583a0)
![languages](https://img.shields.io/badge/languages-JavaScript%20|%20CSS-blue)
![platform](https://img.shields.io/badge/platforms-Ionic%20|%20Versa%20|%20Versa%202%20|%20Versa%20Lite-silver)
![version](https://img.shields.io/badge/version-%201.4.0-green)
![version](https://img.shields.io/badge/version-%201.4.1-green)
[![](https://img.shields.io/github/license/smirko-dev/fitbit-clockface.svg)](https://github.com/smirko-dev/fitbit-clockface/blob/master/LICENSE)
[![FitbitBuild Actions Status](https://github.com/smirko-dev/fitbit-clockface/workflows/FitbitBuild/badge.svg)](https://github.com/smirko-dev/fitbit-clockface/actions)
[![CodeQL Actions Status](https://github.com/smirko-dev/fitbit-clockface/workflows/CodeQL/badge.svg)](https://github.com/smirko-dev/fitbit-clockface/actions)
Expand All @@ -17,6 +17,7 @@ It comes with
- battery icon (Ionic: and status in percentage)
- next calendar event of the current day
- user activity in case of no events (selectable in settings menu)
- touch to hide calendar event temporarily

Find the latest published version in the [Fitbit gallery](https://gallery.fitbit.com/details/ae441b73-2660-407f-b796-a98d1d0583a0).

Expand Down
27 changes: 17 additions & 10 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import document from "document";
import { battery } from "power";
import { preferences } from "user-settings";
import { display } from "display";
import { today } from 'user-activity';
import { me } from "appbit";
import { me as device } from "device";
import * as util from "../common/utils";
import * as appointment from "./appointment";
import * as clock from "./clock";
import * as messaging from "messaging";
Expand Down Expand Up @@ -67,8 +64,6 @@ clock.initialize("minutes", data => {
dateLabel.text = data.date;
// Update appointment
renderAppointment();
// Update battery
renderBattery();
});

battery.onchange = (evt) => {
Expand All @@ -81,13 +76,23 @@ appointment.initialize(() => {
});

display.addEventListener("change", () => {
// Update appointment and battery on display on
if (display.on) {
// Update appointment and battery on display on
renderAppointment();
renderBattery();
}
else {
// Stop updating activity info
hideActivity();
}
});

// Hide event when touched
appointmentsLabel.addEventListener("mousedown", () => {
showActivity();
updateActivity();
})

function renderAppointment() {
// Upate the appointment <text> element
let event = appointment.next();
Expand All @@ -106,14 +111,14 @@ function hideActivity() {
activityIcon.style.opacity = INVISIBLE;
activityLabel.style.opacity = INVISIBLE;
appointmentsLabel.style.opacity = VISIBLE;
clearInterval(activityIntervalID);
//clearInterval(activityIntervalID);
}

function showActivity() {
activityIcon.style.opacity = VISIBLE;
activityLabel.style.opacity = VISIBLE;
appointmentsLabel.style.opacity = INVISIBLE;
activityIntervalID = setInterval(updateActivity, 1500);
//activityIntervalID = setInterval(updateActivity, 1500);
}

function updateActivity() {
Expand All @@ -123,7 +128,6 @@ function updateActivity() {
activityLabel.text = today.adjusted.distance;
break;
case ActivitySelection.FLOORS:

activityIcon.image = "floors.png";
activityLabel.text = today.adjusted.elevationGain;
break;
Expand All @@ -146,7 +150,10 @@ function renderBattery() {
const level = Math.floor(battery.chargeLevel / 10) * 10;
if (level < 20) {
batteryImage.image = `battery-alert.png`;
} else {
}
else {
batteryImage.image = `battery-${Math.floor(battery.chargeLevel / 10) * 10}.png`;
}
}

renderBattery();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "compactclock",
"version": "1.4.0",
"version": "1.4.1",
"license": "MIT",
"devDependencies": {
"@fitbit/sdk": "~4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion resources/index.gui
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<text id="hourLabel" />
<text id="minuteLabel" />
<text id="dateLabel" opacity=".8" />
<textarea id="appointmentsLabel" opacity=".8" />
<textarea id="appointmentsLabel" opacity=".8" pointer-events="visible" />
<image id="batteryImage" href="battery-alert.png" x="275" y="5" width="24" height="24" opacity=".6" class="batteryIcon" />
<text id="batteryLabel" opacity=".8" />
<image id="activityIcon" href="steps.png" x="35%" y="80%" width="32" height="32" opacity=".8" class="activityIcon" />
Expand Down