1
0
forked from firka/firka

30 Commits

Author SHA1 Message Date
zypherift
38f2837034 feat: smoother graph using 3 weighted avarages :O 2026-03-05 00:17:47 +01:00
zypherift
b3b40b5e39 chore: stream home data cache-first then refresh 2026-03-05 00:12:23 +01:00
zypherift
85c2576804 fix: snap grade calculator weights to common percentages 2026-03-05 00:09:05 +01:00
zypherift
22d17f6969 fix: flashbang on new screen pushes 2026-03-04 23:44:24 +01:00
zypherift
7f09c507eb edit: replace spinner with dave 2026-03-04 23:26:01 +01:00
zypherift
1d00505ca7 edit: fine tune wall collision vibration 2026-03-04 23:09:27 +01:00
zypherift
94e6a13ab7 edit: l10n 2026-03-04 23:02:25 +01:00
zypherift
0e65f8e68c add: debug screen for acc 2026-03-04 23:02:25 +01:00
zypherift
3912ad593b edit: l10n 2026-03-04 23:02:25 +01:00
zypherift
1f6eaaeccc add: icons 2026-03-04 23:02:25 +01:00
40f188c2e2 codegen(firka): restore AndroidManifest.xml
flutter_launcher_icons replaces every icon inside
the AndroidManifest.xml which isn't ideal when having
multiple app icons
2026-03-04 21:34:27 +01:00
0aae3801b7 chore: update l10n for firka_wear 2026-03-04 21:17:17 +01:00
26902b7616 add build script for windows 2026-03-04 21:10:09 +01:00
ffaf2c77e0 bump version string to 1.1.1 2026-03-04 18:51:55 +01:00
23f7f7cd48 firka_wear: add error screen
Closes #12
2026-03-04 15:20:15 +01:00
c2879766eb build: run pub get and codegen 2026-03-04 10:55:40 +01:00
01cc08d5f3 codegen: generate missing .g.dart files 2026-03-04 09:56:52 +01:00
c386e1194b auto generate version code 2026-03-04 09:35:17 +01:00
67ed4e03eb firka: remov brotli again 2026-03-04 06:38:01 +01:00
c7d1f80e79 Merge pull request 'IOS Build fix' (#10) from devbeni/firka:dev into dev
Reviewed-on: firka/firka#10
2026-03-04 06:29:07 +01:00
7531e58114 Update project version to 1102 in Info.plist and project.pbxproj 2026-03-04 00:23:15 +01:00
c1e329cb5a Update subproject commit reference in l10n directory 2026-03-03 23:49:35 +01:00
dad52bf20e Merge branch 'dev' of https://git.firka.app/devbeni/firka into dev 2026-03-03 23:46:38 +01:00
5fb6d03d9c Remove Brotli subproject from Android app directory 2026-03-03 23:46:37 +01:00
1ef757d10f merge upstream 2026-03-03 23:46:10 +01:00
444abb83c2 Remove fmb_dart subproject from vendor directory 2026-03-03 23:44:24 +01:00
e835dcf6b1 firka: fix app icon changing
Closes: #9
2026-03-03 23:26:02 +01:00
e61a19fbbf Merge branch 'dev' of https://git.firka.app/devbeni/firka into dev 2026-03-03 23:23:30 +01:00
a937b854cd Update localization files and enhance build script for native assets handling 2026-03-03 23:22:43 +01:00
6d8f17ac00 Update object version and set development team for RunnerTests configuration 2026-03-03 23:11:25 +01:00
24 changed files with 446 additions and 126 deletions

52
build.ps1 Normal file
View File

@@ -0,0 +1,52 @@
$ErrorActionPreference = 'Stop'
$ROOT = $PSScriptRoot
$SHA = (git -C $ROOT rev-parse --short HEAD)
$COMMIT_COUNT = [int](git -C $ROOT rev-list --count HEAD)
function Build-App {
param([string]$App)
$pubspec = Join-Path $ROOT $App "pubspec.yaml"
if (-not (Test-Path $pubspec)) {
Write-Error "Not found: $pubspec"
}
$versionLine = Get-Content $pubspec | Select-String -Pattern '^\s*version:\s*' | Select-Object -First 1
if (-not $versionLine) {
Write-Error "No version line in $pubspec"
}
$line = $versionLine.Line
if ($line -match '^\s*version:\s*([^+\s]+)') {
$baseVersion = $Matches[1].Trim()
} else {
Write-Error "Could not parse version from: $line"
}
$buildName = "${baseVersion}-${SHA}"
$versionCode = 2000 + $COMMIT_COUNT
if ($App -eq "firka_wear") {
$versionCode += 1
}
Write-Host "Building $App : version $buildName (version code: $versionCode)"
Push-Location (Join-Path $ROOT $App)
try {
flutter pub get
dart run scripts/codegen.dart
flutter build appbundle --build-name="$buildName" --build-number="$versionCode" --verbose
} finally {
Pop-Location
}
}
$target = if ($args.Count -gt 0) { $args[0] } else { "all" }
switch ($target) {
"firka" { Build-App firka }
"firka_wear" { Build-App firka_wear }
"all" { Build-App firka; Build-App firka_wear }
default {
Write-Error "Usage: $MyInvocation.MyCommand.Name [firka|firka_wear|all]"
}
}

View File

@@ -1,12 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
# Build firka and/or firka_wear with version from pubspec + short git SHA.
# Usage: ./build.sh [firka|firka_wear|all]
# Default (no args) builds both.
ROOT="$(cd "$(dirname "$0")" && pwd)"
SHA=$(git -C "$ROOT" rev-parse --short HEAD)
COMMIT_COUNT=$(git -C "$ROOT" rev-list --count HEAD)
build_app() {
local APP="$1"
@@ -16,22 +13,21 @@ build_app() {
return 1
fi
local VERSION_LINE BUILD_NUMBER BASE_VERSION BUILD_NAME
local VERSION_LINE BASE_VERSION BUILD_NAME VERSION_CODE
VERSION_LINE=$(grep -E '^\s*version:\s*' "$PUBSPEC" | head -1)
BASE_VERSION=$(echo "$VERSION_LINE" | sed -E 's/^[[:space:]]*version:[[:space:]]*([^+]+).*/\1/' | tr -d ' ')
BUILD_NUMBER=""
if [[ "$VERSION_LINE" == *+* ]]; then
BUILD_NUMBER=$(echo "$VERSION_LINE" | sed -E 's/^[[:space:]]*version:[[:space:]]*[^+]+\+([0-9]+).*/\1/')
fi
BUILD_NAME="${BASE_VERSION}-${SHA}"
echo "Building $APP: version $BUILD_NAME (build number: ${BUILD_NUMBER:-none})"
VERSION_CODE=$((2000 + COMMIT_COUNT))
[[ "$APP" == "firka_wear" ]] && VERSION_CODE=$((VERSION_CODE + 1))
echo "Building $APP: version $BUILD_NAME (version code: $VERSION_CODE)"
cd "$ROOT/$APP"
local FLUTTER_ARGS=(build appbundle --build-name="$BUILD_NAME" --verbose)
[[ -n "${BUILD_NUMBER:-}" ]] && FLUTTER_ARGS+=(--build-number="$BUILD_NUMBER")
flutter pub get
dart run scripts/codegen.dart
flutter "${FLUTTER_ARGS[@]}"
flutter build appbundle --build-name="$BUILD_NAME" --build-number="$VERSION_CODE" --verbose
}
case "${1:-all}" in

View File

@@ -11,7 +11,6 @@
android:name=".AppMain"
android:icon="@mipmap/launcher_icon">
<service
android:name=".WearSyncForegroundService"
android:exported="false"

Submodule firka/android/app/src/main/java/org/brotli added at da8f329432

View File

@@ -1,15 +1,15 @@
icons:
"flutter_launcher_icons.yaml": "c600507ca0df7cebd0f708124842512a14ed3d597b779176200d6ba25b1335b1"
"pubspec.yaml": "c84752e36ab6218d2ac824c17ffb0edb5ac4f809ab87784c9c607a0d9f525abb"
"pubspec.yaml": "cc5c8123f956bca34e25cec666ccc13fe5b7bdec06e217a58e1fa0ee58dedc20"
"assets/images/logos/colored_logo.webp": "4b4fa99d144fe6694aa4487ba1b26aeecafae41e3c877836cd7da28d61a77983"
"assets/images/logos/monochrome_logo.png": "188d2b0a64c70323b09bcee721663d6698fb557066f20ddaec97bba6869c1c6c"
"assets/images/logos/colored_logo_without_mustache.png": "d11cff9f38985885873bfdd2d84e61f8fab03803eada94d4caac1545ef3685f3"
"assets/images/logos/colored_logo_only_mustache.png": "bad6220c11bdfb1dfe04e5173bd2ebedd3999689d4b3a68fc63dc520c96dd33b"
l10n:
"l10n.yml": "a57bc304cac4a2b0235593586f17f400a5165d67fc9aadeaa11893cfa36ee082"
"lib/l10n/app_de.arb": "55f030b312cc07ff05cdc3d6ee10ef9bdec3243b507225e9a47196444518d955"
"lib/l10n/app_en.arb": "cbad6dd2485a983e399cce97371c19089b9110d30536488c14a7ea709c7b6ead"
"lib/l10n/app_de.arb": "9cd5913be1e3bc3ed6c088ef448d5ce2924a6290b7dd6006d1af624c5e9a2503"
"lib/l10n/app_hu.arb": "17077ec76b68ed03796a264b99e4dba9e6ddd532e27a92d8fb237ea6f211f757"
"lib/l10n/app_en.arb": "cbad6dd2485a983e399cce97371c19089b9110d30536488c14a7ea709c7b6ead"
isar:
"lib/data/models/app_settings_model.dart": "5eb5af345f1347f104257f0999763650fe2673f9da1754bd12d3f756fe5c9723"
"lib/data/models/generic_cache_model.dart": "79151d0467fb5d40c532eaaa08ad7c7e24a34304199280fbf49cf6e5adcce6bc"

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -816,7 +816,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
shellScript = "set -e\nNATIVE_ASSETS_DIR=\"$FLUTTER_APPLICATION_PATH/$FLUTTER_BUILD_DIR/native_assets\"\ncase \"$FLUTTER_BUILD_DIR\" in\n /*) NATIVE_ASSETS_DIR=\"$FLUTTER_BUILD_DIR/native_assets\" ;;\nesac\nif [ -d \"$FLUTTER_APPLICATION_PATH/.dart_tool/hooks_runner\" ]; then\n find \"$FLUTTER_APPLICATION_PATH/.dart_tool/hooks_runner\" -exec xattr -c {} \\; 2>/dev/null || true\nfi\nif [ -d \"$NATIVE_ASSETS_DIR\" ]; then\n find \"$NATIVE_ASSETS_DIR\" -exec xattr -c {} \\; 2>/dev/null || true\nfi\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
D576F90540C8E625A9A12317 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
@@ -1076,7 +1076,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -1108,7 +1108,8 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests;
@@ -1127,7 +1128,8 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests;
@@ -1144,7 +1146,8 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests;
@@ -1171,7 +1174,7 @@
CODE_SIGN_ENTITLEMENTS = LiveActivityWidget.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1222,7 +1225,7 @@
CODE_SIGN_ENTITLEMENTS = LiveActivityWidget.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1270,7 +1273,7 @@
CODE_SIGN_ENTITLEMENTS = LiveActivityWidget.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1317,7 +1320,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = FirkaWatchComplicationsExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1370,7 +1373,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = FirkaWatchComplicationsExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1420,7 +1423,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = FirkaWatchComplicationsExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1471,7 +1474,7 @@
CODE_SIGN_ENTITLEMENTS = HomeWidgetsExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1522,7 +1525,7 @@
CODE_SIGN_ENTITLEMENTS = HomeWidgetsExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1569,7 +1572,7 @@
CODE_SIGN_ENTITLEMENTS = HomeWidgetsExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -1877,7 +1880,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -1913,7 +1916,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1101;
CURRENT_PROJECT_VERSION = 1102;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;

View File

@@ -46,7 +46,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1101</string>
<string>1102</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@@ -16,6 +16,7 @@ import 'package:firka/core/bloc/theme_cubit.dart';
import 'package:firka/core/firka_bundle.dart';
import 'package:firka/routing/app_router.dart';
import 'package:firka/services/watch_sync_helper.dart';
import 'package:firka/ui/theme/style.dart';
import 'package:firka/ui/phone/pages/extras/main_wear_pair.dart';
import 'package:firka/l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@@ -34,6 +35,23 @@ class _InitializationScreenState extends State<InitializationScreen> {
const Duration(seconds: 20),
);
ThemeData _buildTheme(FirkaStyle style) {
return ThemeData(
scaffoldBackgroundColor: style.colors.background,
canvasColor: style.colors.background,
bottomSheetTheme: const BottomSheetThemeData(
backgroundColor: Colors.transparent,
),
colorScheme: ColorScheme.fromSeed(
seedColor: style.colors.accent,
brightness: style.isLight ? Brightness.light : Brightness.dark,
background: style.colors.background,
surface: style.colors.card,
),
useMaterial3: false,
);
}
@override
Widget build(BuildContext context) {
return FutureBuilder<AppInitialization>(
@@ -180,40 +198,47 @@ class _InitializationScreenState extends State<InitializationScreen> {
BlocProvider<ReauthCubit>.value(value: reauthCubit),
BlocProvider<HomeRefreshCubit>.value(value: homeRefreshCubit),
],
child: MaterialApp.router(
title: 'Firka',
key: const ValueKey('firkaApp'),
routerConfig: _router!,
theme: ThemeData(
primarySwatch: Colors.lightGreen,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
builder: (context, child) {
return BlocBuilder<ThemeCubit, ThemeState>(
builder: (context, themeState) {
final isLight = themeState.isLightMode;
final overlay = SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: isLight
? Brightness.dark
: Brightness.light,
statusBarBrightness: isLight
? Brightness.light
: Brightness.dark,
systemStatusBarContrastEnforced: false,
);
child: BlocBuilder<ThemeCubit, ThemeState>(
builder: (context, themeState) {
final isLight = themeState.isLightMode;
final overlay = SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness:
isLight ? Brightness.dark : Brightness.light,
statusBarBrightness:
isLight ? Brightness.light : Brightness.dark,
systemStatusBarContrastEnforced: false,
);
SystemChrome.setSystemUIOverlayStyle(overlay);
final themeMode =
isLight ? ThemeMode.light : ThemeMode.dark;
final fallbackBg = isLight
? lightStyle.colors.background
: darkStyle.colors.background;
SystemChrome.setSystemUIOverlayStyle(overlay);
return MaterialApp.router(
title: 'Firka',
key: const ValueKey('firkaApp'),
routerConfig: _router!,
theme: _buildTheme(lightStyle),
darkTheme: _buildTheme(darkStyle),
themeMode: themeMode,
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
builder: (context, child) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: overlay,
child: child ?? const SizedBox.shrink(),
child: ColoredBox(
color: fallbackBg,
child: child ?? const SizedBox.shrink(),
),
);
},
);

View File

@@ -1048,9 +1048,13 @@ class _GradeCalculatorSheetContent extends StatefulWidget {
class _GradeCalculatorSheetContentState
extends State<_GradeCalculatorSheetContent> {
int selectedGrade = 3;
int weightPercent = 100;
int weightIndex = 1; // 0-based index into _snapPoints
final List<(int grade, int weight)> entries = [];
static const _snapPoints = [50, 100, 200, 300, 500];
int get weightPercent => _snapPoints[weightIndex];
@override
Widget build(BuildContext context) {
return Column(
@@ -1184,11 +1188,12 @@ class _GradeCalculatorSheetContentState
trackHeight: 8,
),
child: Slider(
value: weightPercent.toDouble(),
min: 1,
max: 500,
divisions: 499,
onChanged: (v) => setState(() => weightPercent = v.round()),
value: weightIndex.toDouble(),
min: 0,
max: (_snapPoints.length - 1).toDouble(),
divisions: _snapPoints.length - 1,
label: '${weightPercent}%',
onChanged: (v) => setState(() => weightIndex = v.round()),
),
),
),

View File

@@ -55,7 +55,7 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
}
}
Future<void> fetchData({bool cacheOnly = true}) async {
Future<void> fetchData({bool cacheOnly = false}) async {
final midnight = now.getMidnight();
var lessonsFetched = 0;

View File

@@ -4,6 +4,7 @@ import 'dart:math' as math;
import 'package:carousel_slider/carousel_slider.dart';
import 'package:firka/core/firka_bundle.dart';
import 'package:firka/app/app_state.dart';
import 'package:flutter/foundation.dart';
import 'package:firka/ui/phone/widgets/login_webview.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
@@ -68,6 +69,7 @@ class _LoginScreenState extends FirkaState<LoginScreen> {
"assets/images/carousel_dark/slide3.webp",
"assets/images/carousel_dark/slide4.webp",
"assets/images/logos/colored_logo.webp",
"assets/images/logos/loading.gif",
];
try {
await ImagePreloader.preloadMultipleAssets(FirkaBundle(), imagePaths);
@@ -569,6 +571,7 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
static const double _friction = 0.878;
static const double _cardHeight =
45; //not in pixels, idk what unit but it works :p
// cap speeds so impacts stay tame
static const double _maxSpeed = _cardHeight * 1.2;
static const double _tiltForce = 0.05;
static const double _bounceDamping = 0.45;
@@ -644,6 +647,7 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
Offset? _baseline;
StreamSubscription<AccelerometerEvent>? _accelerometerSub;
Duration? _lastTick;
AccelerometerEvent? _lastAccelEvent;
double _sceneWidth = 0;
double _sceneHeight = 0;
@@ -687,6 +691,7 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
}
void _handleTilt(AccelerometerEvent event) {
_lastAccelEvent = event;
final raw = Offset(event.x, event.y);
_baseline ??= raw;
final rel = raw - _baseline!;
@@ -712,6 +717,7 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
if (_sceneWidth == 0 || _sceneHeight == 0) return;
bool collidedThisTick = false;
bool wallHitThisTick = false;
setState(() {
final slope = Offset(-_tilt.dx, _tilt.dy);
@@ -811,30 +817,50 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
double vx = _velocities[i].dx;
double vy = _velocities[i].dy;
// capture incoming velocity components before any bounce damping
final double preVx = vx;
final double preVy = vy;
double impactSpeed = 0.0; // normal to the wall
bool hit = false;
if (pos.dx < minX) {
pos = Offset(minX, pos.dy);
vx = vx.abs() * _bounceDamping;
impactSpeed = math.max(impactSpeed, preVx.abs());
hit = true;
} else if (pos.dx > maxX) {
pos = Offset(maxX, pos.dy);
vx = -vx.abs() * _bounceDamping;
impactSpeed = math.max(impactSpeed, preVx.abs());
hit = true;
}
if (pos.dy < minY) {
pos = Offset(pos.dx, minY);
vy = vy.abs() * _bounceDamping;
impactSpeed = math.max(impactSpeed, preVy.abs());
hit = true;
} else if (pos.dy > maxY) {
pos = Offset(pos.dx, maxY);
vy = -vy.abs() * _bounceDamping;
impactSpeed = math.max(impactSpeed, preVy.abs());
hit = true;
}
_velocities[i] = _clampVel(Offset(vx, vy));
_positions[i] = pos;
// vibrate only when the component toward the wall exceeded threshold
if (hit && impactSpeed > _vibrateSpeedThreshold) {
wallHitThisTick = true;
}
}
}
});
// phone mating session
if (collidedThisTick) _maybeVibrate();
// vibration on collisions (card-card or walls)
if (collidedThisTick || wallHitThisTick) _maybeVibrate();
}
@override
@@ -896,10 +922,59 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
),
);
}),
if (kDebugMode) _buildDebugOverlay(center),
],
),
);
}
Widget _buildDebugOverlay(Offset center) {
final firstPos = _positions.isNotEmpty ? _positions.first : Offset.zero;
final firstVel = _velocities.isNotEmpty ? _velocities.first : Offset.zero;
final accel = _lastAccelEvent;
final speed = firstVel.distance;
String formatOffset(Offset o) =>
'(${o.dx.toStringAsFixed(2)}, ${o.dy.toStringAsFixed(2)})';
return Positioned(
left: 12,
top: 12,
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.55),
borderRadius: BorderRadius.circular(10),
),
width: math.min(260, _sceneWidth - 24),
child: DefaultTextStyle(
style: appStyle.fonts.B_12R.copyWith(
color: Colors.white,
height: 1.25,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('Sim Debug'),
const SizedBox(height: 4),
Text('tilt: ${formatOffset(_tilt)}'),
if (accel != null)
Text(
'accel: (${accel.x.toStringAsFixed(2)}, ${accel.y.toStringAsFixed(2)}, ${accel.z.toStringAsFixed(2)})',
),
Text('baseline set: ${_baseline != null}'),
Text('scene: ${_sceneWidth.toStringAsFixed(0)} x ${_sceneHeight.toStringAsFixed(0)}'),
Text('center: ${formatOffset(center)}'),
Text('card[0] pos: ${formatOffset(firstPos)}'),
Text('card[0] vel: ${formatOffset(firstVel)} | |v|=${speed.toStringAsFixed(2)}'),
Text('cards: ${_cards.length}'),
],
),
),
),
);
}
}
// this sucks :3

