Skip to content

Bloc update 6.1.0

Justin Sauer requested to merge jsar97/tc_frontend:bloc-update-6.1.0 into master

Attempt to solve #148 (closed) Most Changes of the newer Bloc Version are now included.

But there are some non-trivial changes left. Basically every open issue has to do with the following: initialState now was removed and instead of overriding this, the initialState of a Bloc should be provided via the constructor.

For example:

UserBloc() : _httpRepo = HttpRepository();

@override
UserState get initialState => _fix(super.initialState) ?? UserLoggedOutState();

UserState _fix(UserState persistedState){
  // Do some internal logic.
}

The code above does not work with the new changes as it should look like this:

UserBloc() 
  : _httpRepo = HttpRepository(), 
    super(UserLoggedOutState());

The problem is, that you now no longer have access to the persisted state inside of the bloc and thus cannot just call the _fix() method.

If i find a nice way to implement similar behaviour i will update this.

Currently the Bloc's where we have to fix this are:

@jsar97

  • HomeBloc
  • UserBloc

@mblt41 @jsar97

  • VCardBloc // ? Maybe maybe not ?

@dbrb56

  • CafeteriaBloc
  • CafeteriaOpeningBloc
  • CafeteriaSettingsBloc

@mlbn33

  • OCalendarBloc
  • OColorMappingBloc
  • OLessonSelectionBloc
  • OProgramConfigurationBloc
  • OProgramHistoryBloc

@jsar97

  • Final Testing
    1. Every Calendar-Bloc seemingly resets after the update. Need some help for further debugging @mlbn33

@mlbn33

  • We discovered that the runtime type is not persisted. For example in the app OProgramConfigurationState is never expected, but the fromJson doesn't know which state should be rebuilt. It should rebuild OProgramConfigurationEmptyState OR OProgramConfigurationReadyState, but neither does, because it accepts OProgramConfigurationState as default. We need to be able to also save the state class/runtime type.
    image

return OProgramConfigurationState.fromJson(json);

Edited by Justin Sauer

Merge request reports