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

@ -2,40 +2,46 @@ import 'package:openapi/api.dart';
class ServerConfig {
final int trashDays;
final String oauthButtonText;
final String externalDomain;
const ServerConfig({
required this.trashDays,
required this.oauthButtonText,
required this.externalDomain,
});
ServerConfig copyWith({
int? trashDays,
String? oauthButtonText,
String? externalDomain,
}) {
return ServerConfig(
trashDays: trashDays ?? this.trashDays,
oauthButtonText: oauthButtonText ?? this.oauthButtonText,
externalDomain: externalDomain ?? this.externalDomain,
);
}
@override
String toString() =>
'ServerConfig(trashDays: $trashDays, externalDomain: $externalDomain)';
'ServerConfig(trashDays: $trashDays, oauthButtonText: $oauthButtonText, externalDomain: $externalDomain)';
ServerConfig.fromDto(ServerConfigDto dto)
: trashDays = dto.trashDays,
oauthButtonText = dto.oauthButtonText,
externalDomain = dto.externalDomain;
@override
bool operator ==(Object other) {
bool operator ==(covariant ServerConfig other) {
if (identical(this, other)) return true;
return other is ServerConfig &&
other.trashDays == trashDays &&
return other.trashDays == trashDays &&
other.oauthButtonText == oauthButtonText &&
other.externalDomain == externalDomain;
}
@override
int get hashCode => trashDays.hashCode ^ externalDomain.hashCode;
int get hashCode =>
trashDays.hashCode ^ oauthButtonText.hashCode ^ externalDomain.hashCode;
}