View File

@@ -93,6 +93,27 @@ class _GradeChartState extends State<GradeChart> {
}
}
List<FlSpot> _smoothSpots(List<FlSpot> input) {
if (input.length < 3) return input;
final smoothed = <FlSpot>[];
for (var i = 0; i < input.length; i++) {
if (i == 0 || i == input.length - 1) {
smoothed.add(input[i]);
continue;
}
final prev = input[i - 1].y;
final curr = input[i].y;
final next = input[i + 1].y;
final blended = (0.25 * prev) + (0.5 * curr) + (0.25 * next);
smoothed.add(FlSpot(input[i].x, blended));
}
return smoothed;
}
@override
void didUpdateWidget(covariant GradeChart oldWidget) {
super.didUpdateWidget(oldWidget);
@@ -213,8 +234,10 @@ class _GradeChartState extends State<GradeChart> {
}
LineChartData avgData() {
var firstX = spots.first.x;
var lastX = spots.last.x;
final smoothedSpots = _smoothSpots(spots);
var firstX = smoothedSpots.first.x;
var lastX = smoothedSpots.last.x;
if (firstX == lastX) {
lastX = firstX + 1;
}
@@ -359,12 +382,12 @@ class _GradeChartState extends State<GradeChart> {
lineBarsData: [
LineChartBarData(
spots: spots,
spots: smoothedSpots,
isCurved: true,
curveSmoothness: 0.35,
curveSmoothness: 0.5,
showingIndicators: _touchedIndex != null ? [_touchedIndex!] : [],
gradient: LinearGradient(
colors: [for (final s in spots) colorForY(s.y)],
colors: [for (final s in smoothedSpots) colorForY(s.y)],
),
barWidth: 5,
isStrokeCapRound: true,
@@ -373,7 +396,8 @@ class _GradeChartState extends State<GradeChart> {
show: true,
gradient: LinearGradient(
colors: [
for (final s in spots) colorForY(s.y).withValues(alpha: 0.1),
for (final s in smoothedSpots)
colorForY(s.y).withValues(alpha: 0.1),
],
),
),

View File

@@ -276,15 +276,10 @@ class _LoginWebviewWidgetState extends FirkaState<LoginWebviewWidget>
child: Container(
color: appStyle.colors.background,
child: Center(
child: SizedBox(
width: 32,
height: 32,
child: CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation<Color>(
appStyle.colors.accent,
),
),
child: Image.asset(
"assets/images/logos/loading.gif",
width: 50,
height: 50,
),
),
),

View File

@@ -2,7 +2,7 @@ name: firka
description: "Firka, Alternatív e-Kréta kliens."
publish_to: 'none'
version: 1.1.0+2001
version: 1.1.1+2001
environment:
sdk: ^3.11.0
@@ -81,6 +81,7 @@ flutter:
- .env
- assets/images/logos/colored_logo.webp
- assets/images/logos/dave.svg
- assets/images/logos/loading.gif
- assets/images/carousel/
- assets/images/carousel_dark/
- assets/images/icons/

View File

@@ -13,10 +13,33 @@ void main() async {
if (_iconsOutOfDate(root)) {
final inputs = _iconsInputs(root);
stdout.writeln('Icons out of date, running flutter_launcher_icons...');
await _run('dart', ['run', 'flutter_launcher_icons'], root);
_updateLockWithHashes(root, 'icons', _computeHashes(root, inputs));
ran = true;
final manifestFile = File(p.join(root, 'android/app/src/main/AndroidManifest.xml'));
String? manifestBackup;
if (manifestFile.existsSync()) {
manifestBackup = manifestFile.readAsStringSync();
}
late ProcessResult iconResult;
try {
stdout.writeln('Icons out of date, running flutter_launcher_icons...');
iconResult = await Process.run(
'dart',
['run', 'flutter_launcher_icons'],
workingDirectory: root,
runInShell: true,
);
if (iconResult.exitCode == 0) {
_updateLockWithHashes(root, 'icons', _computeHashes(root, inputs));
ran = true;
}
} finally {
if (manifestBackup != null) {
manifestFile.writeAsStringSync(manifestBackup);
}
}
if (iconResult.exitCode != 0) {
stderr.write(iconResult.stderr);
exit(iconResult.exitCode);
}
}
if (_l10nOutOfDate(root)) {
@@ -31,11 +54,11 @@ void main() async {
ran = true;
}
if (_isarOutOfDate(root)) {
if (_isarOutOfDate(root) || _isarGeneratedFilesMissing(root)) {
final inputs = _isarInputs(root);
final hashes = _computeHashes(root, inputs);
stdout.writeln(
'Isar generated dart files out of date, running build_runner...',
'Isar generated dart files out of date or missing, running build_runner...',
);
await _run('dart', ['run', 'build_runner', 'build'], root);
_updateLockWithHashes(root, 'isar', hashes);
@@ -240,6 +263,18 @@ bool _isarOutOfDate(String root) {
return false;
}
bool _isarGeneratedFilesMissing(String root) {
final inputs = _isarInputs(root);
if (inputs.isEmpty) return false;
final modelsDir = p.join(root, 'lib/data/models');
for (final dartFile in inputs) {
final baseName = p.basenameWithoutExtension(dartFile.path);
final gFile = File(p.join(modelsDir, '$baseName.g.dart'));
if (!gFile.existsSync()) return true;
}
return false;
}
List<File> _splashInputs(String root) {
final config = File(p.join(root, 'flutter_native_splash.yaml'));
final splashImage = File(p.join(root, 'assets/images/logos/splash.png'));

Submodule firka/vendor/fmb_dart deleted from fb711c8c40

View File

@@ -1,15 +1,15 @@
icons:
"flutter_launcher_icons.yaml": "2c1bf9056dfe8db94333143643d2b46308fa332e08de9eda62046a941e83aaaa"
"pubspec.yaml": "6be6ac0844c8554f0e2d3eb4d60adf3debae1b29528b4cfba2023d0ccc5e33bf"
"pubspec.yaml": "1948fc1c2c22fbf38f60f1e5b66d71aeefb7637757b26a12619d924c792ed882"
"assets/images/logos/colored_logo.png": "ff9c3452b1b0ed07ffa9067fa4cf4dae45dad3e46f5cb6ef4a62ac8c05d8c080"
"assets/images/logos/monochrome_logo.png": "188d2b0a64c70323b09bcee721663d6698fb557066f20ddaec97bba6869c1c6c"
"assets/images/logos/colored_logo_without_mustache.png": "d11cff9f38985885873bfdd2d84e61f8fab03803eada94d4caac1545ef3685f3"
"assets/images/logos/colored_logo_only_mustache.png": "bad6220c11bdfb1dfe04e5173bd2ebedd3999689d4b3a68fc63dc520c96dd33b"
l10n:
"l10n.yml": "a57bc304cac4a2b0235593586f17f400a5165d67fc9aadeaa11893cfa36ee082"
"lib/l10n/app_de.arb": "55f030b312cc07ff05cdc3d6ee10ef9bdec3243b507225e9a47196444518d955"
"lib/l10n/app_en.arb": "efac3f14d8ecc3e278f80a3e5aff599a88e408d2e30ff9e30f889978f465823a"
"lib/l10n/app_hu.arb": "a7f61bf4452a639d61c350f6674fdb5fd424f9ab31a195a200d446763fa8b396"
"lib/l10n/app_de.arb": "4be15b38c7a86bae77d5d44eb2172c687c94255716c7103ef16418d9a3aa2856"
"lib/l10n/app_en.arb": "6ee8594c5153a1e1fe714a05ea99ed38e63a42aa74faaa1d610c8ba669d7cbbb"
"lib/l10n/app_hu.arb": "9acbf3245d9b286c6b7b20d84750313e49e9c09689e1fe60ad5623877cdbf7a6"
isar:
"lib/data/models/app_settings_model.dart": "2bf4d089ccfcb73edbca5b2d5757e1e698ddde2b8783d212a870aac3157fbb5b"
"lib/data/models/generic_cache_model.dart": "dd9979a4f0ba37ce5fd733bf0966088a759b5f356d97ea09c65eefffe8984639"

View File

@@ -9,6 +9,10 @@ import 'package:firka_wear/services/wear_sync_store.dart';
late final Logger logger;
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
/// When non-null, the app should show [WearErrorScreen] with this error.
final ValueNotifier<FlutterErrorDetails?> globalErrorNotifier =
ValueNotifier<FlutterErrorDetails?>(null);
late WearAppInitialization initData;
bool initDone = false;

View File

@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:wear_plus/wear_plus.dart';
import 'package:firka_wear/app/app_state.dart';
import 'package:firka_wear/app/initialization.dart';
import 'package:firka_wear/core/bloc/wear_sync_cubit.dart';
import 'package:firka_wear/l10n/app_localizations.dart';
import 'package:firka_wear/ui/theme/style.dart';
import 'package:firka_wear/ui/wear/screens/error/error_screen.dart';
import 'package:firka_wear/ui/wear/screens/home/home_screen.dart';
import 'package:firka_wear/ui/wear/screens/login/login_screen.dart';
@@ -25,25 +25,7 @@ class WearInitializationScreen extends StatelessWidget {
if (snapshot.hasError) {
return MaterialApp(
key: ValueKey('firkaErrorPage'),
home: Scaffold(
body: Center(
child: WatchShape(
builder: (context, shape, child) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Error initializing app: ${snapshot.error}',
style: TextStyle(color: Colors.red),
),
child!,
],
);
},
child: SizedBox(),
),
),
),
home: WearErrorScreen(exception: snapshot.error!),
);
}

View File

@@ -1,7 +1,9 @@
import 'dart:async';
import 'dart:io';
import 'package:firka_wear/app/app_state.dart';
import 'package:firka_wear/app/initialization_screen.dart';
import 'package:firka_wear/ui/wear/screens/error/error_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:logging/logging.dart';
@@ -26,5 +28,49 @@ void main() async {
await ScreenUtil.ensureScreenSize();
runApp(WearInitializationScreen());
FlutterError.onError = (FlutterErrorDetails details) {
FlutterError.presentError(details);
if (_isFatalError(details.exception)) {
globalErrorNotifier.value = details;
}
};
runZonedGuarded(() => runApp(const _WearAppWrapper()), (
Object error,
StackTrace stackTrace,
) {
if (_isFatalError(error)) {
globalErrorNotifier.value = FlutterErrorDetails(
exception: error,
stack: stackTrace,
library: 'firka_wear',
);
}
});
}
bool _isFatalError(Object error) {
return error is! AssertionError;
}
class _WearAppWrapper extends StatelessWidget {
const _WearAppWrapper();
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<FlutterErrorDetails?>(
valueListenable: globalErrorNotifier,
builder: (context, error, _) {
if (error != null) {
return MaterialApp(
home: WearErrorScreen(
exception: error.exception,
stackTrace: error.stack,
),
);
}
return WearInitializationScreen();
},
);
}
}

View File

@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:wear_plus/wear_plus.dart';
import 'package:firka_wear/ui/theme/style.dart';
final int _kMaxQrPayloadChars = 410;
String errorPayload(Object exception, [StackTrace? stackTrace]) {
final buffer = StringBuffer();
buffer.writeln(exception.toString());
if (stackTrace != null) buffer.write(stackTrace.toString());
final s = buffer.toString();
return s.length > _kMaxQrPayloadChars
? s.substring(0, _kMaxQrPayloadChars)
: s;
}
/// Full-screen error UI: encodes [exception] (and [stackTrace]) into a QR code
/// scaled to fit the watch's circular display so it is not clipped.
class WearErrorScreen extends StatelessWidget {
final Object exception;
final StackTrace? stackTrace;
const WearErrorScreen({super.key, required this.exception, this.stackTrace});
@override
Widget build(BuildContext context) {
ScreenUtil.init(context);
final payload = errorPayload(exception, stackTrace);
return Scaffold(
backgroundColor: wearStyle.colors.background,
body: LayoutBuilder(
builder: (context, constraints) {
return Center(
child: WatchShape(
builder: (context, shape, child) {
return SizedBox(
width: 350.w,
height: 350.h,
child: QrImageView(
data: payload,
version: 13,
backgroundColor: wearStyle.colors.background,
eyeStyle: QrEyeStyle(
eyeShape: QrEyeShape.square,
color: wearStyle.colors.textPrimary,
),
dataModuleStyle: QrDataModuleStyle(
dataModuleShape: QrDataModuleShape.square,
color: wearStyle.colors.textPrimary,
),
),
);
},
child: const SizedBox.shrink(),
),
);
},
),
);
}
}

View File

@@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.0+2000
version: 1.1.1+2000
environment:
sdk: ^3.11.0
@@ -62,6 +62,7 @@ dependencies:
flutter_svg: ^1.1.6
logging: ^1.3.0
flutter_bloc: ^9.0.0
qr_flutter: ^4.1.0
dev_dependencies:
build_runner: any

View File

@@ -30,11 +30,11 @@ void main() async {
ran = true;
}
if (_isarOutOfDate(root)) {
if (_isarOutOfDate(root) || _isarGeneratedFilesMissing(root)) {
final inputs = _isarInputs(root);
final hashes = _computeHashes(root, inputs);
stdout.writeln(
'Isar generated dart files out of date, running build_runner...',
'Isar generated dart files out of date or missing, running build_runner...',
);
await _run('dart', ['run', 'build_runner', 'build'], root);
_updateLockWithHashes(root, 'isar', hashes);
@@ -228,6 +228,18 @@ bool _isarOutOfDate(String root) {
return false;
}
bool _isarGeneratedFilesMissing(String root) {
final inputs = _isarInputs(root);
if (inputs.isEmpty) return false;
final modelsDir = p.join(root, 'lib/data/models');
for (final dartFile in inputs) {
final baseName = p.basenameWithoutExtension(dartFile.path);
final gFile = File(p.join(modelsDir, '$baseName.g.dart'));
if (!gFile.existsSync()) return true;
}
return false;
}
Future<bool> _run(
String executable,
List<String> args,