Initial upload: fin65-mobile
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# FIN65 - Fix local_auth API
|
||||
|
||||
Ce patch corrige l'erreur :
|
||||
|
||||
```text
|
||||
No named parameter with the name 'options'
|
||||
Not a constant expression: AuthenticationOptions
|
||||
```
|
||||
|
||||
Ton projet a résolu une version de `local_auth` où l'appel doit être écrit avec les paramètres directs :
|
||||
|
||||
```dart
|
||||
authenticate(
|
||||
localizedReason: 'Déverrouiller FIN65',
|
||||
biometricOnly: true,
|
||||
stickyAuth: true,
|
||||
useErrorDialogs: true,
|
||||
)
|
||||
```
|
||||
|
||||
et non avec :
|
||||
|
||||
```dart
|
||||
options: AuthenticationOptions(...)
|
||||
```
|
||||
|
||||
## Utilisation
|
||||
|
||||
Décompresse ce ZIP, puis lance :
|
||||
|
||||
```powershell
|
||||
.\fix_local_auth_api.bat
|
||||
```
|
||||
|
||||
Ensuite :
|
||||
|
||||
```powershell
|
||||
cd D:\07-Logiciels\20-FIN65\fin65_mobile
|
||||
flutter run
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0fix_local_auth_api.bat.ps1"
|
||||
@@ -0,0 +1,80 @@
|
||||
$MobileDir = "D:\07-Logiciels\20-FIN65\fin65_mobile"
|
||||
$SecurityService = Join-Path $MobileDir "lib\services\security_service.dart"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=========================================="
|
||||
Write-Host " FIN65 - Fix local_auth API"
|
||||
Write-Host "=========================================="
|
||||
Write-Host ""
|
||||
|
||||
if (!(Test-Path $SecurityService)) {
|
||||
Write-Host "[ERREUR] Fichier introuvable : $SecurityService" -ForegroundColor Red
|
||||
Read-Host "Appuie sur Entree pour fermer"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$Stamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
||||
Copy-Item $SecurityService "$SecurityService.before_local_auth_fix_$Stamp.bak" -Force
|
||||
Write-Host "Sauvegarde : $SecurityService.before_local_auth_fix_$Stamp.bak"
|
||||
|
||||
$text = Get-Content $SecurityService -Raw
|
||||
|
||||
# Remplace l'appel local_auth récent :
|
||||
# authenticate(localizedReason: ..., options: AuthenticationOptions(...))
|
||||
# par l'API compatible avec la version résolue dans ton projet :
|
||||
# authenticate(localizedReason: ..., biometricOnly: true, stickyAuth: true, useErrorDialogs: true)
|
||||
$oldBlock = @'
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: 'Déverrouiller FIN65',
|
||||
options: const AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
stickyAuth: true,
|
||||
useErrorDialogs: true,
|
||||
),
|
||||
);
|
||||
'@
|
||||
|
||||
$newBlock = @'
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: 'Déverrouiller FIN65',
|
||||
biometricOnly: true,
|
||||
stickyAuth: true,
|
||||
useErrorDialogs: true,
|
||||
);
|
||||
'@
|
||||
|
||||
if ($text.Contains($oldBlock)) {
|
||||
$text = $text.Replace($oldBlock, $newBlock)
|
||||
} else {
|
||||
# Fallback regex au cas où l'indentation varie.
|
||||
$pattern = "(?ms)return await _localAuth\.authenticate\(\s*localizedReason:\s*'Déverrouiller FIN65',\s*options:\s*(?:const\s*)?AuthenticationOptions\(\s*biometricOnly:\s*true,\s*stickyAuth:\s*true,\s*useErrorDialogs:\s*true,\s*\),\s*\);"
|
||||
$replacement = @"
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: 'Déverrouiller FIN65',
|
||||
biometricOnly: true,
|
||||
stickyAuth: true,
|
||||
useErrorDialogs: true,
|
||||
);
|
||||
"@
|
||||
$text = [regex]::Replace($text, $pattern, $replacement)
|
||||
}
|
||||
|
||||
Set-Content -Path $SecurityService -Value $text -Encoding UTF8
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Verification :"
|
||||
Select-String -Path $SecurityService -Pattern "authenticate|AuthenticationOptions|biometricOnly|stickyAuth|useErrorDialogs" | ForEach-Object { Write-Host $_.Line }
|
||||
|
||||
Set-Location $MobileDir
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Nettoyage Flutter..."
|
||||
flutter clean
|
||||
flutter pub get
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Fix local_auth termine."
|
||||
Write-Host "Relance maintenant :"
|
||||
Write-Host "flutter run"
|
||||
Write-Host ""
|
||||
Read-Host "Appuie sur Entree pour fermer"
|
||||
Reference in New Issue
Block a user