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

Implementing user metrics #33

Merged
merged 6 commits into from
Nov 7, 2024
Merged
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The device should be in the pocket for the best accuracy.

[4] Clime, C. sensorsstatus. OpenStore. Retrieved March 18, 2022, from https://open-store.io/app/sensorsstatus.chrisclime.

[5] Usage and implementing of the User Metrics (alias Circle Message): https://docs.ubports.com/en/latest/appdev/guides/user-metrics.html

## License
Copyright (C) 2023 Javad Rahimipour Anaraki

Expand Down
Empty file added logtext
Empty file.
2 changes: 1 addition & 1 deletion manifest.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"desktop": "steps.desktop"
}
},
"version": "1.1.1",
"version": "1.2.1",
"maintainer": "Javad Rahimipour Anaraki <jrahimipour@pm.me>",
"framework" : "@CLICK_FRAMEWORK@"
}
8 changes: 8 additions & 0 deletions po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,11 @@ msgstr "Výška (cm)"
#: ../qml/Setting.qml:152
msgid "Weight (kg)"
msgstr "Hmotnost (kg)"

#: ../qml/Main.qml:50
msgid "%1 Steps walked today."
msgstr "Dnes bylo změřeno %1 kroků"

#: ../qml/Main.qml:51
msgid "No hike measured today."
msgstr "Dnes nebyly změřeny žádné kroky."
7 changes: 7 additions & 0 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,12 @@ msgstr "Empfindlichkeit"
msgid "Goal (steps)"
msgstr "Tagesziel (Schritte)"

#: ../qml/Main.qml:50
msgid "%1 Steps walked today."
msgstr "Heute %1 Schritte gelaufen."

#: ../qml/Main.qml:51
msgid "No hike measured today."
msgstr "Heute wurden keine Schritte gemessen."
#~ msgid "Other"
#~ msgstr "Anderes"
8 changes: 8 additions & 0 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,11 @@ msgstr "Sensitivité"
#: ../qml/Setting.qml:250
msgid "Goal (steps)"
msgstr "Objectif (pas)"

#: ../qml/Main.qml:50
msgid "%1 Steps walked today."
msgstr "Aujourd'hui, %1 pas ont été mesurés"

#: ../qml/Main.qml:51
msgid "No hike measured today."
msgstr "Aucun pas n'a été mesuré aujourd'hui"
8 changes: 8 additions & 0 deletions po/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,11 @@ msgstr "Lengte (in cm)"
#: ../qml/Setting.qml:141
msgid "Weight (kg)"
msgstr "Gewicht (in kg)"

#: ../qml/Main.qml:50
msgid "%1 Steps walked today."
msgstr "Je hebt vandaag %1 stappen gelopen"

#: ../qml/Main.qml:51
msgid "No hike measured today."
msgstr "Er zijn vandaag geen stappen gemeten"
14 changes: 11 additions & 3 deletions po/steps.jranaraki.pot
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,23 @@ msgstr ""
msgid "Copyright"
msgstr ""

#: ../qml/MainPage.qml:46 ../qml/Setting.qml:40
#: ../qml/Main.qml:50
msgid "%1 Steps walked today."
msgstr ""

#: ../qml/Main.qml:51
msgid "No hike measured today."
msgstr ""

#: ../qml/MainPage.qml:46 ../qml/Setting.qml:39
msgid "Settings"
msgstr ""

#: ../qml/MainPage.qml:174
#: ../qml/MainPage.qml:176
msgid "Distance: %1 m"
msgstr ""

#: ../qml/MainPage.qml:174
#: ../qml/MainPage.qml:176
msgid "Steps: %1"
msgstr ""

Expand Down
10 changes: 9 additions & 1 deletion qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import QtQuick 2.7
import Lomiri.Components 1.3
import Qt.labs.settings 1.0
import UserMetrics 0.1

MainView {
id: mainView
Expand All @@ -42,7 +43,14 @@ MainView {
property int goalValue: 10000
property int commonMargin: units.gu(2)
}

Metric { // Define the Metric object.
property string circleMetric
id: metric // A name to reference the metric elsewhere in the code. i.e. when updating format values below.
name: "stepsMetric" // This is a unique ID for storing the user metric data
format: i18n.tr("%1 Steps walked today.") // This is the metric/message that will display "today". Again it uses the string variable that we defined above
emptyFormat: i18n.tr("No hike measured today.") // This is the metric/message for tomorrow. It will "activate" once the day roles over and replaces "format". Here I have use a simple translatable string instead of a variable because I didn’t need it to change.
domain: "steps.jranaraki" // This is the appname, based on what you have in your app settings. Presumably this is how the system lists/ranks the metrics to show on the lock screen.
}
PageStack {
id: pStack
}
Expand Down
6 changes: 4 additions & 2 deletions qml/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Lomiri.Components 1.3
import QtQuick.Layouts 1.3
import QtQuick.LocalStorage 2.0
import QtSensors 5.2
import QtQml 2.0
import UserMetrics 0.1

import "../js/db.js" as StepsDB

Expand Down Expand Up @@ -123,8 +123,10 @@ Page {

for (var i = 0; i < magNoG.length - 1; i++){
if ((magNoG[i] - magNoG[i+1]) > (11 - (preferences.sensitivityValue + 7.0))) {
nSteps = nSteps + 1
nSteps = nSteps+1
distance = Math.round(nSteps * preferences.strideValue) / 100
//Update the circle messae
metric.increment(1)
tmpSteps = tmpSteps + 1
listModel.setProperty(listIndex, "steps", nSteps)
listModel.setProperty(listIndex, "distance", distance)
Expand Down
4 changes: 2 additions & 2 deletions steps.apparmor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"policy_groups": ["sensors"],
"policy_version": 20.04
"policy_groups": ["sensors", "usermetrics"],
"policy_version": 16.04
}