mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-23 03:19:30 +00:00
something
This commit is contained in:
parent
dbf4ce1959
commit
a720c977c2
115 changed files with 8819 additions and 1 deletions
23
lib/settings/models/api_settings.dart
Normal file
23
lib/settings/models/api_settings.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// a freezed class to store the settings of the app
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:whispering_pages/settings/models/audiobookshelf_server.dart';
|
||||
import 'package:whispering_pages/settings/models/authenticated_user.dart';
|
||||
|
||||
part 'api_settings.freezed.dart';
|
||||
part 'api_settings.g.dart';
|
||||
|
||||
/// stores the settings for the active server and user
|
||||
///
|
||||
/// all settings that are needed to interact with the server are stored here
|
||||
@freezed
|
||||
class ApiSettings with _$ApiSettings {
|
||||
const factory ApiSettings({
|
||||
AudiobookShelfServer? activeServer,
|
||||
AuthenticatedUser? activeUser,
|
||||
String? activeLibraryId,
|
||||
}) = _ApiSettings;
|
||||
|
||||
factory ApiSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$ApiSettingsFromJson(json);
|
||||
}
|
||||
229
lib/settings/models/api_settings.freezed.dart
Normal file
229
lib/settings/models/api_settings.freezed.dart
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'api_settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
ApiSettings _$ApiSettingsFromJson(Map<String, dynamic> json) {
|
||||
return _ApiSettings.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ApiSettings {
|
||||
AudiobookShelfServer? get activeServer => throw _privateConstructorUsedError;
|
||||
AuthenticatedUser? get activeUser => throw _privateConstructorUsedError;
|
||||
String? get activeLibraryId => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$ApiSettingsCopyWith<ApiSettings> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ApiSettingsCopyWith<$Res> {
|
||||
factory $ApiSettingsCopyWith(
|
||||
ApiSettings value, $Res Function(ApiSettings) then) =
|
||||
_$ApiSettingsCopyWithImpl<$Res, ApiSettings>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{AudiobookShelfServer? activeServer,
|
||||
AuthenticatedUser? activeUser,
|
||||
String? activeLibraryId});
|
||||
|
||||
$AudiobookShelfServerCopyWith<$Res>? get activeServer;
|
||||
$AuthenticatedUserCopyWith<$Res>? get activeUser;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ApiSettingsCopyWithImpl<$Res, $Val extends ApiSettings>
|
||||
implements $ApiSettingsCopyWith<$Res> {
|
||||
_$ApiSettingsCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? activeServer = freezed,
|
||||
Object? activeUser = freezed,
|
||||
Object? activeLibraryId = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
activeServer: freezed == activeServer
|
||||
? _value.activeServer
|
||||
: activeServer // ignore: cast_nullable_to_non_nullable
|
||||
as AudiobookShelfServer?,
|
||||
activeUser: freezed == activeUser
|
||||
? _value.activeUser
|
||||
: activeUser // ignore: cast_nullable_to_non_nullable
|
||||
as AuthenticatedUser?,
|
||||
activeLibraryId: freezed == activeLibraryId
|
||||
? _value.activeLibraryId
|
||||
: activeLibraryId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AudiobookShelfServerCopyWith<$Res>? get activeServer {
|
||||
if (_value.activeServer == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $AudiobookShelfServerCopyWith<$Res>(_value.activeServer!, (value) {
|
||||
return _then(_value.copyWith(activeServer: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AuthenticatedUserCopyWith<$Res>? get activeUser {
|
||||
if (_value.activeUser == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $AuthenticatedUserCopyWith<$Res>(_value.activeUser!, (value) {
|
||||
return _then(_value.copyWith(activeUser: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ApiSettingsImplCopyWith<$Res>
|
||||
implements $ApiSettingsCopyWith<$Res> {
|
||||
factory _$$ApiSettingsImplCopyWith(
|
||||
_$ApiSettingsImpl value, $Res Function(_$ApiSettingsImpl) then) =
|
||||
__$$ApiSettingsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{AudiobookShelfServer? activeServer,
|
||||
AuthenticatedUser? activeUser,
|
||||
String? activeLibraryId});
|
||||
|
||||
@override
|
||||
$AudiobookShelfServerCopyWith<$Res>? get activeServer;
|
||||
@override
|
||||
$AuthenticatedUserCopyWith<$Res>? get activeUser;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ApiSettingsImplCopyWithImpl<$Res>
|
||||
extends _$ApiSettingsCopyWithImpl<$Res, _$ApiSettingsImpl>
|
||||
implements _$$ApiSettingsImplCopyWith<$Res> {
|
||||
__$$ApiSettingsImplCopyWithImpl(
|
||||
_$ApiSettingsImpl _value, $Res Function(_$ApiSettingsImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? activeServer = freezed,
|
||||
Object? activeUser = freezed,
|
||||
Object? activeLibraryId = freezed,
|
||||
}) {
|
||||
return _then(_$ApiSettingsImpl(
|
||||
activeServer: freezed == activeServer
|
||||
? _value.activeServer
|
||||
: activeServer // ignore: cast_nullable_to_non_nullable
|
||||
as AudiobookShelfServer?,
|
||||
activeUser: freezed == activeUser
|
||||
? _value.activeUser
|
||||
: activeUser // ignore: cast_nullable_to_non_nullable
|
||||
as AuthenticatedUser?,
|
||||
activeLibraryId: freezed == activeLibraryId
|
||||
? _value.activeLibraryId
|
||||
: activeLibraryId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ApiSettingsImpl implements _ApiSettings {
|
||||
const _$ApiSettingsImpl(
|
||||
{this.activeServer, this.activeUser, this.activeLibraryId});
|
||||
|
||||
factory _$ApiSettingsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ApiSettingsImplFromJson(json);
|
||||
|
||||
@override
|
||||
final AudiobookShelfServer? activeServer;
|
||||
@override
|
||||
final AuthenticatedUser? activeUser;
|
||||
@override
|
||||
final String? activeLibraryId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ApiSettings(activeServer: $activeServer, activeUser: $activeUser, activeLibraryId: $activeLibraryId)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ApiSettingsImpl &&
|
||||
(identical(other.activeServer, activeServer) ||
|
||||
other.activeServer == activeServer) &&
|
||||
(identical(other.activeUser, activeUser) ||
|
||||
other.activeUser == activeUser) &&
|
||||
(identical(other.activeLibraryId, activeLibraryId) ||
|
||||
other.activeLibraryId == activeLibraryId));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, activeServer, activeUser, activeLibraryId);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ApiSettingsImplCopyWith<_$ApiSettingsImpl> get copyWith =>
|
||||
__$$ApiSettingsImplCopyWithImpl<_$ApiSettingsImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ApiSettingsImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ApiSettings implements ApiSettings {
|
||||
const factory _ApiSettings(
|
||||
{final AudiobookShelfServer? activeServer,
|
||||
final AuthenticatedUser? activeUser,
|
||||
final String? activeLibraryId}) = _$ApiSettingsImpl;
|
||||
|
||||
factory _ApiSettings.fromJson(Map<String, dynamic> json) =
|
||||
_$ApiSettingsImpl.fromJson;
|
||||
|
||||
@override
|
||||
AudiobookShelfServer? get activeServer;
|
||||
@override
|
||||
AuthenticatedUser? get activeUser;
|
||||
@override
|
||||
String? get activeLibraryId;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ApiSettingsImplCopyWith<_$ApiSettingsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
27
lib/settings/models/api_settings.g.dart
Normal file
27
lib/settings/models/api_settings.g.dart
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'api_settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ApiSettingsImpl _$$ApiSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ApiSettingsImpl(
|
||||
activeServer: json['activeServer'] == null
|
||||
? null
|
||||
: AudiobookShelfServer.fromJson(
|
||||
json['activeServer'] as Map<String, dynamic>),
|
||||
activeUser: json['activeUser'] == null
|
||||
? null
|
||||
: AuthenticatedUser.fromJson(
|
||||
json['activeUser'] as Map<String, dynamic>),
|
||||
activeLibraryId: json['activeLibraryId'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ApiSettingsImplToJson(_$ApiSettingsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'activeServer': instance.activeServer,
|
||||
'activeUser': instance.activeUser,
|
||||
'activeLibraryId': instance.activeLibraryId,
|
||||
};
|
||||
19
lib/settings/models/app_settings.dart
Normal file
19
lib/settings/models/app_settings.dart
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// a freezed class to store the settings of the app
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'app_settings.freezed.dart';
|
||||
part 'app_settings.g.dart';
|
||||
|
||||
/// stores the settings of the app
|
||||
///
|
||||
/// only the visual settings are stored here
|
||||
@freezed
|
||||
class AppSettings with _$AppSettings {
|
||||
const factory AppSettings({
|
||||
@Default(true) bool isDarkMode,
|
||||
}) = _AppSettings;
|
||||
|
||||
factory AppSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$AppSettingsFromJson(json);
|
||||
}
|
||||
153
lib/settings/models/app_settings.freezed.dart
Normal file
153
lib/settings/models/app_settings.freezed.dart
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'app_settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
AppSettings _$AppSettingsFromJson(Map<String, dynamic> json) {
|
||||
return _AppSettings.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AppSettings {
|
||||
bool get isDarkMode => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$AppSettingsCopyWith<AppSettings> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AppSettingsCopyWith<$Res> {
|
||||
factory $AppSettingsCopyWith(
|
||||
AppSettings value, $Res Function(AppSettings) then) =
|
||||
_$AppSettingsCopyWithImpl<$Res, AppSettings>;
|
||||
@useResult
|
||||
$Res call({bool isDarkMode});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AppSettingsCopyWithImpl<$Res, $Val extends AppSettings>
|
||||
implements $AppSettingsCopyWith<$Res> {
|
||||
_$AppSettingsCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDarkMode = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isDarkMode: null == isDarkMode
|
||||
? _value.isDarkMode
|
||||
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AppSettingsImplCopyWith<$Res>
|
||||
implements $AppSettingsCopyWith<$Res> {
|
||||
factory _$$AppSettingsImplCopyWith(
|
||||
_$AppSettingsImpl value, $Res Function(_$AppSettingsImpl) then) =
|
||||
__$$AppSettingsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({bool isDarkMode});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AppSettingsImplCopyWithImpl<$Res>
|
||||
extends _$AppSettingsCopyWithImpl<$Res, _$AppSettingsImpl>
|
||||
implements _$$AppSettingsImplCopyWith<$Res> {
|
||||
__$$AppSettingsImplCopyWithImpl(
|
||||
_$AppSettingsImpl _value, $Res Function(_$AppSettingsImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDarkMode = null,
|
||||
}) {
|
||||
return _then(_$AppSettingsImpl(
|
||||
isDarkMode: null == isDarkMode
|
||||
? _value.isDarkMode
|
||||
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AppSettingsImpl implements _AppSettings {
|
||||
const _$AppSettingsImpl({this.isDarkMode = true});
|
||||
|
||||
factory _$AppSettingsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AppSettingsImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isDarkMode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AppSettings(isDarkMode: $isDarkMode)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AppSettingsImpl &&
|
||||
(identical(other.isDarkMode, isDarkMode) ||
|
||||
other.isDarkMode == isDarkMode));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, isDarkMode);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AppSettingsImplCopyWith<_$AppSettingsImpl> get copyWith =>
|
||||
__$$AppSettingsImplCopyWithImpl<_$AppSettingsImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AppSettingsImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AppSettings implements AppSettings {
|
||||
const factory _AppSettings({final bool isDarkMode}) = _$AppSettingsImpl;
|
||||
|
||||
factory _AppSettings.fromJson(Map<String, dynamic> json) =
|
||||
_$AppSettingsImpl.fromJson;
|
||||
|
||||
@override
|
||||
bool get isDarkMode;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$AppSettingsImplCopyWith<_$AppSettingsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
17
lib/settings/models/app_settings.g.dart
Normal file
17
lib/settings/models/app_settings.g.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'app_settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$AppSettingsImpl _$$AppSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AppSettingsImpl(
|
||||
isDarkMode: json['isDarkMode'] as bool? ?? true,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'isDarkMode': instance.isDarkMode,
|
||||
};
|
||||
18
lib/settings/models/audiobookshelf_server.dart
Normal file
18
lib/settings/models/audiobookshelf_server.dart
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'audiobookshelf_server.freezed.dart';
|
||||
part 'audiobookshelf_server.g.dart';
|
||||
|
||||
typedef AudiobookShelfUri = Uri;
|
||||
|
||||
/// Represents a audiobookshelf server
|
||||
@freezed
|
||||
class AudiobookShelfServer with _$AudiobookShelfServer {
|
||||
const factory AudiobookShelfServer({
|
||||
required AudiobookShelfUri serverUrl,
|
||||
// String? serverName,
|
||||
}) = _AudiobookShelfServer;
|
||||
|
||||
factory AudiobookShelfServer.fromJson(Map<String, dynamic> json) =>
|
||||
_$AudiobookShelfServerFromJson(json);
|
||||
}
|
||||
156
lib/settings/models/audiobookshelf_server.freezed.dart
Normal file
156
lib/settings/models/audiobookshelf_server.freezed.dart
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'audiobookshelf_server.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
AudiobookShelfServer _$AudiobookShelfServerFromJson(Map<String, dynamic> json) {
|
||||
return _AudiobookShelfServer.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AudiobookShelfServer {
|
||||
Uri get serverUrl => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$AudiobookShelfServerCopyWith<AudiobookShelfServer> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AudiobookShelfServerCopyWith<$Res> {
|
||||
factory $AudiobookShelfServerCopyWith(AudiobookShelfServer value,
|
||||
$Res Function(AudiobookShelfServer) then) =
|
||||
_$AudiobookShelfServerCopyWithImpl<$Res, AudiobookShelfServer>;
|
||||
@useResult
|
||||
$Res call({Uri serverUrl});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AudiobookShelfServerCopyWithImpl<$Res,
|
||||
$Val extends AudiobookShelfServer>
|
||||
implements $AudiobookShelfServerCopyWith<$Res> {
|
||||
_$AudiobookShelfServerCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? serverUrl = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
serverUrl: null == serverUrl
|
||||
? _value.serverUrl
|
||||
: serverUrl // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AudiobookShelfServerImplCopyWith<$Res>
|
||||
implements $AudiobookShelfServerCopyWith<$Res> {
|
||||
factory _$$AudiobookShelfServerImplCopyWith(_$AudiobookShelfServerImpl value,
|
||||
$Res Function(_$AudiobookShelfServerImpl) then) =
|
||||
__$$AudiobookShelfServerImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({Uri serverUrl});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AudiobookShelfServerImplCopyWithImpl<$Res>
|
||||
extends _$AudiobookShelfServerCopyWithImpl<$Res, _$AudiobookShelfServerImpl>
|
||||
implements _$$AudiobookShelfServerImplCopyWith<$Res> {
|
||||
__$$AudiobookShelfServerImplCopyWithImpl(_$AudiobookShelfServerImpl _value,
|
||||
$Res Function(_$AudiobookShelfServerImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? serverUrl = null,
|
||||
}) {
|
||||
return _then(_$AudiobookShelfServerImpl(
|
||||
serverUrl: null == serverUrl
|
||||
? _value.serverUrl
|
||||
: serverUrl // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AudiobookShelfServerImpl implements _AudiobookShelfServer {
|
||||
const _$AudiobookShelfServerImpl({required this.serverUrl});
|
||||
|
||||
factory _$AudiobookShelfServerImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AudiobookShelfServerImplFromJson(json);
|
||||
|
||||
@override
|
||||
final Uri serverUrl;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AudiobookShelfServer(serverUrl: $serverUrl)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AudiobookShelfServerImpl &&
|
||||
(identical(other.serverUrl, serverUrl) ||
|
||||
other.serverUrl == serverUrl));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, serverUrl);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AudiobookShelfServerImplCopyWith<_$AudiobookShelfServerImpl>
|
||||
get copyWith =>
|
||||
__$$AudiobookShelfServerImplCopyWithImpl<_$AudiobookShelfServerImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AudiobookShelfServerImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AudiobookShelfServer implements AudiobookShelfServer {
|
||||
const factory _AudiobookShelfServer({required final Uri serverUrl}) =
|
||||
_$AudiobookShelfServerImpl;
|
||||
|
||||
factory _AudiobookShelfServer.fromJson(Map<String, dynamic> json) =
|
||||
_$AudiobookShelfServerImpl.fromJson;
|
||||
|
||||
@override
|
||||
Uri get serverUrl;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$AudiobookShelfServerImplCopyWith<_$AudiobookShelfServerImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
19
lib/settings/models/audiobookshelf_server.g.dart
Normal file
19
lib/settings/models/audiobookshelf_server.g.dart
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'audiobookshelf_server.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$AudiobookShelfServerImpl _$$AudiobookShelfServerImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$AudiobookShelfServerImpl(
|
||||
serverUrl: Uri.parse(json['serverUrl'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AudiobookShelfServerImplToJson(
|
||||
_$AudiobookShelfServerImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'serverUrl': instance.serverUrl.toString(),
|
||||
};
|
||||
20
lib/settings/models/authenticated_user.dart
Normal file
20
lib/settings/models/authenticated_user.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:whispering_pages/settings/models/audiobookshelf_server.dart';
|
||||
|
||||
part 'authenticated_user.freezed.dart';
|
||||
part 'authenticated_user.g.dart';
|
||||
|
||||
/// authenticated user with server and credentials
|
||||
@freezed
|
||||
class AuthenticatedUser with _$AuthenticatedUser {
|
||||
const factory AuthenticatedUser({
|
||||
required AudiobookShelfServer server,
|
||||
required String authToken,
|
||||
String? id,
|
||||
String? username,
|
||||
String? password,
|
||||
}) = _AuthenticatedUser;
|
||||
|
||||
factory AuthenticatedUser.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthenticatedUserFromJson(json);
|
||||
}
|
||||
253
lib/settings/models/authenticated_user.freezed.dart
Normal file
253
lib/settings/models/authenticated_user.freezed.dart
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'authenticated_user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
AuthenticatedUser _$AuthenticatedUserFromJson(Map<String, dynamic> json) {
|
||||
return _AuthenticatedUser.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthenticatedUser {
|
||||
AudiobookShelfServer get server => throw _privateConstructorUsedError;
|
||||
String get authToken => throw _privateConstructorUsedError;
|
||||
String? get id => throw _privateConstructorUsedError;
|
||||
String? get username => throw _privateConstructorUsedError;
|
||||
String? get password => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$AuthenticatedUserCopyWith<AuthenticatedUser> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthenticatedUserCopyWith<$Res> {
|
||||
factory $AuthenticatedUserCopyWith(
|
||||
AuthenticatedUser value, $Res Function(AuthenticatedUser) then) =
|
||||
_$AuthenticatedUserCopyWithImpl<$Res, AuthenticatedUser>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{AudiobookShelfServer server,
|
||||
String authToken,
|
||||
String? id,
|
||||
String? username,
|
||||
String? password});
|
||||
|
||||
$AudiobookShelfServerCopyWith<$Res> get server;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthenticatedUserCopyWithImpl<$Res, $Val extends AuthenticatedUser>
|
||||
implements $AuthenticatedUserCopyWith<$Res> {
|
||||
_$AuthenticatedUserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? server = null,
|
||||
Object? authToken = null,
|
||||
Object? id = freezed,
|
||||
Object? username = freezed,
|
||||
Object? password = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
server: null == server
|
||||
? _value.server
|
||||
: server // ignore: cast_nullable_to_non_nullable
|
||||
as AudiobookShelfServer,
|
||||
authToken: null == authToken
|
||||
? _value.authToken
|
||||
: authToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
username: freezed == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
password: freezed == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AudiobookShelfServerCopyWith<$Res> get server {
|
||||
return $AudiobookShelfServerCopyWith<$Res>(_value.server, (value) {
|
||||
return _then(_value.copyWith(server: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthenticatedUserImplCopyWith<$Res>
|
||||
implements $AuthenticatedUserCopyWith<$Res> {
|
||||
factory _$$AuthenticatedUserImplCopyWith(_$AuthenticatedUserImpl value,
|
||||
$Res Function(_$AuthenticatedUserImpl) then) =
|
||||
__$$AuthenticatedUserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{AudiobookShelfServer server,
|
||||
String authToken,
|
||||
String? id,
|
||||
String? username,
|
||||
String? password});
|
||||
|
||||
@override
|
||||
$AudiobookShelfServerCopyWith<$Res> get server;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthenticatedUserImplCopyWithImpl<$Res>
|
||||
extends _$AuthenticatedUserCopyWithImpl<$Res, _$AuthenticatedUserImpl>
|
||||
implements _$$AuthenticatedUserImplCopyWith<$Res> {
|
||||
__$$AuthenticatedUserImplCopyWithImpl(_$AuthenticatedUserImpl _value,
|
||||
$Res Function(_$AuthenticatedUserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? server = null,
|
||||
Object? authToken = null,
|
||||
Object? id = freezed,
|
||||
Object? username = freezed,
|
||||
Object? password = freezed,
|
||||
}) {
|
||||
return _then(_$AuthenticatedUserImpl(
|
||||
server: null == server
|
||||
? _value.server
|
||||
: server // ignore: cast_nullable_to_non_nullable
|
||||
as AudiobookShelfServer,
|
||||
authToken: null == authToken
|
||||
? _value.authToken
|
||||
: authToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
username: freezed == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
password: freezed == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AuthenticatedUserImpl implements _AuthenticatedUser {
|
||||
const _$AuthenticatedUserImpl(
|
||||
{required this.server,
|
||||
required this.authToken,
|
||||
this.id,
|
||||
this.username,
|
||||
this.password});
|
||||
|
||||
factory _$AuthenticatedUserImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthenticatedUserImplFromJson(json);
|
||||
|
||||
@override
|
||||
final AudiobookShelfServer server;
|
||||
@override
|
||||
final String authToken;
|
||||
@override
|
||||
final String? id;
|
||||
@override
|
||||
final String? username;
|
||||
@override
|
||||
final String? password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthenticatedUser(server: $server, authToken: $authToken, id: $id, username: $username, password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthenticatedUserImpl &&
|
||||
(identical(other.server, server) || other.server == server) &&
|
||||
(identical(other.authToken, authToken) ||
|
||||
other.authToken == authToken) &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.username, username) ||
|
||||
other.username == username) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, server, authToken, id, username, password);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthenticatedUserImplCopyWith<_$AuthenticatedUserImpl> get copyWith =>
|
||||
__$$AuthenticatedUserImplCopyWithImpl<_$AuthenticatedUserImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthenticatedUserImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthenticatedUser implements AuthenticatedUser {
|
||||
const factory _AuthenticatedUser(
|
||||
{required final AudiobookShelfServer server,
|
||||
required final String authToken,
|
||||
final String? id,
|
||||
final String? username,
|
||||
final String? password}) = _$AuthenticatedUserImpl;
|
||||
|
||||
factory _AuthenticatedUser.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthenticatedUserImpl.fromJson;
|
||||
|
||||
@override
|
||||
AudiobookShelfServer get server;
|
||||
@override
|
||||
String get authToken;
|
||||
@override
|
||||
String? get id;
|
||||
@override
|
||||
String? get username;
|
||||
@override
|
||||
String? get password;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$AuthenticatedUserImplCopyWith<_$AuthenticatedUserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
28
lib/settings/models/authenticated_user.g.dart
Normal file
28
lib/settings/models/authenticated_user.g.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'authenticated_user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$AuthenticatedUserImpl _$$AuthenticatedUserImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$AuthenticatedUserImpl(
|
||||
server:
|
||||
AudiobookShelfServer.fromJson(json['server'] as Map<String, dynamic>),
|
||||
authToken: json['authToken'] as String,
|
||||
id: json['id'] as String?,
|
||||
username: json['username'] as String?,
|
||||
password: json['password'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AuthenticatedUserImplToJson(
|
||||
_$AuthenticatedUserImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'server': instance.server,
|
||||
'authToken': instance.authToken,
|
||||
'id': instance.id,
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
};
|
||||
4
lib/settings/models/models.dart
Normal file
4
lib/settings/models/models.dart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export 'api_settings.dart';
|
||||
export 'app_settings.dart';
|
||||
export 'audiobookshelf_server.dart';
|
||||
export 'authenticated_user.dart';
|
||||
Loading…
Add table
Add a link
Reference in a new issue