-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
414 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:event/event.dart'; | ||
import 'package:jasmine/basic/methods.dart'; | ||
|
||
enum LoginStatus { | ||
notSet, | ||
logging, | ||
loginField, | ||
loginSuccess, | ||
} | ||
|
||
late SelfInfo _selfInfo; | ||
LoginStatus _status = LoginStatus.notSet; | ||
final Event _event = Event(); | ||
|
||
SelfInfo get selfInfo => _selfInfo; | ||
|
||
Event get loginEvent => _event; | ||
|
||
LoginStatus get loginStatus => _status; | ||
|
||
set _loginState(LoginStatus value) { | ||
_status = value; | ||
_event.broadcast(); | ||
} | ||
|
||
Future initLogin() async { | ||
try { | ||
_loginState = LoginStatus.logging; | ||
final preLogin = await methods.preLogin(); | ||
if (!preLogin.preSet) { | ||
_loginState = LoginStatus.notSet; | ||
} else if (preLogin.preLogin) { | ||
_selfInfo = preLogin.selfInfo!; | ||
_loginState = LoginStatus.loginSuccess; | ||
} else { | ||
_loginState = LoginStatus.loginField; | ||
} | ||
} catch (e, st) { | ||
print("$e\n$st"); | ||
_loginState = LoginStatus.loginField; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.