Skip to content

Commit

Permalink
feat: improve setting and add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Turtlepaw committed Nov 2, 2024
1 parent b5c33e7 commit 259b9c7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# October Changelog
> [!NOTE]
> Not complete
- 1 new challenge
- 🎲 Bingo
- 3 new data types (viewable in ⚙️ Settings)
- 💧 Water
- 🔥 Calories
- 🏃 Distance
- More account controls in-app (⚙️ Settings -> ✏️ [edit profile])
- 📨 Change password
- 🗑️ Delete Account
- More challenge controls (Select a challenge -> More [three dots])
- 🕑 End challenge
- Obtain app logs (More [three dots] -> 🪲 Debug Logs)
- ⚠️ May contain sensitive information!

#### Internal

We've really cleaned up a lot of code, and added the [`SharedLogger`](/lib/utils/sharedLogger.dart) which allows logs to be exported. As always, we've also fixed a bunch of bugs, and you'll notice several improvements throughout the app.
23 changes: 13 additions & 10 deletions lib/routes/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,19 @@ class _SettingsPageState extends State<SettingsPage> {
textAlign: TextAlign.center,
)
else if (health.steps != null)
Wrap(
spacing: 1, // Space between items horizontally
runSpacing: 5, // Set this to 0 to minimize space between rows
alignment: WrapAlignment.start, // Align items at the start
children: [
buildDataBlock(BingoDataType.steps, health.steps!, theme),
buildDataBlock(BingoDataType.calories, health.calories!, theme),
buildDataBlock(BingoDataType.distance, health.distance!, theme),
buildDataBlock(BingoDataType.water, health.water!, theme),
],
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Wrap(
spacing: 5, // Space between items horizontally
runSpacing: 5, // Set this to 0 to minimize space between rows
alignment: WrapAlignment.start, // Align items at the start
children: [
buildDataBlock(BingoDataType.steps, health.steps!, theme),
buildDataBlock(BingoDataType.calories, health.calories!, theme),
buildDataBlock(BingoDataType.distance, health.distance!, theme),
buildDataBlock(BingoDataType.water, health.water!, theme),
],
),
)
else
Row(
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ String formatInt(int number) {
}

String formatNumber(num number) {
return NumberFormat.decimalPattern().format(number);
return NumberFormat.decimalPattern().format(number.toInt());
}
16 changes: 16 additions & 0 deletions lib/utils/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:health/health.dart';
import 'package:pocketbase/pocketbase.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'bingo/data.dart';
import 'challengeManager.dart';

class HealthManager with ChangeNotifier {
Expand Down Expand Up @@ -289,6 +290,21 @@ class HealthManager with ChangeNotifier {
date.month == now.month &&
date.day == now.day;
}

num getValue(BingoDataType type) {
switch (type) {
case BingoDataType.steps:
return steps ?? 0;
case BingoDataType.calories:
return calories ?? 0;
case BingoDataType.water:
return water ?? 0;
case BingoDataType.distance:
return distance ?? 0;
default:
return 0;
}
}
}

enum HealthType { systemManaged, watch }
Expand Down

0 comments on commit 259b9c7

Please sign in to comment.