|
|
@ -1,11 +1,11 @@ |
|
|
|
import 'dart:async'; |
|
|
|
import 'dart:async'; |
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart'; |
|
|
|
import 'package:flutter/foundation.dart'; |
|
|
|
|
|
|
|
import 'package:neon/neon.dart'; |
|
|
|
import 'package:neon/src/bloc/bloc.dart'; |
|
|
|
import 'package:neon/src/bloc/bloc.dart'; |
|
|
|
import 'package:neon/src/bloc/result.dart'; |
|
|
|
import 'package:neon/src/bloc/result.dart'; |
|
|
|
import 'package:neon/src/models/account.dart'; |
|
|
|
import 'package:neon/src/models/account.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
import 'package:package_info_plus/package_info_plus.dart'; |
|
|
|
|
|
|
|
import 'package:rxdart/rxdart.dart'; |
|
|
|
import 'package:rxdart/rxdart.dart'; |
|
|
|
|
|
|
|
|
|
|
|
abstract interface class LoginCheckAccountBlocEvents {} |
|
|
|
abstract interface class LoginCheckAccountBlocEvents {} |
|
|
@ -18,7 +18,6 @@ abstract interface class LoginCheckAccountBlocStates { |
|
|
|
class LoginCheckAccountBloc extends InteractiveBloc |
|
|
|
class LoginCheckAccountBloc extends InteractiveBloc |
|
|
|
implements LoginCheckAccountBlocEvents, LoginCheckAccountBlocStates { |
|
|
|
implements LoginCheckAccountBlocEvents, LoginCheckAccountBlocStates { |
|
|
|
LoginCheckAccountBloc( |
|
|
|
LoginCheckAccountBloc( |
|
|
|
this._packageInfo, |
|
|
|
|
|
|
|
this.serverURL, |
|
|
|
this.serverURL, |
|
|
|
this.loginName, |
|
|
|
this.loginName, |
|
|
|
this.password, |
|
|
|
this.password, |
|
|
@ -26,7 +25,6 @@ class LoginCheckAccountBloc extends InteractiveBloc |
|
|
|
unawaited(refresh()); |
|
|
|
unawaited(refresh()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final PackageInfo _packageInfo; |
|
|
|
|
|
|
|
final String serverURL; |
|
|
|
final String serverURL; |
|
|
|
final String loginName; |
|
|
|
final String loginName; |
|
|
|
final String password; |
|
|
|
final String password; |
|
|
@ -48,7 +46,7 @@ class LoginCheckAccountBloc extends InteractiveBloc |
|
|
|
serverURL, |
|
|
|
serverURL, |
|
|
|
loginName: loginName, |
|
|
|
loginName: loginName, |
|
|
|
password: password, |
|
|
|
password: password, |
|
|
|
userAgentOverride: userAgent(_packageInfo), |
|
|
|
userAgentOverride: neonUserAgent, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
final response = await client.provisioningApi.getCurrentUser(); |
|
|
|
final response = await client.provisioningApi.getCurrentUser(); |
|
|
@ -58,7 +56,7 @@ class LoginCheckAccountBloc extends InteractiveBloc |
|
|
|
loginName: loginName, |
|
|
|
loginName: loginName, |
|
|
|
username: response.ocs.data.id, |
|
|
|
username: response.ocs.data.id, |
|
|
|
password: password, |
|
|
|
password: password, |
|
|
|
userAgent: userAgent(_packageInfo), |
|
|
|
userAgent: neonUserAgent, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
state.add(Result.success(account)); |
|
|
|
state.add(Result.success(account)); |
|
|
|