-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
96: feat: fixed for the issue (#30) r=myConsciousness a=myConsciousness Co-authored-by: myConsciousness <contact@shinyakato.dev> # 1. Description <!-- Provide a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change. If this is a breaking change, specify explicitly which APIs have been changed. --> ## 1.1. Checklist <!-- Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. --> - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`. - [x] I have updated/added relevant examples in `examples`. ## 1.2. Breaking Change <!-- Does your PR require users to manually update their apps to accommodate your change? If the PR is a breaking change this should be indicated with suffix "!" (for example, `feat!:`, `fix!:`). See [Conventional Commit] for details. --> - [ ] Yes, this is a breaking change. - [x] No, this is _not_ a breaking change. ## 1.3. Related Issues <!-- Provide a list of issues related to this PR from the [issue database]. Indicate which of these issues are resolved or fixed by this PR, i.e. Fixes #xxxx* !--> <!-- Links --> [issue database]: https://github.com/mastodon-dart/mastodon-api/issues [contributor guide]: https://github.com/mastodon-dart/mastodon-api/blob/main/CONTRIBUTING.md [style guide]: https://github.com/mastodon-dart/mastodon-api/blob/main/STYLEGUIDE.md [conventional commit]: https://conventionalcommits.org Co-authored-by: myConsciousness <contact@shinyakato.dev> Co-authored-by: Shinya Kato / 加藤 真也 <kato.shinya.dev@gmail.com>
- Loading branch information
Showing
17 changed files
with
1,163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2022 Kato Shinya. All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided the conditions. | ||
|
||
// ignore_for_file: invalid_annotation_target | ||
|
||
// 📦 Package imports: | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
import 'position_marker.dart'; | ||
|
||
part 'notification_snapshot.freezed.dart'; | ||
part 'notification_snapshot.g.dart'; | ||
|
||
/// Represents the last read position within a user's timelines. | ||
@freezed | ||
class NotificationSnapshot with _$NotificationSnapshot { | ||
const factory NotificationSnapshot({ | ||
/// Snapshot for notifications. | ||
@JsonKey(name: 'notifications') required PositionMarker marker, | ||
}) = _NotificationSnapshot; | ||
|
||
factory NotificationSnapshot.fromJson(Map<String, Object?> json) => | ||
_$NotificationSnapshotFromJson(json); | ||
} |
176 changes: 176 additions & 0 deletions
176
lib/src/service/entities/notification_snapshot.freezed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark | ||
|
||
part of 'notification_snapshot.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); | ||
|
||
NotificationSnapshot _$NotificationSnapshotFromJson(Map<String, dynamic> json) { | ||
return _NotificationSnapshot.fromJson(json); | ||
} | ||
|
||
/// @nodoc | ||
mixin _$NotificationSnapshot { | ||
/// Snapshot for notifications. | ||
@JsonKey(name: 'notifications') | ||
PositionMarker get marker => throw _privateConstructorUsedError; | ||
|
||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; | ||
@JsonKey(ignore: true) | ||
$NotificationSnapshotCopyWith<NotificationSnapshot> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class $NotificationSnapshotCopyWith<$Res> { | ||
factory $NotificationSnapshotCopyWith(NotificationSnapshot value, | ||
$Res Function(NotificationSnapshot) then) = | ||
_$NotificationSnapshotCopyWithImpl<$Res, NotificationSnapshot>; | ||
@useResult | ||
$Res call({@JsonKey(name: 'notifications') PositionMarker marker}); | ||
|
||
$PositionMarkerCopyWith<$Res> get marker; | ||
} | ||
|
||
/// @nodoc | ||
class _$NotificationSnapshotCopyWithImpl<$Res, | ||
$Val extends NotificationSnapshot> | ||
implements $NotificationSnapshotCopyWith<$Res> { | ||
_$NotificationSnapshotCopyWithImpl(this._value, this._then); | ||
|
||
// ignore: unused_field | ||
final $Val _value; | ||
// ignore: unused_field | ||
final $Res Function($Val) _then; | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? marker = null, | ||
}) { | ||
return _then(_value.copyWith( | ||
marker: null == marker | ||
? _value.marker | ||
: marker // ignore: cast_nullable_to_non_nullable | ||
as PositionMarker, | ||
) as $Val); | ||
} | ||
|
||
@override | ||
@pragma('vm:prefer-inline') | ||
$PositionMarkerCopyWith<$Res> get marker { | ||
return $PositionMarkerCopyWith<$Res>(_value.marker, (value) { | ||
return _then(_value.copyWith(marker: value) as $Val); | ||
}); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$$_NotificationSnapshotCopyWith<$Res> | ||
implements $NotificationSnapshotCopyWith<$Res> { | ||
factory _$$_NotificationSnapshotCopyWith(_$_NotificationSnapshot value, | ||
$Res Function(_$_NotificationSnapshot) then) = | ||
__$$_NotificationSnapshotCopyWithImpl<$Res>; | ||
@override | ||
@useResult | ||
$Res call({@JsonKey(name: 'notifications') PositionMarker marker}); | ||
|
||
@override | ||
$PositionMarkerCopyWith<$Res> get marker; | ||
} | ||
|
||
/// @nodoc | ||
class __$$_NotificationSnapshotCopyWithImpl<$Res> | ||
extends _$NotificationSnapshotCopyWithImpl<$Res, _$_NotificationSnapshot> | ||
implements _$$_NotificationSnapshotCopyWith<$Res> { | ||
__$$_NotificationSnapshotCopyWithImpl(_$_NotificationSnapshot _value, | ||
$Res Function(_$_NotificationSnapshot) _then) | ||
: super(_value, _then); | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? marker = null, | ||
}) { | ||
return _then(_$_NotificationSnapshot( | ||
marker: null == marker | ||
? _value.marker | ||
: marker // ignore: cast_nullable_to_non_nullable | ||
as PositionMarker, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
@JsonSerializable() | ||
class _$_NotificationSnapshot implements _NotificationSnapshot { | ||
const _$_NotificationSnapshot( | ||
{@JsonKey(name: 'notifications') required this.marker}); | ||
|
||
factory _$_NotificationSnapshot.fromJson(Map<String, dynamic> json) => | ||
_$$_NotificationSnapshotFromJson(json); | ||
|
||
/// Snapshot for notifications. | ||
@override | ||
@JsonKey(name: 'notifications') | ||
final PositionMarker marker; | ||
|
||
@override | ||
String toString() { | ||
return 'NotificationSnapshot(marker: $marker)'; | ||
} | ||
|
||
@override | ||
bool operator ==(dynamic other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && | ||
other is _$_NotificationSnapshot && | ||
(identical(other.marker, marker) || other.marker == marker)); | ||
} | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
int get hashCode => Object.hash(runtimeType, marker); | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
@pragma('vm:prefer-inline') | ||
_$$_NotificationSnapshotCopyWith<_$_NotificationSnapshot> get copyWith => | ||
__$$_NotificationSnapshotCopyWithImpl<_$_NotificationSnapshot>( | ||
this, _$identity); | ||
|
||
@override | ||
Map<String, dynamic> toJson() { | ||
return _$$_NotificationSnapshotToJson( | ||
this, | ||
); | ||
} | ||
} | ||
|
||
abstract class _NotificationSnapshot implements NotificationSnapshot { | ||
const factory _NotificationSnapshot( | ||
{@JsonKey(name: 'notifications') | ||
required final PositionMarker marker}) = _$_NotificationSnapshot; | ||
|
||
factory _NotificationSnapshot.fromJson(Map<String, dynamic> json) = | ||
_$_NotificationSnapshot.fromJson; | ||
|
||
@override | ||
|
||
/// Snapshot for notifications. | ||
@JsonKey(name: 'notifications') | ||
PositionMarker get marker; | ||
@override | ||
@JsonKey(ignore: true) | ||
_$$_NotificationSnapshotCopyWith<_$_NotificationSnapshot> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2022 Kato Shinya. All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided the conditions. | ||
|
||
// ignore_for_file: invalid_annotation_target | ||
|
||
// 📦 Package imports: | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'position_marker.freezed.dart'; | ||
part 'position_marker.g.dart'; | ||
|
||
/// Represents the last read position within a user's timelines. | ||
@freezed | ||
class PositionMarker with _$PositionMarker { | ||
const factory PositionMarker({ | ||
/// The ID of the most recently viewed entity. | ||
required String lastReadId, | ||
|
||
/// An incrementing counter, used for locking to prevent write conflicts. | ||
required int version, | ||
|
||
/// The timestamp of when the marker was set. | ||
required DateTime updatedAt, | ||
}) = _PositionMarker; | ||
|
||
factory PositionMarker.fromJson(Map<String, Object?> json) => | ||
_$PositionMarkerFromJson(json); | ||
} |
Oops, something went wrong.