mirror of
https://github.com/openfoodfacts/smooth-app.git
synced 2025-08-26 11:16:45 +08:00
Force cookie to be saved if not (#5254)
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:openfoodfacts/openfoodfacts.dart';
|
||||
@ -110,14 +112,16 @@ class UserManagementProvider with ChangeNotifier {
|
||||
password: user.password,
|
||||
),
|
||||
);
|
||||
switch (loginResult.type) {
|
||||
case LoginResultType.successful:
|
||||
case LoginResultType.serverIssue:
|
||||
case LoginResultType.exception:
|
||||
return;
|
||||
case LoginResultType.unsuccessful:
|
||||
// TODO(m123): Notify the user
|
||||
await logout();
|
||||
|
||||
if (loginResult.type == LoginResultType.unsuccessful) {
|
||||
// TODO(m123): Notify the user
|
||||
await logout();
|
||||
return;
|
||||
}
|
||||
|
||||
/// Save the cookie if necessary
|
||||
if (user.cookie == null && loginResult.user?.cookie != null) {
|
||||
putUser(loginResult.user!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ Future<bool> _init1() async {
|
||||
),
|
||||
daoString: DaoString(_localDatabase),
|
||||
);
|
||||
ProductQuery.setQueryType(_userPreferences);
|
||||
UserManagementProvider().checkUserLoginValidity();
|
||||
|
||||
await AnalyticsHelper.linkPreferences(_userPreferences);
|
||||
@ -144,7 +145,6 @@ Future<bool> _init1() async {
|
||||
_themeProvider = ThemeProvider(_userPreferences);
|
||||
_colorProvider = ColorProvider(_userPreferences);
|
||||
_textContrastProvider = TextContrastProvider(_userPreferences);
|
||||
ProductQuery.setQueryType(_userPreferences);
|
||||
|
||||
await CameraHelper.init();
|
||||
await ProductQuery.setUuid(_localDatabase);
|
||||
|
Reference in New Issue
Block a user