release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
// lib/features/gamification/providers/gamification_provider.dart
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
security: sanitize all error messages shown to users
Created centralized userFriendlyError() utility that converts raw
exceptions into clean, user-friendly messages. Strips hostnames,
ports, OS error codes, HTTP status codes, stack traces, and Django
field names. Maps network/timeout/auth/server errors to plain
English messages.
Fixed 16 locations across 10 files:
- home_screen, calendar_screen, learn_more_screen (SnackBar/Text)
- login_screen, desktop_login_screen (SnackBar)
- profile_screen, contribute_screen, search_screen (SnackBar)
- review_form, review_section (inline error text)
- gamification_provider (error field)
Also removed double-wrapped exceptions in ReviewService (rethrow
instead of throw Exception('Failed to...: $e')).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:15:02 +05:30
|
|
|
import '../../../core/utils/error_utils.dart';
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
import '../models/gamification_models.dart';
|
|
|
|
|
import '../services/gamification_service.dart';
|
|
|
|
|
|
|
|
|
|
class GamificationProvider extends ChangeNotifier {
|
|
|
|
|
final GamificationService _service = GamificationService();
|
|
|
|
|
|
|
|
|
|
// State
|
|
|
|
|
UserGamificationProfile? profile;
|
|
|
|
|
List<LeaderboardEntry> leaderboard = [];
|
|
|
|
|
List<ShopItem> shopItems = [];
|
|
|
|
|
List<AchievementBadge> achievements = [];
|
feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- Fix gamification endpoints to use Node.js server (app.eventifyplus.com)
- Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit)
- Add booking models, service, payment service (Razorpay), checkout provider
- Add 3-step CheckoutScreen with Razorpay native modal integration
- Add Google OAuth login (Flutter + Django backend)
- Add full notifications system (Django model + 3 endpoints + Flutter UI)
- Register CheckoutProvider, NotificationProvider in main.dart MultiProvider
- Wire notification bell in HomeScreen app bar
- Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
2026-04-04 15:46:53 +05:30
|
|
|
List<SubmissionModel> submissions = [];
|
|
|
|
|
CurrentUserStats? currentUserStats;
|
|
|
|
|
int totalParticipants = 0;
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
|
|
|
|
|
// Leaderboard filters — matches web version
|
|
|
|
|
String leaderboardDistrict = 'Overall Kerala';
|
|
|
|
|
String leaderboardTimePeriod = 'all_time'; // 'all_time' | 'this_month'
|
|
|
|
|
|
|
|
|
|
bool isLoading = false;
|
|
|
|
|
String? error;
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// Load everything at once (called when ContributeScreen is mounted)
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
Future<void> loadAll() async {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
error = null;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
final results = await Future.wait([
|
feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- Fix gamification endpoints to use Node.js server (app.eventifyplus.com)
- Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit)
- Add booking models, service, payment service (Razorpay), checkout provider
- Add 3-step CheckoutScreen with Razorpay native modal integration
- Add Google OAuth login (Flutter + Django backend)
- Add full notifications system (Django model + 3 endpoints + Flutter UI)
- Register CheckoutProvider, NotificationProvider in main.dart MultiProvider
- Wire notification bell in HomeScreen app bar
- Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
2026-04-04 15:46:53 +05:30
|
|
|
_service.getDashboard(),
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
_service.getLeaderboard(district: leaderboardDistrict, timePeriod: leaderboardTimePeriod),
|
|
|
|
|
_service.getShopItems(),
|
|
|
|
|
_service.getAchievements(),
|
|
|
|
|
]);
|
|
|
|
|
|
feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- Fix gamification endpoints to use Node.js server (app.eventifyplus.com)
- Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit)
- Add booking models, service, payment service (Razorpay), checkout provider
- Add 3-step CheckoutScreen with Razorpay native modal integration
- Add Google OAuth login (Flutter + Django backend)
- Add full notifications system (Django model + 3 endpoints + Flutter UI)
- Register CheckoutProvider, NotificationProvider in main.dart MultiProvider
- Wire notification bell in HomeScreen app bar
- Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
2026-04-04 15:46:53 +05:30
|
|
|
final dashboard = results[0] as DashboardResponse;
|
|
|
|
|
profile = dashboard.profile;
|
|
|
|
|
submissions = dashboard.submissions;
|
|
|
|
|
|
|
|
|
|
final lbResponse = results[1] as LeaderboardResponse;
|
|
|
|
|
leaderboard = lbResponse.entries;
|
|
|
|
|
currentUserStats = lbResponse.currentUser;
|
|
|
|
|
totalParticipants = lbResponse.totalParticipants;
|
|
|
|
|
|
|
|
|
|
shopItems = results[2] as List<ShopItem>;
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
achievements = results[3] as List<AchievementBadge>;
|
|
|
|
|
} catch (e) {
|
security: sanitize all error messages shown to users
Created centralized userFriendlyError() utility that converts raw
exceptions into clean, user-friendly messages. Strips hostnames,
ports, OS error codes, HTTP status codes, stack traces, and Django
field names. Maps network/timeout/auth/server errors to plain
English messages.
Fixed 16 locations across 10 files:
- home_screen, calendar_screen, learn_more_screen (SnackBar/Text)
- login_screen, desktop_login_screen (SnackBar)
- profile_screen, contribute_screen, search_screen (SnackBar)
- review_form, review_section (inline error text)
- gamification_provider (error field)
Also removed double-wrapped exceptions in ReviewService (rethrow
instead of throw Exception('Failed to...: $e')).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:15:02 +05:30
|
|
|
error = userFriendlyError(e);
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
} finally {
|
|
|
|
|
isLoading = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// Change district filter
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
Future<void> setDistrict(String district) async {
|
|
|
|
|
if (leaderboardDistrict == district) return;
|
|
|
|
|
leaderboardDistrict = district;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
try {
|
feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- Fix gamification endpoints to use Node.js server (app.eventifyplus.com)
- Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit)
- Add booking models, service, payment service (Razorpay), checkout provider
- Add 3-step CheckoutScreen with Razorpay native modal integration
- Add Google OAuth login (Flutter + Django backend)
- Add full notifications system (Django model + 3 endpoints + Flutter UI)
- Register CheckoutProvider, NotificationProvider in main.dart MultiProvider
- Wire notification bell in HomeScreen app bar
- Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
2026-04-04 15:46:53 +05:30
|
|
|
final response = await _service.getLeaderboard(district: district, timePeriod: leaderboardTimePeriod);
|
|
|
|
|
leaderboard = response.entries;
|
|
|
|
|
currentUserStats = response.currentUser;
|
|
|
|
|
totalParticipants = response.totalParticipants;
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
} catch (e) {
|
security: sanitize all error messages shown to users
Created centralized userFriendlyError() utility that converts raw
exceptions into clean, user-friendly messages. Strips hostnames,
ports, OS error codes, HTTP status codes, stack traces, and Django
field names. Maps network/timeout/auth/server errors to plain
English messages.
Fixed 16 locations across 10 files:
- home_screen, calendar_screen, learn_more_screen (SnackBar/Text)
- login_screen, desktop_login_screen (SnackBar)
- profile_screen, contribute_screen, search_screen (SnackBar)
- review_form, review_section (inline error text)
- gamification_provider (error field)
Also removed double-wrapped exceptions in ReviewService (rethrow
instead of throw Exception('Failed to...: $e')).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:15:02 +05:30
|
|
|
error = userFriendlyError(e);
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// Change time period filter
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
Future<void> setTimePeriod(String period) async {
|
|
|
|
|
if (leaderboardTimePeriod == period) return;
|
|
|
|
|
leaderboardTimePeriod = period;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
try {
|
feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- Fix gamification endpoints to use Node.js server (app.eventifyplus.com)
- Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit)
- Add booking models, service, payment service (Razorpay), checkout provider
- Add 3-step CheckoutScreen with Razorpay native modal integration
- Add Google OAuth login (Flutter + Django backend)
- Add full notifications system (Django model + 3 endpoints + Flutter UI)
- Register CheckoutProvider, NotificationProvider in main.dart MultiProvider
- Wire notification bell in HomeScreen app bar
- Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
2026-04-04 15:46:53 +05:30
|
|
|
final response = await _service.getLeaderboard(district: leaderboardDistrict, timePeriod: period);
|
|
|
|
|
leaderboard = response.entries;
|
|
|
|
|
currentUserStats = response.currentUser;
|
|
|
|
|
totalParticipants = response.totalParticipants;
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
} catch (e) {
|
security: sanitize all error messages shown to users
Created centralized userFriendlyError() utility that converts raw
exceptions into clean, user-friendly messages. Strips hostnames,
ports, OS error codes, HTTP status codes, stack traces, and Django
field names. Maps network/timeout/auth/server errors to plain
English messages.
Fixed 16 locations across 10 files:
- home_screen, calendar_screen, learn_more_screen (SnackBar/Text)
- login_screen, desktop_login_screen (SnackBar)
- profile_screen, contribute_screen, search_screen (SnackBar)
- review_form, review_section (inline error text)
- gamification_provider (error field)
Also removed double-wrapped exceptions in ReviewService (rethrow
instead of throw Exception('Failed to...: $e')).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:15:02 +05:30
|
|
|
error = userFriendlyError(e);
|
release: bump version to 1.4(p) (versionCode 14)
- Update versionCode 12 → 14, versionName 1.3(p) → 1.4(p)
- Update pubspec.yaml version to 1.4.0+14
- Add CHANGELOG.md with full version history
- Update README.md: version badge + changelog section
- Desktop Contribute Dashboard rebuilt to match web version
- Contributor Dashboard title, 3-tab nav (Contribute/Leaderboard/Achievements)
- Two-column submit form, tier milestone progress bar
- Desktop leaderboard with podium, filters, rank table (green points)
- Desktop achievements 3-column badge grid
- Inline Reward Shop with RP balance
- Gamification feature module (EP, RP, leaderboard, achievements, shop)
- Profile screen redesigned to match web app layout with animations
- Home screen bottom sheet date filter chips
- Updated API endpoints, login/event detail screens, theme colors
- Added Gilroy font suite, responsive layout improvements
2026-03-18 11:10:56 +05:30
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// Redeem a shop item — deducts RP locally optimistically, returns voucher code
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
Future<String> redeemItem(String itemId) async {
|
|
|
|
|
final item = shopItems.firstWhere((s) => s.id == itemId);
|
|
|
|
|
|
|
|
|
|
// Optimistically deduct RP
|
|
|
|
|
if (profile != null) {
|
|
|
|
|
profile = UserGamificationProfile(
|
|
|
|
|
userId: profile!.userId,
|
|
|
|
|
lifetimeEp: profile!.lifetimeEp,
|
|
|
|
|
currentEp: profile!.currentEp,
|
|
|
|
|
currentRp: profile!.currentRp - item.rpCost,
|
|
|
|
|
tier: profile!.tier,
|
|
|
|
|
);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
final record = await _service.redeemItem(itemId);
|
|
|
|
|
return record.voucherCode;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// Rollback on failure
|
|
|
|
|
if (profile != null) {
|
|
|
|
|
profile = UserGamificationProfile(
|
|
|
|
|
userId: profile!.userId,
|
|
|
|
|
lifetimeEp: profile!.lifetimeEp,
|
|
|
|
|
currentEp: profile!.currentEp,
|
|
|
|
|
currentRp: profile!.currentRp + item.rpCost,
|
|
|
|
|
tier: profile!.tier,
|
|
|
|
|
);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
rethrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// Submit a contribution
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
Future<void> submitContribution(Map<String, dynamic> data) async {
|
|
|
|
|
await _service.submitContribution(data);
|
|
|
|
|
}
|
|
|
|
|
}
|