* feat(mobile): lock chat input while bot is responding + 20s timeout - Add _isWaitingForResponse flag to ChatProvider; set in _startPolling, cleared in _stopPolling so it covers the full polling lifecycle not just the initial HTTP POST - Add _pollingStartTime + 20s timeout in _pollForUpdates; if the bot never responds the flag resets, errorMessage is surfaced, and input unlocks automatically - Gate send button and keyboard shortcut on isSendingMessage || isWaitingForResponse so users cannot queue up multiple messages while a response is in flight (adding an interrupt like with other chat bots would require a larger rewrite of the backend structure) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(mobile): make polling timeout measure inactivity not total duration Reset _pollingStartTime whenever assistant content grows so the 20s timeout only fires if no new content has arrived in that window. Prevents cutting off a slow-but-streaming response mid-generation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(mobile): lock input for full polling duration, not just until first chunk - Add isPolling getter to ChatProvider (true while _pollingTimer is active) - Gate send button and intent on isPolling in addition to isWaitingForResponse so users cannot submit overlapping prompts while a response is still streaming - Also auto-scroll while polling is active * Fix chat polling timeout race and send re-entry guard Polling timeout was evaluated before the network attempt, allowing it to fire just as a response became ready. Timeout check now runs after each poll attempt and only when no progress was made; network errors fall through to the same check instead of silently swallowing the tick. Added _isSendInFlight boolean to prevent rapid taps from re-entering _sendMessage() during the async token fetch window before provider flags are set. Guard is set synchronously at the top of the method and cleared in a finally block. * fix(mobile): prevent overlapping polls and empty-placeholder stop Add _isPollingRequestInFlight guard so Timer.periodic ticks are skipped if a getChat request is still in flight, preventing stale results from resetting state out of order. Fix empty assistant placeholder incorrectly triggering _stopPolling: stable is only declared when a previously observed length exists and hasn't grown. An initial empty message keeps polling until content arrives or the timeout fires. * fix(mobile): reset _lastAssistantContentLength in _stopPolling Prevents stale content-length state from a prior polling session bleeding into the next one. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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 Finances 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 Finances 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 <simulator-device-UDID>
# or
flutter run -d "iPhone 17 Pro"
# 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 Finances Rails API:
Authentication
POST /api/v1/auth/login- User authenticationPOST /api/v1/auth/signup- User registrationPOST /api/v1/auth/refresh- Token refresh
Accounts
GET /api/v1/accounts- Fetch user accounts
Transactions
GET /api/v1/transactions- Get all transactions (optionally filter byaccount_idquery parameter)POST /api/v1/transactions- Create a new transactionPUT /api/v1/transactions/:id- Update an existing transactionDELETE /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
mainbranch 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
- TestFlight:
mobile-release(mobile tags) triggers.github/workflows/ios-testflight.ymlfor signed App Store Connect uploads as part of one release flow
See mobile/docs/iOS_TESTFLIGHT.md for required secrets and setup.
Downloading Build Artifacts
After a successful CI run, download artifacts from the GitHub Actions workflow:
app-release-apk- Android APK fileapp-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
Android release metadata comes from pubspec.yaml (version: <name>+<code>). Keep the numeric build code increasing for every release so Android can install upgrades over older APKs.
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.