Files
sure/mobile
Lazy Bone 81cf473862 fix: Use getValidAccessToken() in connectivity banner sync button (#851)
* feat(mobile): Add transaction display on calendar date tap

Implement two-tap interaction for calendar dates:
- First tap selects a date (highlighted with thicker primary color border)
- Second tap on same date shows AlertDialog with transactions for that day

Each transaction displays with:
- Color-coded icon (red minus for expenses, green plus for income)
- Transaction name as title
- Notes as subtitle (if present)
- Amount with color matching expense/income

Selection is cleared when changing account, account type, or month.

https://claude.ai/code/session_019m7ZrCakU6h9xLwD1NTx9i

* feat(mobile): optimize asset/liability display with filters

- Add NetWorthCard widget with placeholder for future net worth API
- Add side-by-side Assets/Liabilities display with tap-to-filter
- Implement CurrencyFilter widget for multi-select currency filtering
- Replace old _SummaryCard with new unified design
- Remove _CollapsibleSectionHeader in favor of filter-based navigation

The net worth section shows a placeholder as the API endpoint is not yet available.
Users can now filter accounts by type (assets/liabilities) and by currency.

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* fix(mobile): remove unused variables and add const

- Remove unused _totalAssets, _totalLiabilities, _getPrimaryCurrency
- Add const to Text('All') widget

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* feat(mobile): enhance dashboard with icons, long-press breakdown, and grouped view

- NetWorthCard: replace text labels with trending icons, add colored
  bottom borders for asset (green) and liability (red) sections
- Add long-press gesture on asset/liability areas to show full currency
  breakdown in a bottom sheet popup
- Add collapsible account type grouping (Crypto, Bank, Investment, etc.)
  with type-specific icons and expand/collapse headers
- Add PreferencesService for persisting display settings
- Add "Group by Account Type" toggle in Settings screen
- Wire settings change to dashboard via GlobalKey for live updates

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* refactor(mobile): remove welcome header from dashboard

Strip the Welcome greeting and subtitle to let the financial
overview take immediate focus.

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* feat(mobile): compact filter buttons with scroll-wheel currency switcher

- Remove trending icons from asset/liability filter buttons
- Increase amount font size to titleMedium bold
- Reduce Net Worth section and filter button padding
- Show single currency at a time with ListWheelScrollView for
  scrolling between currencies (wheel-picker style)
- Absorb scroll events via NotificationListener to prevent
  triggering pull-to-refresh
- Keep icons in the long-press currency breakdown popup

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* feat: Add API key login option to mobile app

Add a "Via API Key Login" button on the login screen that opens a
dialog for entering an API key. The API key is validated by making a
test request to /api/v1/accounts with the X-Api-Key header, and on
success is persisted in secure storage. All HTTP services now use a
centralized ApiConfig.getAuthHeaders() helper that returns the correct
auth header (X-Api-Key or Bearer) based on the current auth mode.

https://claude.ai/code/session_01DnyCzdMjVpSsbBZK3XbzUH

* fix: Improve API key dialog context handling and controller disposal

- Use outer context for SnackBar so it displays on the main screen
  instead of behind the dialog
- Explicitly dispose TextEditingController to prevent memory leaks
- Close dialog on failure before showing error SnackBar for better UX
- Avoid StatefulBuilder context parameter shadowing

https://claude.ai/code/session_01DnyCzdMjVpSsbBZK3XbzUH

* fix: Use user-friendly error message in API key login catch block

Log the technical exception details via LogService.instance.error and
show a generic "Unable to connect" message to the user instead of
exposing the raw exception string.

https://claude.ai/code/session_01DnyCzdMjVpSsbBZK3XbzUH

* fix: Use getValidAccessToken() in connectivity banner sync button

Replace direct authProvider.tokens?.accessToken access with
getValidAccessToken() so the Sync Now button works in API-key
auth mode where _tokens is null.

https://claude.ai/code/session_01DnyCzdMjVpSsbBZK3XbzUH

* Revert "fix: Use getValidAccessToken() in connectivity banner sync button"

This reverts commit 7015c160f0.

* Reapply "fix: Use getValidAccessToken() in connectivity banner sync button"

This reverts commit b29e010de3.

* fix: Use getValidAccessToken() in connectivity banner sync button

Replace direct authProvider.tokens?.accessToken access with
getValidAccessToken() so the Sync Now button works in API-key
auth mode where _tokens is null.

https://claude.ai/code/session_01DnyCzdMjVpSsbBZK3XbzUH

* fix(mobile): prevent bottom sheet overflow with ConstrainedBox

Use ConstrainedBox + ListView.separated with shrinkWrap for the
currency breakdown popup. Few currencies: sheet sizes to content.
Many currencies: caps at 50% screen height and scrolls.

Also add isScrollControlled and useSafeArea to showModalBottomSheet.

https://claude.ai/code/session_01W8cQSCzmgTmTqwRJ8Ycpx3

* fix: Prevent multiple syncs and handle auth errors in connectivity banner

Set _isSyncing immediately on tap to disable the button during token
refresh, wrap getValidAccessToken() in try/catch with user-facing error
snackbar, and await _handleSync so errors propagate correctly.

https://claude.ai/code/session_01GgVgjqwyXhWMZN3eWfaMCk

---------

Signed-off-by: Lazy Bone <89256478+dwvwdv@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-01 23:16:02 +01:00
..
2026-01-11 10:29:23 +01:00
2026-01-11 10:29:23 +01:00

Sure Mobile

A Flutter mobile application for Sure personal finance management system. This is the mobile client that connects to the Sure backend server.

About

This app is a mobile companion to the Sure personal finance management system. It provides basic functionality to:

  • Login - Authenticate with your Sure Finance server
  • View Balance - See all your accounts and their balances

For more detailed technical documentation, see docs/TECHNICAL_GUIDE.md.

Features

  • 🔐 Secure authentication with OAuth 2.0
  • 📱 Cross-platform support (Android & iOS)
  • 💰 View all linked accounts
  • 🎨 Material Design 3 with light/dark theme support
  • 🔄 Token refresh for persistent sessions
  • 🔒 Two-factor authentication (MFA) support

Requirements

  • Flutter SDK >= 3.0.0
  • Dart SDK >= 3.0.0
  • Android SDK (for Android builds)
  • Xcode (for iOS builds)

Getting Started

1. Install Flutter

Follow the official Flutter installation guide: https://docs.flutter.dev/get-started/install

2. Install Dependencies

flutter pub get

# For iOS development, also install CocoaPods dependencies
cd ios
pod install
cd ..

3. Generate App Icons

flutter pub run flutter_launcher_icons

This step generates the app icons for all platforms based on the source icon in assets/icon/app_icon.png. This is required before building the app locally.

4. Configure API Endpoint

Edit lib/services/api_config.dart to point to your Sure Finance server:

// For local development with Android emulator
static String _baseUrl = 'http://10.0.2.2:3000';

// For local development with iOS simulator
static String _baseUrl = 'http://localhost:3000';

// For production
static String _baseUrl = 'https://your-sure-server.com';

5. Run the App

# For Android
flutter run -d android

# For iOS
flutter run -d ios

# For web (development only)
flutter run -d chrome

Project Structure

.
├── lib/
│   ├── main.dart              # App entry point
│   ├── models/                # Data models
│   │   ├── account.dart
│   │   ├── auth_tokens.dart
│   │   └── user.dart
│   ├── providers/             # State management
│   │   ├── auth_provider.dart
│   │   └── accounts_provider.dart
│   ├── screens/               # UI screens
│   │   ├── login_screen.dart
│   │   └── dashboard_screen.dart
│   ├── services/              # API services
│   │   ├── api_config.dart
│   │   ├── auth_service.dart
│   │   ├── accounts_service.dart
│   │   └── device_service.dart
│   └── widgets/               # Reusable widgets
│       └── account_card.dart
├── android/                   # Android configuration
├── ios/                       # iOS configuration
├── pubspec.yaml               # Dependencies
└── README.md

API Integration

This app integrates with the Sure Finance Rails API:

Authentication

  • POST /api/v1/auth/login - User authentication
  • POST /api/v1/auth/signup - User registration
  • POST /api/v1/auth/refresh - Token refresh

Accounts

  • GET /api/v1/accounts - Fetch user accounts

Transactions

  • GET /api/v1/transactions - Get all transactions (optionally filter by account_id query parameter)
  • POST /api/v1/transactions - Create a new transaction
  • PUT /api/v1/transactions/:id - Update an existing transaction
  • DELETE /api/v1/transactions/:id - Delete a transaction

Transaction POST Request Format

{
  "transaction": {
    "account_id": "2980ffb0-f595-4572-be0e-7b9b9c53949b",  // required
    "name": "test",  // required
    "date": "2025-07-15",  // required
    "amount": 100,  // optional, defaults to 0
    "currency": "AUD",  // optional, defaults to your profile currency
    "nature": "expense"  // optional, defaults to "expense", other option is "income"
  }
}

CI/CD

The app includes automated CI/CD via GitHub Actions (.github/workflows/flutter-build.yml):

  • Triggers: On push/PR to main branch when Flutter files change
  • Android Build: Generates release APK and AAB artifacts
  • iOS Build: Generates iOS release build (unsigned)
  • Quality Checks: Code analysis and tests run before building

Downloading Build Artifacts

After a successful CI run, download artifacts from the GitHub Actions workflow:

  • app-release-apk - Android APK file
  • app-release-aab - Android App Bundle (for Play Store)
  • ios-build-unsigned - iOS app bundle (unsigned, see iOS build guide for signing)

Building for Release

Android

flutter build apk --release
# or for App Bundle
flutter build appbundle --release

iOS

# Ensure CocoaPods dependencies are installed first
cd ios && pod install && cd ..

# Build iOS release
flutter build ios --release

For detailed iOS build instructions, troubleshooting, and CI/CD setup, see docs/iOS_BUILD.md.

Future Expansion

This app provides a foundation for additional features:

  • Transaction history
  • Account sync
  • Budget management
  • Investment tracking
  • AI chat assistant
  • Push notifications
  • Biometric authentication

License

This project is distributed under the AGPLv3 license.