hardened API decoding against server fields the models did not expect
The Talk room list crashed for a new account because the server omits
lastMessage for rooms without a visible message and the model required it.
Beyond that single field, a review of the Talk models against the OpenAPI
spec of the installed version (23.0.8) found the same crash class in several
places: closed enums over open server values (inCall bitmask, rich-object
types, actor and message types), a deleted parent sent as {id, deleted},
and the autocomplete status arriving as an object.
- json_serializable `checked: true`: decode errors now name class and field
- lists (rooms, messages, participants, autocomplete) decode per entry;
a malformed entry is skipped and reported via ClientErrorReporter
- unknownEnumValue fallbacks for all response enums of Talk and breakers
- lastMessage nullable; inCall as bitmask; deleted parent placeholder;
autocomplete status object/string; fixed shareWithDisplayNameUnique key
- GetRoomParams no longer sends null query parameters
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrepDTL4qDe35TuS29sLW3
This commit is contained in:
@@ -4,4 +4,5 @@ targets:
|
|||||||
json_serializable:
|
json_serializable:
|
||||||
options:
|
options:
|
||||||
explicit_to_json: false
|
explicit_to_json: false
|
||||||
|
checked: true
|
||||||
generic_argument_factories: true
|
generic_argument_factories: true
|
||||||
@@ -7,4 +7,9 @@ abstract class ApiResponse {
|
|||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
@JsonKey(includeIfNull: false)
|
||||||
Map<String, String>? headers;
|
Map<String, String>? headers;
|
||||||
|
|
||||||
|
/// Entries the decoder skipped (see `decodeListLenient`), reported by the
|
||||||
|
/// API layer once the response is back on the main isolate.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
List<String> parseWarnings = const [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
/// Decodes server lists element by element so one entry the model cannot map
|
||||||
|
/// (a field the server dropped, an enum value it added) is skipped and
|
||||||
|
/// recorded instead of failing the whole response and with it the screen.
|
||||||
|
///
|
||||||
|
/// Skipped entries are collected per isolate; the API layer drains them with
|
||||||
|
/// [drainDecodeWarnings] and reports them, so a drift in the server's format
|
||||||
|
/// still reaches us without taking the feature down for the user.
|
||||||
|
final List<String> _warnings = [];
|
||||||
|
|
||||||
|
List<T> decodeListLenient<T>(
|
||||||
|
Object? raw,
|
||||||
|
T Function(Map<String, dynamic>) fromJson, {
|
||||||
|
required String what,
|
||||||
|
}) {
|
||||||
|
final items = <T>[];
|
||||||
|
if (raw is! List<dynamic>) {
|
||||||
|
throw FormatException(
|
||||||
|
'expected a list of ${what}s, got ${raw.runtimeType}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for (final entry in raw) {
|
||||||
|
try {
|
||||||
|
items.add(fromJson(entry as Map<String, dynamic>));
|
||||||
|
} on CheckedFromJsonException catch (e) {
|
||||||
|
_warnings.add('$what: $e');
|
||||||
|
} on TypeError catch (e) {
|
||||||
|
_warnings.add('$what: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<T> decodeSetLenient<T>(
|
||||||
|
Object? raw,
|
||||||
|
T Function(Map<String, dynamic>) fromJson, {
|
||||||
|
required String what,
|
||||||
|
}) => decodeListLenient(raw, fromJson, what: what).toSet();
|
||||||
|
|
||||||
|
/// Returns and clears the entries skipped since the last call.
|
||||||
|
List<String> drainDecodeWarnings() {
|
||||||
|
final out = List<String>.of(_warnings);
|
||||||
|
_warnings.clear();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import 'package:http/http.dart' as http;
|
|||||||
import '../../../model/endpoint_data.dart';
|
import '../../../model/endpoint_data.dart';
|
||||||
import '../../errors/server_exception.dart';
|
import '../../errors/server_exception.dart';
|
||||||
import '../../http_errors.dart';
|
import '../../http_errors.dart';
|
||||||
|
import '../../json_lenient.dart';
|
||||||
|
import '../../marianumconnect/queries/report_client_error/client_error_reporter.dart';
|
||||||
import '../nextcloud_ocs.dart';
|
import '../nextcloud_ocs.dart';
|
||||||
import 'autocomplete_response.dart';
|
import 'autocomplete_response.dart';
|
||||||
|
|
||||||
@@ -43,6 +45,13 @@ class AutocompleteApi {
|
|||||||
technicalDetails: 'core/autocomplete/get: ${response.body}',
|
technicalDetails: 'core/autocomplete/get: ${response.body}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return AutocompleteResponse.fromJson(NextcloudOcs.decode(response.body));
|
final result = AutocompleteResponse.fromJson(
|
||||||
|
NextcloudOcs.decode(response.body),
|
||||||
|
);
|
||||||
|
ClientErrorReporter.reportDecodeWarnings(
|
||||||
|
'Autocomplete',
|
||||||
|
drainDecodeWarnings(),
|
||||||
|
);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
import '../../json_lenient.dart';
|
||||||
import '../files_sharing/queries/share/share.dart';
|
import '../files_sharing/queries/share/share.dart';
|
||||||
|
|
||||||
part 'autocomplete_response.g.dart';
|
part 'autocomplete_response.g.dart';
|
||||||
@@ -14,6 +15,7 @@ int shareTypeFromSource(String? source) {
|
|||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class AutocompleteResponse {
|
class AutocompleteResponse {
|
||||||
|
@JsonKey(fromJson: _entriesFromJson)
|
||||||
List<AutocompleteResponseObject> data;
|
List<AutocompleteResponseObject> data;
|
||||||
|
|
||||||
AutocompleteResponse(this.data);
|
AutocompleteResponse(this.data);
|
||||||
@@ -23,15 +25,31 @@ class AutocompleteResponse {
|
|||||||
Map<String, dynamic> toJson() => _$AutocompleteResponseToJson(this);
|
Map<String, dynamic> toJson() => _$AutocompleteResponseToJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<AutocompleteResponseObject> _entriesFromJson(Object? raw) =>
|
||||||
|
decodeListLenient(
|
||||||
|
raw,
|
||||||
|
AutocompleteResponseObject.fromJson,
|
||||||
|
what: 'autocomplete entry',
|
||||||
|
);
|
||||||
|
|
||||||
|
/// The server sends a user-status object for users that have one and an empty
|
||||||
|
/// string otherwise; only the status string itself is kept.
|
||||||
|
String? _statusFromJson(Object? raw) => switch (raw) {
|
||||||
|
Map<String, dynamic> status => status['status']?.toString(),
|
||||||
|
String status when status.isNotEmpty => status,
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class AutocompleteResponseObject {
|
class AutocompleteResponseObject {
|
||||||
String id;
|
String id;
|
||||||
String label;
|
String label;
|
||||||
String? icon;
|
String? icon;
|
||||||
String? source;
|
String? source;
|
||||||
|
@JsonKey(fromJson: _statusFromJson)
|
||||||
String? status;
|
String? status;
|
||||||
String? subline;
|
String? subline;
|
||||||
String? shareWithDisplayNameUniqe;
|
String? shareWithDisplayNameUnique;
|
||||||
|
|
||||||
AutocompleteResponseObject(
|
AutocompleteResponseObject(
|
||||||
this.id,
|
this.id,
|
||||||
@@ -40,7 +58,7 @@ class AutocompleteResponseObject {
|
|||||||
this.source,
|
this.source,
|
||||||
this.status,
|
this.status,
|
||||||
this.subline,
|
this.subline,
|
||||||
this.shareWithDisplayNameUniqe,
|
this.shareWithDisplayNameUnique,
|
||||||
);
|
);
|
||||||
|
|
||||||
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) =>
|
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
@@ -8,13 +8,12 @@ part of 'autocomplete_response.dart';
|
|||||||
|
|
||||||
AutocompleteResponse _$AutocompleteResponseFromJson(
|
AutocompleteResponse _$AutocompleteResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => AutocompleteResponse(
|
) => $checkedCreate('AutocompleteResponse', json, ($checkedConvert) {
|
||||||
(json['data'] as List<dynamic>)
|
final val = AutocompleteResponse(
|
||||||
.map(
|
$checkedConvert('data', (v) => _entriesFromJson(v)),
|
||||||
(e) => AutocompleteResponseObject.fromJson(e as Map<String, dynamic>),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$AutocompleteResponseToJson(
|
Map<String, dynamic> _$AutocompleteResponseToJson(
|
||||||
AutocompleteResponse instance,
|
AutocompleteResponse instance,
|
||||||
@@ -22,15 +21,18 @@ Map<String, dynamic> _$AutocompleteResponseToJson(
|
|||||||
|
|
||||||
AutocompleteResponseObject _$AutocompleteResponseObjectFromJson(
|
AutocompleteResponseObject _$AutocompleteResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => AutocompleteResponseObject(
|
) => $checkedCreate('AutocompleteResponseObject', json, ($checkedConvert) {
|
||||||
json['id'] as String,
|
final val = AutocompleteResponseObject(
|
||||||
json['label'] as String,
|
$checkedConvert('id', (v) => v as String),
|
||||||
json['icon'] as String?,
|
$checkedConvert('label', (v) => v as String),
|
||||||
json['source'] as String?,
|
$checkedConvert('icon', (v) => v as String?),
|
||||||
json['status'] as String?,
|
$checkedConvert('source', (v) => v as String?),
|
||||||
json['subline'] as String?,
|
$checkedConvert('status', (v) => _statusFromJson(v)),
|
||||||
json['shareWithDisplayNameUniqe'] as String?,
|
$checkedConvert('subline', (v) => v as String?),
|
||||||
|
$checkedConvert('shareWithDisplayNameUnique', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$AutocompleteResponseObjectToJson(
|
Map<String, dynamic> _$AutocompleteResponseObjectToJson(
|
||||||
AutocompleteResponseObject instance,
|
AutocompleteResponseObject instance,
|
||||||
@@ -41,5 +43,5 @@ Map<String, dynamic> _$AutocompleteResponseObjectToJson(
|
|||||||
'source': instance.source,
|
'source': instance.source,
|
||||||
'status': instance.status,
|
'status': instance.status,
|
||||||
'subline': instance.subline,
|
'subline': instance.subline,
|
||||||
'shareWithDisplayNameUniqe': instance.shareWithDisplayNameUniqe,
|
'shareWithDisplayNameUnique': instance.shareWithDisplayNameUnique,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,16 +8,19 @@ part of 'file_sharing_api_params.dart';
|
|||||||
|
|
||||||
FileSharingApiParams _$FileSharingApiParamsFromJson(
|
FileSharingApiParams _$FileSharingApiParamsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => FileSharingApiParams(
|
) => $checkedCreate('FileSharingApiParams', json, ($checkedConvert) {
|
||||||
shareType: (json['shareType'] as num).toInt(),
|
final val = FileSharingApiParams(
|
||||||
shareWith: json['shareWith'] as String,
|
shareType: $checkedConvert('shareType', (v) => (v as num).toInt()),
|
||||||
path: json['path'] as String,
|
shareWith: $checkedConvert('shareWith', (v) => v as String),
|
||||||
referenceId: json['referenceId'] as String?,
|
path: $checkedConvert('path', (v) => v as String),
|
||||||
talkMetaData: json['talkMetaData'] as String?,
|
referenceId: $checkedConvert('referenceId', (v) => v as String?),
|
||||||
permissions: (json['permissions'] as num?)?.toInt(),
|
talkMetaData: $checkedConvert('talkMetaData', (v) => v as String?),
|
||||||
password: json['password'] as String?,
|
permissions: $checkedConvert('permissions', (v) => (v as num?)?.toInt()),
|
||||||
expireDate: json['expireDate'] as String?,
|
password: $checkedConvert('password', (v) => v as String?),
|
||||||
|
expireDate: $checkedConvert('expireDate', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$FileSharingApiParamsToJson(
|
Map<String, dynamic> _$FileSharingApiParamsToJson(
|
||||||
FileSharingApiParams instance,
|
FileSharingApiParams instance,
|
||||||
|
|||||||
@@ -7,14 +7,20 @@ part of 'search_files_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
SearchFilesResponse _$SearchFilesResponseFromJson(Map<String, dynamic> json) =>
|
SearchFilesResponse _$SearchFilesResponseFromJson(Map<String, dynamic> json) =>
|
||||||
SearchFilesResponse(
|
$checkedCreate('SearchFilesResponse', json, ($checkedConvert) {
|
||||||
name: json['name'] as String,
|
final val = SearchFilesResponse(
|
||||||
isPaginated: json['isPaginated'] as bool,
|
name: $checkedConvert('name', (v) => v as String),
|
||||||
cursor: (json['cursor'] as num?)?.toInt(),
|
isPaginated: $checkedConvert('isPaginated', (v) => v as bool),
|
||||||
entries: (json['entries'] as List<dynamic>)
|
cursor: $checkedConvert('cursor', (v) => (v as num?)?.toInt()),
|
||||||
|
entries: $checkedConvert(
|
||||||
|
'entries',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => SearchFilesEntry.fromJson(e as Map<String, dynamic>))
|
.map((e) => SearchFilesEntry.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$SearchFilesResponseToJson(
|
Map<String, dynamic> _$SearchFilesResponseToJson(
|
||||||
SearchFilesResponse instance,
|
SearchFilesResponse instance,
|
||||||
@@ -26,13 +32,19 @@ Map<String, dynamic> _$SearchFilesResponseToJson(
|
|||||||
};
|
};
|
||||||
|
|
||||||
SearchFilesEntry _$SearchFilesEntryFromJson(Map<String, dynamic> json) =>
|
SearchFilesEntry _$SearchFilesEntryFromJson(Map<String, dynamic> json) =>
|
||||||
SearchFilesEntry(
|
$checkedCreate('SearchFilesEntry', json, ($checkedConvert) {
|
||||||
title: json['title'] as String,
|
final val = SearchFilesEntry(
|
||||||
subline: json['subline'] as String?,
|
title: $checkedConvert('title', (v) => v as String),
|
||||||
icon: json['icon'] as String?,
|
subline: $checkedConvert('subline', (v) => v as String?),
|
||||||
resourceUrl: json['resourceUrl'] as String?,
|
icon: $checkedConvert('icon', (v) => v as String?),
|
||||||
attributes: json['attributes'] as Map<String, dynamic>?,
|
resourceUrl: $checkedConvert('resourceUrl', (v) => v as String?),
|
||||||
|
attributes: $checkedConvert(
|
||||||
|
'attributes',
|
||||||
|
(v) => v as Map<String, dynamic>?,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$SearchFilesEntryToJson(SearchFilesEntry instance) =>
|
Map<String, dynamic> _$SearchFilesEntryToJson(SearchFilesEntry instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,24 +7,33 @@ part of 'get_chat_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
GetChatParams _$GetChatParamsFromJson(Map<String, dynamic> json) =>
|
GetChatParams _$GetChatParamsFromJson(Map<String, dynamic> json) =>
|
||||||
GetChatParams(
|
$checkedCreate('GetChatParams', json, ($checkedConvert) {
|
||||||
lookIntoFuture: $enumDecode(
|
final val = GetChatParams(
|
||||||
_$GetChatParamsSwitchEnumMap,
|
lookIntoFuture: $checkedConvert(
|
||||||
json['lookIntoFuture'],
|
'lookIntoFuture',
|
||||||
|
(v) => $enumDecode(_$GetChatParamsSwitchEnumMap, v),
|
||||||
),
|
),
|
||||||
limit: (json['limit'] as num?)?.toInt(),
|
limit: $checkedConvert('limit', (v) => (v as num?)?.toInt()),
|
||||||
lastKnownMessageId: (json['lastKnownMessageId'] as num?)?.toInt(),
|
lastKnownMessageId: $checkedConvert(
|
||||||
lastCommonReadId: (json['lastCommonReadId'] as num?)?.toInt(),
|
'lastKnownMessageId',
|
||||||
timeout: (json['timeout'] as num?)?.toInt(),
|
(v) => (v as num?)?.toInt(),
|
||||||
setReadMarker: $enumDecodeNullable(
|
|
||||||
_$GetChatParamsSwitchEnumMap,
|
|
||||||
json['setReadMarker'],
|
|
||||||
),
|
),
|
||||||
includeLastKnown: $enumDecodeNullable(
|
lastCommonReadId: $checkedConvert(
|
||||||
_$GetChatParamsSwitchEnumMap,
|
'lastCommonReadId',
|
||||||
json['includeLastKnown'],
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
timeout: $checkedConvert('timeout', (v) => (v as num?)?.toInt()),
|
||||||
|
setReadMarker: $checkedConvert(
|
||||||
|
'setReadMarker',
|
||||||
|
(v) => $enumDecodeNullable(_$GetChatParamsSwitchEnumMap, v),
|
||||||
|
),
|
||||||
|
includeLastKnown: $checkedConvert(
|
||||||
|
'includeLastKnown',
|
||||||
|
(v) => $enumDecodeNullable(_$GetChatParamsSwitchEnumMap, v),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatParamsToJson(
|
Map<String, dynamic> _$GetChatParamsToJson(
|
||||||
GetChatParams instance,
|
GetChatParams instance,
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ import 'package:json_annotation/json_annotation.dart';
|
|||||||
|
|
||||||
import '../../../../extensions/date_time.dart';
|
import '../../../../extensions/date_time.dart';
|
||||||
import '../../../api_response.dart';
|
import '../../../api_response.dart';
|
||||||
|
import '../../../json_lenient.dart';
|
||||||
import '../room/get_room_response.dart';
|
import '../room/get_room_response.dart';
|
||||||
|
|
||||||
part 'get_chat_response.g.dart';
|
part 'get_chat_response.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetChatResponse extends ApiResponse {
|
class GetChatResponse extends ApiResponse {
|
||||||
|
@JsonKey(fromJson: _messagesFromJson)
|
||||||
Set<GetChatResponseObject> data;
|
Set<GetChatResponseObject> data;
|
||||||
|
|
||||||
GetChatResponse(this.data);
|
GetChatResponse(this.data);
|
||||||
@@ -23,15 +25,20 @@ class GetChatResponse extends ApiResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<GetChatResponseObject> _messagesFromJson(Object? raw) =>
|
||||||
|
decodeSetLenient(raw, GetChatResponseObject.fromJson, what: 'message');
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetChatResponseObject {
|
class GetChatResponseObject {
|
||||||
int id;
|
int id;
|
||||||
String token;
|
String token;
|
||||||
|
@JsonKey(unknownEnumValue: GetRoomResponseObjectMessageActorType.unknown)
|
||||||
GetRoomResponseObjectMessageActorType actorType;
|
GetRoomResponseObjectMessageActorType actorType;
|
||||||
String actorId;
|
String actorId;
|
||||||
String actorDisplayName;
|
String actorDisplayName;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
String systemMessage;
|
String systemMessage;
|
||||||
|
@JsonKey(unknownEnumValue: GetRoomResponseObjectMessageType.unknown)
|
||||||
GetRoomResponseObjectMessageType messageType;
|
GetRoomResponseObjectMessageType messageType;
|
||||||
bool isReplyable;
|
bool isReplyable;
|
||||||
String referenceId;
|
String referenceId;
|
||||||
@@ -40,6 +47,11 @@ class GetChatResponseObject {
|
|||||||
List<String>? reactionsSelf;
|
List<String>? reactionsSelf;
|
||||||
@JsonKey(fromJson: _fromJson)
|
@JsonKey(fromJson: _fromJson)
|
||||||
Map<String, RichObjectString>? messageParameters;
|
Map<String, RichObjectString>? messageParameters;
|
||||||
|
|
||||||
|
/// The quoted message. When the original is no longer available (expired,
|
||||||
|
/// purged) the server only sends `{id, deleted: true}`; that becomes a
|
||||||
|
/// deleted-comment placeholder so the quote still renders.
|
||||||
|
@JsonKey(fromJson: _parentFromJson)
|
||||||
GetChatResponseObject? parent;
|
GetChatResponseObject? parent;
|
||||||
|
|
||||||
/// Whether the server flagged this message to be rendered as Markdown
|
/// Whether the server flagged this message to be rendered as Markdown
|
||||||
@@ -73,13 +85,31 @@ class GetChatResponseObject {
|
|||||||
/// [timestamp] is in seconds.
|
/// [timestamp] is in seconds.
|
||||||
DateTime get sentAt => DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
|
DateTime get sentAt => DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
|
||||||
|
|
||||||
static GetChatResponseObject getDateDummy(int timestamp) =>
|
static GetChatResponseObject getDateDummy(int timestamp) => getTextDummy(
|
||||||
getTextDummy(
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
timestamp * 1000,
|
timestamp * 1000,
|
||||||
).formatDateRelativeShort(),
|
).formatDateRelativeShort(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static GetChatResponseObject deletedPlaceholder(int id) =>
|
||||||
|
GetChatResponseObject(
|
||||||
|
id,
|
||||||
|
'',
|
||||||
|
GetRoomResponseObjectMessageActorType.user,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
GetRoomResponseObjectMessageType.deletedComment,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'Nachricht wurde gelöscht',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
|
||||||
static GetChatResponseObject getTextDummy(String text) =>
|
static GetChatResponseObject getTextDummy(String text) =>
|
||||||
GetChatResponseObject(
|
GetChatResponseObject(
|
||||||
0,
|
0,
|
||||||
@@ -100,14 +130,24 @@ class GetChatResponseObject {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetChatResponseObject? _parentFromJson(Object? json) {
|
||||||
|
if (json is! Map<String, dynamic>) return null;
|
||||||
|
if (json['deleted'] == true) {
|
||||||
|
return GetChatResponseObject.deletedPlaceholder(
|
||||||
|
(json['id'] as num?)?.toInt() ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return GetChatResponseObject.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, RichObjectString>? _fromJson(dynamic json) {
|
Map<String, RichObjectString>? _fromJson(dynamic json) {
|
||||||
if (json is Map<String, dynamic>) {
|
if (json is Map<String, dynamic>) {
|
||||||
final data = <String, RichObjectString>{};
|
final data = <String, RichObjectString>{};
|
||||||
for (final element in json.keys) {
|
for (final entry in json.entries) {
|
||||||
data.putIfAbsent(
|
final value = entry.value;
|
||||||
element,
|
if (value is Map<String, dynamic>) {
|
||||||
() => RichObjectString.fromJson(json[element] as Map<String, dynamic>),
|
data[entry.key] = RichObjectString.fromJson(value);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -117,6 +157,7 @@ Map<String, RichObjectString>? _fromJson(dynamic json) {
|
|||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class RichObjectString {
|
class RichObjectString {
|
||||||
|
@JsonKey(unknownEnumValue: RichObjectStringObjectType.unknown)
|
||||||
RichObjectStringObjectType type;
|
RichObjectStringObjectType type;
|
||||||
String id;
|
String id;
|
||||||
String name;
|
String name;
|
||||||
@@ -148,4 +189,14 @@ enum RichObjectStringObjectType {
|
|||||||
geoLocation,
|
geoLocation,
|
||||||
@JsonValue('call')
|
@JsonValue('call')
|
||||||
call,
|
call,
|
||||||
|
@JsonValue('user-group')
|
||||||
|
userGroup,
|
||||||
|
@JsonValue('circle')
|
||||||
|
circle,
|
||||||
|
@JsonValue('email')
|
||||||
|
email,
|
||||||
|
|
||||||
|
/// Anything else (deck cards, contacts, calendar events, ...); the
|
||||||
|
/// placeholder still resolves to the object's name.
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,18 @@ part of 'get_chat_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
GetChatResponse _$GetChatResponseFromJson(Map<String, dynamic> json) =>
|
GetChatResponse _$GetChatResponseFromJson(Map<String, dynamic> json) =>
|
||||||
GetChatResponse(
|
$checkedCreate('GetChatResponse', json, ($checkedConvert) {
|
||||||
(json['data'] as List<dynamic>)
|
final val = GetChatResponse(
|
||||||
.map(
|
$checkedConvert('data', (v) => _messagesFromJson(v)),
|
||||||
(e) => GetChatResponseObject.fromJson(e as Map<String, dynamic>),
|
|
||||||
)
|
|
||||||
.toSet(),
|
|
||||||
)
|
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
|
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -26,31 +28,49 @@ Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
|
|||||||
|
|
||||||
GetChatResponseObject _$GetChatResponseObjectFromJson(
|
GetChatResponseObject _$GetChatResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetChatResponseObject(
|
) => $checkedCreate('GetChatResponseObject', json, ($checkedConvert) {
|
||||||
(json['id'] as num).toInt(),
|
final val = GetChatResponseObject(
|
||||||
json['token'] as String,
|
$checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
$enumDecode(
|
$checkedConvert('token', (v) => v as String),
|
||||||
|
$checkedConvert(
|
||||||
|
'actorType',
|
||||||
|
(v) => $enumDecode(
|
||||||
_$GetRoomResponseObjectMessageActorTypeEnumMap,
|
_$GetRoomResponseObjectMessageActorTypeEnumMap,
|
||||||
json['actorType'],
|
v,
|
||||||
|
unknownValue: GetRoomResponseObjectMessageActorType.unknown,
|
||||||
),
|
),
|
||||||
json['actorId'] as String,
|
),
|
||||||
json['actorDisplayName'] as String,
|
$checkedConvert('actorId', (v) => v as String),
|
||||||
(json['timestamp'] as num).toInt(),
|
$checkedConvert('actorDisplayName', (v) => v as String),
|
||||||
json['systemMessage'] as String,
|
$checkedConvert('timestamp', (v) => (v as num).toInt()),
|
||||||
$enumDecode(_$GetRoomResponseObjectMessageTypeEnumMap, json['messageType']),
|
$checkedConvert('systemMessage', (v) => v as String),
|
||||||
json['isReplyable'] as bool,
|
$checkedConvert(
|
||||||
json['referenceId'] as String,
|
'messageType',
|
||||||
json['message'] as String,
|
(v) => $enumDecode(
|
||||||
_fromJson(json['messageParameters']),
|
_$GetRoomResponseObjectMessageTypeEnumMap,
|
||||||
(json['reactions'] as Map<String, dynamic>?)?.map(
|
v,
|
||||||
|
unknownValue: GetRoomResponseObjectMessageType.unknown,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$checkedConvert('isReplyable', (v) => v as bool),
|
||||||
|
$checkedConvert('referenceId', (v) => v as String),
|
||||||
|
$checkedConvert('message', (v) => v as String),
|
||||||
|
$checkedConvert('messageParameters', (v) => _fromJson(v)),
|
||||||
|
$checkedConvert(
|
||||||
|
'reactions',
|
||||||
|
(v) => (v as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(k, (e as num).toInt()),
|
(k, e) => MapEntry(k, (e as num).toInt()),
|
||||||
),
|
),
|
||||||
(json['reactionsSelf'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
),
|
||||||
json['parent'] == null
|
$checkedConvert(
|
||||||
? null
|
'reactionsSelf',
|
||||||
: GetChatResponseObject.fromJson(json['parent'] as Map<String, dynamic>),
|
(v) => (v as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||||
json['markdown'] as bool? ?? false,
|
),
|
||||||
|
$checkedConvert('parent', (v) => _parentFromJson(v)),
|
||||||
|
$checkedConvert('markdown', (v) => v as bool? ?? false),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
||||||
GetChatResponseObject instance,
|
GetChatResponseObject instance,
|
||||||
@@ -83,6 +103,12 @@ const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
|||||||
GetRoomResponseObjectMessageActorType.guest: 'guests',
|
GetRoomResponseObjectMessageActorType.guest: 'guests',
|
||||||
GetRoomResponseObjectMessageActorType.bot: 'bots',
|
GetRoomResponseObjectMessageActorType.bot: 'bots',
|
||||||
GetRoomResponseObjectMessageActorType.bridge: 'bridged',
|
GetRoomResponseObjectMessageActorType.bridge: 'bridged',
|
||||||
|
GetRoomResponseObjectMessageActorType.group: 'groups',
|
||||||
|
GetRoomResponseObjectMessageActorType.email: 'emails',
|
||||||
|
GetRoomResponseObjectMessageActorType.circle: 'circles',
|
||||||
|
GetRoomResponseObjectMessageActorType.federatedUser: 'federated_users',
|
||||||
|
GetRoomResponseObjectMessageActorType.phone: 'phones',
|
||||||
|
GetRoomResponseObjectMessageActorType.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$GetRoomResponseObjectMessageTypeEnumMap = {
|
const _$GetRoomResponseObjectMessageTypeEnumMap = {
|
||||||
@@ -91,16 +117,27 @@ const _$GetRoomResponseObjectMessageTypeEnumMap = {
|
|||||||
GetRoomResponseObjectMessageType.deletedComment: 'comment_deleted',
|
GetRoomResponseObjectMessageType.deletedComment: 'comment_deleted',
|
||||||
GetRoomResponseObjectMessageType.system: 'system',
|
GetRoomResponseObjectMessageType.system: 'system',
|
||||||
GetRoomResponseObjectMessageType.command: 'command',
|
GetRoomResponseObjectMessageType.command: 'command',
|
||||||
|
GetRoomResponseObjectMessageType.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|
||||||
RichObjectString _$RichObjectStringFromJson(Map<String, dynamic> json) =>
|
RichObjectString _$RichObjectStringFromJson(Map<String, dynamic> json) =>
|
||||||
RichObjectString(
|
$checkedCreate('RichObjectString', json, ($checkedConvert) {
|
||||||
$enumDecode(_$RichObjectStringObjectTypeEnumMap, json['type']),
|
final val = RichObjectString(
|
||||||
json['id'] as String,
|
$checkedConvert(
|
||||||
json['name'] as String,
|
'type',
|
||||||
json['path'] as String?,
|
(v) => $enumDecode(
|
||||||
json['link'] as String?,
|
_$RichObjectStringObjectTypeEnumMap,
|
||||||
|
v,
|
||||||
|
unknownValue: RichObjectStringObjectType.unknown,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$checkedConvert('id', (v) => v as String),
|
||||||
|
$checkedConvert('name', (v) => v as String),
|
||||||
|
$checkedConvert('path', (v) => v as String?),
|
||||||
|
$checkedConvert('link', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$RichObjectStringToJson(RichObjectString instance) =>
|
Map<String, dynamic> _$RichObjectStringToJson(RichObjectString instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -120,4 +157,8 @@ const _$RichObjectStringObjectTypeEnumMap = {
|
|||||||
RichObjectStringObjectType.talkPoll: 'talk-poll',
|
RichObjectStringObjectType.talkPoll: 'talk-poll',
|
||||||
RichObjectStringObjectType.geoLocation: 'geo-location',
|
RichObjectStringObjectType.geoLocation: 'geo-location',
|
||||||
RichObjectStringObjectType.call: 'call',
|
RichObjectStringObjectType.call: 'call',
|
||||||
|
RichObjectStringObjectType.userGroup: 'user-group',
|
||||||
|
RichObjectStringObjectType.circle: 'circle',
|
||||||
|
RichObjectStringObjectType.email: 'email',
|
||||||
|
RichObjectStringObjectType.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,14 +7,18 @@ part of 'create_poll_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
CreatePollParams _$CreatePollParamsFromJson(Map<String, dynamic> json) =>
|
CreatePollParams _$CreatePollParamsFromJson(Map<String, dynamic> json) =>
|
||||||
CreatePollParams(
|
$checkedCreate('CreatePollParams', json, ($checkedConvert) {
|
||||||
question: json['question'] as String,
|
final val = CreatePollParams(
|
||||||
options: (json['options'] as List<dynamic>)
|
question: $checkedConvert('question', (v) => v as String),
|
||||||
.map((e) => e as String)
|
options: $checkedConvert(
|
||||||
.toList(),
|
'options',
|
||||||
resultMode: (json['resultMode'] as num).toInt(),
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
maxVotes: (json['maxVotes'] as num).toInt(),
|
),
|
||||||
|
resultMode: $checkedConvert('resultMode', (v) => (v as num).toInt()),
|
||||||
|
maxVotes: $checkedConvert('maxVotes', (v) => (v as num).toInt()),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CreatePollParamsToJson(CreatePollParams instance) =>
|
Map<String, dynamic> _$CreatePollParamsToJson(CreatePollParams instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,14 +7,17 @@ part of 'create_room_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
|
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
|
||||||
CreateRoomParams(
|
$checkedCreate('CreateRoomParams', json, ($checkedConvert) {
|
||||||
roomType: (json['roomType'] as num).toInt(),
|
final val = CreateRoomParams(
|
||||||
invite: json['invite'] as String,
|
roomType: $checkedConvert('roomType', (v) => (v as num).toInt()),
|
||||||
source: json['source'] as String?,
|
invite: $checkedConvert('invite', (v) => v as String),
|
||||||
roomName: json['roomName'] as String?,
|
source: $checkedConvert('source', (v) => v as String?),
|
||||||
objectType: json['objectType'] as String?,
|
roomName: $checkedConvert('roomName', (v) => v as String?),
|
||||||
objectId: json['objectId'] as String?,
|
objectType: $checkedConvert('objectType', (v) => v as String?),
|
||||||
|
objectId: $checkedConvert('objectId', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CreateRoomParamsToJson(CreateRoomParams instance) =>
|
Map<String, dynamic> _$CreateRoomParamsToJson(CreateRoomParams instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,12 +7,21 @@ part of 'create_room_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
CreateRoomResponse _$CreateRoomResponseFromJson(Map<String, dynamic> json) =>
|
CreateRoomResponse _$CreateRoomResponseFromJson(Map<String, dynamic> json) =>
|
||||||
CreateRoomResponse(
|
$checkedCreate('CreateRoomResponse', json, ($checkedConvert) {
|
||||||
CreateRoomResponseData.fromJson(json['data'] as Map<String, dynamic>),
|
final val = CreateRoomResponse(
|
||||||
)
|
$checkedConvert(
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
'data',
|
||||||
(k, e) => MapEntry(k, e as String),
|
(v) => CreateRoomResponseData.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CreateRoomResponseToJson(CreateRoomResponse instance) =>
|
Map<String, dynamic> _$CreateRoomResponseToJson(CreateRoomResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -22,7 +31,12 @@ Map<String, dynamic> _$CreateRoomResponseToJson(CreateRoomResponse instance) =>
|
|||||||
|
|
||||||
CreateRoomResponseData _$CreateRoomResponseDataFromJson(
|
CreateRoomResponseData _$CreateRoomResponseDataFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => CreateRoomResponseData(json['token'] as String);
|
) => $checkedCreate('CreateRoomResponseData', json, ($checkedConvert) {
|
||||||
|
final val = CreateRoomResponseData(
|
||||||
|
$checkedConvert('token', (v) => v as String),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CreateRoomResponseDataToJson(
|
Map<String, dynamic> _$CreateRoomResponseDataToJson(
|
||||||
CreateRoomResponseData instance,
|
CreateRoomResponseData instance,
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ part of 'delete_react_message_params.dart';
|
|||||||
|
|
||||||
DeleteReactMessageParams _$DeleteReactMessageParamsFromJson(
|
DeleteReactMessageParams _$DeleteReactMessageParamsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => DeleteReactMessageParams(json['reaction'] as String);
|
) => $checkedCreate('DeleteReactMessageParams', json, ($checkedConvert) {
|
||||||
|
final val = DeleteReactMessageParams(
|
||||||
|
$checkedConvert('reaction', (v) => v as String),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$DeleteReactMessageParamsToJson(
|
Map<String, dynamic> _$DeleteReactMessageParamsToJson(
|
||||||
DeleteReactMessageParams instance,
|
DeleteReactMessageParams instance,
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
import '../../../api_response.dart';
|
import '../../../api_response.dart';
|
||||||
|
import '../../../json_lenient.dart';
|
||||||
|
|
||||||
part 'get_participants_response.g.dart';
|
part 'get_participants_response.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetParticipantsResponse extends ApiResponse {
|
class GetParticipantsResponse extends ApiResponse {
|
||||||
|
@JsonKey(fromJson: _participantsFromJson)
|
||||||
Set<GetParticipantsResponseObject> data;
|
Set<GetParticipantsResponseObject> data;
|
||||||
|
|
||||||
GetParticipantsResponse(this.data);
|
GetParticipantsResponse(this.data);
|
||||||
@@ -15,15 +17,25 @@ class GetParticipantsResponse extends ApiResponse {
|
|||||||
Map<String, dynamic> toJson() => _$GetParticipantsResponseToJson(this);
|
Map<String, dynamic> toJson() => _$GetParticipantsResponseToJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<GetParticipantsResponseObject> _participantsFromJson(Object? raw) =>
|
||||||
|
decodeSetLenient(
|
||||||
|
raw,
|
||||||
|
GetParticipantsResponseObject.fromJson,
|
||||||
|
what: 'participant',
|
||||||
|
);
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetParticipantsResponseObject {
|
class GetParticipantsResponseObject {
|
||||||
int attendeeId;
|
int attendeeId;
|
||||||
String actorType;
|
String actorType;
|
||||||
String actorId;
|
String actorId;
|
||||||
String displayName;
|
String displayName;
|
||||||
|
@JsonKey(unknownEnumValue: GetParticipantsResponseObjectParticipantType.user)
|
||||||
GetParticipantsResponseObjectParticipantType participantType;
|
GetParticipantsResponseObjectParticipantType participantType;
|
||||||
int lastPing;
|
int lastPing;
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags inCall;
|
|
||||||
|
/// Bitmask: 1 = in call, 2 = with audio, 4 = with video, 8 = via phone.
|
||||||
|
int inCall;
|
||||||
int permissions;
|
int permissions;
|
||||||
int attendeePermissions;
|
int attendeePermissions;
|
||||||
String? sessionId;
|
String? sessionId;
|
||||||
@@ -54,6 +66,11 @@ class GetParticipantsResponseObject {
|
|||||||
factory GetParticipantsResponseObject.fromJson(Map<String, dynamic> json) =>
|
factory GetParticipantsResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||||
_$GetParticipantsResponseObjectFromJson(json);
|
_$GetParticipantsResponseObjectFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$GetParticipantsResponseObjectToJson(this);
|
Map<String, dynamic> toJson() => _$GetParticipantsResponseObjectToJson(this);
|
||||||
|
|
||||||
|
bool get isInCall => inCall & 1 != 0;
|
||||||
|
bool get inCallWithAudio => inCall & 2 != 0;
|
||||||
|
bool get inCallWithVideo => inCall & 4 != 0;
|
||||||
|
bool get inCallViaPhone => inCall & 8 != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GetParticipantsResponseObjectParticipantType {
|
enum GetParticipantsResponseObjectParticipantType {
|
||||||
@@ -73,16 +90,3 @@ enum GetParticipantsResponseObjectParticipantType {
|
|||||||
const GetParticipantsResponseObjectParticipantType(this.prettyName);
|
const GetParticipantsResponseObjectParticipantType(this.prettyName);
|
||||||
final String prettyName;
|
final String prettyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GetParticipantsResponseObjectParticipantsInCallFlags {
|
|
||||||
@JsonValue(0)
|
|
||||||
disconnected,
|
|
||||||
@JsonValue(1)
|
|
||||||
inCall,
|
|
||||||
@JsonValue(2)
|
|
||||||
providesAudio,
|
|
||||||
@JsonValue(3)
|
|
||||||
providesVideo,
|
|
||||||
@JsonValue(4)
|
|
||||||
usesSipDialIn,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,19 +8,18 @@ part of 'get_participants_response.dart';
|
|||||||
|
|
||||||
GetParticipantsResponse _$GetParticipantsResponseFromJson(
|
GetParticipantsResponse _$GetParticipantsResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('GetParticipantsResponse', json, ($checkedConvert) {
|
||||||
GetParticipantsResponse(
|
final val = GetParticipantsResponse(
|
||||||
(json['data'] as List<dynamic>)
|
$checkedConvert('data', (v) => _participantsFromJson(v)),
|
||||||
.map(
|
|
||||||
(e) => GetParticipantsResponseObject.fromJson(
|
|
||||||
e as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toSet(),
|
|
||||||
)
|
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetParticipantsResponseToJson(
|
Map<String, dynamic> _$GetParticipantsResponseToJson(
|
||||||
GetParticipantsResponse instance,
|
GetParticipantsResponse instance,
|
||||||
@@ -31,29 +30,36 @@ Map<String, dynamic> _$GetParticipantsResponseToJson(
|
|||||||
|
|
||||||
GetParticipantsResponseObject _$GetParticipantsResponseObjectFromJson(
|
GetParticipantsResponseObject _$GetParticipantsResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetParticipantsResponseObject(
|
) => $checkedCreate('GetParticipantsResponseObject', json, ($checkedConvert) {
|
||||||
(json['attendeeId'] as num).toInt(),
|
final val = GetParticipantsResponseObject(
|
||||||
json['actorType'] as String,
|
$checkedConvert('attendeeId', (v) => (v as num).toInt()),
|
||||||
json['actorId'] as String,
|
$checkedConvert('actorType', (v) => v as String),
|
||||||
json['displayName'] as String,
|
$checkedConvert('actorId', (v) => v as String),
|
||||||
$enumDecode(
|
$checkedConvert('displayName', (v) => v as String),
|
||||||
|
$checkedConvert(
|
||||||
|
'participantType',
|
||||||
|
(v) => $enumDecode(
|
||||||
_$GetParticipantsResponseObjectParticipantTypeEnumMap,
|
_$GetParticipantsResponseObjectParticipantTypeEnumMap,
|
||||||
json['participantType'],
|
v,
|
||||||
|
unknownValue: GetParticipantsResponseObjectParticipantType.user,
|
||||||
),
|
),
|
||||||
(json['lastPing'] as num).toInt(),
|
|
||||||
$enumDecode(
|
|
||||||
_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap,
|
|
||||||
json['inCall'],
|
|
||||||
),
|
),
|
||||||
(json['permissions'] as num).toInt(),
|
$checkedConvert('lastPing', (v) => (v as num).toInt()),
|
||||||
(json['attendeePermissions'] as num).toInt(),
|
$checkedConvert('inCall', (v) => (v as num).toInt()),
|
||||||
json['sessionId'] as String?,
|
$checkedConvert('permissions', (v) => (v as num).toInt()),
|
||||||
(json['sessionIds'] as List<dynamic>).map((e) => e as String).toList(),
|
$checkedConvert('attendeePermissions', (v) => (v as num).toInt()),
|
||||||
json['status'] as String?,
|
$checkedConvert('sessionId', (v) => v as String?),
|
||||||
json['statusIcon'] as String?,
|
$checkedConvert(
|
||||||
json['statusMessage'] as String?,
|
'sessionIds',
|
||||||
json['roomToken'] as String?,
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
|
),
|
||||||
|
$checkedConvert('status', (v) => v as String?),
|
||||||
|
$checkedConvert('statusIcon', (v) => v as String?),
|
||||||
|
$checkedConvert('statusMessage', (v) => v as String?),
|
||||||
|
$checkedConvert('roomToken', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetParticipantsResponseObjectToJson(
|
Map<String, dynamic> _$GetParticipantsResponseObjectToJson(
|
||||||
GetParticipantsResponseObject instance,
|
GetParticipantsResponseObject instance,
|
||||||
@@ -66,9 +72,7 @@ Map<String, dynamic> _$GetParticipantsResponseObjectToJson(
|
|||||||
_$GetParticipantsResponseObjectParticipantTypeEnumMap[instance
|
_$GetParticipantsResponseObjectParticipantTypeEnumMap[instance
|
||||||
.participantType]!,
|
.participantType]!,
|
||||||
'lastPing': instance.lastPing,
|
'lastPing': instance.lastPing,
|
||||||
'inCall':
|
'inCall': instance.inCall,
|
||||||
_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap[instance
|
|
||||||
.inCall]!,
|
|
||||||
'permissions': instance.permissions,
|
'permissions': instance.permissions,
|
||||||
'attendeePermissions': instance.attendeePermissions,
|
'attendeePermissions': instance.attendeePermissions,
|
||||||
'sessionId': instance.sessionId,
|
'sessionId': instance.sessionId,
|
||||||
@@ -87,11 +91,3 @@ const _$GetParticipantsResponseObjectParticipantTypeEnumMap = {
|
|||||||
GetParticipantsResponseObjectParticipantType.userFollowingPublicLink: 5,
|
GetParticipantsResponseObjectParticipantType.userFollowingPublicLink: 5,
|
||||||
GetParticipantsResponseObjectParticipantType.guestWithModeratorPermissions: 6,
|
GetParticipantsResponseObjectParticipantType.guestWithModeratorPermissions: 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap = {
|
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags.disconnected: 0,
|
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags.inCall: 1,
|
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags.providesAudio: 2,
|
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags.providesVideo: 3,
|
|
||||||
GetParticipantsResponseObjectParticipantsInCallFlags.usesSipDialIn: 4,
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -8,15 +8,21 @@ part of 'get_poll_state_response.dart';
|
|||||||
|
|
||||||
GetPollStateResponse _$GetPollStateResponseFromJson(
|
GetPollStateResponse _$GetPollStateResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('GetPollStateResponse', json, ($checkedConvert) {
|
||||||
GetPollStateResponse(
|
final val = GetPollStateResponse(
|
||||||
GetPollStateResponseObject.fromJson(
|
$checkedConvert(
|
||||||
json['data'] as Map<String, dynamic>,
|
'data',
|
||||||
|
(v) => GetPollStateResponseObject.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetPollStateResponseToJson(
|
Map<String, dynamic> _$GetPollStateResponseToJson(
|
||||||
GetPollStateResponse instance,
|
GetPollStateResponse instance,
|
||||||
@@ -27,21 +33,30 @@ Map<String, dynamic> _$GetPollStateResponseToJson(
|
|||||||
|
|
||||||
GetPollStateResponseObject _$GetPollStateResponseObjectFromJson(
|
GetPollStateResponseObject _$GetPollStateResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetPollStateResponseObject(
|
) => $checkedCreate('GetPollStateResponseObject', json, ($checkedConvert) {
|
||||||
(json['id'] as num).toInt(),
|
final val = GetPollStateResponseObject(
|
||||||
json['question'] as String,
|
$checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
(json['options'] as List<dynamic>).map((e) => e as String).toList(),
|
$checkedConvert('question', (v) => v as String),
|
||||||
json['votes'],
|
$checkedConvert(
|
||||||
json['actorType'] as String,
|
'options',
|
||||||
json['actorId'] as String,
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
json['actorDisplayName'] as String,
|
),
|
||||||
(json['status'] as num).toInt(),
|
$checkedConvert('votes', (v) => v),
|
||||||
(json['resultMode'] as num).toInt(),
|
$checkedConvert('actorType', (v) => v as String),
|
||||||
(json['maxVotes'] as num).toInt(),
|
$checkedConvert('actorId', (v) => v as String),
|
||||||
(json['votedSelf'] as List<dynamic>).map((e) => (e as num).toInt()).toList(),
|
$checkedConvert('actorDisplayName', (v) => v as String),
|
||||||
(json['numVoters'] as num?)?.toInt(),
|
$checkedConvert('status', (v) => (v as num).toInt()),
|
||||||
json['details'] as List<dynamic>?,
|
$checkedConvert('resultMode', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('maxVotes', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert(
|
||||||
|
'votedSelf',
|
||||||
|
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
|
||||||
|
),
|
||||||
|
$checkedConvert('numVoters', (v) => (v as num?)?.toInt()),
|
||||||
|
$checkedConvert('details', (v) => v as List<dynamic>?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetPollStateResponseObjectToJson(
|
Map<String, dynamic> _$GetPollStateResponseObjectToJson(
|
||||||
GetPollStateResponseObject instance,
|
GetPollStateResponseObject instance,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class GetReactionsResponse extends ApiResponse {
|
|||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class GetReactionsResponseObject {
|
class GetReactionsResponseObject {
|
||||||
|
@JsonKey(unknownEnumValue: GetReactionsResponseObjectActorType.unknown)
|
||||||
GetReactionsResponseObjectActorType actorType;
|
GetReactionsResponseObjectActorType actorType;
|
||||||
String actorId;
|
String actorId;
|
||||||
String actorDisplayName;
|
String actorDisplayName;
|
||||||
@@ -39,4 +40,11 @@ enum GetReactionsResponseObjectActorType {
|
|||||||
guests,
|
guests,
|
||||||
@JsonValue('users')
|
@JsonValue('users')
|
||||||
users,
|
users,
|
||||||
|
@JsonValue('emails')
|
||||||
|
emails,
|
||||||
|
@JsonValue('bots')
|
||||||
|
bots,
|
||||||
|
@JsonValue('federated_users')
|
||||||
|
federatedUsers,
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ part of 'get_reactions_response.dart';
|
|||||||
|
|
||||||
GetReactionsResponse _$GetReactionsResponseFromJson(
|
GetReactionsResponse _$GetReactionsResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('GetReactionsResponse', json, ($checkedConvert) {
|
||||||
GetReactionsResponse(
|
final val = GetReactionsResponse(
|
||||||
(json['data'] as Map<String, dynamic>).map(
|
$checkedConvert(
|
||||||
|
'data',
|
||||||
|
(v) => (v as Map<String, dynamic>).map(
|
||||||
(k, e) => MapEntry(
|
(k, e) => MapEntry(
|
||||||
k,
|
k,
|
||||||
(e as List<dynamic>)
|
(e as List<dynamic>)
|
||||||
@@ -22,10 +24,16 @@ GetReactionsResponse _$GetReactionsResponseFromJson(
|
|||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetReactionsResponseToJson(
|
Map<String, dynamic> _$GetReactionsResponseToJson(
|
||||||
GetReactionsResponse instance,
|
GetReactionsResponse instance,
|
||||||
@@ -38,12 +46,22 @@ Map<String, dynamic> _$GetReactionsResponseToJson(
|
|||||||
|
|
||||||
GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
|
GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetReactionsResponseObject(
|
) => $checkedCreate('GetReactionsResponseObject', json, ($checkedConvert) {
|
||||||
$enumDecode(_$GetReactionsResponseObjectActorTypeEnumMap, json['actorType']),
|
final val = GetReactionsResponseObject(
|
||||||
json['actorId'] as String,
|
$checkedConvert(
|
||||||
json['actorDisplayName'] as String,
|
'actorType',
|
||||||
(json['timestamp'] as num).toInt(),
|
(v) => $enumDecode(
|
||||||
|
_$GetReactionsResponseObjectActorTypeEnumMap,
|
||||||
|
v,
|
||||||
|
unknownValue: GetReactionsResponseObjectActorType.unknown,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$checkedConvert('actorId', (v) => v as String),
|
||||||
|
$checkedConvert('actorDisplayName', (v) => v as String),
|
||||||
|
$checkedConvert('timestamp', (v) => (v as num).toInt()),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetReactionsResponseObjectToJson(
|
Map<String, dynamic> _$GetReactionsResponseObjectToJson(
|
||||||
GetReactionsResponseObject instance,
|
GetReactionsResponseObject instance,
|
||||||
@@ -58,4 +76,8 @@ Map<String, dynamic> _$GetReactionsResponseObjectToJson(
|
|||||||
const _$GetReactionsResponseObjectActorTypeEnumMap = {
|
const _$GetReactionsResponseObjectActorTypeEnumMap = {
|
||||||
GetReactionsResponseObjectActorType.guests: 'guests',
|
GetReactionsResponseObjectActorType.guests: 'guests',
|
||||||
GetReactionsResponseObjectActorType.users: 'users',
|
GetReactionsResponseObjectActorType.users: 'users',
|
||||||
|
GetReactionsResponseObjectActorType.emails: 'emails',
|
||||||
|
GetReactionsResponseObjectActorType.bots: 'bots',
|
||||||
|
GetReactionsResponseObjectActorType.federatedUsers: 'federated_users',
|
||||||
|
GetReactionsResponseObjectActorType.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ part of 'react_message_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
ReactMessageParams _$ReactMessageParamsFromJson(Map<String, dynamic> json) =>
|
ReactMessageParams _$ReactMessageParamsFromJson(Map<String, dynamic> json) =>
|
||||||
ReactMessageParams(json['reaction'] as String);
|
$checkedCreate('ReactMessageParams', json, ($checkedConvert) {
|
||||||
|
final val = ReactMessageParams(
|
||||||
|
$checkedConvert('reaction', (v) => v as String),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ReactMessageParamsToJson(ReactMessageParams instance) =>
|
Map<String, dynamic> _$ReactMessageParamsToJson(ReactMessageParams instance) =>
|
||||||
<String, dynamic>{'reaction': instance.reaction};
|
<String, dynamic>{'reaction': instance.reaction};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
import '../../../json_lenient.dart';
|
||||||
import '../../nextcloud_ocs.dart';
|
import '../../nextcloud_ocs.dart';
|
||||||
import '../talk_api.dart';
|
import '../talk_api.dart';
|
||||||
import 'get_room_params.dart';
|
import 'get_room_params.dart';
|
||||||
@@ -19,4 +20,5 @@ class GetRoom extends TalkApi<GetRoomResponse> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetRoomResponse _parseRooms(String raw) =>
|
GetRoomResponse _parseRooms(String raw) =>
|
||||||
GetRoomResponse.fromJson(NextcloudOcs.decode(raw));
|
GetRoomResponse.fromJson(NextcloudOcs.decode(raw))
|
||||||
|
..parseWarnings = drainDecodeWarnings();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import '../../../api_params.dart';
|
|||||||
|
|
||||||
part 'get_room_params.g.dart';
|
part 'get_room_params.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||||
class GetRoomParams extends ApiParams {
|
class GetRoomParams extends ApiParams {
|
||||||
GetRoomParamsStatusUpdate? noStatusUpdate;
|
GetRoomParamsStatusUpdate? noStatusUpdate;
|
||||||
@JsonKey(toJson: _format)
|
@JsonKey(toJson: _format)
|
||||||
|
|||||||
@@ -7,21 +7,27 @@ part of 'get_room_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
GetRoomParams _$GetRoomParamsFromJson(Map<String, dynamic> json) =>
|
GetRoomParams _$GetRoomParamsFromJson(Map<String, dynamic> json) =>
|
||||||
GetRoomParams(
|
$checkedCreate('GetRoomParams', json, ($checkedConvert) {
|
||||||
noStatusUpdate: $enumDecodeNullable(
|
final val = GetRoomParams(
|
||||||
_$GetRoomParamsStatusUpdateEnumMap,
|
noStatusUpdate: $checkedConvert(
|
||||||
json['noStatusUpdate'],
|
'noStatusUpdate',
|
||||||
|
(v) => $enumDecodeNullable(_$GetRoomParamsStatusUpdateEnumMap, v),
|
||||||
|
),
|
||||||
|
includeStatus: $checkedConvert('includeStatus', (v) => v as bool?),
|
||||||
|
modifiedSince: $checkedConvert(
|
||||||
|
'modifiedSince',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
),
|
),
|
||||||
includeStatus: json['includeStatus'] as bool?,
|
|
||||||
modifiedSince: (json['modifiedSince'] as num?)?.toInt(),
|
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetRoomParamsToJson(
|
Map<String, dynamic> _$GetRoomParamsToJson(GetRoomParams instance) =>
|
||||||
GetRoomParams instance,
|
<String, dynamic>{
|
||||||
) => <String, dynamic>{
|
'noStatusUpdate':
|
||||||
'noStatusUpdate': _$GetRoomParamsStatusUpdateEnumMap[instance.noStatusUpdate],
|
?_$GetRoomParamsStatusUpdateEnumMap[instance.noStatusUpdate],
|
||||||
'includeStatus': GetRoomParams._format(instance.includeStatus),
|
'includeStatus': GetRoomParams._format(instance.includeStatus),
|
||||||
'modifiedSince': instance.modifiedSince,
|
'modifiedSince': ?instance.modifiedSince,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$GetRoomParamsStatusUpdateEnumMap = {
|
const _$GetRoomParamsStatusUpdateEnumMap = {
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
import '../../../api_response.dart';
|
import '../../../api_response.dart';
|
||||||
|
import '../../../json_lenient.dart';
|
||||||
import '../chat/get_chat_response.dart';
|
import '../chat/get_chat_response.dart';
|
||||||
|
|
||||||
part 'get_room_response.g.dart';
|
part 'get_room_response.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetRoomResponse extends ApiResponse {
|
class GetRoomResponse extends ApiResponse {
|
||||||
|
@JsonKey(fromJson: _roomsFromJson)
|
||||||
Set<GetRoomResponseObject> data;
|
Set<GetRoomResponseObject> data;
|
||||||
|
|
||||||
GetRoomResponse(this.data);
|
GetRoomResponse(this.data);
|
||||||
@@ -33,10 +35,14 @@ class GetRoomResponse extends ApiResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<GetRoomResponseObject> _roomsFromJson(Object? raw) =>
|
||||||
|
decodeSetLenient(raw, GetRoomResponseObject.fromJson, what: 'room');
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class GetRoomResponseObject {
|
class GetRoomResponseObject {
|
||||||
int id;
|
int id;
|
||||||
String token;
|
String token;
|
||||||
|
@JsonKey(unknownEnumValue: GetRoomResponseObjectConversationType.unknown)
|
||||||
GetRoomResponseObjectConversationType type;
|
GetRoomResponseObjectConversationType type;
|
||||||
String name;
|
String name;
|
||||||
String displayName;
|
String displayName;
|
||||||
@@ -55,13 +61,20 @@ class GetRoomResponseObject {
|
|||||||
bool canLeaveConversation;
|
bool canLeaveConversation;
|
||||||
int lastActivity;
|
int lastActivity;
|
||||||
bool isFavorite;
|
bool isFavorite;
|
||||||
|
@JsonKey(
|
||||||
|
unknownEnumValue:
|
||||||
|
GetRoomResponseObjectParticipantNotificationLevel.defaultLevel,
|
||||||
|
)
|
||||||
GetRoomResponseObjectParticipantNotificationLevel notificationLevel;
|
GetRoomResponseObjectParticipantNotificationLevel notificationLevel;
|
||||||
int unreadMessages;
|
int unreadMessages;
|
||||||
bool unreadMention;
|
bool unreadMention;
|
||||||
bool unreadMentionDirect;
|
bool unreadMentionDirect;
|
||||||
int lastReadMessage;
|
int lastReadMessage;
|
||||||
int lastCommonReadMessage;
|
int lastCommonReadMessage;
|
||||||
GetChatResponseObject lastMessage;
|
|
||||||
|
/// Omitted by the server for rooms without a visible message (empty room,
|
||||||
|
/// last message expired or hidden from this user, federated conversation).
|
||||||
|
GetChatResponseObject? lastMessage;
|
||||||
String? status;
|
String? status;
|
||||||
String? statusIcon;
|
String? statusIcon;
|
||||||
String? statusMessage;
|
String? statusMessage;
|
||||||
@@ -117,6 +130,9 @@ enum GetRoomResponseObjectConversationType {
|
|||||||
deleted,
|
deleted,
|
||||||
@JsonValue(6)
|
@JsonValue(6)
|
||||||
noteToSelf,
|
noteToSelf,
|
||||||
|
|
||||||
|
/// Fallback for types this app does not know yet; treated like a group.
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GetRoomResponseObjectParticipantNotificationLevel {
|
enum GetRoomResponseObjectParticipantNotificationLevel {
|
||||||
@@ -147,6 +163,17 @@ enum GetRoomResponseObjectMessageActorType {
|
|||||||
bot,
|
bot,
|
||||||
@JsonValue('bridged')
|
@JsonValue('bridged')
|
||||||
bridge,
|
bridge,
|
||||||
|
@JsonValue('groups')
|
||||||
|
group,
|
||||||
|
@JsonValue('emails')
|
||||||
|
email,
|
||||||
|
@JsonValue('circles')
|
||||||
|
circle,
|
||||||
|
@JsonValue('federated_users')
|
||||||
|
federatedUser,
|
||||||
|
@JsonValue('phones')
|
||||||
|
phone,
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GetRoomResponseObjectMessageType {
|
enum GetRoomResponseObjectMessageType {
|
||||||
@@ -160,4 +187,8 @@ enum GetRoomResponseObjectMessageType {
|
|||||||
system,
|
system,
|
||||||
@JsonValue('command')
|
@JsonValue('command')
|
||||||
command,
|
command,
|
||||||
|
|
||||||
|
/// Fallback for types this app does not know yet (e.g. call recordings);
|
||||||
|
/// rendered like a plain comment.
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,18 @@ part of 'get_room_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
GetRoomResponse _$GetRoomResponseFromJson(Map<String, dynamic> json) =>
|
GetRoomResponse _$GetRoomResponseFromJson(Map<String, dynamic> json) =>
|
||||||
GetRoomResponse(
|
$checkedCreate('GetRoomResponse', json, ($checkedConvert) {
|
||||||
(json['data'] as List<dynamic>)
|
final val = GetRoomResponse(
|
||||||
.map(
|
$checkedConvert('data', (v) => _roomsFromJson(v)),
|
||||||
(e) => GetRoomResponseObject.fromJson(e as Map<String, dynamic>),
|
|
||||||
)
|
|
||||||
.toSet(),
|
|
||||||
)
|
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
|
Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -26,41 +28,61 @@ Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
|
|||||||
|
|
||||||
GetRoomResponseObject _$GetRoomResponseObjectFromJson(
|
GetRoomResponseObject _$GetRoomResponseObjectFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetRoomResponseObject(
|
) => $checkedCreate('GetRoomResponseObject', json, ($checkedConvert) {
|
||||||
(json['id'] as num).toInt(),
|
final val = GetRoomResponseObject(
|
||||||
json['token'] as String,
|
$checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
$enumDecode(_$GetRoomResponseObjectConversationTypeEnumMap, json['type']),
|
$checkedConvert('token', (v) => v as String),
|
||||||
json['name'] as String,
|
$checkedConvert(
|
||||||
json['displayName'] as String,
|
'type',
|
||||||
json['description'] as String,
|
(v) => $enumDecode(
|
||||||
(json['participantType'] as num).toInt(),
|
_$GetRoomResponseObjectConversationTypeEnumMap,
|
||||||
(json['participantFlags'] as num).toInt(),
|
v,
|
||||||
(json['readOnly'] as num).toInt(),
|
unknownValue: GetRoomResponseObjectConversationType.unknown,
|
||||||
(json['listable'] as num).toInt(),
|
|
||||||
(json['lastPing'] as num).toInt(),
|
|
||||||
json['sessionId'] as String,
|
|
||||||
json['hasPassword'] as bool,
|
|
||||||
json['hasCall'] as bool,
|
|
||||||
(json['callFlag'] as num).toInt(),
|
|
||||||
json['canStartCall'] as bool,
|
|
||||||
json['canDeleteConversation'] as bool,
|
|
||||||
json['canLeaveConversation'] as bool,
|
|
||||||
(json['lastActivity'] as num).toInt(),
|
|
||||||
json['isFavorite'] as bool,
|
|
||||||
$enumDecode(
|
|
||||||
_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
|
|
||||||
json['notificationLevel'],
|
|
||||||
),
|
),
|
||||||
(json['unreadMessages'] as num).toInt(),
|
),
|
||||||
json['unreadMention'] as bool,
|
$checkedConvert('name', (v) => v as String),
|
||||||
json['unreadMentionDirect'] as bool,
|
$checkedConvert('displayName', (v) => v as String),
|
||||||
(json['lastReadMessage'] as num).toInt(),
|
$checkedConvert('description', (v) => v as String),
|
||||||
(json['lastCommonReadMessage'] as num).toInt(),
|
$checkedConvert('participantType', (v) => (v as num).toInt()),
|
||||||
GetChatResponseObject.fromJson(json['lastMessage'] as Map<String, dynamic>),
|
$checkedConvert('participantFlags', (v) => (v as num).toInt()),
|
||||||
json['status'] as String?,
|
$checkedConvert('readOnly', (v) => (v as num).toInt()),
|
||||||
json['statusIcon'] as String?,
|
$checkedConvert('listable', (v) => (v as num).toInt()),
|
||||||
json['statusMessage'] as String?,
|
$checkedConvert('lastPing', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('sessionId', (v) => v as String),
|
||||||
|
$checkedConvert('hasPassword', (v) => v as bool),
|
||||||
|
$checkedConvert('hasCall', (v) => v as bool),
|
||||||
|
$checkedConvert('callFlag', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('canStartCall', (v) => v as bool),
|
||||||
|
$checkedConvert('canDeleteConversation', (v) => v as bool),
|
||||||
|
$checkedConvert('canLeaveConversation', (v) => v as bool),
|
||||||
|
$checkedConvert('lastActivity', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('isFavorite', (v) => v as bool),
|
||||||
|
$checkedConvert(
|
||||||
|
'notificationLevel',
|
||||||
|
(v) => $enumDecode(
|
||||||
|
_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
|
||||||
|
v,
|
||||||
|
unknownValue:
|
||||||
|
GetRoomResponseObjectParticipantNotificationLevel.defaultLevel,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$checkedConvert('unreadMessages', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('unreadMention', (v) => v as bool),
|
||||||
|
$checkedConvert('unreadMentionDirect', (v) => v as bool),
|
||||||
|
$checkedConvert('lastReadMessage', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert('lastCommonReadMessage', (v) => (v as num).toInt()),
|
||||||
|
$checkedConvert(
|
||||||
|
'lastMessage',
|
||||||
|
(v) => v == null
|
||||||
|
? null
|
||||||
|
: GetChatResponseObject.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
|
$checkedConvert('status', (v) => v as String?),
|
||||||
|
$checkedConvert('statusIcon', (v) => v as String?),
|
||||||
|
$checkedConvert('statusMessage', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetRoomResponseObjectToJson(
|
Map<String, dynamic> _$GetRoomResponseObjectToJson(
|
||||||
GetRoomResponseObject instance,
|
GetRoomResponseObject instance,
|
||||||
@@ -93,7 +115,7 @@ Map<String, dynamic> _$GetRoomResponseObjectToJson(
|
|||||||
'unreadMentionDirect': instance.unreadMentionDirect,
|
'unreadMentionDirect': instance.unreadMentionDirect,
|
||||||
'lastReadMessage': instance.lastReadMessage,
|
'lastReadMessage': instance.lastReadMessage,
|
||||||
'lastCommonReadMessage': instance.lastCommonReadMessage,
|
'lastCommonReadMessage': instance.lastCommonReadMessage,
|
||||||
'lastMessage': instance.lastMessage.toJson(),
|
'lastMessage': instance.lastMessage?.toJson(),
|
||||||
'status': instance.status,
|
'status': instance.status,
|
||||||
'statusIcon': instance.statusIcon,
|
'statusIcon': instance.statusIcon,
|
||||||
'statusMessage': instance.statusMessage,
|
'statusMessage': instance.statusMessage,
|
||||||
@@ -106,6 +128,7 @@ const _$GetRoomResponseObjectConversationTypeEnumMap = {
|
|||||||
GetRoomResponseObjectConversationType.changelog: 4,
|
GetRoomResponseObjectConversationType.changelog: 4,
|
||||||
GetRoomResponseObjectConversationType.deleted: 5,
|
GetRoomResponseObjectConversationType.deleted: 5,
|
||||||
GetRoomResponseObjectConversationType.noteToSelf: 6,
|
GetRoomResponseObjectConversationType.noteToSelf: 6,
|
||||||
|
GetRoomResponseObjectConversationType.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$GetRoomResponseObjectParticipantNotificationLevelEnumMap = {
|
const _$GetRoomResponseObjectParticipantNotificationLevelEnumMap = {
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ part of 'send_message_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
SendMessageParams _$SendMessageParamsFromJson(Map<String, dynamic> json) =>
|
SendMessageParams _$SendMessageParamsFromJson(Map<String, dynamic> json) =>
|
||||||
SendMessageParams(
|
$checkedCreate('SendMessageParams', json, ($checkedConvert) {
|
||||||
json['message'] as String,
|
final val = SendMessageParams(
|
||||||
replyTo: json['replyTo'] as String?,
|
$checkedConvert('message', (v) => v as String),
|
||||||
|
replyTo: $checkedConvert('replyTo', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$SendMessageParamsToJson(SendMessageParams instance) =>
|
Map<String, dynamic> _$SendMessageParamsToJson(SendMessageParams instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,9 +7,15 @@ part of 'set_read_marker_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
SetReadMarkerParams _$SetReadMarkerParamsFromJson(Map<String, dynamic> json) =>
|
SetReadMarkerParams _$SetReadMarkerParamsFromJson(Map<String, dynamic> json) =>
|
||||||
SetReadMarkerParams(
|
$checkedCreate('SetReadMarkerParams', json, ($checkedConvert) {
|
||||||
lastReadMessage: (json['lastReadMessage'] as num?)?.toInt(),
|
final val = SetReadMarkerParams(
|
||||||
|
lastReadMessage: $checkedConvert(
|
||||||
|
'lastReadMessage',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$SetReadMarkerParamsToJson(
|
Map<String, dynamic> _$SetReadMarkerParamsToJson(
|
||||||
SetReadMarkerParams instance,
|
SetReadMarkerParams instance,
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import '../../errors/network_exception.dart';
|
|||||||
import '../../errors/parse_exception.dart';
|
import '../../errors/parse_exception.dart';
|
||||||
import '../../errors/talk_exception.dart';
|
import '../../errors/talk_exception.dart';
|
||||||
import '../../http_errors.dart';
|
import '../../http_errors.dart';
|
||||||
|
import '../../json_lenient.dart';
|
||||||
|
import '../../marianumconnect/queries/report_client_error/client_error_reporter.dart';
|
||||||
import '../nextcloud_ocs.dart';
|
import '../nextcloud_ocs.dart';
|
||||||
import 'talk_error.dart';
|
import 'talk_error.dart';
|
||||||
|
|
||||||
@@ -73,12 +75,17 @@ abstract class TalkApi<T extends ApiResponse?> {
|
|||||||
throwForStatus(status, detail);
|
throwForStatus(status, detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final T assembled;
|
||||||
try {
|
try {
|
||||||
final assembled = await assembleAsync(data.body);
|
assembled = await assembleAsync(data.body);
|
||||||
assembled?.headers = data.headers;
|
|
||||||
return assembled;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw ParseException(technicalDetails: 'Talk $endpoint assemble: $e');
|
throw ParseException(technicalDetails: 'Talk $endpoint assemble: $e');
|
||||||
}
|
}
|
||||||
|
assembled?.headers = data.headers;
|
||||||
|
ClientErrorReporter.reportDecodeWarnings('Talk $path', [
|
||||||
|
...?assembled?.parseWarnings,
|
||||||
|
...drainDecodeWarnings(),
|
||||||
|
]);
|
||||||
|
return assembled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,15 @@ part of 'vote_poll_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
VotePollParams _$VotePollParamsFromJson(Map<String, dynamic> json) =>
|
VotePollParams _$VotePollParamsFromJson(Map<String, dynamic> json) =>
|
||||||
VotePollParams(
|
$checkedCreate('VotePollParams', json, ($checkedConvert) {
|
||||||
optionIds: (json['optionIds'] as List<dynamic>)
|
final val = VotePollParams(
|
||||||
.map((e) => (e as num).toInt())
|
optionIds: $checkedConvert(
|
||||||
.toList(),
|
'optionIds',
|
||||||
|
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$VotePollParamsToJson(VotePollParams instance) =>
|
Map<String, dynamic> _$VotePollParamsToJson(VotePollParams instance) =>
|
||||||
<String, dynamic>{'optionIds': instance.optionIds};
|
<String, dynamic>{'optionIds': instance.optionIds};
|
||||||
|
|||||||
@@ -7,23 +7,28 @@ part of 'cacheable_file.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
|
CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
|
||||||
CacheableFile(
|
$checkedCreate('CacheableFile', json, ($checkedConvert) {
|
||||||
path: json['path'] as String,
|
final val = CacheableFile(
|
||||||
isDirectory: json['isDirectory'] as bool,
|
path: $checkedConvert('path', (v) => v as String),
|
||||||
name: json['name'] as String,
|
isDirectory: $checkedConvert('isDirectory', (v) => v as bool),
|
||||||
mimeType: json['mimeType'] as String?,
|
name: $checkedConvert('name', (v) => v as String),
|
||||||
size: (json['size'] as num?)?.toInt(),
|
mimeType: $checkedConvert('mimeType', (v) => v as String?),
|
||||||
eTag: json['eTag'] as String?,
|
size: $checkedConvert('size', (v) => (v as num?)?.toInt()),
|
||||||
createdAt: json['createdAt'] == null
|
eTag: $checkedConvert('eTag', (v) => v as String?),
|
||||||
? null
|
createdAt: $checkedConvert(
|
||||||
: DateTime.parse(json['createdAt'] as String),
|
'createdAt',
|
||||||
modifiedAt: json['modifiedAt'] == null
|
(v) => v == null ? null : DateTime.parse(v as String),
|
||||||
? null
|
),
|
||||||
: DateTime.parse(json['modifiedAt'] as String),
|
modifiedAt: $checkedConvert(
|
||||||
fileId: (json['fileId'] as num?)?.toInt(),
|
'modifiedAt',
|
||||||
hasPreview: json['hasPreview'] as bool?,
|
(v) => v == null ? null : DateTime.parse(v as String),
|
||||||
isSharedWithMe: json['isSharedWithMe'] as bool?,
|
),
|
||||||
|
fileId: $checkedConvert('fileId', (v) => (v as num?)?.toInt()),
|
||||||
|
hasPreview: $checkedConvert('hasPreview', (v) => v as bool?),
|
||||||
|
isSharedWithMe: $checkedConvert('isSharedWithMe', (v) => v as bool?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
|
Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ part of 'list_files_params.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
ListFilesParams _$ListFilesParamsFromJson(Map<String, dynamic> json) =>
|
ListFilesParams _$ListFilesParamsFromJson(Map<String, dynamic> json) =>
|
||||||
ListFilesParams(json['path'] as String);
|
$checkedCreate('ListFilesParams', json, ($checkedConvert) {
|
||||||
|
final val = ListFilesParams($checkedConvert('path', (v) => v as String));
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ListFilesParamsToJson(ListFilesParams instance) =>
|
Map<String, dynamic> _$ListFilesParamsToJson(ListFilesParams instance) =>
|
||||||
<String, dynamic>{'path': instance.path};
|
<String, dynamic>{'path': instance.path};
|
||||||
|
|||||||
@@ -7,14 +7,23 @@ part of 'list_files_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
|
ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
|
||||||
ListFilesResponse(
|
$checkedCreate('ListFilesResponse', json, ($checkedConvert) {
|
||||||
(json['files'] as List<dynamic>)
|
final val = ListFilesResponse(
|
||||||
|
$checkedConvert(
|
||||||
|
'files',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
|
.map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
|
||||||
.toSet(),
|
.toSet(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
|
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -6,12 +6,22 @@ part of 'mc_holiday.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McHoliday _$McHolidayFromJson(Map<String, dynamic> json) => McHoliday(
|
McHoliday _$McHolidayFromJson(Map<String, dynamic> json) =>
|
||||||
shortName: json['shortName'] as String,
|
$checkedCreate('McHoliday', json, ($checkedConvert) {
|
||||||
longName: json['longName'] as String,
|
final val = McHoliday(
|
||||||
startDate: McHoliday._dateFromJson(json['startDate'] as String),
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
endDate: McHoliday._dateFromJson(json['endDate'] as String),
|
longName: $checkedConvert('longName', (v) => v as String),
|
||||||
|
startDate: $checkedConvert(
|
||||||
|
'startDate',
|
||||||
|
(v) => McHoliday._dateFromJson(v as String),
|
||||||
|
),
|
||||||
|
endDate: $checkedConvert(
|
||||||
|
'endDate',
|
||||||
|
(v) => McHoliday._dateFromJson(v as String),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McHolidayToJson(McHoliday instance) => <String, dynamic>{
|
Map<String, dynamic> _$McHolidayToJson(McHoliday instance) => <String, dynamic>{
|
||||||
'shortName': instance.shortName,
|
'shortName': instance.shortName,
|
||||||
|
|||||||
@@ -8,12 +8,15 @@ part of 'absence_prefill_response.dart';
|
|||||||
|
|
||||||
AbsencePrefillResponse _$AbsencePrefillResponseFromJson(
|
AbsencePrefillResponse _$AbsencePrefillResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => AbsencePrefillResponse(
|
) => $checkedCreate('AbsencePrefillResponse', json, ($checkedConvert) {
|
||||||
firstName: json['firstName'] as String? ?? '',
|
final val = AbsencePrefillResponse(
|
||||||
lastName: json['lastName'] as String? ?? '',
|
firstName: $checkedConvert('firstName', (v) => v as String? ?? ''),
|
||||||
className: json['className'] as String? ?? '',
|
lastName: $checkedConvert('lastName', (v) => v as String? ?? ''),
|
||||||
phone: json['phone'] as String? ?? '',
|
className: $checkedConvert('className', (v) => v as String? ?? ''),
|
||||||
|
phone: $checkedConvert('phone', (v) => v as String? ?? ''),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$AbsencePrefillResponseToJson(
|
Map<String, dynamic> _$AbsencePrefillResponseToJson(
|
||||||
AbsencePrefillResponse instance,
|
AbsencePrefillResponse instance,
|
||||||
|
|||||||
@@ -7,14 +7,17 @@ part of 'auth_login_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
AuthLoginUser _$AuthLoginUserFromJson(Map<String, dynamic> json) =>
|
AuthLoginUser _$AuthLoginUserFromJson(Map<String, dynamic> json) =>
|
||||||
AuthLoginUser(
|
$checkedCreate('AuthLoginUser', json, ($checkedConvert) {
|
||||||
id: json['id'] as String,
|
final val = AuthLoginUser(
|
||||||
username: json['username'] as String,
|
id: $checkedConvert('id', (v) => v as String),
|
||||||
firstName: json['firstName'] as String,
|
username: $checkedConvert('username', (v) => v as String),
|
||||||
lastName: json['lastName'] as String,
|
firstName: $checkedConvert('firstName', (v) => v as String),
|
||||||
userType: json['userType'] as String?,
|
lastName: $checkedConvert('lastName', (v) => v as String),
|
||||||
className: json['className'] as String?,
|
userType: $checkedConvert('userType', (v) => v as String?),
|
||||||
|
className: $checkedConvert('className', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$AuthLoginUserToJson(AuthLoginUser instance) =>
|
Map<String, dynamic> _$AuthLoginUserToJson(AuthLoginUser instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -27,12 +30,21 @@ Map<String, dynamic> _$AuthLoginUserToJson(AuthLoginUser instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
AuthLoginResponse _$AuthLoginResponseFromJson(Map<String, dynamic> json) =>
|
AuthLoginResponse _$AuthLoginResponseFromJson(Map<String, dynamic> json) =>
|
||||||
AuthLoginResponse(
|
$checkedCreate('AuthLoginResponse', json, ($checkedConvert) {
|
||||||
token: json['token'] as String,
|
final val = AuthLoginResponse(
|
||||||
tokenId: json['tokenId'] as String,
|
token: $checkedConvert('token', (v) => v as String),
|
||||||
expiresAt: AuthLoginResponse._expiresFromJson(json['expiresAt']),
|
tokenId: $checkedConvert('tokenId', (v) => v as String),
|
||||||
user: AuthLoginUser.fromJson(json['user'] as Map<String, dynamic>),
|
expiresAt: $checkedConvert(
|
||||||
|
'expiresAt',
|
||||||
|
(v) => AuthLoginResponse._expiresFromJson(v),
|
||||||
|
),
|
||||||
|
user: $checkedConvert(
|
||||||
|
'user',
|
||||||
|
(v) => AuthLoginUser.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$AuthLoginResponseToJson(AuthLoginResponse instance) =>
|
Map<String, dynamic> _$AuthLoginResponseToJson(AuthLoginResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class GetBreakersResponse extends ApiResponse {
|
|||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class BreakerRule {
|
class BreakerRule {
|
||||||
|
@JsonKey(unknownEnumValue: BreakerArea.unknown)
|
||||||
List<BreakerArea> areas;
|
List<BreakerArea> areas;
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
@@ -69,4 +70,7 @@ enum BreakerArea {
|
|||||||
feedback,
|
feedback,
|
||||||
@JsonValue('MORE')
|
@JsonValue('MORE')
|
||||||
more,
|
more,
|
||||||
|
|
||||||
|
/// An area the backend added after this build; no module maps to it.
|
||||||
|
unknown,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,25 @@ part of 'get_breakers_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
GetBreakersResponse _$GetBreakersResponseFromJson(Map<String, dynamic> json) =>
|
GetBreakersResponse _$GetBreakersResponseFromJson(Map<String, dynamic> json) =>
|
||||||
GetBreakersResponse(
|
$checkedCreate('GetBreakersResponse', json, ($checkedConvert) {
|
||||||
(json['rules'] as List<dynamic>?)
|
final val = GetBreakersResponse(
|
||||||
|
$checkedConvert(
|
||||||
|
'rules',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)
|
||||||
?.map((e) => BreakerRule.fromJson(e as Map<String, dynamic>))
|
?.map((e) => BreakerRule.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetBreakersResponseToJson(
|
Map<String, dynamic> _$GetBreakersResponseToJson(
|
||||||
GetBreakersResponse instance,
|
GetBreakersResponse instance,
|
||||||
@@ -24,13 +34,26 @@ Map<String, dynamic> _$GetBreakersResponseToJson(
|
|||||||
'rules': instance.rules.map((e) => e.toJson()).toList(),
|
'rules': instance.rules.map((e) => e.toJson()).toList(),
|
||||||
};
|
};
|
||||||
|
|
||||||
BreakerRule _$BreakerRuleFromJson(Map<String, dynamic> json) => BreakerRule(
|
BreakerRule _$BreakerRuleFromJson(Map<String, dynamic> json) =>
|
||||||
(json['areas'] as List<dynamic>)
|
$checkedCreate('BreakerRule', json, ($checkedConvert) {
|
||||||
.map((e) => $enumDecode(_$BreakerAreaEnumMap, e))
|
final val = BreakerRule(
|
||||||
|
$checkedConvert(
|
||||||
|
'areas',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) => $enumDecode(
|
||||||
|
_$BreakerAreaEnumMap,
|
||||||
|
e,
|
||||||
|
unknownValue: BreakerArea.unknown,
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
json['message'] as String,
|
),
|
||||||
(json['maxBuild'] as num?)?.toInt(),
|
$checkedConvert('message', (v) => v as String),
|
||||||
|
$checkedConvert('maxBuild', (v) => (v as num?)?.toInt()),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$BreakerRuleToJson(BreakerRule instance) =>
|
Map<String, dynamic> _$BreakerRuleToJson(BreakerRule instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -52,4 +75,5 @@ const _$BreakerAreaEnumMap = {
|
|||||||
BreakerArea.dates: 'DATES',
|
BreakerArea.dates: 'DATES',
|
||||||
BreakerArea.feedback: 'FEEDBACK',
|
BreakerArea.feedback: 'FEEDBACK',
|
||||||
BreakerArea.more: 'MORE',
|
BreakerArea.more: 'MORE',
|
||||||
|
BreakerArea.unknown: 'unknown',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,13 +8,28 @@ part of 'get_capabilities_response.dart';
|
|||||||
|
|
||||||
CapabilitiesResponse _$CapabilitiesResponseFromJson(
|
CapabilitiesResponse _$CapabilitiesResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => CapabilitiesResponse(
|
) => $checkedCreate('CapabilitiesResponse', json, ($checkedConvert) {
|
||||||
viewForeignTimetables: json['viewForeignTimetables'] as bool? ?? false,
|
final val = CapabilitiesResponse(
|
||||||
pushNotifications: json['pushNotifications'] as bool? ?? false,
|
viewForeignTimetables: $checkedConvert(
|
||||||
timetablePastDays: (json['timetablePastDays'] as num?)?.toInt(),
|
'viewForeignTimetables',
|
||||||
timetableFutureDays: (json['timetableFutureDays'] as num?)?.toInt(),
|
(v) => v as bool? ?? false,
|
||||||
userType: json['userType'] as String?,
|
),
|
||||||
|
pushNotifications: $checkedConvert(
|
||||||
|
'pushNotifications',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
timetablePastDays: $checkedConvert(
|
||||||
|
'timetablePastDays',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
timetableFutureDays: $checkedConvert(
|
||||||
|
'timetableFutureDays',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
userType: $checkedConvert('userType', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CapabilitiesResponseToJson(
|
Map<String, dynamic> _$CapabilitiesResponseToJson(
|
||||||
CapabilitiesResponse instance,
|
CapabilitiesResponse instance,
|
||||||
|
|||||||
@@ -7,14 +7,20 @@ part of 'get_ticker_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TickerResponse _$TickerResponseFromJson(Map<String, dynamic> json) =>
|
TickerResponse _$TickerResponseFromJson(Map<String, dynamic> json) =>
|
||||||
TickerResponse(
|
$checkedCreate('TickerResponse', json, ($checkedConvert) {
|
||||||
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
|
final val = TickerResponse(
|
||||||
available: json['available'] as bool? ?? false,
|
schemaVersion: $checkedConvert(
|
||||||
hash: json['hash'] as String?,
|
'schemaVersion',
|
||||||
publishedAt: json['publishedAt'] as String?,
|
(v) => (v as num?)?.toInt() ?? 1,
|
||||||
webUrl: json['webUrl'] as String? ?? '/ticker',
|
),
|
||||||
content: json['content'] as Map<String, dynamic>?,
|
available: $checkedConvert('available', (v) => v as bool? ?? false),
|
||||||
|
hash: $checkedConvert('hash', (v) => v as String?),
|
||||||
|
publishedAt: $checkedConvert('publishedAt', (v) => v as String?),
|
||||||
|
webUrl: $checkedConvert('webUrl', (v) => v as String? ?? '/ticker'),
|
||||||
|
content: $checkedConvert('content', (v) => v as Map<String, dynamic>?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerResponseToJson(TickerResponse instance) =>
|
Map<String, dynamic> _$TickerResponseToJson(TickerResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,15 +7,26 @@ part of 'get_ticker_nav_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TickerNavResponse _$TickerNavResponseFromJson(Map<String, dynamic> json) =>
|
TickerNavResponse _$TickerNavResponseFromJson(Map<String, dynamic> json) =>
|
||||||
TickerNavResponse(
|
$checkedCreate('TickerNavResponse', json, ($checkedConvert) {
|
||||||
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
|
final val = TickerNavResponse(
|
||||||
navHash: json['navHash'] as String? ?? '',
|
schemaVersion: $checkedConvert(
|
||||||
sections:
|
'schemaVersion',
|
||||||
(json['sections'] as List<dynamic>?)
|
(v) => (v as num?)?.toInt() ?? 1,
|
||||||
?.map((e) => TickerNavSection.fromJson(e as Map<String, dynamic>))
|
),
|
||||||
|
navHash: $checkedConvert('navHash', (v) => v as String? ?? ''),
|
||||||
|
sections: $checkedConvert(
|
||||||
|
'sections',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => TickerNavSection.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerNavResponseToJson(TickerNavResponse instance) =>
|
Map<String, dynamic> _$TickerNavResponseToJson(TickerNavResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -25,14 +36,22 @@ Map<String, dynamic> _$TickerNavResponseToJson(TickerNavResponse instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
TickerNavSection _$TickerNavSectionFromJson(Map<String, dynamic> json) =>
|
TickerNavSection _$TickerNavSectionFromJson(Map<String, dynamic> json) =>
|
||||||
TickerNavSection(
|
$checkedCreate('TickerNavSection', json, ($checkedConvert) {
|
||||||
title: json['title'] as String? ?? '',
|
final val = TickerNavSection(
|
||||||
pages:
|
title: $checkedConvert('title', (v) => v as String? ?? ''),
|
||||||
(json['pages'] as List<dynamic>?)
|
pages: $checkedConvert(
|
||||||
?.map((e) => TickerNavPage.fromJson(e as Map<String, dynamic>))
|
'pages',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => TickerNavPage.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerNavSectionToJson(TickerNavSection instance) =>
|
Map<String, dynamic> _$TickerNavSectionToJson(TickerNavSection instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -41,15 +60,21 @@ Map<String, dynamic> _$TickerNavSectionToJson(TickerNavSection instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
TickerNavPage _$TickerNavPageFromJson(Map<String, dynamic> json) =>
|
TickerNavPage _$TickerNavPageFromJson(Map<String, dynamic> json) =>
|
||||||
TickerNavPage(
|
$checkedCreate('TickerNavPage', json, ($checkedConvert) {
|
||||||
title: json['title'] as String? ?? '',
|
final val = TickerNavPage(
|
||||||
slug: json['slug'] as String? ?? '',
|
title: $checkedConvert('title', (v) => v as String? ?? ''),
|
||||||
kind: json['kind'] as String? ?? 'CONTENT',
|
slug: $checkedConvert('slug', (v) => v as String? ?? ''),
|
||||||
hash: json['hash'] as String?,
|
kind: $checkedConvert('kind', (v) => v as String? ?? 'CONTENT'),
|
||||||
externalUrl: json['externalUrl'] as String?,
|
hash: $checkedConvert('hash', (v) => v as String?),
|
||||||
externalUrlNewTab: json['externalUrlNewTab'] as bool?,
|
externalUrl: $checkedConvert('externalUrl', (v) => v as String?),
|
||||||
fileUrl: json['fileUrl'] as String?,
|
externalUrlNewTab: $checkedConvert(
|
||||||
|
'externalUrlNewTab',
|
||||||
|
(v) => v as bool?,
|
||||||
|
),
|
||||||
|
fileUrl: $checkedConvert('fileUrl', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerNavPageToJson(TickerNavPage instance) =>
|
Map<String, dynamic> _$TickerNavPageToJson(TickerNavPage instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,22 +7,31 @@ part of 'get_ticker_page_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TickerPageResponse _$TickerPageResponseFromJson(Map<String, dynamic> json) =>
|
TickerPageResponse _$TickerPageResponseFromJson(Map<String, dynamic> json) =>
|
||||||
TickerPageResponse(
|
$checkedCreate('TickerPageResponse', json, ($checkedConvert) {
|
||||||
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
|
final val = TickerPageResponse(
|
||||||
slug: json['slug'] as String?,
|
schemaVersion: $checkedConvert(
|
||||||
title: json['title'] as String?,
|
'schemaVersion',
|
||||||
kind: json['kind'] as String? ?? 'CONTENT',
|
(v) => (v as num?)?.toInt() ?? 1,
|
||||||
content: json['content'] as Map<String, dynamic>?,
|
),
|
||||||
externalUrl: json['externalUrl'] as String?,
|
slug: $checkedConvert('slug', (v) => v as String?),
|
||||||
externalUrlNewTab: json['externalUrlNewTab'] as bool?,
|
title: $checkedConvert('title', (v) => v as String?),
|
||||||
fileUrl: json['fileUrl'] as String?,
|
kind: $checkedConvert('kind', (v) => v as String? ?? 'CONTENT'),
|
||||||
contentType: json['contentType'] as String?,
|
content: $checkedConvert('content', (v) => v as Map<String, dynamic>?),
|
||||||
filename: json['filename'] as String?,
|
externalUrl: $checkedConvert('externalUrl', (v) => v as String?),
|
||||||
hash: json['hash'] as String?,
|
externalUrlNewTab: $checkedConvert(
|
||||||
webUrl: json['webUrl'] as String?,
|
'externalUrlNewTab',
|
||||||
publishedAt: json['publishedAt'] as String?,
|
(v) => v as bool?,
|
||||||
fileFetchedAt: json['fileFetchedAt'] as String?,
|
),
|
||||||
|
fileUrl: $checkedConvert('fileUrl', (v) => v as String?),
|
||||||
|
contentType: $checkedConvert('contentType', (v) => v as String?),
|
||||||
|
filename: $checkedConvert('filename', (v) => v as String?),
|
||||||
|
hash: $checkedConvert('hash', (v) => v as String?),
|
||||||
|
webUrl: $checkedConvert('webUrl', (v) => v as String?),
|
||||||
|
publishedAt: $checkedConvert('publishedAt', (v) => v as String?),
|
||||||
|
fileFetchedAt: $checkedConvert('fileFetchedAt', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerPageResponseToJson(TickerPageResponse instance) =>
|
Map<String, dynamic> _$TickerPageResponseToJson(TickerPageResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ class ClientErrorReporter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Server entries the decoder could not map (see `decodeListLenient`): the
|
||||||
|
/// app keeps working without them, the report says which field drifted.
|
||||||
|
static void reportDecodeWarnings(String context, Iterable<String> warnings) {
|
||||||
|
for (final warning in warnings) {
|
||||||
|
log('$context: skipped entry: $warning');
|
||||||
|
_report(errorType: 'decode', message: warning, context: context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void _report({
|
static void _report({
|
||||||
required String errorType,
|
required String errorType,
|
||||||
required String message,
|
required String message,
|
||||||
|
|||||||
+21
-10
@@ -7,11 +7,14 @@ part of 'timetable_get_classes_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McTimetableClass _$McTimetableClassFromJson(Map<String, dynamic> json) =>
|
McTimetableClass _$McTimetableClassFromJson(Map<String, dynamic> json) =>
|
||||||
McTimetableClass(
|
$checkedCreate('McTimetableClass', json, ($checkedConvert) {
|
||||||
id: (json['id'] as num).toInt(),
|
final val = McTimetableClass(
|
||||||
shortName: json['shortName'] as String,
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
longName: json['longName'] as String,
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
|
longName: $checkedConvert('longName', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
|
Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -22,15 +25,23 @@ Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
|
|||||||
|
|
||||||
TimetableGetClassesResponse _$TimetableGetClassesResponseFromJson(
|
TimetableGetClassesResponse _$TimetableGetClassesResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetClassesResponse', json, ($checkedConvert) {
|
||||||
TimetableGetClassesResponse(
|
final val = TimetableGetClassesResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McTimetableClass.fromJson(e as Map<String, dynamic>))
|
.map((e) => McTimetableClass.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetClassesResponseToJson(
|
Map<String, dynamic> _$TimetableGetClassesResponseToJson(
|
||||||
TimetableGetClassesResponse instance,
|
TimetableGetClassesResponse instance,
|
||||||
|
|||||||
+14
-6
@@ -8,15 +8,23 @@ part of 'timetable_get_holidays_response.dart';
|
|||||||
|
|
||||||
TimetableGetHolidaysResponse _$TimetableGetHolidaysResponseFromJson(
|
TimetableGetHolidaysResponse _$TimetableGetHolidaysResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetHolidaysResponse', json, ($checkedConvert) {
|
||||||
TimetableGetHolidaysResponse(
|
final val = TimetableGetHolidaysResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
|
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetHolidaysResponseToJson(
|
Map<String, dynamic> _$TimetableGetHolidaysResponseToJson(
|
||||||
TimetableGetHolidaysResponse instance,
|
TimetableGetHolidaysResponse instance,
|
||||||
|
|||||||
+22
-10
@@ -6,11 +6,15 @@ part of 'timetable_get_rooms_response.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McRoom _$McRoomFromJson(Map<String, dynamic> json) => McRoom(
|
McRoom _$McRoomFromJson(Map<String, dynamic> json) =>
|
||||||
id: (json['id'] as num).toInt(),
|
$checkedCreate('McRoom', json, ($checkedConvert) {
|
||||||
shortName: json['shortName'] as String,
|
final val = McRoom(
|
||||||
longName: json['longName'] as String,
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
|
longName: $checkedConvert('longName', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McRoomToJson(McRoom instance) => <String, dynamic>{
|
Map<String, dynamic> _$McRoomToJson(McRoom instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
@@ -20,15 +24,23 @@ Map<String, dynamic> _$McRoomToJson(McRoom instance) => <String, dynamic>{
|
|||||||
|
|
||||||
TimetableGetRoomsResponse _$TimetableGetRoomsResponseFromJson(
|
TimetableGetRoomsResponse _$TimetableGetRoomsResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetRoomsResponse', json, ($checkedConvert) {
|
||||||
TimetableGetRoomsResponse(
|
final val = TimetableGetRoomsResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McRoom.fromJson(e as Map<String, dynamic>))
|
.map((e) => McRoom.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetRoomsResponseToJson(
|
Map<String, dynamic> _$TimetableGetRoomsResponseToJson(
|
||||||
TimetableGetRoomsResponse instance,
|
TimetableGetRoomsResponse instance,
|
||||||
|
|||||||
+18
-11
@@ -8,20 +8,27 @@ part of 'timetable_get_schoolyear_response.dart';
|
|||||||
|
|
||||||
TimetableGetSchoolyearResponse _$TimetableGetSchoolyearResponseFromJson(
|
TimetableGetSchoolyearResponse _$TimetableGetSchoolyearResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetSchoolyearResponse', json, ($checkedConvert) {
|
||||||
TimetableGetSchoolyearResponse(
|
final val = TimetableGetSchoolyearResponse(
|
||||||
id: (json['id'] as num).toInt(),
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
name: json['name'] as String,
|
name: $checkedConvert('name', (v) => v as String),
|
||||||
startDate: TimetableGetSchoolyearResponse._dateFromJson(
|
startDate: $checkedConvert(
|
||||||
json['startDate'] as String,
|
'startDate',
|
||||||
|
(v) => TimetableGetSchoolyearResponse._dateFromJson(v as String),
|
||||||
),
|
),
|
||||||
endDate: TimetableGetSchoolyearResponse._dateFromJson(
|
endDate: $checkedConvert(
|
||||||
json['endDate'] as String,
|
'endDate',
|
||||||
|
(v) => TimetableGetSchoolyearResponse._dateFromJson(v as String),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetSchoolyearResponseToJson(
|
Map<String, dynamic> _$TimetableGetSchoolyearResponseToJson(
|
||||||
TimetableGetSchoolyearResponse instance,
|
TimetableGetSchoolyearResponse instance,
|
||||||
|
|||||||
+22
-11
@@ -7,12 +7,15 @@ part of 'timetable_get_students_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McTimetableStudent _$McTimetableStudentFromJson(Map<String, dynamic> json) =>
|
McTimetableStudent _$McTimetableStudentFromJson(Map<String, dynamic> json) =>
|
||||||
McTimetableStudent(
|
$checkedCreate('McTimetableStudent', json, ($checkedConvert) {
|
||||||
id: (json['id'] as num).toInt(),
|
final val = McTimetableStudent(
|
||||||
firstName: json['firstName'] as String,
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
lastName: json['lastName'] as String,
|
firstName: $checkedConvert('firstName', (v) => v as String),
|
||||||
displayName: json['displayName'] as String,
|
lastName: $checkedConvert('lastName', (v) => v as String),
|
||||||
|
displayName: $checkedConvert('displayName', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
|
Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -24,15 +27,23 @@ Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
|
|||||||
|
|
||||||
TimetableGetStudentsResponse _$TimetableGetStudentsResponseFromJson(
|
TimetableGetStudentsResponse _$TimetableGetStudentsResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetStudentsResponse', json, ($checkedConvert) {
|
||||||
TimetableGetStudentsResponse(
|
final val = TimetableGetStudentsResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
|
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetStudentsResponseToJson(
|
Map<String, dynamic> _$TimetableGetStudentsResponseToJson(
|
||||||
TimetableGetStudentsResponse instance,
|
TimetableGetStudentsResponse instance,
|
||||||
|
|||||||
+23
-11
@@ -6,12 +6,16 @@ part of 'timetable_get_subjects_response.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McSubject _$McSubjectFromJson(Map<String, dynamic> json) => McSubject(
|
McSubject _$McSubjectFromJson(Map<String, dynamic> json) =>
|
||||||
id: (json['id'] as num).toInt(),
|
$checkedCreate('McSubject', json, ($checkedConvert) {
|
||||||
shortName: json['shortName'] as String,
|
final val = McSubject(
|
||||||
longName: json['longName'] as String,
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
color: json['color'] as String?,
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
|
longName: $checkedConvert('longName', (v) => v as String),
|
||||||
|
color: $checkedConvert('color', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McSubjectToJson(McSubject instance) => <String, dynamic>{
|
Map<String, dynamic> _$McSubjectToJson(McSubject instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
@@ -22,15 +26,23 @@ Map<String, dynamic> _$McSubjectToJson(McSubject instance) => <String, dynamic>{
|
|||||||
|
|
||||||
TimetableGetSubjectsResponse _$TimetableGetSubjectsResponseFromJson(
|
TimetableGetSubjectsResponse _$TimetableGetSubjectsResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetSubjectsResponse', json, ($checkedConvert) {
|
||||||
TimetableGetSubjectsResponse(
|
final val = TimetableGetSubjectsResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McSubject.fromJson(e as Map<String, dynamic>))
|
.map((e) => McSubject.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetSubjectsResponseToJson(
|
Map<String, dynamic> _$TimetableGetSubjectsResponseToJson(
|
||||||
TimetableGetSubjectsResponse instance,
|
TimetableGetSubjectsResponse instance,
|
||||||
|
|||||||
+21
-10
@@ -8,11 +8,14 @@ part of 'timetable_get_teachers_response.dart';
|
|||||||
|
|
||||||
McTimetableTeacherElement _$McTimetableTeacherElementFromJson(
|
McTimetableTeacherElement _$McTimetableTeacherElementFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => McTimetableTeacherElement(
|
) => $checkedCreate('McTimetableTeacherElement', json, ($checkedConvert) {
|
||||||
id: (json['id'] as num).toInt(),
|
final val = McTimetableTeacherElement(
|
||||||
shortName: json['shortName'] as String,
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
displayName: json['displayName'] as String,
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
|
displayName: $checkedConvert('displayName', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimetableTeacherElementToJson(
|
Map<String, dynamic> _$McTimetableTeacherElementToJson(
|
||||||
McTimetableTeacherElement instance,
|
McTimetableTeacherElement instance,
|
||||||
@@ -24,18 +27,26 @@ Map<String, dynamic> _$McTimetableTeacherElementToJson(
|
|||||||
|
|
||||||
TimetableGetTeachersResponse _$TimetableGetTeachersResponseFromJson(
|
TimetableGetTeachersResponse _$TimetableGetTeachersResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetTeachersResponse', json, ($checkedConvert) {
|
||||||
TimetableGetTeachersResponse(
|
final val = TimetableGetTeachersResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map(
|
.map(
|
||||||
(e) =>
|
(e) =>
|
||||||
McTimetableTeacherElement.fromJson(e as Map<String, dynamic>),
|
McTimetableTeacherElement.fromJson(e as Map<String, dynamic>),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetTeachersResponseToJson(
|
Map<String, dynamic> _$TimetableGetTeachersResponseToJson(
|
||||||
TimetableGetTeachersResponse instance,
|
TimetableGetTeachersResponse instance,
|
||||||
|
|||||||
+31
-11
@@ -7,12 +7,24 @@ part of 'timetable_get_timegrid_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McTimegridUnit _$McTimegridUnitFromJson(Map<String, dynamic> json) =>
|
McTimegridUnit _$McTimegridUnitFromJson(Map<String, dynamic> json) =>
|
||||||
McTimegridUnit(
|
$checkedCreate('McTimegridUnit', json, ($checkedConvert) {
|
||||||
dayOfWeek: _dayFromJson(json['dayOfWeek'] as String),
|
final val = McTimegridUnit(
|
||||||
label: json['label'] as String,
|
dayOfWeek: $checkedConvert(
|
||||||
startTime: McTimegridUnit._timeFromJson(json['startTime'] as String),
|
'dayOfWeek',
|
||||||
endTime: McTimegridUnit._timeFromJson(json['endTime'] as String),
|
(v) => _dayFromJson(v as String),
|
||||||
|
),
|
||||||
|
label: $checkedConvert('label', (v) => v as String),
|
||||||
|
startTime: $checkedConvert(
|
||||||
|
'startTime',
|
||||||
|
(v) => McTimegridUnit._timeFromJson(v as String),
|
||||||
|
),
|
||||||
|
endTime: $checkedConvert(
|
||||||
|
'endTime',
|
||||||
|
(v) => McTimegridUnit._timeFromJson(v as String),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimegridUnitToJson(McTimegridUnit instance) =>
|
Map<String, dynamic> _$McTimegridUnitToJson(McTimegridUnit instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -24,15 +36,23 @@ Map<String, dynamic> _$McTimegridUnitToJson(McTimegridUnit instance) =>
|
|||||||
|
|
||||||
TimetableGetTimegridResponse _$TimetableGetTimegridResponseFromJson(
|
TimetableGetTimegridResponse _$TimetableGetTimegridResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetTimegridResponse', json, ($checkedConvert) {
|
||||||
TimetableGetTimegridResponse(
|
final val = TimetableGetTimegridResponse(
|
||||||
result: (json['result'] as List<dynamic>)
|
result: $checkedConvert(
|
||||||
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McTimegridUnit.fromJson(e as Map<String, dynamic>))
|
.map((e) => McTimegridUnit.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetTimegridResponseToJson(
|
Map<String, dynamic> _$TimetableGetTimegridResponseToJson(
|
||||||
TimetableGetTimegridResponse instance,
|
TimetableGetTimegridResponse instance,
|
||||||
|
|||||||
+82
-37
@@ -7,14 +7,23 @@ part of 'timetable_get_week_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McTimetableTeacher _$McTimetableTeacherFromJson(Map<String, dynamic> json) =>
|
McTimetableTeacher _$McTimetableTeacherFromJson(Map<String, dynamic> json) =>
|
||||||
McTimetableTeacher(
|
$checkedCreate('McTimetableTeacher', json, ($checkedConvert) {
|
||||||
shortName: json['shortName'] as String,
|
final val = McTimetableTeacher(
|
||||||
displayName: json['displayName'] as String,
|
shortName: $checkedConvert('shortName', (v) => v as String),
|
||||||
originalShortName: json['originalShortName'] as String?,
|
displayName: $checkedConvert('displayName', (v) => v as String),
|
||||||
originalDisplayName: json['originalDisplayName'] as String?,
|
originalShortName: $checkedConvert(
|
||||||
id: (json['id'] as num?)?.toInt(),
|
'originalShortName',
|
||||||
originalId: (json['originalId'] as num?)?.toInt(),
|
(v) => v as String?,
|
||||||
|
),
|
||||||
|
originalDisplayName: $checkedConvert(
|
||||||
|
'originalDisplayName',
|
||||||
|
(v) => v as String?,
|
||||||
|
),
|
||||||
|
id: $checkedConvert('id', (v) => (v as num?)?.toInt()),
|
||||||
|
originalId: $checkedConvert('originalId', (v) => (v as num?)?.toInt()),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimetableTeacherToJson(McTimetableTeacher instance) =>
|
Map<String, dynamic> _$McTimetableTeacherToJson(McTimetableTeacher instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -26,31 +35,53 @@ Map<String, dynamic> _$McTimetableTeacherToJson(McTimetableTeacher instance) =>
|
|||||||
'originalId': instance.originalId,
|
'originalId': instance.originalId,
|
||||||
};
|
};
|
||||||
|
|
||||||
McTimetableEntry _$McTimetableEntryFromJson(Map<String, dynamic> json) =>
|
McTimetableEntry _$McTimetableEntryFromJson(
|
||||||
McTimetableEntry(
|
Map<String, dynamic> json,
|
||||||
id: (json['id'] as num).toInt(),
|
) => $checkedCreate('McTimetableEntry', json, ($checkedConvert) {
|
||||||
date: McTimetableEntry._dateFromJson(json['date'] as String),
|
final val = McTimetableEntry(
|
||||||
startTime: McTimetableEntry._timeFromJson(json['startTime'] as String),
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
endTime: McTimetableEntry._timeFromJson(json['endTime'] as String),
|
date: $checkedConvert(
|
||||||
subjects: (json['subjects'] as List<dynamic>)
|
'date',
|
||||||
.map((e) => e as String)
|
(v) => McTimetableEntry._dateFromJson(v as String),
|
||||||
.toList(),
|
),
|
||||||
teachers: (json['teachers'] as List<dynamic>)
|
startTime: $checkedConvert(
|
||||||
|
'startTime',
|
||||||
|
(v) => McTimetableEntry._timeFromJson(v as String),
|
||||||
|
),
|
||||||
|
endTime: $checkedConvert(
|
||||||
|
'endTime',
|
||||||
|
(v) => McTimetableEntry._timeFromJson(v as String),
|
||||||
|
),
|
||||||
|
subjects: $checkedConvert(
|
||||||
|
'subjects',
|
||||||
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
|
),
|
||||||
|
teachers: $checkedConvert(
|
||||||
|
'teachers',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McTimetableTeacher.fromJson(e as Map<String, dynamic>))
|
.map((e) => McTimetableTeacher.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
rooms: (json['rooms'] as List<dynamic>).map((e) => e as String).toList(),
|
),
|
||||||
classNames: (json['classNames'] as List<dynamic>)
|
rooms: $checkedConvert(
|
||||||
.map((e) => e as String)
|
'rooms',
|
||||||
.toList(),
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
lessonType: json['lessonType'] as String,
|
),
|
||||||
status: json['status'] as String,
|
classNames: $checkedConvert(
|
||||||
substitutionText: json['substitutionText'] as String?,
|
'classNames',
|
||||||
lessonText: json['lessonText'] as String?,
|
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
|
||||||
infoText: json['infoText'] as String?,
|
),
|
||||||
classIds: (json['classIds'] as List<dynamic>?)
|
lessonType: $checkedConvert('lessonType', (v) => v as String),
|
||||||
?.map((e) => (e as num).toInt())
|
status: $checkedConvert('status', (v) => v as String),
|
||||||
.toList(),
|
substitutionText: $checkedConvert('substitutionText', (v) => v as String?),
|
||||||
|
lessonText: $checkedConvert('lessonText', (v) => v as String?),
|
||||||
|
infoText: $checkedConvert('infoText', (v) => v as String?),
|
||||||
|
classIds: $checkedConvert(
|
||||||
|
'classIds',
|
||||||
|
(v) => (v as List<dynamic>?)?.map((e) => (e as num).toInt()).toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McTimetableEntryToJson(McTimetableEntry instance) =>
|
Map<String, dynamic> _$McTimetableEntryToJson(McTimetableEntry instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -72,17 +103,31 @@ Map<String, dynamic> _$McTimetableEntryToJson(McTimetableEntry instance) =>
|
|||||||
|
|
||||||
TimetableGetWeekResponse _$TimetableGetWeekResponseFromJson(
|
TimetableGetWeekResponse _$TimetableGetWeekResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('TimetableGetWeekResponse', json, ($checkedConvert) {
|
||||||
TimetableGetWeekResponse(
|
final val = TimetableGetWeekResponse(
|
||||||
from: McTimetableEntry._dateFromJson(json['from'] as String),
|
from: $checkedConvert(
|
||||||
until: McTimetableEntry._dateFromJson(json['until'] as String),
|
'from',
|
||||||
entries: (json['entries'] as List<dynamic>)
|
(v) => McTimetableEntry._dateFromJson(v as String),
|
||||||
|
),
|
||||||
|
until: $checkedConvert(
|
||||||
|
'until',
|
||||||
|
(v) => McTimetableEntry._dateFromJson(v as String),
|
||||||
|
),
|
||||||
|
entries: $checkedConvert(
|
||||||
|
'entries',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McTimetableEntry.fromJson(e as Map<String, dynamic>))
|
.map((e) => McTimetableEntry.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableGetWeekResponseToJson(
|
Map<String, dynamic> _$TimetableGetWeekResponseToJson(
|
||||||
TimetableGetWeekResponse instance,
|
TimetableGetWeekResponse instance,
|
||||||
|
|||||||
@@ -7,13 +7,16 @@ part of 'user_search_response.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
McUserSearchResult _$McUserSearchResultFromJson(Map<String, dynamic> json) =>
|
McUserSearchResult _$McUserSearchResultFromJson(Map<String, dynamic> json) =>
|
||||||
McUserSearchResult(
|
$checkedCreate('McUserSearchResult', json, ($checkedConvert) {
|
||||||
username: json['username'] as String,
|
final val = McUserSearchResult(
|
||||||
firstName: json['firstName'] as String,
|
username: $checkedConvert('username', (v) => v as String),
|
||||||
lastName: json['lastName'] as String,
|
firstName: $checkedConvert('firstName', (v) => v as String),
|
||||||
userType: json['userType'] as String,
|
lastName: $checkedConvert('lastName', (v) => v as String),
|
||||||
className: json['className'] as String?,
|
userType: $checkedConvert('userType', (v) => v as String),
|
||||||
|
className: $checkedConvert('className', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$McUserSearchResultToJson(McUserSearchResult instance) =>
|
Map<String, dynamic> _$McUserSearchResultToJson(McUserSearchResult instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -25,14 +28,25 @@ Map<String, dynamic> _$McUserSearchResultToJson(McUserSearchResult instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
UserSearchResponse _$UserSearchResponseFromJson(Map<String, dynamic> json) =>
|
UserSearchResponse _$UserSearchResponseFromJson(Map<String, dynamic> json) =>
|
||||||
UserSearchResponse(
|
$checkedCreate('UserSearchResponse', json, ($checkedConvert) {
|
||||||
result: (json['result'] as List<dynamic>)
|
final val = UserSearchResponse(
|
||||||
.map((e) => McUserSearchResult.fromJson(e as Map<String, dynamic>))
|
result: $checkedConvert(
|
||||||
.toList(),
|
'result',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) => McUserSearchResult.fromJson(e as Map<String, dynamic>),
|
||||||
)
|
)
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
.toList(),
|
||||||
(k, e) => MapEntry(k, e as String),
|
),
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$UserSearchResponseToJson(UserSearchResponse instance) =>
|
Map<String, dynamic> _$UserSearchResponseToJson(UserSearchResponse instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -8,18 +8,33 @@ part of 'custom_timetable_event.dart';
|
|||||||
|
|
||||||
CustomTimetableEvent _$CustomTimetableEventFromJson(
|
CustomTimetableEvent _$CustomTimetableEventFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => CustomTimetableEvent(
|
) => $checkedCreate('CustomTimetableEvent', json, ($checkedConvert) {
|
||||||
id: json['id'] as String,
|
final val = CustomTimetableEvent(
|
||||||
title: json['title'] as String,
|
id: $checkedConvert('id', (v) => v as String),
|
||||||
description: json['description'] as String,
|
title: $checkedConvert('title', (v) => v as String),
|
||||||
startDate: CustomTimetableEvent._dateFromJson(json['startDate'] as String),
|
description: $checkedConvert('description', (v) => v as String),
|
||||||
endDate: CustomTimetableEvent._dateFromJson(json['endDate'] as String),
|
startDate: $checkedConvert(
|
||||||
color: json['color'] as String?,
|
'startDate',
|
||||||
rrule: json['rrule'] as String,
|
(v) => CustomTimetableEvent._dateFromJson(v as String),
|
||||||
skipHolidays: json['skipHolidays'] as bool? ?? false,
|
),
|
||||||
createdAt: CustomTimetableEvent._dateFromJson(json['createdAt'] as String),
|
endDate: $checkedConvert(
|
||||||
updatedAt: CustomTimetableEvent._dateFromJson(json['updatedAt'] as String),
|
'endDate',
|
||||||
|
(v) => CustomTimetableEvent._dateFromJson(v as String),
|
||||||
|
),
|
||||||
|
color: $checkedConvert('color', (v) => v as String?),
|
||||||
|
rrule: $checkedConvert('rrule', (v) => v as String),
|
||||||
|
skipHolidays: $checkedConvert('skipHolidays', (v) => v as bool? ?? false),
|
||||||
|
createdAt: $checkedConvert(
|
||||||
|
'createdAt',
|
||||||
|
(v) => CustomTimetableEvent._dateFromJson(v as String),
|
||||||
|
),
|
||||||
|
updatedAt: $checkedConvert(
|
||||||
|
'updatedAt',
|
||||||
|
(v) => CustomTimetableEvent._dateFromJson(v as String),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CustomTimetableEventToJson(
|
Map<String, dynamic> _$CustomTimetableEventToJson(
|
||||||
CustomTimetableEvent instance,
|
CustomTimetableEvent instance,
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ part of 'get_custom_timetable_event_params.dart';
|
|||||||
|
|
||||||
GetCustomTimetableEventParams _$GetCustomTimetableEventParamsFromJson(
|
GetCustomTimetableEventParams _$GetCustomTimetableEventParamsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => GetCustomTimetableEventParams(json['user'] as String);
|
) => $checkedCreate('GetCustomTimetableEventParams', json, ($checkedConvert) {
|
||||||
|
final val = GetCustomTimetableEventParams(
|
||||||
|
$checkedConvert('user', (v) => v as String),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetCustomTimetableEventParamsToJson(
|
Map<String, dynamic> _$GetCustomTimetableEventParamsToJson(
|
||||||
GetCustomTimetableEventParams instance,
|
GetCustomTimetableEventParams instance,
|
||||||
|
|||||||
@@ -8,17 +8,23 @@ part of 'get_custom_timetable_event_response.dart';
|
|||||||
|
|
||||||
GetCustomTimetableEventResponse _$GetCustomTimetableEventResponseFromJson(
|
GetCustomTimetableEventResponse _$GetCustomTimetableEventResponseFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) =>
|
) => $checkedCreate('GetCustomTimetableEventResponse', json, ($checkedConvert) {
|
||||||
GetCustomTimetableEventResponse(
|
final val = GetCustomTimetableEventResponse(
|
||||||
(json['events'] as List<dynamic>)
|
$checkedConvert(
|
||||||
.map(
|
'events',
|
||||||
(e) => CustomTimetableEvent.fromJson(e as Map<String, dynamic>),
|
(v) => (v as List<dynamic>)
|
||||||
)
|
.map((e) => CustomTimetableEvent.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
),
|
||||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
);
|
||||||
|
$checkedConvert(
|
||||||
|
'headers',
|
||||||
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GetCustomTimetableEventResponseToJson(
|
Map<String, dynamic> _$GetCustomTimetableEventResponseToJson(
|
||||||
GetCustomTimetableEventResponse instance,
|
GetCustomTimetableEventResponse instance,
|
||||||
|
|||||||
+7
-1
@@ -8,7 +8,13 @@ part of 'remove_custom_timetable_event_params.dart';
|
|||||||
|
|
||||||
RemoveCustomTimetableEventParams _$RemoveCustomTimetableEventParamsFromJson(
|
RemoveCustomTimetableEventParams _$RemoveCustomTimetableEventParamsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => RemoveCustomTimetableEventParams(json['id'] as String);
|
) =>
|
||||||
|
$checkedCreate('RemoveCustomTimetableEventParams', json, ($checkedConvert) {
|
||||||
|
final val = RemoveCustomTimetableEventParams(
|
||||||
|
$checkedConvert('id', (v) => v as String),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$RemoveCustomTimetableEventParamsToJson(
|
Map<String, dynamic> _$RemoveCustomTimetableEventParamsToJson(
|
||||||
RemoveCustomTimetableEventParams instance,
|
RemoveCustomTimetableEventParams instance,
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ class AppRoutes {
|
|||||||
// would race the fresh one and could regress the server cursor.
|
// would race the fresh one and could regress the server cursor.
|
||||||
context.read<ChatListBloc>().markRoomAsRead(
|
context.read<ChatListBloc>().markRoomAsRead(
|
||||||
room.token,
|
room.token,
|
||||||
room.lastMessage.id,
|
room.lastMessage?.id ?? room.lastReadMessage,
|
||||||
);
|
);
|
||||||
NotificationTasks.clearNotificationsForChat(room.token);
|
NotificationTasks.clearNotificationsForChat(room.token);
|
||||||
TalkNavigator.pushSplitView(
|
TalkNavigator.pushSplitView(
|
||||||
|
|||||||
+6
-1
@@ -7,7 +7,12 @@ part of 'loadable_save_context.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_LoadableSaveContext _$LoadableSaveContextFromJson(Map<String, dynamic> json) =>
|
_LoadableSaveContext _$LoadableSaveContextFromJson(Map<String, dynamic> json) =>
|
||||||
_LoadableSaveContext(timestamp: (json['timestamp'] as num).toInt());
|
$checkedCreate('_LoadableSaveContext', json, ($checkedConvert) {
|
||||||
|
final val = _LoadableSaveContext(
|
||||||
|
timestamp: $checkedConvert('timestamp', (v) => (v as num).toInt()),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$LoadableSaveContextToJson(
|
Map<String, dynamic> _$LoadableSaveContextToJson(
|
||||||
_LoadableSaveContext instance,
|
_LoadableSaveContext instance,
|
||||||
|
|||||||
@@ -7,13 +7,17 @@ part of 'breaker_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_BreakerState _$BreakerStateFromJson(Map<String, dynamic> json) =>
|
_BreakerState _$BreakerStateFromJson(Map<String, dynamic> json) =>
|
||||||
_BreakerState(
|
$checkedCreate('_BreakerState', json, ($checkedConvert) {
|
||||||
response: json['response'] == null
|
final val = _BreakerState(
|
||||||
|
response: $checkedConvert(
|
||||||
|
'response',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: GetBreakersResponse.fromJson(
|
: GetBreakersResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['response'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$BreakerStateToJson(_BreakerState instance) =>
|
Map<String, dynamic> _$BreakerStateToJson(_BreakerState instance) =>
|
||||||
<String, dynamic>{'response': instance.response};
|
<String, dynamic>{'response': instance.response};
|
||||||
|
|||||||
@@ -7,14 +7,29 @@ part of 'capabilities_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_CapabilitiesState _$CapabilitiesStateFromJson(Map<String, dynamic> json) =>
|
_CapabilitiesState _$CapabilitiesStateFromJson(Map<String, dynamic> json) =>
|
||||||
_CapabilitiesState(
|
$checkedCreate('_CapabilitiesState', json, ($checkedConvert) {
|
||||||
viewForeignTimetables: json['viewForeignTimetables'] as bool? ?? false,
|
final val = _CapabilitiesState(
|
||||||
pushNotifications: json['pushNotifications'] as bool? ?? false,
|
viewForeignTimetables: $checkedConvert(
|
||||||
timetablePastDays: (json['timetablePastDays'] as num?)?.toInt(),
|
'viewForeignTimetables',
|
||||||
timetableFutureDays: (json['timetableFutureDays'] as num?)?.toInt(),
|
(v) => v as bool? ?? false,
|
||||||
userType: json['userType'] as String?,
|
),
|
||||||
loaded: json['loaded'] as bool? ?? false,
|
pushNotifications: $checkedConvert(
|
||||||
|
'pushNotifications',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
timetablePastDays: $checkedConvert(
|
||||||
|
'timetablePastDays',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
timetableFutureDays: $checkedConvert(
|
||||||
|
'timetableFutureDays',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
userType: $checkedConvert('userType', (v) => v as String?),
|
||||||
|
loaded: $checkedConvert('loaded', (v) => v as bool? ?? false),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$CapabilitiesStateToJson(_CapabilitiesState instance) =>
|
Map<String, dynamic> _$CapabilitiesStateToJson(_CapabilitiesState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -411,6 +411,7 @@ class ChatBloc
|
|||||||
case GetRoomResponseObjectMessageType.deletedComment:
|
case GetRoomResponseObjectMessageType.deletedComment:
|
||||||
case GetRoomResponseObjectMessageType.system:
|
case GetRoomResponseObjectMessageType.system:
|
||||||
case GetRoomResponseObjectMessageType.command:
|
case GetRoomResponseObjectMessageType.command:
|
||||||
|
case GetRoomResponseObjectMessageType.unknown:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,30 @@ part of 'chat_state.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_ChatState _$ChatStateFromJson(Map<String, dynamic> json) => _ChatState(
|
_ChatState _$ChatStateFromJson(Map<String, dynamic> json) => $checkedCreate(
|
||||||
currentToken: json['currentToken'] as String? ?? '',
|
'_ChatState',
|
||||||
chatResponse: json['chatResponse'] == null
|
json,
|
||||||
|
($checkedConvert) {
|
||||||
|
final val = _ChatState(
|
||||||
|
currentToken: $checkedConvert('currentToken', (v) => v as String? ?? ''),
|
||||||
|
chatResponse: $checkedConvert(
|
||||||
|
'chatResponse',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: GetChatResponse.fromJson(json['chatResponse'] as Map<String, dynamic>),
|
: GetChatResponse.fromJson(v as Map<String, dynamic>),
|
||||||
referenceMessageId: (json['referenceMessageId'] as num?)?.toInt(),
|
),
|
||||||
hasMoreOld: json['hasMoreOld'] as bool? ?? true,
|
referenceMessageId: $checkedConvert(
|
||||||
isLoadingOlder: json['isLoadingOlder'] as bool? ?? false,
|
'referenceMessageId',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
hasMoreOld: $checkedConvert('hasMoreOld', (v) => v as bool? ?? true),
|
||||||
|
isLoadingOlder: $checkedConvert(
|
||||||
|
'isLoadingOlder',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ChatStateToJson(_ChatState instance) =>
|
Map<String, dynamic> _$ChatStateToJson(_ChatState instance) =>
|
||||||
|
|||||||
@@ -187,16 +187,18 @@ class ChatListBloc
|
|||||||
/// Clears unread too — long-poll only feeds this in for an actively-open chat.
|
/// Clears unread too — long-poll only feeds this in for an actively-open chat.
|
||||||
void applyIncomingMessage(String token, GetChatResponseObject message) {
|
void applyIncomingMessage(String token, GetChatResponseObject message) {
|
||||||
_mutateRoom(token, (r) {
|
_mutateRoom(token, (r) {
|
||||||
final wasRead =
|
final wasRead = r.unreadMessages == 0 && r.lastReadMessage >= message.id;
|
||||||
r.unreadMessages == 0 && r.lastReadMessage >= message.id;
|
final lastId = r.lastMessage?.id ?? 0;
|
||||||
final hasNewer = r.lastMessage.id >= message.id;
|
final hasNewer = lastId >= message.id;
|
||||||
if (wasRead && hasNewer) return false;
|
if (wasRead && hasNewer) return false;
|
||||||
r.unreadMessages = 0;
|
r.unreadMessages = 0;
|
||||||
r.unreadMention = false;
|
r.unreadMention = false;
|
||||||
r.unreadMentionDirect = false;
|
r.unreadMentionDirect = false;
|
||||||
if (message.id > r.lastReadMessage) r.lastReadMessage = message.id;
|
if (message.id > r.lastReadMessage) r.lastReadMessage = message.id;
|
||||||
if (message.id > r.lastMessage.id) r.lastMessage = message;
|
if (message.id > lastId) r.lastMessage = message;
|
||||||
if (message.timestamp > r.lastActivity) r.lastActivity = message.timestamp;
|
if (message.timestamp > r.lastActivity) {
|
||||||
|
r.lastActivity = message.timestamp;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,17 @@ part of 'chat_list_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_ChatListState _$ChatListStateFromJson(Map<String, dynamic> json) =>
|
_ChatListState _$ChatListStateFromJson(Map<String, dynamic> json) =>
|
||||||
_ChatListState(
|
$checkedCreate('_ChatListState', json, ($checkedConvert) {
|
||||||
rooms: json['rooms'] == null
|
final val = _ChatListState(
|
||||||
|
rooms: $checkedConvert(
|
||||||
|
'rooms',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: GetRoomResponse.fromJson(json['rooms'] as Map<String, dynamic>),
|
: GetRoomResponse.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ChatListStateToJson(_ChatListState instance) =>
|
Map<String, dynamic> _$ChatListStateToJson(_ChatListState instance) =>
|
||||||
<String, dynamic>{'rooms': instance.rooms};
|
<String, dynamic>{'rooms': instance.rooms};
|
||||||
|
|||||||
@@ -6,16 +6,24 @@ part of 'files_state.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_FilesState _$FilesStateFromJson(Map<String, dynamic> json) => _FilesState(
|
_FilesState _$FilesStateFromJson(Map<String, dynamic> json) =>
|
||||||
currentPath:
|
$checkedCreate('_FilesState', json, ($checkedConvert) {
|
||||||
(json['currentPath'] as List<dynamic>?)
|
final val = _FilesState(
|
||||||
?.map((e) => e as String)
|
currentPath: $checkedConvert(
|
||||||
.toList() ??
|
'currentPath',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||||
const <String>[],
|
const <String>[],
|
||||||
listing: json['listing'] == null
|
),
|
||||||
|
listing: $checkedConvert(
|
||||||
|
'listing',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: ListFilesResponse.fromJson(json['listing'] as Map<String, dynamic>),
|
: ListFilesResponse.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$FilesStateToJson(_FilesState instance) =>
|
Map<String, dynamic> _$FilesStateToJson(_FilesState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,15 +7,19 @@ part of 'grade_averages_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_GradeAveragesState _$GradeAveragesStateFromJson(Map<String, dynamic> json) =>
|
_GradeAveragesState _$GradeAveragesStateFromJson(Map<String, dynamic> json) =>
|
||||||
_GradeAveragesState(
|
$checkedCreate('_GradeAveragesState', json, ($checkedConvert) {
|
||||||
gradingSystem: $enumDecode(
|
final val = _GradeAveragesState(
|
||||||
_$GradeAveragesGradingSystemEnumMap,
|
gradingSystem: $checkedConvert(
|
||||||
json['gradingSystem'],
|
'gradingSystem',
|
||||||
|
(v) => $enumDecode(_$GradeAveragesGradingSystemEnumMap, v),
|
||||||
|
),
|
||||||
|
grades: $checkedConvert(
|
||||||
|
'grades',
|
||||||
|
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
|
||||||
),
|
),
|
||||||
grades: (json['grades'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$GradeAveragesStateToJson(
|
Map<String, dynamic> _$GradeAveragesStateToJson(
|
||||||
_GradeAveragesState instance,
|
_GradeAveragesState instance,
|
||||||
|
|||||||
@@ -7,13 +7,19 @@ part of 'holidays_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_HolidaysState _$HolidaysStateFromJson(Map<String, dynamic> json) =>
|
_HolidaysState _$HolidaysStateFromJson(Map<String, dynamic> json) =>
|
||||||
_HolidaysState(
|
$checkedCreate('_HolidaysState', json, ($checkedConvert) {
|
||||||
showPastHolidays: json['showPastHolidays'] as bool,
|
final val = _HolidaysState(
|
||||||
showDisclaimer: json['showDisclaimer'] as bool,
|
showPastHolidays: $checkedConvert('showPastHolidays', (v) => v as bool),
|
||||||
holidays: (json['holidays'] as List<dynamic>)
|
showDisclaimer: $checkedConvert('showDisclaimer', (v) => v as bool),
|
||||||
|
holidays: $checkedConvert(
|
||||||
|
'holidays',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
|
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$HolidaysStateToJson(_HolidaysState instance) =>
|
Map<String, dynamic> _$HolidaysStateToJson(_HolidaysState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,12 +7,18 @@ part of 'marianum_dates_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_MarianumDatesState _$MarianumDatesStateFromJson(Map<String, dynamic> json) =>
|
_MarianumDatesState _$MarianumDatesStateFromJson(Map<String, dynamic> json) =>
|
||||||
_MarianumDatesState(
|
$checkedCreate('_MarianumDatesState', json, ($checkedConvert) {
|
||||||
showPastEvents: json['showPastEvents'] as bool,
|
final val = _MarianumDatesState(
|
||||||
events: (json['events'] as List<dynamic>)
|
showPastEvents: $checkedConvert('showPastEvents', (v) => v as bool),
|
||||||
|
events: $checkedConvert(
|
||||||
|
'events',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => MarianumDate.fromJson(e as Map<String, dynamic>))
|
.map((e) => MarianumDate.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$MarianumDatesStateToJson(_MarianumDatesState instance) =>
|
Map<String, dynamic> _$MarianumDatesStateToJson(_MarianumDatesState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -21,14 +27,17 @@ Map<String, dynamic> _$MarianumDatesStateToJson(_MarianumDatesState instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
_MarianumDate _$MarianumDateFromJson(Map<String, dynamic> json) =>
|
_MarianumDate _$MarianumDateFromJson(Map<String, dynamic> json) =>
|
||||||
_MarianumDate(
|
$checkedCreate('_MarianumDate', json, ($checkedConvert) {
|
||||||
uid: json['uid'] as String,
|
final val = _MarianumDate(
|
||||||
title: json['title'] as String,
|
uid: $checkedConvert('uid', (v) => v as String),
|
||||||
description: json['description'] as String?,
|
title: $checkedConvert('title', (v) => v as String),
|
||||||
start: DateTime.parse(json['start'] as String),
|
description: $checkedConvert('description', (v) => v as String?),
|
||||||
end: DateTime.parse(json['end'] as String),
|
start: $checkedConvert('start', (v) => DateTime.parse(v as String)),
|
||||||
isAllDay: json['isAllDay'] as bool,
|
end: $checkedConvert('end', (v) => DateTime.parse(v as String)),
|
||||||
|
isAllDay: $checkedConvert('isAllDay', (v) => v as bool),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$MarianumDateToJson(_MarianumDate instance) =>
|
Map<String, dynamic> _$MarianumDateToJson(_MarianumDate instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -8,36 +8,49 @@ part of 'marianum_message_state.dart';
|
|||||||
|
|
||||||
_MarianumMessageState _$MarianumMessageStateFromJson(
|
_MarianumMessageState _$MarianumMessageStateFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _MarianumMessageState(
|
) => $checkedCreate('_MarianumMessageState', json, ($checkedConvert) {
|
||||||
messageList: MarianumMessageList.fromJson(
|
final val = _MarianumMessageState(
|
||||||
json['messageList'] as Map<String, dynamic>,
|
messageList: $checkedConvert(
|
||||||
|
'messageList',
|
||||||
|
(v) => MarianumMessageList.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$MarianumMessageStateToJson(
|
Map<String, dynamic> _$MarianumMessageStateToJson(
|
||||||
_MarianumMessageState instance,
|
_MarianumMessageState instance,
|
||||||
) => <String, dynamic>{'messageList': instance.messageList};
|
) => <String, dynamic>{'messageList': instance.messageList};
|
||||||
|
|
||||||
_MarianumMessageList _$MarianumMessageListFromJson(Map<String, dynamic> json) =>
|
_MarianumMessageList _$MarianumMessageListFromJson(Map<String, dynamic> json) =>
|
||||||
_MarianumMessageList(
|
$checkedCreate('_MarianumMessageList', json, ($checkedConvert) {
|
||||||
base: json['base'] as String,
|
final val = _MarianumMessageList(
|
||||||
messages: (json['messages'] as List<dynamic>)
|
base: $checkedConvert('base', (v) => v as String),
|
||||||
|
messages: $checkedConvert(
|
||||||
|
'messages',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => MarianumMessage.fromJson(e as Map<String, dynamic>))
|
.map((e) => MarianumMessage.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$MarianumMessageListToJson(
|
Map<String, dynamic> _$MarianumMessageListToJson(
|
||||||
_MarianumMessageList instance,
|
_MarianumMessageList instance,
|
||||||
) => <String, dynamic>{'base': instance.base, 'messages': instance.messages};
|
) => <String, dynamic>{'base': instance.base, 'messages': instance.messages};
|
||||||
|
|
||||||
_MarianumMessage _$MarianumMessageFromJson(Map<String, dynamic> json) =>
|
_MarianumMessage _$MarianumMessageFromJson(Map<String, dynamic> json) =>
|
||||||
_MarianumMessage(
|
$checkedCreate('_MarianumMessage', json, ($checkedConvert) {
|
||||||
id: json['id'] as String? ?? '',
|
final val = _MarianumMessage(
|
||||||
name: json['name'] as String,
|
id: $checkedConvert('id', (v) => v as String? ?? ''),
|
||||||
date: json['date'] as String,
|
name: $checkedConvert('name', (v) => v as String),
|
||||||
description: json['description'] as String? ?? '',
|
date: $checkedConvert('date', (v) => v as String),
|
||||||
url: json['url'] as String,
|
description: $checkedConvert('description', (v) => v as String? ?? ''),
|
||||||
|
url: $checkedConvert('url', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$MarianumMessageToJson(_MarianumMessage instance) =>
|
Map<String, dynamic> _$MarianumMessageToJson(_MarianumMessage instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
+49
-17
@@ -8,24 +8,56 @@ part of 'nextcloud_capabilities_state.dart';
|
|||||||
|
|
||||||
_NextcloudCapabilitiesState _$NextcloudCapabilitiesStateFromJson(
|
_NextcloudCapabilitiesState _$NextcloudCapabilitiesStateFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _NextcloudCapabilitiesState(
|
) => $checkedCreate('_NextcloudCapabilitiesState', json, ($checkedConvert) {
|
||||||
apiEnabled: json['apiEnabled'] as bool? ?? false,
|
final val = _NextcloudCapabilitiesState(
|
||||||
publicEnabled: json['publicEnabled'] as bool? ?? false,
|
apiEnabled: $checkedConvert('apiEnabled', (v) => v as bool? ?? false),
|
||||||
publicMultipleLinks: json['publicMultipleLinks'] as bool? ?? false,
|
publicEnabled: $checkedConvert('publicEnabled', (v) => v as bool? ?? false),
|
||||||
publicUploadEnabled: json['publicUploadEnabled'] as bool? ?? false,
|
publicMultipleLinks: $checkedConvert(
|
||||||
publicPasswordEnforced: json['publicPasswordEnforced'] as bool? ?? false,
|
'publicMultipleLinks',
|
||||||
publicExpireEnabled: json['publicExpireEnabled'] as bool? ?? false,
|
(v) => v as bool? ?? false,
|
||||||
publicExpireDays: (json['publicExpireDays'] as num?)?.toInt(),
|
),
|
||||||
publicExpireEnforced: json['publicExpireEnforced'] as bool? ?? false,
|
publicUploadEnabled: $checkedConvert(
|
||||||
groupEnabled: json['groupEnabled'] as bool? ?? false,
|
'publicUploadEnabled',
|
||||||
resharing: json['resharing'] as bool? ?? false,
|
(v) => v as bool? ?? false,
|
||||||
passwordMinLength: (json['passwordMinLength'] as num?)?.toInt(),
|
),
|
||||||
passwordEnforceUpperLower:
|
publicPasswordEnforced: $checkedConvert(
|
||||||
json['passwordEnforceUpperLower'] as bool? ?? false,
|
'publicPasswordEnforced',
|
||||||
passwordEnforceNumeric: json['passwordEnforceNumeric'] as bool? ?? false,
|
(v) => v as bool? ?? false,
|
||||||
passwordEnforceSpecial: json['passwordEnforceSpecial'] as bool? ?? false,
|
),
|
||||||
loaded: json['loaded'] as bool? ?? false,
|
publicExpireEnabled: $checkedConvert(
|
||||||
|
'publicExpireEnabled',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
publicExpireDays: $checkedConvert(
|
||||||
|
'publicExpireDays',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
publicExpireEnforced: $checkedConvert(
|
||||||
|
'publicExpireEnforced',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
groupEnabled: $checkedConvert('groupEnabled', (v) => v as bool? ?? false),
|
||||||
|
resharing: $checkedConvert('resharing', (v) => v as bool? ?? false),
|
||||||
|
passwordMinLength: $checkedConvert(
|
||||||
|
'passwordMinLength',
|
||||||
|
(v) => (v as num?)?.toInt(),
|
||||||
|
),
|
||||||
|
passwordEnforceUpperLower: $checkedConvert(
|
||||||
|
'passwordEnforceUpperLower',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
passwordEnforceNumeric: $checkedConvert(
|
||||||
|
'passwordEnforceNumeric',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
passwordEnforceSpecial: $checkedConvert(
|
||||||
|
'passwordEnforceSpecial',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
loaded: $checkedConvert('loaded', (v) => v as bool? ?? false),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$NextcloudCapabilitiesStateToJson(
|
Map<String, dynamic> _$NextcloudCapabilitiesStateToJson(
|
||||||
_NextcloudCapabilitiesState instance,
|
_NextcloudCapabilitiesState instance,
|
||||||
|
|||||||
@@ -7,11 +7,17 @@ part of 'ticker_page_state.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_TickerPageState _$TickerPageStateFromJson(Map<String, dynamic> json) =>
|
_TickerPageState _$TickerPageStateFromJson(Map<String, dynamic> json) =>
|
||||||
_TickerPageState(
|
$checkedCreate('_TickerPageState', json, ($checkedConvert) {
|
||||||
page: json['page'] == null
|
final val = _TickerPageState(
|
||||||
|
page: $checkedConvert(
|
||||||
|
'page',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TickerPageResponse.fromJson(json['page'] as Map<String, dynamic>),
|
: TickerPageResponse.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerPageStateToJson(_TickerPageState instance) =>
|
Map<String, dynamic> _$TickerPageStateToJson(_TickerPageState instance) =>
|
||||||
<String, dynamic>{'page': instance.page};
|
<String, dynamic>{'page': instance.page};
|
||||||
|
|||||||
@@ -6,15 +6,25 @@ part of 'ticker_state.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_TickerState _$TickerStateFromJson(Map<String, dynamic> json) => _TickerState(
|
_TickerState _$TickerStateFromJson(Map<String, dynamic> json) =>
|
||||||
ticker: json['ticker'] == null
|
$checkedCreate('_TickerState', json, ($checkedConvert) {
|
||||||
|
final val = _TickerState(
|
||||||
|
ticker: $checkedConvert(
|
||||||
|
'ticker',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TickerResponse.fromJson(json['ticker'] as Map<String, dynamic>),
|
: TickerResponse.fromJson(v as Map<String, dynamic>),
|
||||||
nav: json['nav'] == null
|
),
|
||||||
|
nav: $checkedConvert(
|
||||||
|
'nav',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TickerNavResponse.fromJson(json['nav'] as Map<String, dynamic>),
|
: TickerNavResponse.fromJson(v as Map<String, dynamic>),
|
||||||
selectedSlug: json['selectedSlug'] as String?,
|
),
|
||||||
|
selectedSlug: $checkedConvert('selectedSlug', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TickerStateToJson(_TickerState instance) =>
|
Map<String, dynamic> _$TickerStateToJson(_TickerState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -6,56 +6,74 @@ part of 'timetable_state.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_TimetableState _$TimetableStateFromJson(Map<String, dynamic> json) =>
|
_TimetableState _$TimetableStateFromJson(
|
||||||
_TimetableState(
|
Map<String, dynamic> json,
|
||||||
weekCache:
|
) => $checkedCreate('_TimetableState', json, ($checkedConvert) {
|
||||||
(json['weekCache'] as Map<String, dynamic>?)?.map(
|
final val = _TimetableState(
|
||||||
|
weekCache: $checkedConvert(
|
||||||
|
'weekCache',
|
||||||
|
(v) =>
|
||||||
|
(v as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(
|
(k, e) => MapEntry(
|
||||||
k,
|
k,
|
||||||
TimetableGetWeekResponse.fromJson(e as Map<String, dynamic>),
|
TimetableGetWeekResponse.fromJson(e as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
) ??
|
) ??
|
||||||
const <String, TimetableGetWeekResponse>{},
|
const <String, TimetableGetWeekResponse>{},
|
||||||
rooms: json['rooms'] == null
|
|
||||||
? null
|
|
||||||
: TimetableGetRoomsResponse.fromJson(
|
|
||||||
json['rooms'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
subjects: json['subjects'] == null
|
rooms: $checkedConvert(
|
||||||
|
'rooms',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TimetableGetSubjectsResponse.fromJson(
|
: TimetableGetRoomsResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['subjects'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
schoolHolidays: json['schoolHolidays'] == null
|
subjects: $checkedConvert(
|
||||||
|
'subjects',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TimetableGetHolidaysResponse.fromJson(
|
: TimetableGetSubjectsResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['schoolHolidays'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
schoolyear: json['schoolyear'] == null
|
schoolHolidays: $checkedConvert(
|
||||||
|
'schoolHolidays',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TimetableGetSchoolyearResponse.fromJson(
|
: TimetableGetHolidaysResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['schoolyear'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
timegrid: json['timegrid'] == null
|
schoolyear: $checkedConvert(
|
||||||
|
'schoolyear',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: TimetableGetTimegridResponse.fromJson(
|
: TimetableGetSchoolyearResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['timegrid'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
customEvents: json['customEvents'] == null
|
timegrid: $checkedConvert(
|
||||||
|
'timegrid',
|
||||||
|
(v) => v == null
|
||||||
? null
|
? null
|
||||||
: GetCustomTimetableEventResponse.fromJson(
|
: TimetableGetTimegridResponse.fromJson(v as Map<String, dynamic>),
|
||||||
json['customEvents'] as Map<String, dynamic>,
|
|
||||||
),
|
),
|
||||||
startDate: DateTime.parse(json['startDate'] as String),
|
customEvents: $checkedConvert(
|
||||||
endDate: DateTime.parse(json['endDate'] as String),
|
'customEvents',
|
||||||
dataVersion: (json['dataVersion'] as num?)?.toInt() ?? 0,
|
(v) => v == null
|
||||||
accessibleStartDate: json['accessibleStartDate'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['accessibleStartDate'] as String),
|
: GetCustomTimetableEventResponse.fromJson(v as Map<String, dynamic>),
|
||||||
accessibleEndDate: json['accessibleEndDate'] == null
|
),
|
||||||
? null
|
startDate: $checkedConvert('startDate', (v) => DateTime.parse(v as String)),
|
||||||
: DateTime.parse(json['accessibleEndDate'] as String),
|
endDate: $checkedConvert('endDate', (v) => DateTime.parse(v as String)),
|
||||||
|
dataVersion: $checkedConvert(
|
||||||
|
'dataVersion',
|
||||||
|
(v) => (v as num?)?.toInt() ?? 0,
|
||||||
|
),
|
||||||
|
accessibleStartDate: $checkedConvert(
|
||||||
|
'accessibleStartDate',
|
||||||
|
(v) => v == null ? null : DateTime.parse(v as String),
|
||||||
|
),
|
||||||
|
accessibleEndDate: $checkedConvert(
|
||||||
|
'accessibleEndDate',
|
||||||
|
(v) => v == null ? null : DateTime.parse(v as String),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableStateToJson(_TimetableState instance) =>
|
Map<String, dynamic> _$TimetableStateToJson(_TimetableState instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -8,14 +8,23 @@ part of 'chat_background_settings.dart';
|
|||||||
|
|
||||||
ChatBackgroundSettings _$ChatBackgroundSettingsFromJson(
|
ChatBackgroundSettings _$ChatBackgroundSettingsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => ChatBackgroundSettings(
|
) => $checkedCreate('ChatBackgroundSettings', json, ($checkedConvert) {
|
||||||
type: $enumDecode(_$ChatBackgroundTypeEnumMap, json['type']),
|
final val = ChatBackgroundSettings(
|
||||||
fit: $enumDecode(_$ChatBackgroundFitEnumMap, json['fit']),
|
type: $checkedConvert(
|
||||||
colorValue: (json['colorValue'] as num?)?.toInt(),
|
'type',
|
||||||
imageVersion: (json['imageVersion'] as num).toInt(),
|
(v) => $enumDecode(_$ChatBackgroundTypeEnumMap, v),
|
||||||
dim: (json['dim'] as num).toDouble(),
|
),
|
||||||
blur: (json['blur'] as num).toDouble(),
|
fit: $checkedConvert(
|
||||||
|
'fit',
|
||||||
|
(v) => $enumDecode(_$ChatBackgroundFitEnumMap, v),
|
||||||
|
),
|
||||||
|
colorValue: $checkedConvert('colorValue', (v) => (v as num?)?.toInt()),
|
||||||
|
imageVersion: $checkedConvert('imageVersion', (v) => (v as num).toInt()),
|
||||||
|
dim: $checkedConvert('dim', (v) => (v as num).toDouble()),
|
||||||
|
blur: $checkedConvert('blur', (v) => (v as num).toDouble()),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ChatBackgroundSettingsToJson(
|
Map<String, dynamic> _$ChatBackgroundSettingsToJson(
|
||||||
ChatBackgroundSettings instance,
|
ChatBackgroundSettings instance,
|
||||||
|
|||||||
@@ -7,23 +7,49 @@ part of 'dev_tools_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
DevToolsSettings _$DevToolsSettingsFromJson(Map<String, dynamic> json) =>
|
DevToolsSettings _$DevToolsSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
DevToolsSettings(
|
$checkedCreate('DevToolsSettings', json, ($checkedConvert) {
|
||||||
showPerformanceOverlay: json['showPerformanceOverlay'] as bool,
|
final val = DevToolsSettings(
|
||||||
showFrameStats: json['showFrameStats'] as bool? ?? false,
|
showPerformanceOverlay: $checkedConvert(
|
||||||
showMemoryStats: json['showMemoryStats'] as bool? ?? false,
|
'showPerformanceOverlay',
|
||||||
showSemanticsDebugger: json['showSemanticsDebugger'] as bool? ?? false,
|
(v) => v as bool,
|
||||||
slowAnimations: json['slowAnimations'] as bool? ?? false,
|
),
|
||||||
textScaleOverride: (json['textScaleOverride'] as num?)?.toDouble() ?? 0,
|
showFrameStats: $checkedConvert(
|
||||||
marianumConnectEndpoint:
|
'showFrameStats',
|
||||||
$enumDecodeNullable(
|
(v) => v as bool? ?? false,
|
||||||
_$MarianumConnectEndpointEnumMap,
|
),
|
||||||
json['marianumConnectEndpoint'],
|
showMemoryStats: $checkedConvert(
|
||||||
) ??
|
'showMemoryStats',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
showSemanticsDebugger: $checkedConvert(
|
||||||
|
'showSemanticsDebugger',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
slowAnimations: $checkedConvert(
|
||||||
|
'slowAnimations',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
|
textScaleOverride: $checkedConvert(
|
||||||
|
'textScaleOverride',
|
||||||
|
(v) => (v as num?)?.toDouble() ?? 0,
|
||||||
|
),
|
||||||
|
marianumConnectEndpoint: $checkedConvert(
|
||||||
|
'marianumConnectEndpoint',
|
||||||
|
(v) =>
|
||||||
|
$enumDecodeNullable(_$MarianumConnectEndpointEnumMap, v) ??
|
||||||
MarianumConnectEndpoint.live,
|
MarianumConnectEndpoint.live,
|
||||||
marianumConnectCustomUrl:
|
),
|
||||||
json['marianumConnectCustomUrl'] as String? ?? '',
|
marianumConnectCustomUrl: $checkedConvert(
|
||||||
emergencyNoticeUrl: json['emergencyNoticeUrl'] as String? ?? '',
|
'marianumConnectCustomUrl',
|
||||||
|
(v) => v as String? ?? '',
|
||||||
|
),
|
||||||
|
emergencyNoticeUrl: $checkedConvert(
|
||||||
|
'emergencyNoticeUrl',
|
||||||
|
(v) => v as String? ?? '',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$DevToolsSettingsToJson(DevToolsSettings instance) =>
|
Map<String, dynamic> _$DevToolsSettingsToJson(DevToolsSettings instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -6,11 +6,18 @@ part of 'file_settings.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
FileSettings _$FileSettingsFromJson(Map<String, dynamic> json) => FileSettings(
|
FileSettings _$FileSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
sortFoldersToTop: json['sortFoldersToTop'] as bool,
|
$checkedCreate('FileSettings', json, ($checkedConvert) {
|
||||||
ascending: json['ascending'] as bool,
|
final val = FileSettings(
|
||||||
sortBy: $enumDecode(_$SortOptionEnumMap, json['sortBy']),
|
sortFoldersToTop: $checkedConvert('sortFoldersToTop', (v) => v as bool),
|
||||||
|
ascending: $checkedConvert('ascending', (v) => v as bool),
|
||||||
|
sortBy: $checkedConvert(
|
||||||
|
'sortBy',
|
||||||
|
(v) => $enumDecode(_$SortOptionEnumMap, v),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$FileSettingsToJson(FileSettings instance) =>
|
Map<String, dynamic> _$FileSettingsToJson(FileSettings instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,9 +7,15 @@ part of 'file_view_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
FileViewSettings _$FileViewSettingsFromJson(Map<String, dynamic> json) =>
|
FileViewSettings _$FileViewSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
FileViewSettings(
|
$checkedCreate('FileViewSettings', json, ($checkedConvert) {
|
||||||
alwaysOpenExternally: json['alwaysOpenExternally'] as bool,
|
final val = FileViewSettings(
|
||||||
|
alwaysOpenExternally: $checkedConvert(
|
||||||
|
'alwaysOpenExternally',
|
||||||
|
(v) => v as bool,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$FileViewSettingsToJson(FileViewSettings instance) =>
|
Map<String, dynamic> _$FileViewSettingsToJson(FileViewSettings instance) =>
|
||||||
<String, dynamic>{'alwaysOpenExternally': instance.alwaysOpenExternally};
|
<String, dynamic>{'alwaysOpenExternally': instance.alwaysOpenExternally};
|
||||||
|
|||||||
@@ -7,7 +7,15 @@ part of 'haptic_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
HapticSettings _$HapticSettingsFromJson(Map<String, dynamic> json) =>
|
HapticSettings _$HapticSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
HapticSettings(level: $enumDecode(_$HapticLevelEnumMap, json['level']));
|
$checkedCreate('HapticSettings', json, ($checkedConvert) {
|
||||||
|
final val = HapticSettings(
|
||||||
|
level: $checkedConvert(
|
||||||
|
'level',
|
||||||
|
(v) => $enumDecode(_$HapticLevelEnumMap, v),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$HapticSettingsToJson(HapticSettings instance) =>
|
Map<String, dynamic> _$HapticSettingsToJson(HapticSettings instance) =>
|
||||||
<String, dynamic>{'level': _$HapticLevelEnumMap[instance.level]!};
|
<String, dynamic>{'level': _$HapticLevelEnumMap[instance.level]!};
|
||||||
|
|||||||
@@ -7,10 +7,16 @@ part of 'holidays_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
HolidaysSettings _$HolidaysSettingsFromJson(Map<String, dynamic> json) =>
|
HolidaysSettings _$HolidaysSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
HolidaysSettings(
|
$checkedCreate('HolidaysSettings', json, ($checkedConvert) {
|
||||||
dismissedDisclaimer: json['dismissedDisclaimer'] as bool,
|
final val = HolidaysSettings(
|
||||||
showPastEvents: json['showPastEvents'] as bool,
|
dismissedDisclaimer: $checkedConvert(
|
||||||
|
'dismissedDisclaimer',
|
||||||
|
(v) => v as bool,
|
||||||
|
),
|
||||||
|
showPastEvents: $checkedConvert('showPastEvents', (v) => v as bool),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$HolidaysSettingsToJson(HolidaysSettings instance) =>
|
Map<String, dynamic> _$HolidaysSettingsToJson(HolidaysSettings instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -7,17 +7,35 @@ part of 'modules_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
ModulesSettings _$ModulesSettingsFromJson(Map<String, dynamic> json) =>
|
ModulesSettings _$ModulesSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
ModulesSettings(
|
$checkedCreate('ModulesSettings', json, ($checkedConvert) {
|
||||||
moduleOrder: (json['moduleOrder'] as List<dynamic>)
|
final val = ModulesSettings(
|
||||||
|
moduleOrder: $checkedConvert(
|
||||||
|
'moduleOrder',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => $enumDecode(_$ModulesEnumMap, e))
|
.map((e) => $enumDecode(_$ModulesEnumMap, e))
|
||||||
.toList(),
|
.toList(),
|
||||||
hiddenModules: (json['hiddenModules'] as List<dynamic>)
|
),
|
||||||
|
hiddenModules: $checkedConvert(
|
||||||
|
'hiddenModules',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => $enumDecode(_$ModulesEnumMap, e))
|
.map((e) => $enumDecode(_$ModulesEnumMap, e))
|
||||||
.toList(),
|
.toList(),
|
||||||
autoFillBottomBar: json['autoFillBottomBar'] as bool? ?? true,
|
),
|
||||||
fixedBottomBarSlots: (json['fixedBottomBarSlots'] as num?)?.toInt() ?? 3,
|
autoFillBottomBar: $checkedConvert(
|
||||||
teacherDefaultsApplied: json['teacherDefaultsApplied'] as bool? ?? false,
|
'autoFillBottomBar',
|
||||||
|
(v) => v as bool? ?? true,
|
||||||
|
),
|
||||||
|
fixedBottomBarSlots: $checkedConvert(
|
||||||
|
'fixedBottomBarSlots',
|
||||||
|
(v) => (v as num?)?.toInt() ?? 3,
|
||||||
|
),
|
||||||
|
teacherDefaultsApplied: $checkedConvert(
|
||||||
|
'teacherDefaultsApplied',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$ModulesSettingsToJson(
|
Map<String, dynamic> _$ModulesSettingsToJson(
|
||||||
ModulesSettings instance,
|
ModulesSettings instance,
|
||||||
|
|||||||
@@ -8,11 +8,16 @@ part of 'notification_settings.dart';
|
|||||||
|
|
||||||
NotificationSettings _$NotificationSettingsFromJson(
|
NotificationSettings _$NotificationSettingsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => NotificationSettings(
|
) => $checkedCreate('NotificationSettings', json, ($checkedConvert) {
|
||||||
enabled: json['enabled'] as bool? ?? true,
|
final val = NotificationSettings(
|
||||||
talkPermissionPromptShown:
|
enabled: $checkedConvert('enabled', (v) => v as bool? ?? true),
|
||||||
json['talkPermissionPromptShown'] as bool? ?? false,
|
talkPermissionPromptShown: $checkedConvert(
|
||||||
|
'talkPermissionPromptShown',
|
||||||
|
(v) => v as bool? ?? false,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$NotificationSettingsToJson(
|
Map<String, dynamic> _$NotificationSettingsToJson(
|
||||||
NotificationSettings instance,
|
NotificationSettings instance,
|
||||||
|
|||||||
+43
-25
@@ -6,43 +6,61 @@ part of 'settings.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
Settings _$SettingsFromJson(Map<String, dynamic> json) => Settings(
|
Settings _$SettingsFromJson(Map<String, dynamic> json) =>
|
||||||
appTheme: Settings._themeFromJson(json['appTheme'] as String),
|
$checkedCreate('Settings', json, ($checkedConvert) {
|
||||||
devToolsEnabled: json['devToolsEnabled'] as bool,
|
final val = Settings(
|
||||||
modulesSettings: ModulesSettings.fromJson(
|
appTheme: $checkedConvert(
|
||||||
json['modulesSettings'] as Map<String, dynamic>,
|
'appTheme',
|
||||||
|
(v) => Settings._themeFromJson(v as String),
|
||||||
),
|
),
|
||||||
timetableSettings: TimetableSettings.fromJson(
|
devToolsEnabled: $checkedConvert('devToolsEnabled', (v) => v as bool),
|
||||||
json['timetableSettings'] as Map<String, dynamic>,
|
modulesSettings: $checkedConvert(
|
||||||
|
'modulesSettings',
|
||||||
|
(v) => ModulesSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
timetableFavoritesSettings: TimetableFavoritesSettings.fromJson(
|
timetableSettings: $checkedConvert(
|
||||||
json['timetableFavoritesSettings'] as Map<String, dynamic>,
|
'timetableSettings',
|
||||||
|
(v) => TimetableSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
talkSettings: TalkSettings.fromJson(
|
timetableFavoritesSettings: $checkedConvert(
|
||||||
json['talkSettings'] as Map<String, dynamic>,
|
'timetableFavoritesSettings',
|
||||||
|
(v) => TimetableFavoritesSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
chatBackgroundSettings: ChatBackgroundSettings.fromJson(
|
talkSettings: $checkedConvert(
|
||||||
json['chatBackgroundSettings'] as Map<String, dynamic>,
|
'talkSettings',
|
||||||
|
(v) => TalkSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
fileSettings: FileSettings.fromJson(
|
chatBackgroundSettings: $checkedConvert(
|
||||||
json['fileSettings'] as Map<String, dynamic>,
|
'chatBackgroundSettings',
|
||||||
|
(v) => ChatBackgroundSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
holidaysSettings: HolidaysSettings.fromJson(
|
fileSettings: $checkedConvert(
|
||||||
json['holidaysSettings'] as Map<String, dynamic>,
|
'fileSettings',
|
||||||
|
(v) => FileSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
fileViewSettings: FileViewSettings.fromJson(
|
holidaysSettings: $checkedConvert(
|
||||||
json['fileViewSettings'] as Map<String, dynamic>,
|
'holidaysSettings',
|
||||||
|
(v) => HolidaysSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
notificationSettings: NotificationSettings.fromJson(
|
fileViewSettings: $checkedConvert(
|
||||||
json['notificationSettings'] as Map<String, dynamic>,
|
'fileViewSettings',
|
||||||
|
(v) => FileViewSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
devToolsSettings: DevToolsSettings.fromJson(
|
notificationSettings: $checkedConvert(
|
||||||
json['devToolsSettings'] as Map<String, dynamic>,
|
'notificationSettings',
|
||||||
|
(v) => NotificationSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
hapticSettings: HapticSettings.fromJson(
|
devToolsSettings: $checkedConvert(
|
||||||
json['hapticSettings'] as Map<String, dynamic>,
|
'devToolsSettings',
|
||||||
|
(v) => DevToolsSettings.fromJson(v as Map<String, dynamic>),
|
||||||
|
),
|
||||||
|
hapticSettings: $checkedConvert(
|
||||||
|
'hapticSettings',
|
||||||
|
(v) => HapticSettings.fromJson(v as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$SettingsToJson(Settings instance) => <String, dynamic>{
|
Map<String, dynamic> _$SettingsToJson(Settings instance) => <String, dynamic>{
|
||||||
'appTheme': Settings._themeToJson(instance.appTheme),
|
'appTheme': Settings._themeToJson(instance.appTheme),
|
||||||
|
|||||||
@@ -6,12 +6,25 @@ part of 'talk_settings.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TalkSettings _$TalkSettingsFromJson(Map<String, dynamic> json) => TalkSettings(
|
TalkSettings _$TalkSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
sortFavoritesToTop: json['sortFavoritesToTop'] as bool,
|
$checkedCreate('TalkSettings', json, ($checkedConvert) {
|
||||||
sortUnreadToTop: json['sortUnreadToTop'] as bool,
|
final val = TalkSettings(
|
||||||
drafts: Map<String, String>.from(json['drafts'] as Map),
|
sortFavoritesToTop: $checkedConvert(
|
||||||
draftReplies: Map<String, int>.from(json['draftReplies'] as Map),
|
'sortFavoritesToTop',
|
||||||
|
(v) => v as bool,
|
||||||
|
),
|
||||||
|
sortUnreadToTop: $checkedConvert('sortUnreadToTop', (v) => v as bool),
|
||||||
|
drafts: $checkedConvert(
|
||||||
|
'drafts',
|
||||||
|
(v) => Map<String, String>.from(v as Map),
|
||||||
|
),
|
||||||
|
draftReplies: $checkedConvert(
|
||||||
|
'draftReplies',
|
||||||
|
(v) => Map<String, int>.from(v as Map),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TalkSettingsToJson(TalkSettings instance) =>
|
Map<String, dynamic> _$TalkSettingsToJson(TalkSettings instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -8,11 +8,17 @@ part of 'timetable_favorites_settings.dart';
|
|||||||
|
|
||||||
FavoriteTimetableElement _$FavoriteTimetableElementFromJson(
|
FavoriteTimetableElement _$FavoriteTimetableElementFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => FavoriteTimetableElement(
|
) => $checkedCreate('FavoriteTimetableElement', json, ($checkedConvert) {
|
||||||
type: $enumDecode(_$TimetableElementTypeEnumMap, json['type']),
|
final val = FavoriteTimetableElement(
|
||||||
id: (json['id'] as num).toInt(),
|
type: $checkedConvert(
|
||||||
label: json['label'] as String,
|
'type',
|
||||||
|
(v) => $enumDecode(_$TimetableElementTypeEnumMap, v),
|
||||||
|
),
|
||||||
|
id: $checkedConvert('id', (v) => (v as num).toInt()),
|
||||||
|
label: $checkedConvert('label', (v) => v as String),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$FavoriteTimetableElementToJson(
|
Map<String, dynamic> _$FavoriteTimetableElementToJson(
|
||||||
FavoriteTimetableElement instance,
|
FavoriteTimetableElement instance,
|
||||||
@@ -31,11 +37,19 @@ const _$TimetableElementTypeEnumMap = {
|
|||||||
|
|
||||||
TimetableFavoritesSettings _$TimetableFavoritesSettingsFromJson(
|
TimetableFavoritesSettings _$TimetableFavoritesSettingsFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => TimetableFavoritesSettings(
|
) => $checkedCreate('TimetableFavoritesSettings', json, ($checkedConvert) {
|
||||||
favorites: (json['favorites'] as List<dynamic>)
|
final val = TimetableFavoritesSettings(
|
||||||
.map((e) => FavoriteTimetableElement.fromJson(e as Map<String, dynamic>))
|
favorites: $checkedConvert(
|
||||||
|
'favorites',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) => FavoriteTimetableElement.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableFavoritesSettingsToJson(
|
Map<String, dynamic> _$TimetableFavoritesSettingsToJson(
|
||||||
TimetableFavoritesSettings instance,
|
TimetableFavoritesSettings instance,
|
||||||
|
|||||||
@@ -7,13 +7,19 @@ part of 'timetable_settings.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TimetableSettings _$TimetableSettingsFromJson(Map<String, dynamic> json) =>
|
TimetableSettings _$TimetableSettingsFromJson(Map<String, dynamic> json) =>
|
||||||
TimetableSettings(
|
$checkedCreate('TimetableSettings', json, ($checkedConvert) {
|
||||||
connectDoubleLessons: json['connectDoubleLessons'] as bool,
|
final val = TimetableSettings(
|
||||||
timetableNameMode: $enumDecode(
|
connectDoubleLessons: $checkedConvert(
|
||||||
_$TimetableNameModeEnumMap,
|
'connectDoubleLessons',
|
||||||
json['timetableNameMode'],
|
(v) => v as bool,
|
||||||
|
),
|
||||||
|
timetableNameMode: $checkedConvert(
|
||||||
|
'timetableNameMode',
|
||||||
|
(v) => $enumDecode(_$TimetableNameModeEnumMap, v),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$TimetableSettingsToJson(
|
Map<String, dynamic> _$TimetableSettingsToJson(
|
||||||
TimetableSettings instance,
|
TimetableSettings instance,
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class _ChatBubbleState extends State<ChatBubble>
|
|||||||
case GetRoomResponseObjectMessageType.comment:
|
case GetRoomResponseObjectMessageType.comment:
|
||||||
case GetRoomResponseObjectMessageType.voiceMessage:
|
case GetRoomResponseObjectMessageType.voiceMessage:
|
||||||
case GetRoomResponseObjectMessageType.command:
|
case GetRoomResponseObjectMessageType.command:
|
||||||
|
case GetRoomResponseObjectMessageType.unknown:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import '../../../../api/marianumcloud/talk/actions/talk_actions.dart';
|
import '../../../../api/marianumcloud/talk/actions/talk_actions.dart';
|
||||||
|
import '../../../../api/marianumcloud/talk/chat/get_chat_response.dart';
|
||||||
import '../../../../api/marianumcloud/talk/chat/rich_object_string_processor.dart';
|
import '../../../../api/marianumcloud/talk/chat/rich_object_string_processor.dart';
|
||||||
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
||||||
import '../../../../api/marianumcloud/talk/room/notification_level.dart';
|
import '../../../../api/marianumcloud/talk/room/notification_level.dart';
|
||||||
@@ -69,8 +70,7 @@ class _ChatTileState extends State<ChatTile> {
|
|||||||
/// Memoised per last message: the tile rebuilds on every chat-list emit and
|
/// Memoised per last message: the tile rebuilds on every chat-list emit and
|
||||||
/// the Markdown strip is a full parse. Keyed by content, since every refresh
|
/// the Markdown strip is a full parse. Keyed by content, since every refresh
|
||||||
/// delivers new message objects.
|
/// delivers new message objects.
|
||||||
String _lastMessagePreview() {
|
String _lastMessagePreview(GetChatResponseObject last) {
|
||||||
final last = widget.data.lastMessage;
|
|
||||||
final key = (last.id, last.message, last.markdown);
|
final key = (last.id, last.message, last.markdown);
|
||||||
if (key == _previewFor) return _preview;
|
if (key == _previewFor) return _preview;
|
||||||
final text = RichObjectStringProcessor.parseToString(
|
final text = RichObjectStringProcessor.parseToString(
|
||||||
@@ -84,9 +84,16 @@ class _ChatTileState extends State<ChatTile> {
|
|||||||
Object? _previewFor;
|
Object? _previewFor;
|
||||||
String _preview = '';
|
String _preview = '';
|
||||||
|
|
||||||
|
String _subtitle() {
|
||||||
|
final last = widget.data.lastMessage;
|
||||||
|
if (last == null) return 'Noch keine Nachrichten';
|
||||||
|
return '${last.sentAt.formatRelative()}: ${_lastMessagePreview(last)}';
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _setCurrentAsRead() async {
|
Future<void> _setCurrentAsRead() async {
|
||||||
final token = widget.data.token;
|
final token = widget.data.token;
|
||||||
final lastId = widget.data.lastMessage.id;
|
final lastId = widget.data.lastMessage?.id;
|
||||||
|
if (lastId == null) return;
|
||||||
context.read<ChatListBloc>().markRoomAsRead(token, lastId);
|
context.read<ChatListBloc>().markRoomAsRead(token, lastId);
|
||||||
unawaited(NotificationTasks.clearNotificationsForChat(token));
|
unawaited(NotificationTasks.clearNotificationsForChat(token));
|
||||||
await context.read<ChatBloc>().sendServerReadMarker(token, lastId);
|
await context.read<ChatBloc>().sendServerReadMarker(token, lastId);
|
||||||
@@ -173,11 +180,7 @@ class _ChatTileState extends State<ChatTile> {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(_subtitle(), overflow: TextOverflow.ellipsis),
|
||||||
'${widget.data.lastMessage.sentAt.formatRelative()}: '
|
|
||||||
'${_lastMessagePreview()}',
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
trailing: widget.data.unreadMessages <= 0
|
trailing: widget.data.unreadMessages <= 0
|
||||||
? null
|
? null
|
||||||
: Semantics(
|
: Semantics(
|
||||||
|
|||||||
@@ -7,19 +7,31 @@ part of 'widget_data.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_WidgetLesson _$WidgetLessonFromJson(Map<String, dynamic> json) =>
|
_WidgetLesson _$WidgetLessonFromJson(Map<String, dynamic> json) =>
|
||||||
_WidgetLesson(
|
$checkedCreate('_WidgetLesson', json, ($checkedConvert) {
|
||||||
start: DateTime.parse(json['start'] as String),
|
final val = _WidgetLesson(
|
||||||
end: DateTime.parse(json['end'] as String),
|
start: $checkedConvert('start', (v) => DateTime.parse(v as String)),
|
||||||
subjectShort: json['subjectShort'] as String,
|
end: $checkedConvert('end', (v) => DateTime.parse(v as String)),
|
||||||
subjectLong: json['subjectLong'] as String?,
|
subjectShort: $checkedConvert('subjectShort', (v) => v as String),
|
||||||
room: json['room'] as String?,
|
subjectLong: $checkedConvert('subjectLong', (v) => v as String?),
|
||||||
teacher: json['teacher'] as String?,
|
room: $checkedConvert('room', (v) => v as String?),
|
||||||
originalTeacher: json['originalTeacher'] as String?,
|
teacher: $checkedConvert('teacher', (v) => v as String?),
|
||||||
status: $enumDecode(_$WidgetLessonStatusEnumMap, json['status']),
|
originalTeacher: $checkedConvert(
|
||||||
customColor: json['customColor'] as String?,
|
'originalTeacher',
|
||||||
color: json['color'] as String?,
|
(v) => v as String?,
|
||||||
siblingCount: (json['siblingCount'] as num?)?.toInt() ?? 0,
|
),
|
||||||
|
status: $checkedConvert(
|
||||||
|
'status',
|
||||||
|
(v) => $enumDecode(_$WidgetLessonStatusEnumMap, v),
|
||||||
|
),
|
||||||
|
customColor: $checkedConvert('customColor', (v) => v as String?),
|
||||||
|
color: $checkedConvert('color', (v) => v as String?),
|
||||||
|
siblingCount: $checkedConvert(
|
||||||
|
'siblingCount',
|
||||||
|
(v) => (v as num?)?.toInt() ?? 0,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$WidgetLessonToJson(_WidgetLesson instance) =>
|
Map<String, dynamic> _$WidgetLessonToJson(_WidgetLesson instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -48,13 +60,25 @@ const _$WidgetLessonStatusEnumMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_WidgetPeriod _$WidgetPeriodFromJson(Map<String, dynamic> json) =>
|
_WidgetPeriod _$WidgetPeriodFromJson(Map<String, dynamic> json) =>
|
||||||
_WidgetPeriod(
|
$checkedCreate('_WidgetPeriod', json, ($checkedConvert) {
|
||||||
name: json['name'] as String,
|
final val = _WidgetPeriod(
|
||||||
startMinutes: (json['startMinutes'] as num).toInt(),
|
name: $checkedConvert('name', (v) => v as String),
|
||||||
endMinutes: (json['endMinutes'] as num).toInt(),
|
startMinutes: $checkedConvert(
|
||||||
virtualStartMinutes: (json['virtualStartMinutes'] as num).toInt(),
|
'startMinutes',
|
||||||
virtualEndMinutes: (json['virtualEndMinutes'] as num).toInt(),
|
(v) => (v as num).toInt(),
|
||||||
|
),
|
||||||
|
endMinutes: $checkedConvert('endMinutes', (v) => (v as num).toInt()),
|
||||||
|
virtualStartMinutes: $checkedConvert(
|
||||||
|
'virtualStartMinutes',
|
||||||
|
(v) => (v as num).toInt(),
|
||||||
|
),
|
||||||
|
virtualEndMinutes: $checkedConvert(
|
||||||
|
'virtualEndMinutes',
|
||||||
|
(v) => (v as num).toInt(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$WidgetPeriodToJson(_WidgetPeriod instance) =>
|
Map<String, dynamic> _$WidgetPeriodToJson(_WidgetPeriod instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -66,11 +90,14 @@ Map<String, dynamic> _$WidgetPeriodToJson(_WidgetPeriod instance) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
_WidgetDayInfo _$WidgetDayInfoFromJson(Map<String, dynamic> json) =>
|
_WidgetDayInfo _$WidgetDayInfoFromJson(Map<String, dynamic> json) =>
|
||||||
_WidgetDayInfo(
|
$checkedCreate('_WidgetDayInfo', json, ($checkedConvert) {
|
||||||
date: DateTime.parse(json['date'] as String),
|
final val = _WidgetDayInfo(
|
||||||
isHoliday: json['isHoliday'] as bool? ?? false,
|
date: $checkedConvert('date', (v) => DateTime.parse(v as String)),
|
||||||
holidayName: json['holidayName'] as String?,
|
isHoliday: $checkedConvert('isHoliday', (v) => v as bool? ?? false),
|
||||||
|
holidayName: $checkedConvert('holidayName', (v) => v as String?),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$WidgetDayInfoToJson(_WidgetDayInfo instance) =>
|
Map<String, dynamic> _$WidgetDayInfoToJson(_WidgetDayInfo instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -79,26 +106,42 @@ Map<String, dynamic> _$WidgetDayInfoToJson(_WidgetDayInfo instance) =>
|
|||||||
'holidayName': instance.holidayName,
|
'holidayName': instance.holidayName,
|
||||||
};
|
};
|
||||||
|
|
||||||
_WidgetTimetableData _$WidgetTimetableDataFromJson(Map<String, dynamic> json) =>
|
_WidgetTimetableData _$WidgetTimetableDataFromJson(
|
||||||
_WidgetTimetableData(
|
Map<String, dynamic> json,
|
||||||
fetchedAt: DateTime.parse(json['fetchedAt'] as String),
|
) => $checkedCreate('_WidgetTimetableData', json, ($checkedConvert) {
|
||||||
anchorDate: DateTime.parse(json['anchorDate'] as String),
|
final val = _WidgetTimetableData(
|
||||||
lessons: (json['lessons'] as List<dynamic>)
|
fetchedAt: $checkedConvert('fetchedAt', (v) => DateTime.parse(v as String)),
|
||||||
|
anchorDate: $checkedConvert(
|
||||||
|
'anchorDate',
|
||||||
|
(v) => DateTime.parse(v as String),
|
||||||
|
),
|
||||||
|
lessons: $checkedConvert(
|
||||||
|
'lessons',
|
||||||
|
(v) => (v as List<dynamic>)
|
||||||
.map((e) => WidgetLesson.fromJson(e as Map<String, dynamic>))
|
.map((e) => WidgetLesson.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
periods:
|
),
|
||||||
(json['periods'] as List<dynamic>?)
|
periods: $checkedConvert(
|
||||||
|
'periods',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)
|
||||||
?.map((e) => WidgetPeriod.fromJson(e as Map<String, dynamic>))
|
?.map((e) => WidgetPeriod.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const <WidgetPeriod>[],
|
const <WidgetPeriod>[],
|
||||||
isHoliday: json['isHoliday'] as bool? ?? false,
|
),
|
||||||
holidayName: json['holidayName'] as String?,
|
isHoliday: $checkedConvert('isHoliday', (v) => v as bool? ?? false),
|
||||||
days:
|
holidayName: $checkedConvert('holidayName', (v) => v as String?),
|
||||||
(json['days'] as List<dynamic>?)
|
days: $checkedConvert(
|
||||||
|
'days',
|
||||||
|
(v) =>
|
||||||
|
(v as List<dynamic>?)
|
||||||
?.map((e) => WidgetDayInfo.fromJson(e as Map<String, dynamic>))
|
?.map((e) => WidgetDayInfo.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const <WidgetDayInfo>[],
|
const <WidgetDayInfo>[],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> _$WidgetTimetableDataToJson(
|
Map<String, dynamic> _$WidgetTimetableDataToJson(
|
||||||
_WidgetTimetableData instance,
|
_WidgetTimetableData instance,
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:marianum_mobile/api/json_lenient.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/autocomplete/autocomplete_response.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('accepts the status as object, string or empty', () {
|
||||||
|
final response = AutocompleteResponse.fromJson({
|
||||||
|
'data': [
|
||||||
|
{
|
||||||
|
'id': 'a',
|
||||||
|
'label': 'A',
|
||||||
|
'status': {'status': 'online', 'message': null},
|
||||||
|
},
|
||||||
|
{'id': 'b', 'label': 'B', 'status': ''},
|
||||||
|
{'id': 'c', 'label': 'C', 'status': 'dnd'},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
expect(response.data.map((e) => e.status), ['online', null, 'dnd']);
|
||||||
|
expect(drainDecodeWarnings(), isEmpty);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('skips an entry without id instead of failing the search', () {
|
||||||
|
final response = AutocompleteResponse.fromJson({
|
||||||
|
'data': [
|
||||||
|
{'label': 'no id'},
|
||||||
|
{'id': 'b', 'label': 'B'},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
expect(response.data.single.id, 'b');
|
||||||
|
expect(drainDecodeWarnings().single, contains('"id"'));
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/talk/get_participants/get_participants_response.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('reads inCall as a bitmask', () {
|
||||||
|
final participant = GetParticipantsResponseObject.fromJson({
|
||||||
|
'attendeeId': 1,
|
||||||
|
'actorType': 'users',
|
||||||
|
'actorId': 'u',
|
||||||
|
'displayName': 'U',
|
||||||
|
'participantType': 3,
|
||||||
|
'lastPing': 0,
|
||||||
|
'inCall': 7,
|
||||||
|
'permissions': 0,
|
||||||
|
'attendeePermissions': 0,
|
||||||
|
'sessionIds': <String>[],
|
||||||
|
});
|
||||||
|
expect(participant.isInCall, isTrue);
|
||||||
|
expect(participant.inCallWithAudio, isTrue);
|
||||||
|
expect(participant.inCallWithVideo, isTrue);
|
||||||
|
expect(participant.inCallViaPhone, isFalse);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:marianum_mobile/api/json_lenient.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/talk/chat/get_chat_response.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/talk/room/get_room_response.dart';
|
||||||
|
|
||||||
|
Map<String, dynamic> _room({bool withLastMessage = true}) => {
|
||||||
|
'id': 1,
|
||||||
|
'token': 'abc',
|
||||||
|
'type': 2,
|
||||||
|
'name': 'room',
|
||||||
|
'displayName': 'Room',
|
||||||
|
'description': '',
|
||||||
|
'participantType': 3,
|
||||||
|
'participantFlags': 0,
|
||||||
|
'readOnly': 0,
|
||||||
|
'listable': 0,
|
||||||
|
'lastPing': 0,
|
||||||
|
'sessionId': '0',
|
||||||
|
'hasPassword': false,
|
||||||
|
'hasCall': false,
|
||||||
|
'callFlag': 0,
|
||||||
|
'canStartCall': true,
|
||||||
|
'canDeleteConversation': false,
|
||||||
|
'canLeaveConversation': true,
|
||||||
|
'lastActivity': 1700000000,
|
||||||
|
'isFavorite': false,
|
||||||
|
'notificationLevel': 0,
|
||||||
|
'unreadMessages': 0,
|
||||||
|
'unreadMention': false,
|
||||||
|
'unreadMentionDirect': false,
|
||||||
|
'lastReadMessage': 0,
|
||||||
|
'lastCommonReadMessage': 0,
|
||||||
|
if (withLastMessage)
|
||||||
|
'lastMessage': {
|
||||||
|
'id': 7,
|
||||||
|
'token': 'abc',
|
||||||
|
'actorType': 'users',
|
||||||
|
'actorId': 'u',
|
||||||
|
'actorDisplayName': 'U',
|
||||||
|
'timestamp': 1700000000,
|
||||||
|
'systemMessage': '',
|
||||||
|
'messageType': 'comment',
|
||||||
|
'isReplyable': true,
|
||||||
|
'referenceId': '',
|
||||||
|
'message': 'hi',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
setUp(drainDecodeWarnings);
|
||||||
|
|
||||||
|
test('skips a room that does not parse and records class and key', () {
|
||||||
|
final broken = _room()..remove('displayName');
|
||||||
|
final response = GetRoomResponse.fromJson({
|
||||||
|
'data': [broken, _room()],
|
||||||
|
});
|
||||||
|
expect(response.data.length, 1);
|
||||||
|
final warnings = drainDecodeWarnings();
|
||||||
|
expect(warnings, hasLength(1));
|
||||||
|
expect(warnings.single, contains('GetRoomResponseObject'));
|
||||||
|
expect(warnings.single, contains('"displayName"'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('parses a room whose lastMessage the server omitted', () {
|
||||||
|
final response = GetRoomResponse.fromJson({
|
||||||
|
'data': [_room(withLastMessage: false), _room()],
|
||||||
|
});
|
||||||
|
final rooms = response.data.toList();
|
||||||
|
expect(rooms[0].lastMessage, isNull);
|
||||||
|
expect(rooms[1].lastMessage?.id, 7);
|
||||||
|
expect(drainDecodeWarnings(), isEmpty);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('maps unknown enum values to their fallbacks', () {
|
||||||
|
final room = _room()
|
||||||
|
..['type'] = 99
|
||||||
|
..['notificationLevel'] = 42;
|
||||||
|
(room['lastMessage'] as Map<String, dynamic>)
|
||||||
|
..['actorType'] = 'emails'
|
||||||
|
..['messageType'] = 'record-video'
|
||||||
|
..['messageParameters'] = {
|
||||||
|
'actor': {'type': 'deck-card', 'id': '1', 'name': 'Card'},
|
||||||
|
};
|
||||||
|
final parsed = GetRoomResponse.fromJson({
|
||||||
|
'data': [room],
|
||||||
|
}).data.single;
|
||||||
|
expect(parsed.type, GetRoomResponseObjectConversationType.unknown);
|
||||||
|
expect(
|
||||||
|
parsed.notificationLevel,
|
||||||
|
GetRoomResponseObjectParticipantNotificationLevel.defaultLevel,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
parsed.lastMessage?.actorType,
|
||||||
|
GetRoomResponseObjectMessageActorType.email,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
parsed.lastMessage?.messageType,
|
||||||
|
GetRoomResponseObjectMessageType.unknown,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
parsed.lastMessage?.messageParameters?['actor']?.type,
|
||||||
|
RichObjectStringObjectType.unknown,
|
||||||
|
);
|
||||||
|
expect(drainDecodeWarnings(), isEmpty);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('turns a deleted parent into a placeholder', () {
|
||||||
|
final room = _room();
|
||||||
|
(room['lastMessage'] as Map<String, dynamic>)['parent'] = {
|
||||||
|
'id': 3,
|
||||||
|
'deleted': true,
|
||||||
|
};
|
||||||
|
final parent = GetRoomResponse.fromJson({
|
||||||
|
'data': [room],
|
||||||
|
}).data.single.lastMessage?.parent;
|
||||||
|
expect(parent?.id, 3);
|
||||||
|
expect(
|
||||||
|
parent?.messageType,
|
||||||
|
GetRoomResponseObjectMessageType.deletedComment,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user