| 1 | import 'package:mobx/mobx.dart'; |
| 2 | |
| 3 | part 'authentication_store.g.dart'; |
| 4 | |
| 5 | class AuthenticationStore = AuthenticationStoreBase with _$AuthenticationStore; |
| 6 | |
| 7 | enum AuthenticationState { uninitialized, installed, allowed, allowedCreate, _reset } |
| 8 | |
| 9 | abstract class AuthenticationStoreBase with Store { |
| 10 | AuthenticationStoreBase() : state = AuthenticationState.uninitialized; |
| 11 | |
| 12 | @observable |
| 13 | AuthenticationState state; |
| 14 | |
| 15 | @action |
| 16 | void installed() { |
| 17 | state = AuthenticationState._reset; |
| 18 | state = AuthenticationState.installed; |
| 19 | } |
| 20 | |
| 21 | @action |
| 22 | void allowed() { |
| 23 | state = AuthenticationState._reset; |
| 24 | state = AuthenticationState.allowed; |
| 25 | } |
| 26 | |
| 27 | @action |
| 28 | void allowedCreate() { |
| 29 | state = AuthenticationState._reset; |
| 30 | state = AuthenticationState.allowedCreate; |
| 31 | } |
| 32 | } |