Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
640bbea802 | ||
|
|
7ae137f865 | ||
|
|
cabd121ac1 |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
docs/superpowers/specs/*.md
|
||||||
@@ -40,7 +40,7 @@ repos:
|
|||||||
rev: v0.13.0
|
rev: v0.13.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: markdownlint
|
- id: markdownlint
|
||||||
exclude: "^.github|(^docs/_sidebar\\.md$)"
|
exclude: "^.github|_sidebar\\.md$|superpowers/(specs|plans)/.*\\.md$"
|
||||||
|
|
||||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||||
rev: v0.11.0.1
|
rev: v0.11.0.1
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,350 @@
|
|||||||
|
<!-- markdownlint-disable-file -->
|
||||||
|
# MyIce Flutter App - Design Specification
|
||||||
|
|
||||||
|
**Date:** 2026-07-06
|
||||||
|
**Context:** Application mobile Flutter (iOS/Android) reproduisant le fonctionnement de la webapp myice existante.
|
||||||
|
**Backend:** L'application se connecte a l'API FastAPI existante (myice/webapi.py) via HTTP.
|
||||||
|
|
||||||
|
## 1. Architecture globale
|
||||||
|
|
||||||
|
Approche : **Repository + Provider (B)**
|
||||||
|
|
||||||
|
```
|
||||||
|
lib/
|
||||||
|
├── main.dart # Entry point, MaterialApp, MultiProvider
|
||||||
|
├── config/
|
||||||
|
│ └── api_config.dart # URL base de l'API, timeouts
|
||||||
|
├── models/
|
||||||
|
│ ├── account.dart # {name, label}
|
||||||
|
│ ├── event.dart # Game/Practice du schedule
|
||||||
|
│ ├── event_detail.dart # Details + convocation
|
||||||
|
│ ├── user_info.dart # {email}
|
||||||
|
│ └── convocation.dart # Player, Staff, Convocation
|
||||||
|
├── services/
|
||||||
|
│ ├── api_service.dart # Dio + intercepteur Bearer
|
||||||
|
│ └── auth_service.dart # Login/logout OIDC, deep link
|
||||||
|
├── providers/
|
||||||
|
│ ├── auth_provider.dart # Etat auth + user info
|
||||||
|
│ ├── schedule_provider.dart # Liste events + filtres
|
||||||
|
│ └── event_provider.dart # Details d'un event (optionnel)
|
||||||
|
├── repositories/
|
||||||
|
│ └── myice_repository.dart # Appels API : accounts, schedule, game
|
||||||
|
├── screens/
|
||||||
|
│ ├── login_screen.dart
|
||||||
|
│ ├── schedule_screen.dart
|
||||||
|
│ └── event_detail_screen.dart
|
||||||
|
└── widgets/
|
||||||
|
├── event_card.dart
|
||||||
|
├── filter_dropdown.dart
|
||||||
|
└── loading_indicator.dart
|
||||||
|
```
|
||||||
|
|
||||||
|
**Pattern :** Repository encapsule les appels API -> Providers gerent l'etat reactif -> Screens ecoutent les Providers.
|
||||||
|
|
||||||
|
## 2. Dependances Flutter
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
flutter:
|
||||||
|
sdk: flutter
|
||||||
|
dio: ^5.4.0
|
||||||
|
provider: ^6.1.0
|
||||||
|
shared_preferences: ^2.2.0
|
||||||
|
flutter_web_auth: ^0.6.0
|
||||||
|
intl: ^0.19.0 # Pour le parsing/formatage de dates si besoin
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Modeles de donnees (JSON <-> Dart)
|
||||||
|
|
||||||
|
### Account
|
||||||
|
```dart
|
||||||
|
class Account {
|
||||||
|
final String name;
|
||||||
|
final String label;
|
||||||
|
Account({required this.name, required this.label});
|
||||||
|
factory Account.fromJson(Map<String, dynamic> json) => Account(
|
||||||
|
name: json['name'] as String,
|
||||||
|
label: json['label'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Event
|
||||||
|
Provenant de `/schedule`.
|
||||||
|
```dart
|
||||||
|
class Event {
|
||||||
|
final String idEvent;
|
||||||
|
final String agegroup;
|
||||||
|
final String name;
|
||||||
|
final String title;
|
||||||
|
final String opponent;
|
||||||
|
final String place;
|
||||||
|
final String start;
|
||||||
|
final String end;
|
||||||
|
final String? color;
|
||||||
|
final String eventType; // mappe depuis le champ JSON 'event'
|
||||||
|
|
||||||
|
Event({
|
||||||
|
required this.idEvent,
|
||||||
|
required this.agegroup,
|
||||||
|
required this.name,
|
||||||
|
required this.title,
|
||||||
|
required this.opponent,
|
||||||
|
required this.place,
|
||||||
|
required this.start,
|
||||||
|
required this.end,
|
||||||
|
this.color,
|
||||||
|
required this.eventType,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Event.fromJson(Map<String, dynamic> json) => Event(
|
||||||
|
idEvent: json['id_event']?.toString() ?? '',
|
||||||
|
agegroup: json['agegroup'] as String,
|
||||||
|
name: json['name'] as String? ?? '',
|
||||||
|
title: json['title'] as String,
|
||||||
|
opponent: json['opponent'] as String? ?? '',
|
||||||
|
place: json['place'] as String? ?? '',
|
||||||
|
start: json['start'] as String,
|
||||||
|
end: json['end'] as String,
|
||||||
|
color: json['color'] as String?,
|
||||||
|
eventType: json['event'] as String? ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Player
|
||||||
|
```dart
|
||||||
|
class Player {
|
||||||
|
final String? position;
|
||||||
|
final String? number;
|
||||||
|
final String fname;
|
||||||
|
final String lname;
|
||||||
|
final String dob;
|
||||||
|
|
||||||
|
Player({this.position, this.number, required this.fname, required this.lname, required this.dob});
|
||||||
|
|
||||||
|
factory Player.fromJson(Map<String, dynamic> json) => Player(
|
||||||
|
position: json['position'] as String?,
|
||||||
|
number: json['number']?.toString(),
|
||||||
|
fname: json['fname'] as String,
|
||||||
|
lname: json['lname'] as String,
|
||||||
|
dob: json['dob'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Staff
|
||||||
|
```dart
|
||||||
|
class Staff {
|
||||||
|
final String role;
|
||||||
|
final String fname;
|
||||||
|
final String lname;
|
||||||
|
|
||||||
|
Staff({required this.role, required this.fname, required this.lname});
|
||||||
|
|
||||||
|
factory Staff.fromJson(Map<String, dynamic> json) => Staff(
|
||||||
|
role: json['role'] as String,
|
||||||
|
fname: json['fname'] as String,
|
||||||
|
lname: json['lname'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Convocation
|
||||||
|
```dart
|
||||||
|
class Convocation {
|
||||||
|
final List<Player> available;
|
||||||
|
final List<Staff> staff;
|
||||||
|
|
||||||
|
Convocation({required this.available, required this.staff});
|
||||||
|
|
||||||
|
factory Convocation.fromJson(Map<String, dynamic> json) => Convocation(
|
||||||
|
available: (json['available'] as List? ?? [])
|
||||||
|
.map((e) => Player.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
staff: (json['staff'] as List? ?? [])
|
||||||
|
.map((e) => Staff.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### EventDetail
|
||||||
|
Provenant de `/game/{id}`.
|
||||||
|
```dart
|
||||||
|
class EventDetail {
|
||||||
|
final String title;
|
||||||
|
final String type;
|
||||||
|
final String place;
|
||||||
|
final String timeStart;
|
||||||
|
final String timeEnd;
|
||||||
|
final Convocation convocation;
|
||||||
|
|
||||||
|
EventDetail({
|
||||||
|
required this.title,
|
||||||
|
required this.type,
|
||||||
|
required this.place,
|
||||||
|
required this.timeStart,
|
||||||
|
required this.timeEnd,
|
||||||
|
required this.convocation,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory EventDetail.fromJson(Map<String, dynamic> json) => EventDetail(
|
||||||
|
title: json['title'] as String,
|
||||||
|
type: json['type'] as String,
|
||||||
|
place: json['place'] as String? ?? '',
|
||||||
|
timeStart: json['time_start'] as String,
|
||||||
|
timeEnd: json['time_end'] as String,
|
||||||
|
convocation: Convocation.fromJson(json['convocation'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### UserInfo
|
||||||
|
```dart
|
||||||
|
class UserInfo {
|
||||||
|
final String email;
|
||||||
|
UserInfo({required this.email});
|
||||||
|
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
|
||||||
|
email: json['email'] as String? ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Services
|
||||||
|
|
||||||
|
### ApiService
|
||||||
|
Utilise `dio`. Un intercepteur ajoute automatiquement le header `Authorization: Bearer <token>`.
|
||||||
|
|
||||||
|
Concept:
|
||||||
|
- `setBearerToken(token)` ajoute un `InterceptorsWrapper` a Dio.
|
||||||
|
- `clearBearerToken()` retire les intercepteurs existants.
|
||||||
|
- Methodes: `getAccounts()`, `getSchedule(account)`, `getGameDetail(gameId, account)`, `getUserInfo()`.
|
||||||
|
- Retournent des objets modeles via `fromJson`.
|
||||||
|
|
||||||
|
### AuthService
|
||||||
|
Utilise `flutter_web_auth` pour l'OIDC + `shared_preferences` pour stocker le token.
|
||||||
|
|
||||||
|
Concept:
|
||||||
|
- `storedToken`, `storedAccount` depuis `SharedPreferences`.
|
||||||
|
- `login()`: appelle `FlutterWebAuth.authenticate(url: baseUrl/login, callbackUrlScheme: 'myice')`. Parse le fragment `#access_token=xxx` de l'URL retournee. Stocke le token.
|
||||||
|
- `setAccount(account)`: persiste le compte selectionne.
|
||||||
|
- `logout()`: supprime token, account, userInfo des prefs.
|
||||||
|
|
||||||
|
**Configuration deep link requise:**
|
||||||
|
- Android: intent-filter dans `AndroidManifest.xml` pour scheme `myice://`.
|
||||||
|
- iOS: `CFBundleURLTypes` dans `Info.plist` avec scheme `myice`.
|
||||||
|
|
||||||
|
## 5. Providers (Provider package)
|
||||||
|
|
||||||
|
### AuthProvider
|
||||||
|
Gere l'etat global d'authentification.
|
||||||
|
|
||||||
|
**Etat:** `isAuthenticated`, `userInfo`.
|
||||||
|
**Methodes:**
|
||||||
|
- `init()`: Verifie token stocke, appelle `/userinfo`. Si 401, considere deconnecte.
|
||||||
|
- `login()`: Lance AuthService.login(), met a jour le token, appelle `/userinfo`, notifie listeners.
|
||||||
|
- `logout()`: Efface le token, notifie listeners.
|
||||||
|
|
||||||
|
### ScheduleProvider
|
||||||
|
Gere les events, les comptes, et les filtres.
|
||||||
|
|
||||||
|
**Etat:** `accounts`, `events`, `selectedAccount`, `selectedAgegroup`, `selectedSubgroup`, `isLoading`, `error`.
|
||||||
|
**Methodes:**
|
||||||
|
- `loadAccounts()`: Appelle `/accounts`, met a jour `accounts`. Selectionne `storedAccount` si present, sinon le premier.
|
||||||
|
- `loadSchedule()`: Met `isLoading = true`, appelle `/schedule?account=selectedAccount`, filtre events ou `eventType == "Jeu"`, extrait les `agegroup` uniques pour les filtres.
|
||||||
|
- `setAccount(String)`: Met a jour `selectedAccount`, sauvegarde dans SharedPreferences, appelle `loadSchedule()`.
|
||||||
|
- `setAgegroup(String)`: Met a jour, reset `selectedSubgroup`, notifie.
|
||||||
|
- `setSubgroup(String)`: Met a jour, notifie.
|
||||||
|
- `get filteredEvents`: Getter filtre `events` par `agegroup` et `subgroup`.
|
||||||
|
|
||||||
|
**Logique de filtre sous-groupe:**
|
||||||
|
Identique a la webapp. La fonction `extractSubgroup(name)` retire la partie apres `" - "` dans le `name` de l'event pour obtenir le sous-groupe (si applicable).
|
||||||
|
|
||||||
|
### EventDetailProvider (Optionnel)
|
||||||
|
Gere le chargement des details d'un event. Peut etre integre dans `ScheduleProvider` si prefere pour garder un seul provider.
|
||||||
|
|
||||||
|
**Etat:** `eventDetail`, `isLoading`, `error`.
|
||||||
|
**Methodes:** `loadEventDetail(gameId)` appelle `/game/{gameId}`.
|
||||||
|
|
||||||
|
## 6. Ecrans
|
||||||
|
|
||||||
|
### LoginScreen
|
||||||
|
- **AppBar:** Aucune (centre).
|
||||||
|
- **Body:** Column centree.
|
||||||
|
- Titre: "MyIce - Games" (headlineLarge, couleur indigo).
|
||||||
|
- Bouton: "Se connecter avec Infomaniak" (style degrade indigo -> violet).
|
||||||
|
- Texte d'aide: "Connectez-vous pour acceder aux evenements...".
|
||||||
|
- **Comportement:**
|
||||||
|
- Si `authProvider.isAuthenticated`, navigue automatiquement vers `ScheduleScreen`.
|
||||||
|
- Affiche `CircularProgressIndicator` pendant le login.
|
||||||
|
- SnackBar en cas d'erreur.
|
||||||
|
|
||||||
|
### ScheduleScreen
|
||||||
|
- **AppBar:** Titre "MyIce", action logout + email utilisateur.
|
||||||
|
- **Body:**
|
||||||
|
- **Filtres:** Card avec 3 `DropdownButtonFormField` (Compte, Age, Sous-groupe). Le bouton "Charger" est optionnel (changement de compte recharge auto).
|
||||||
|
- **Liste:** `Expanded` + `ListView.builder`. Affiche `EventCard` pour chaque event filtre.
|
||||||
|
- Etats: Loading (`CircularProgressIndicator`), vide (texte info), erreur (SnackBar).
|
||||||
|
|
||||||
|
### EventDetailScreen
|
||||||
|
- **AppBar:** Titre = `event.title`, bouton retour.
|
||||||
|
- **Body:** `SingleChildScrollView` + `Padding(16)`.
|
||||||
|
- Card recap: Type, Lieu, Heure.
|
||||||
|
- Section Joueurs:
|
||||||
|
- Si vide: Card amber "Aucun joueur convoque".
|
||||||
|
- Sinon: Card avec total + repartition positions. Liste triee par position puis numero: `[Position] #Num - Prenom Nom (DOB)`.
|
||||||
|
- Section Personnel:
|
||||||
|
- Si vide: Card bleu "Aucun personnel convoque".
|
||||||
|
- Sinon: Liste `role: Prenom Nom`.
|
||||||
|
- Si aucun joueur ET aucun personnel: Card amber principal "Aucun joueur ni personnel convoque" uniquement.
|
||||||
|
|
||||||
|
### Widgets reutilisables
|
||||||
|
- **EventCard:** Card avec bordure laterale coloree. Titre (`agegroup - name`), sous-titre, details (adversaire, lieu, heure). onTap -> `EventDetailScreen`.
|
||||||
|
- **FilterDropdown:** `DropdownButtonFormField` generique stylise.
|
||||||
|
|
||||||
|
## 7. Navigation & Routing
|
||||||
|
|
||||||
|
Utilisation de `Navigator` classique (pas de package tierce pour 3 ecrans).
|
||||||
|
- `main.dart`: `MaterialApp` avec `home` determine par `Consumer<AuthProvider>` (`ScheduleScreen` ou `LoginScreen`).
|
||||||
|
- Navigation details: `Navigator.push(MaterialPageRoute(builder: (_) => EventDetailScreen(...)))`.
|
||||||
|
|
||||||
|
## 8. Gestion des erreurs
|
||||||
|
|
||||||
|
- Erreur reseau / API: SnackBar rouge avec message.
|
||||||
|
- 401 (Token expire): Deconnexion automatique + redirection `LoginScreen`.
|
||||||
|
- JSON malforme: La webapp gere cote backend. Cote Flutter, `jsonDecode` echoue -> message "Donnees invalides".
|
||||||
|
- Aucun event/joueur: Interface vide avec message informatif (pas d'erreur).
|
||||||
|
|
||||||
|
## 9. Configuration requise
|
||||||
|
|
||||||
|
### Android
|
||||||
|
Ajouter un intent-filter dans `android/app/src/main/AndroidManifest.xml` pour le deep link `myice://callback`.
|
||||||
|
|
||||||
|
### iOS
|
||||||
|
Ajouter `CFBundleURLTypes` dans `ios/Runner/Info.plist` avec scheme `myice`.
|
||||||
|
|
||||||
|
### Configuration API
|
||||||
|
`lib/config/api_config.dart`:
|
||||||
|
```dart
|
||||||
|
class ApiConfig {
|
||||||
|
static const String baseUrl = 'https://your-api-domain.com'; // A configurer
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 10. Plan d'implementation (High-level)
|
||||||
|
|
||||||
|
1. Scaffolding du projet Flutter (`flutter create`).
|
||||||
|
2. Ajout des dependances (`pubspec.yaml`).
|
||||||
|
3. Configuration des deep links (`AndroidManifest` + `Info.plist`).
|
||||||
|
4. Implementation des modeles de donnees (`fromJson`).
|
||||||
|
5. Implementation des services (`ApiService`, `AuthService`).
|
||||||
|
6. Implementation des providers (`AuthProvider`, `ScheduleProvider`).
|
||||||
|
7. Implementation des ecrans (`LoginScreen`, `ScheduleScreen`, `EventDetailScreen`).
|
||||||
|
8. Implementation des widgets (`EventCard`, etc.).
|
||||||
|
9. Wiring dans `main.dart` avec `MultiProvider`.
|
||||||
|
10. Tests manuels de l'auth OIDC et de la navigation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Prochaine etape apres validation du spec:** Creer le plan d'implementation detaille avec le skill `writing-plans`.
|
||||||
+25
-11
@@ -7,7 +7,7 @@ from fastapi import FastAPI, Header, HTTPException, Request, status
|
|||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import FileResponse, RedirectResponse
|
from fastapi.responses import FileResponse, RedirectResponse
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing import Annotated
|
from typing import Annotated, Optional
|
||||||
from . import myice
|
from . import myice
|
||||||
|
|
||||||
# OIDC Configuration
|
# OIDC Configuration
|
||||||
@@ -151,11 +151,10 @@ async def favico():
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/login")
|
@app.get("/login")
|
||||||
async def login(request: Request):
|
async def login(request: Request, redirect_uri: Optional[str] = None):
|
||||||
"""Redirect to Infomaniak OIDC login"""
|
"""Redirect to Infomaniak OIDC login"""
|
||||||
import urllib.parse
|
|
||||||
|
|
||||||
import secrets
|
import secrets
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
state = secrets.token_urlsafe(32)
|
state = secrets.token_urlsafe(32)
|
||||||
nonce = secrets.token_urlsafe(32)
|
nonce = secrets.token_urlsafe(32)
|
||||||
@@ -196,6 +195,16 @@ async def login(request: Request):
|
|||||||
samesite="Lax",
|
samesite="Lax",
|
||||||
max_age=300,
|
max_age=300,
|
||||||
)
|
)
|
||||||
|
# Store target redirect URI (e.g. myice://callback) for mobile app flow
|
||||||
|
if redirect_uri:
|
||||||
|
response.set_cookie(
|
||||||
|
"oidc_target_redirect",
|
||||||
|
redirect_uri,
|
||||||
|
httponly=True,
|
||||||
|
secure=True,
|
||||||
|
samesite="Lax",
|
||||||
|
max_age=300,
|
||||||
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@@ -204,12 +213,17 @@ async def callback(request: Request, code: str, state: str):
|
|||||||
"""Handle OIDC callback and exchange code for token"""
|
"""Handle OIDC callback and exchange code for token"""
|
||||||
expected_state = request.cookies.get("oidc_state")
|
expected_state = request.cookies.get("oidc_state")
|
||||||
code_verifier = request.cookies.get("oidc_verifier")
|
code_verifier = request.cookies.get("oidc_verifier")
|
||||||
|
# Determine final redirect target (mobile app or web frontend)
|
||||||
|
target_redirect = request.cookies.get("oidc_target_redirect") or os.environ.get(
|
||||||
|
"FRONTEND_URL", "/"
|
||||||
|
)
|
||||||
# We should also delete state/nonce cookies once read
|
# We should also delete state/nonce cookies once read
|
||||||
if not expected_state or state != expected_state:
|
if not expected_state or state != expected_state:
|
||||||
response = RedirectResponse("/?error=Invalid state parameter")
|
response = RedirectResponse(f"/{target_redirect}?error=Invalid state parameter")
|
||||||
response.delete_cookie("oidc_state")
|
response.delete_cookie("oidc_state")
|
||||||
response.delete_cookie("oidc_nonce")
|
response.delete_cookie("oidc_nonce")
|
||||||
response.delete_cookie("oidc_verifier")
|
response.delete_cookie("oidc_verifier")
|
||||||
|
response.delete_cookie("oidc_target_redirect")
|
||||||
return response
|
return response
|
||||||
# Exchange authorization code for access token
|
# Exchange authorization code for access token
|
||||||
token_data = {
|
token_data = {
|
||||||
@@ -227,14 +241,14 @@ async def callback(request: Request, code: str, state: str):
|
|||||||
# Log the error for debugging
|
# Log the error for debugging
|
||||||
logging.error("Token exchange failed: %s", token_response)
|
logging.error("Token exchange failed: %s", token_response)
|
||||||
# Redirect back to frontend with error
|
# Redirect back to frontend with error
|
||||||
frontend_url = os.environ.get("FRONTEND_URL", "/")
|
|
||||||
error_detail = token_response.get(
|
error_detail = token_response.get(
|
||||||
"error_description", "Failed to obtain access token"
|
"error_description", "Failed to obtain access token"
|
||||||
)
|
)
|
||||||
error_response = RedirectResponse(f"{frontend_url}?error={error_detail}")
|
error_response = RedirectResponse(f"{target_redirect}?error={error_detail}")
|
||||||
error_response.delete_cookie("oidc_state")
|
error_response.delete_cookie("oidc_state")
|
||||||
error_response.delete_cookie("oidc_nonce")
|
error_response.delete_cookie("oidc_nonce")
|
||||||
error_response.delete_cookie("oidc_verifier")
|
error_response.delete_cookie("oidc_verifier")
|
||||||
|
error_response.delete_cookie("oidc_target_redirect")
|
||||||
return error_response
|
return error_response
|
||||||
|
|
||||||
access_token = token_response["access_token"]
|
access_token = token_response["access_token"]
|
||||||
@@ -250,19 +264,19 @@ async def callback(request: Request, code: str, state: str):
|
|||||||
user_email = userinfo.get("email")
|
user_email = userinfo.get("email")
|
||||||
if ALLOWED_USERS and user_email not in ALLOWED_USERS:
|
if ALLOWED_USERS and user_email not in ALLOWED_USERS:
|
||||||
# Redirect back to frontend with error
|
# Redirect back to frontend with error
|
||||||
frontend_url = os.environ.get("FRONTEND_URL", "/")
|
response = RedirectResponse(f"{target_redirect}?error=User not authorized")
|
||||||
response = RedirectResponse(f"{frontend_url}?error=User not authorized")
|
|
||||||
response.delete_cookie("oidc_state")
|
response.delete_cookie("oidc_state")
|
||||||
response.delete_cookie("oidc_nonce")
|
response.delete_cookie("oidc_nonce")
|
||||||
response.delete_cookie("oidc_verifier")
|
response.delete_cookie("oidc_verifier")
|
||||||
|
response.delete_cookie("oidc_target_redirect")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
# Redirect back to frontend with access token and user info
|
# Redirect back to frontend with access token and user info
|
||||||
frontend_url = os.environ.get("FRONTEND_URL", "/")
|
response = RedirectResponse(f"{target_redirect}#access_token={access_token}")
|
||||||
response = RedirectResponse(f"{frontend_url}#access_token={access_token}")
|
|
||||||
response.delete_cookie("oidc_state")
|
response.delete_cookie("oidc_state")
|
||||||
response.delete_cookie("oidc_nonce")
|
response.delete_cookie("oidc_nonce")
|
||||||
response.delete_cookie("oidc_verifier")
|
response.delete_cookie("oidc_verifier")
|
||||||
|
response.delete_cookie("oidc_target_redirect")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Flutter/Dart specific
|
||||||
|
.dart_tool/
|
||||||
|
.packages
|
||||||
|
build/
|
||||||
|
.pub/
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Android
|
||||||
|
*.apk
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
!/android/app/src/main/AndroidManifest.xml
|
||||||
|
|
||||||
|
# iOS
|
||||||
|
ios/Pods/
|
||||||
|
ios/.symlinks/
|
||||||
|
ios/Flutter/Flutter.framework
|
||||||
|
ios/Flutter/Flutter.podspec
|
||||||
|
|
||||||
|
# Xcode
|
||||||
|
xcuserdata/
|
||||||
|
*.xcworkspace/
|
||||||
|
DerivedData/
|
||||||
|
|
||||||
|
# Web
|
||||||
|
lib/generated_plugin_registrant.dart
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
windows/flutter/
|
||||||
|
windows/runner/
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
linux/flutter/
|
||||||
|
linux/runner/
|
||||||
|
|
||||||
|
# Firebase
|
||||||
|
firebase_app_id_file.json
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.tmp
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application
|
||||||
|
android:label="myice_mobile"
|
||||||
|
android:name="${applicationName}"
|
||||||
|
android:icon="@mipmap/ic_launcher">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/LaunchTheme"
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
<meta-data
|
||||||
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
|
android:resource="@style/NormalTheme"
|
||||||
|
/>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="myice" android:host="callback" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<meta-data
|
||||||
|
android:name="flutterEmbedding"
|
||||||
|
android:value="2" />
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>MyIce</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>myice_mobile</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>ch.parano.myice</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>myice</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true/>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>UIMainStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: myice_mobile
|
||||||
|
description: Flutter mobile app for MyIce
|
||||||
|
publish_to: 'none'
|
||||||
|
version: 1.0.0+1
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: '>=3.1.0 <4.0.0'
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
flutter:
|
||||||
|
sdk: flutter
|
||||||
|
dio: ^5.4.0
|
||||||
|
provider: ^6.1.0
|
||||||
|
shared_preferences: ^2.2.0
|
||||||
|
flutter_web_auth: ^0.6.0
|
||||||
|
intl: ^0.19.0
|
||||||
|
|
||||||
|
dev_dependencies:
|
||||||
|
flutter_test:
|
||||||
|
sdk: flutter
|
||||||
|
flutter_lints: ^3.0.0
|
||||||
|
|
||||||
|
flutter:
|
||||||
|
uses-material-design: true
|
||||||
Reference in new issue
Block a user