Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed silentLogin cardOrder bug #2034

Open
wants to merge 12 commits into
base: experimental
Choose a base branch
from
6 changes: 4 additions & 2 deletions lib/core/providers/cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class CardsDataProvider extends ChangeNotifier {
'employee_id',
];

// Default card states
for (String card in CardTitleConstants.titleMap.keys.toList()) {
_cardStates![card] = true;
}
Expand Down Expand Up @@ -255,11 +256,12 @@ class CardsDataProvider extends ChangeNotifier {
}
}


activateStudentCards() {
int index = _cardOrder!.indexOf('MyStudentChart') + 1;
_cardOrder!.insertAll(index, _studentCards.toList());

// TODO: test w/o this
// TODO: test w/o this (duplicated the cards)
_cardOrder = List.from(_cardOrder!.toSet().toList());

updateCardOrder(_cardOrder);
Expand All @@ -271,7 +273,7 @@ class CardsDataProvider extends ChangeNotifier {
int index = _cardOrder!.indexOf('MyStudentChart') + 1;
_cardOrder!.insertAll(index, _studentCards.toList());

// TODO: test w/o this
// TODO: test w/o this (duplicated the cards)
_cardOrder = List.from(_cardOrder!.toSet().toList());

for (String card in _studentCards) {
Expand Down
3 changes: 1 addition & 2 deletions lib/core/providers/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ class UserDataProvider extends ChangeNotifier {

if (username.isNotEmpty && password.isNotEmpty) {
_encryptAndSaveCredentials(username, password);

if (await silentLogin()) {
if (_userProfileModel!.classifications!.student!) {
_cardsDataProvider!.showAllStudentCards();
Expand Down Expand Up @@ -219,8 +218,8 @@ class UserDataProvider extends ChangeNotifier {
await updateAuthenticationModel(_authenticationService.data);

await fetchUserProfile();

CardsDataProvider _cardsDataProvider = CardsDataProvider();
//_cardsDataProvider.loadSavedData();
_cardsDataProvider
.updateAvailableCards(_userProfileModel!.ucsdaffiliation);

Expand Down