refactor(mobile): use startOAuth and server features flags (#6155)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2024-01-04 20:44:40 +00:00 committed by GitHub
parent 13ba83dce6
commit 2aaf941dda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 33 deletions

View file

@ -3,40 +3,56 @@ import 'package:openapi/api.dart';
class ServerFeatures {
final bool trash;
final bool map;
final bool oauthEnabled;
final bool passwordLogin;
const ServerFeatures({
required this.trash,
required this.map,
required this.oauthEnabled,
required this.passwordLogin,
});
ServerFeatures copyWith({
bool? trash,
bool? map,
bool? oauthEnabled,
bool? passwordLogin,
}) {
return ServerFeatures(
trash: trash ?? this.trash,
map: map ?? this.map,
oauthEnabled: oauthEnabled ?? this.oauthEnabled,
passwordLogin: passwordLogin ?? this.passwordLogin,
);
}
@override
String toString() {
return 'ServerFeatures(trash: $trash, map: $map)';
return 'ServerFeatures(trash: $trash, map: $map, oauthEnabled: $oauthEnabled, passwordLogin: $passwordLogin)';
}
ServerFeatures.fromDto(ServerFeaturesDto dto)
: trash = dto.trash,
map = dto.map;
map = dto.map,
oauthEnabled = dto.oauth,
passwordLogin = dto.passwordLogin;
@override
bool operator ==(Object other) {
bool operator ==(covariant ServerFeatures other) {
if (identical(this, other)) return true;
return other is ServerFeatures && other.trash == trash && other.map == map;
return other.trash == trash &&
other.map == map &&
other.oauthEnabled == oauthEnabled &&
other.passwordLogin == passwordLogin;
}
@override
int get hashCode {
return trash.hashCode ^ map.hashCode;
return trash.hashCode ^
map.hashCode ^
oauthEnabled.hashCode ^
passwordLogin.hashCode;
}
}