Made google-play login working again, and fixed numerous bugs
All checks were successful
update version / increment-build-number (push) Successful in 9s
All checks were successful
update version / increment-build-number (push) Successful in 9s
This commit is contained in:
@ -35,7 +35,7 @@ class AccountData {
|
||||
return _password!;
|
||||
}
|
||||
|
||||
Future<void> setData(BuildContext context, String username, String password) async {
|
||||
Future<void> setData(String username, String password) async {
|
||||
SharedPreferences storage = await _storage;
|
||||
|
||||
storage.setString(_usernameField, username);
|
||||
@ -43,9 +43,10 @@ class AccountData {
|
||||
await _updateFromStorage();
|
||||
}
|
||||
|
||||
Future<void> removeData(BuildContext context) async {
|
||||
Future<void> removeData({BuildContext? context}) async {
|
||||
_populated = Completer();
|
||||
Provider.of<AccountModel>(context, listen: false).setState(AccountModelState.loggedOut);
|
||||
|
||||
if(context != null) Provider.of<AccountModel>(context, listen: false).setState(AccountModelState.loggedOut);
|
||||
|
||||
SharedPreferences storage = await _storage;
|
||||
await storage.remove(_usernameField);
|
||||
@ -54,12 +55,12 @@ class AccountData {
|
||||
|
||||
Future<void> _updateFromStorage() async {
|
||||
SharedPreferences storage = await _storage;
|
||||
await storage.reload();
|
||||
//await storage.reload(); // This line was the cause of the first rejected google play upload :(
|
||||
if(storage.containsKey(_usernameField) && storage.containsKey(_passwordField)) {
|
||||
_username = storage.getString(_usernameField);
|
||||
_password = storage.getString(_passwordField);
|
||||
}
|
||||
_populated.complete();
|
||||
if(!_populated.isCompleted) _populated.complete();
|
||||
}
|
||||
|
||||
Future<bool> waitForPopulation() async {
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import '../accountData.dart';
|
||||
import 'accountData.dart';
|
||||
|
||||
enum EndpointMode {
|
||||
live,
|
||||
@ -31,8 +31,6 @@ class Endpoint {
|
||||
class EndpointData {
|
||||
static final EndpointData _instance = EndpointData._construct();
|
||||
|
||||
String? usernameOverride;
|
||||
|
||||
factory EndpointData() {
|
||||
return _instance;
|
||||
}
|
||||
@ -41,11 +39,7 @@ class EndpointData {
|
||||
|
||||
EndpointMode getEndpointMode() {
|
||||
late String existingName;
|
||||
if(usernameOverride != null) {
|
||||
existingName = usernameOverride!;
|
||||
} else {
|
||||
existingName = AccountData().getUsername();
|
||||
}
|
||||
existingName = AccountData().getUsername();
|
||||
return existingName.startsWith("google") ? EndpointMode.stage : EndpointMode.live;
|
||||
}
|
||||
|
Reference in New Issue
Block a user