Compare commits
24 Commits
3.5.0+150
...
60b8e2bcad
| Author | SHA1 | Date | |
|---|---|---|---|
|
60b8e2bcad
|
|||
|
504e4d55ad
|
|||
|
38a15bb62a
|
|||
|
9d03faf594
|
|||
|
fd79c11d18
|
|||
|
c4ac256896
|
|||
|
c1fc8ea3fe
|
|||
|
29574ada88
|
|||
|
7369f5d88c
|
|||
|
5b3c138ebe
|
|||
|
562bdf62e9
|
|||
|
a73672925e
|
|||
|
c585522c35
|
|||
|
6aba84e506
|
|||
|
c6f104afc7
|
|||
|
4181fd0090
|
|||
|
84bca9601a
|
|||
|
31b83b2d27
|
|||
|
dfcb089c69
|
|||
|
fe365e8c6d
|
|||
|
b5262137ad
|
|||
|
11e93314c7
|
|||
|
c8658bc0ca
|
|||
|
b2f689693b
|
@@ -1020,6 +1020,8 @@
|
|||||||
"uploadFile": "Upload File",
|
"uploadFile": "Upload File",
|
||||||
"authDeviceChallenges": "Device Usage",
|
"authDeviceChallenges": "Device Usage",
|
||||||
"authDeviceHint": "Swipe left to edit label, swipe right to logout device.",
|
"authDeviceHint": "Swipe left to edit label, swipe right to logout device.",
|
||||||
|
"authSessionLogout": "Logout Session",
|
||||||
|
"authSessionLogoutHint": "Are you sure you want to logout this session? This will terminate this specific login session.",
|
||||||
"settingsMessageDisplayStyle": "Message Display Style",
|
"settingsMessageDisplayStyle": "Message Display Style",
|
||||||
"auto": "Auto",
|
"auto": "Auto",
|
||||||
"manual": "Manual",
|
"manual": "Manual",
|
||||||
@@ -1489,5 +1491,7 @@
|
|||||||
"accountActivationAlert": "Remember to activate your account",
|
"accountActivationAlert": "Remember to activate your account",
|
||||||
"accountActivationAlertHint": "Unactivated account may leads to various of permission issues, activate your account by clicking the link we sent to your email inbox.",
|
"accountActivationAlertHint": "Unactivated account may leads to various of permission issues, activate your account by clicking the link we sent to your email inbox.",
|
||||||
"accountActivationResendHint": "Didn't see it? Try click the button below to resend one. If you need to update your email while your account was unactivated, feel free to contact our customer service.",
|
"accountActivationResendHint": "Didn't see it? Try click the button below to resend one. If you need to update your email while your account was unactivated, feel free to contact our customer service.",
|
||||||
"accountActivationResend": "Resend"
|
"accountActivationResend": "Resend",
|
||||||
|
"ipAddress": "IP Address",
|
||||||
|
"noFurtherData": "No further data"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,9 +268,9 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- record_ios (1.1.0):
|
- record_ios (1.1.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- SDWebImage (5.21.3):
|
- SDWebImage (5.21.5):
|
||||||
- SDWebImage/Core (= 5.21.3)
|
- SDWebImage/Core (= 5.21.5)
|
||||||
- SDWebImage/Core (5.21.3)
|
- SDWebImage/Core (5.21.5)
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
@@ -281,25 +281,25 @@ PODS:
|
|||||||
- sqflite_darwin (0.0.4):
|
- sqflite_darwin (0.0.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- sqlite3 (3.50.4):
|
- sqlite3 (3.51.1):
|
||||||
- sqlite3/common (= 3.50.4)
|
- sqlite3/common (= 3.51.1)
|
||||||
- sqlite3/common (3.50.4)
|
- sqlite3/common (3.51.1)
|
||||||
- sqlite3/dbstatvtab (3.50.4):
|
- sqlite3/dbstatvtab (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/fts5 (3.50.4):
|
- sqlite3/fts5 (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/math (3.50.4):
|
- sqlite3/math (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/perf-threadsafe (3.50.4):
|
- sqlite3/perf-threadsafe (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/rtree (3.50.4):
|
- sqlite3/rtree (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/session (3.50.4):
|
- sqlite3/session (3.51.1):
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3_flutter_libs (0.0.1):
|
- sqlite3_flutter_libs (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- sqlite3 (~> 3.50.4)
|
- sqlite3 (~> 3.51.1)
|
||||||
- sqlite3/dbstatvtab
|
- sqlite3/dbstatvtab
|
||||||
- sqlite3/fts5
|
- sqlite3/fts5
|
||||||
- sqlite3/math
|
- sqlite3/math
|
||||||
@@ -545,13 +545,13 @@ SPEC CHECKSUMS:
|
|||||||
protocol_handler_ios: 59f23ee71f3ec602d67902ca7f669a80957888d5
|
protocol_handler_ios: 59f23ee71f3ec602d67902ca7f669a80957888d5
|
||||||
receive_sharing_intent: 222384f00ffe7e952bbfabaa9e3967cb87e5fe00
|
receive_sharing_intent: 222384f00ffe7e952bbfabaa9e3967cb87e5fe00
|
||||||
record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374
|
record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374
|
||||||
SDWebImage: 16309af6d214ba3f77a7c6f6fdda888cb313a50a
|
SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838
|
||||||
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
|
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
|
||||||
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
||||||
sign_in_with_apple: c5dcc141574c8c54d5ac99dd2163c0c72ad22418
|
sign_in_with_apple: c5dcc141574c8c54d5ac99dd2163c0c72ad22418
|
||||||
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
|
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
|
||||||
sqlite3: 73513155ec6979715d3904ef53a8d68892d4032b
|
sqlite3: 8d708bc63e9f4ce48f0ad9d6269e478c5ced1d9b
|
||||||
sqlite3_flutter_libs: 83f8e9f5b6554077f1d93119fe20ebaa5f3a9ef1
|
sqlite3_flutter_libs: d13b8b3003f18f596e542bcb9482d105577eff41
|
||||||
super_native_extensions: b763c02dc3a8fd078389f410bf15149179020cb4
|
super_native_extensions: b763c02dc3a8fd078389f410bf15149179020cb4
|
||||||
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
||||||
syncfusion_flutter_pdfviewer: 90dc48305d2e33d4aa20681d1e98ddeda891bc14
|
syncfusion_flutter_pdfviewer: 90dc48305d2e33d4aa20681d1e98ddeda891bc14
|
||||||
|
|||||||
@@ -358,8 +358,12 @@ class AppDatabase extends _$AppDatabase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveChatRooms(List<SnChatRoom> rooms) async {
|
Future<void> saveChatRooms(
|
||||||
|
List<SnChatRoom> rooms, {
|
||||||
|
bool override = false,
|
||||||
|
}) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
|
if (override) {
|
||||||
// 1. Identify rooms to remove
|
// 1. Identify rooms to remove
|
||||||
final remoteRoomIds = rooms.map((r) => r.id).toSet();
|
final remoteRoomIds = rooms.map((r) => r.id).toSet();
|
||||||
final currentRooms = await select(chatRooms).get();
|
final currentRooms = await select(chatRooms).get();
|
||||||
@@ -369,13 +373,15 @@ class AppDatabase extends _$AppDatabase {
|
|||||||
if (idsToRemove.isNotEmpty) {
|
if (idsToRemove.isNotEmpty) {
|
||||||
final idsList = idsToRemove.toList();
|
final idsList = idsToRemove.toList();
|
||||||
// Remove messages
|
// Remove messages
|
||||||
await (delete(chatMessages)..where((t) => t.roomId.isIn(idsList))).go();
|
await (delete(chatMessages)
|
||||||
|
..where((t) => t.roomId.isIn(idsList))).go();
|
||||||
// Remove members
|
// Remove members
|
||||||
await (delete(chatMembers)
|
await (delete(chatMembers)
|
||||||
..where((t) => t.chatRoomId.isIn(idsList))).go();
|
..where((t) => t.chatRoomId.isIn(idsList))).go();
|
||||||
// Remove rooms
|
// Remove rooms
|
||||||
await (delete(chatRooms)..where((t) => t.id.isIn(idsList))).go();
|
await (delete(chatRooms)..where((t) => t.id.isIn(idsList))).go();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Upsert remote rooms
|
// 2. Upsert remote rooms
|
||||||
await batch((batch) {
|
await batch((batch) {
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ class IslandApp extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final theme = ref.watch(themeProvider);
|
final theme = ref.watch(themeProvider);
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
// Convert string theme mode to ThemeMode enum
|
// Convert string theme mode to ThemeMode enum
|
||||||
ThemeMode getThemeMode() {
|
ThemeMode getThemeMode() {
|
||||||
|
|||||||
@@ -216,20 +216,20 @@ sealed class SnAuthDevice with _$SnAuthDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class SnAuthDeviceWithChallenge with _$SnAuthDeviceWithChallenge {
|
sealed class SnAuthDeviceWithSession with _$SnAuthDeviceWithSession {
|
||||||
const factory SnAuthDeviceWithChallenge({
|
const factory SnAuthDeviceWithSession({
|
||||||
required String id,
|
required String id,
|
||||||
required String deviceId,
|
required String deviceId,
|
||||||
required String deviceName,
|
required String deviceName,
|
||||||
required String? deviceLabel,
|
required String? deviceLabel,
|
||||||
required String accountId,
|
required String accountId,
|
||||||
required int platform,
|
required int platform,
|
||||||
required List<SnAuthChallenge> challenges,
|
required List<SnAuthSession> sessions,
|
||||||
@Default(false) bool isCurrent,
|
@Default(false) bool isCurrent,
|
||||||
}) = _SnAuthDeviceWithChallengee;
|
}) = _SnAuthDeviceWithSessione;
|
||||||
|
|
||||||
factory SnAuthDeviceWithChallenge.fromJson(Map<String, dynamic> json) =>
|
factory SnAuthDeviceWithSession.fromJson(Map<String, dynamic> json) =>
|
||||||
_$SnAuthDeviceWithChallengeFromJson(json);
|
_$SnAuthDeviceWithSessionFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
|
|||||||
@@ -3068,51 +3068,51 @@ as bool,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SnAuthDeviceWithChallenge _$SnAuthDeviceWithChallengeFromJson(
|
SnAuthDeviceWithSession _$SnAuthDeviceWithSessionFromJson(
|
||||||
Map<String, dynamic> json
|
Map<String, dynamic> json
|
||||||
) {
|
) {
|
||||||
return _SnAuthDeviceWithChallengee.fromJson(
|
return _SnAuthDeviceWithSessione.fromJson(
|
||||||
json
|
json
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnAuthDeviceWithChallenge {
|
mixin _$SnAuthDeviceWithSession {
|
||||||
|
|
||||||
String get id; String get deviceId; String get deviceName; String? get deviceLabel; String get accountId; int get platform; List<SnAuthChallenge> get challenges; bool get isCurrent;
|
String get id; String get deviceId; String get deviceName; String? get deviceLabel; String get accountId; int get platform; List<SnAuthSession> get sessions; bool get isCurrent;
|
||||||
/// Create a copy of SnAuthDeviceWithChallenge
|
/// Create a copy of SnAuthDeviceWithSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnAuthDeviceWithChallengeCopyWith<SnAuthDeviceWithChallenge> get copyWith => _$SnAuthDeviceWithChallengeCopyWithImpl<SnAuthDeviceWithChallenge>(this as SnAuthDeviceWithChallenge, _$identity);
|
$SnAuthDeviceWithSessionCopyWith<SnAuthDeviceWithSession> get copyWith => _$SnAuthDeviceWithSessionCopyWithImpl<SnAuthDeviceWithSession>(this as SnAuthDeviceWithSession, _$identity);
|
||||||
|
|
||||||
/// Serializes this SnAuthDeviceWithChallenge to a JSON map.
|
/// Serializes this SnAuthDeviceWithSession to a JSON map.
|
||||||
Map<String, dynamic> toJson();
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAuthDeviceWithChallenge&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.deviceLabel, deviceLabel) || other.deviceLabel == deviceLabel)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.platform, platform) || other.platform == platform)&&const DeepCollectionEquality().equals(other.challenges, challenges)&&(identical(other.isCurrent, isCurrent) || other.isCurrent == isCurrent));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAuthDeviceWithSession&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.deviceLabel, deviceLabel) || other.deviceLabel == deviceLabel)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.platform, platform) || other.platform == platform)&&const DeepCollectionEquality().equals(other.sessions, sessions)&&(identical(other.isCurrent, isCurrent) || other.isCurrent == isCurrent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,deviceId,deviceName,deviceLabel,accountId,platform,const DeepCollectionEquality().hash(challenges),isCurrent);
|
int get hashCode => Object.hash(runtimeType,id,deviceId,deviceName,deviceLabel,accountId,platform,const DeepCollectionEquality().hash(sessions),isCurrent);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAuthDeviceWithChallenge(id: $id, deviceId: $deviceId, deviceName: $deviceName, deviceLabel: $deviceLabel, accountId: $accountId, platform: $platform, challenges: $challenges, isCurrent: $isCurrent)';
|
return 'SnAuthDeviceWithSession(id: $id, deviceId: $deviceId, deviceName: $deviceName, deviceLabel: $deviceLabel, accountId: $accountId, platform: $platform, sessions: $sessions, isCurrent: $isCurrent)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract mixin class $SnAuthDeviceWithChallengeCopyWith<$Res> {
|
abstract mixin class $SnAuthDeviceWithSessionCopyWith<$Res> {
|
||||||
factory $SnAuthDeviceWithChallengeCopyWith(SnAuthDeviceWithChallenge value, $Res Function(SnAuthDeviceWithChallenge) _then) = _$SnAuthDeviceWithChallengeCopyWithImpl;
|
factory $SnAuthDeviceWithSessionCopyWith(SnAuthDeviceWithSession value, $Res Function(SnAuthDeviceWithSession) _then) = _$SnAuthDeviceWithSessionCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthChallenge> challenges, bool isCurrent
|
String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthSession> sessions, bool isCurrent
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -3120,16 +3120,16 @@ $Res call({
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class _$SnAuthDeviceWithChallengeCopyWithImpl<$Res>
|
class _$SnAuthDeviceWithSessionCopyWithImpl<$Res>
|
||||||
implements $SnAuthDeviceWithChallengeCopyWith<$Res> {
|
implements $SnAuthDeviceWithSessionCopyWith<$Res> {
|
||||||
_$SnAuthDeviceWithChallengeCopyWithImpl(this._self, this._then);
|
_$SnAuthDeviceWithSessionCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
final SnAuthDeviceWithChallenge _self;
|
final SnAuthDeviceWithSession _self;
|
||||||
final $Res Function(SnAuthDeviceWithChallenge) _then;
|
final $Res Function(SnAuthDeviceWithSession) _then;
|
||||||
|
|
||||||
/// Create a copy of SnAuthDeviceWithChallenge
|
/// Create a copy of SnAuthDeviceWithSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceId = null,Object? deviceName = null,Object? deviceLabel = freezed,Object? accountId = null,Object? platform = null,Object? challenges = null,Object? isCurrent = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceId = null,Object? deviceName = null,Object? deviceLabel = freezed,Object? accountId = null,Object? platform = null,Object? sessions = null,Object? isCurrent = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -3137,8 +3137,8 @@ as String,deviceName: null == deviceName ? _self.deviceName : deviceName // igno
|
|||||||
as String,deviceLabel: freezed == deviceLabel ? _self.deviceLabel : deviceLabel // ignore: cast_nullable_to_non_nullable
|
as String,deviceLabel: freezed == deviceLabel ? _self.deviceLabel : deviceLabel // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as String?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,platform: null == platform ? _self.platform : platform // ignore: cast_nullable_to_non_nullable
|
as String,platform: null == platform ? _self.platform : platform // ignore: cast_nullable_to_non_nullable
|
||||||
as int,challenges: null == challenges ? _self.challenges : challenges // ignore: cast_nullable_to_non_nullable
|
as int,sessions: null == sessions ? _self.sessions : sessions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<SnAuthChallenge>,isCurrent: null == isCurrent ? _self.isCurrent : isCurrent // ignore: cast_nullable_to_non_nullable
|
as List<SnAuthSession>,isCurrent: null == isCurrent ? _self.isCurrent : isCurrent // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -3146,8 +3146,8 @@ as bool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Adds pattern-matching-related methods to [SnAuthDeviceWithChallenge].
|
/// Adds pattern-matching-related methods to [SnAuthDeviceWithSession].
|
||||||
extension SnAuthDeviceWithChallengePatterns on SnAuthDeviceWithChallenge {
|
extension SnAuthDeviceWithSessionPatterns on SnAuthDeviceWithSession {
|
||||||
/// A variant of `map` that fallback to returning `orElse`.
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
///
|
///
|
||||||
/// It is equivalent to doing:
|
/// It is equivalent to doing:
|
||||||
@@ -3160,10 +3160,10 @@ extension SnAuthDeviceWithChallengePatterns on SnAuthDeviceWithChallenge {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SnAuthDeviceWithChallengee value)? $default,{required TResult orElse(),}){
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SnAuthDeviceWithSessione value)? $default,{required TResult orElse(),}){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee() when $default != null:
|
case _SnAuthDeviceWithSessione() when $default != null:
|
||||||
return $default(_that);case _:
|
return $default(_that);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
@@ -3182,10 +3182,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SnAuthDeviceWithChallengee value) $default,){
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SnAuthDeviceWithSessione value) $default,){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee():
|
case _SnAuthDeviceWithSessione():
|
||||||
return $default(_that);}
|
return $default(_that);}
|
||||||
}
|
}
|
||||||
/// A variant of `map` that fallback to returning `null`.
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
@@ -3200,10 +3200,10 @@ return $default(_that);}
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SnAuthDeviceWithChallengee value)? $default,){
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SnAuthDeviceWithSessione value)? $default,){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee() when $default != null:
|
case _SnAuthDeviceWithSessione() when $default != null:
|
||||||
return $default(_that);case _:
|
return $default(_that);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -3221,10 +3221,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthChallenge> challenges, bool isCurrent)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthSession> sessions, bool isCurrent)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee() when $default != null:
|
case _SnAuthDeviceWithSessione() when $default != null:
|
||||||
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.challenges,_that.isCurrent);case _:
|
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.sessions,_that.isCurrent);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3242,10 +3242,10 @@ return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthChallenge> challenges, bool isCurrent) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthSession> sessions, bool isCurrent) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee():
|
case _SnAuthDeviceWithSessione():
|
||||||
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.challenges,_that.isCurrent);}
|
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.sessions,_that.isCurrent);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -3259,10 +3259,10 @@ return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthChallenge> challenges, bool isCurrent)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthSession> sessions, bool isCurrent)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthDeviceWithChallengee() when $default != null:
|
case _SnAuthDeviceWithSessione() when $default != null:
|
||||||
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.challenges,_that.isCurrent);case _:
|
return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that.accountId,_that.platform,_that.sessions,_that.isCurrent);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3273,9 +3273,9 @@ return $default(_that.id,_that.deviceId,_that.deviceName,_that.deviceLabel,_that
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnAuthDeviceWithChallengee implements SnAuthDeviceWithChallenge {
|
class _SnAuthDeviceWithSessione implements SnAuthDeviceWithSession {
|
||||||
const _SnAuthDeviceWithChallengee({required this.id, required this.deviceId, required this.deviceName, required this.deviceLabel, required this.accountId, required this.platform, required final List<SnAuthChallenge> challenges, this.isCurrent = false}): _challenges = challenges;
|
const _SnAuthDeviceWithSessione({required this.id, required this.deviceId, required this.deviceName, required this.deviceLabel, required this.accountId, required this.platform, required final List<SnAuthSession> sessions, this.isCurrent = false}): _sessions = sessions;
|
||||||
factory _SnAuthDeviceWithChallengee.fromJson(Map<String, dynamic> json) => _$SnAuthDeviceWithChallengeeFromJson(json);
|
factory _SnAuthDeviceWithSessione.fromJson(Map<String, dynamic> json) => _$SnAuthDeviceWithSessioneFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@override final String deviceId;
|
@override final String deviceId;
|
||||||
@@ -3283,49 +3283,49 @@ class _SnAuthDeviceWithChallengee implements SnAuthDeviceWithChallenge {
|
|||||||
@override final String? deviceLabel;
|
@override final String? deviceLabel;
|
||||||
@override final String accountId;
|
@override final String accountId;
|
||||||
@override final int platform;
|
@override final int platform;
|
||||||
final List<SnAuthChallenge> _challenges;
|
final List<SnAuthSession> _sessions;
|
||||||
@override List<SnAuthChallenge> get challenges {
|
@override List<SnAuthSession> get sessions {
|
||||||
if (_challenges is EqualUnmodifiableListView) return _challenges;
|
if (_sessions is EqualUnmodifiableListView) return _sessions;
|
||||||
// ignore: implicit_dynamic_type
|
// ignore: implicit_dynamic_type
|
||||||
return EqualUnmodifiableListView(_challenges);
|
return EqualUnmodifiableListView(_sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override@JsonKey() final bool isCurrent;
|
@override@JsonKey() final bool isCurrent;
|
||||||
|
|
||||||
/// Create a copy of SnAuthDeviceWithChallenge
|
/// Create a copy of SnAuthDeviceWithSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$SnAuthDeviceWithChallengeeCopyWith<_SnAuthDeviceWithChallengee> get copyWith => __$SnAuthDeviceWithChallengeeCopyWithImpl<_SnAuthDeviceWithChallengee>(this, _$identity);
|
_$SnAuthDeviceWithSessioneCopyWith<_SnAuthDeviceWithSessione> get copyWith => __$SnAuthDeviceWithSessioneCopyWithImpl<_SnAuthDeviceWithSessione>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return _$SnAuthDeviceWithChallengeeToJson(this, );
|
return _$SnAuthDeviceWithSessioneToJson(this, );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAuthDeviceWithChallengee&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.deviceLabel, deviceLabel) || other.deviceLabel == deviceLabel)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.platform, platform) || other.platform == platform)&&const DeepCollectionEquality().equals(other._challenges, _challenges)&&(identical(other.isCurrent, isCurrent) || other.isCurrent == isCurrent));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAuthDeviceWithSessione&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.deviceLabel, deviceLabel) || other.deviceLabel == deviceLabel)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.platform, platform) || other.platform == platform)&&const DeepCollectionEquality().equals(other._sessions, _sessions)&&(identical(other.isCurrent, isCurrent) || other.isCurrent == isCurrent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,deviceId,deviceName,deviceLabel,accountId,platform,const DeepCollectionEquality().hash(_challenges),isCurrent);
|
int get hashCode => Object.hash(runtimeType,id,deviceId,deviceName,deviceLabel,accountId,platform,const DeepCollectionEquality().hash(_sessions),isCurrent);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAuthDeviceWithChallenge(id: $id, deviceId: $deviceId, deviceName: $deviceName, deviceLabel: $deviceLabel, accountId: $accountId, platform: $platform, challenges: $challenges, isCurrent: $isCurrent)';
|
return 'SnAuthDeviceWithSession(id: $id, deviceId: $deviceId, deviceName: $deviceName, deviceLabel: $deviceLabel, accountId: $accountId, platform: $platform, sessions: $sessions, isCurrent: $isCurrent)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract mixin class _$SnAuthDeviceWithChallengeeCopyWith<$Res> implements $SnAuthDeviceWithChallengeCopyWith<$Res> {
|
abstract mixin class _$SnAuthDeviceWithSessioneCopyWith<$Res> implements $SnAuthDeviceWithSessionCopyWith<$Res> {
|
||||||
factory _$SnAuthDeviceWithChallengeeCopyWith(_SnAuthDeviceWithChallengee value, $Res Function(_SnAuthDeviceWithChallengee) _then) = __$SnAuthDeviceWithChallengeeCopyWithImpl;
|
factory _$SnAuthDeviceWithSessioneCopyWith(_SnAuthDeviceWithSessione value, $Res Function(_SnAuthDeviceWithSessione) _then) = __$SnAuthDeviceWithSessioneCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthChallenge> challenges, bool isCurrent
|
String id, String deviceId, String deviceName, String? deviceLabel, String accountId, int platform, List<SnAuthSession> sessions, bool isCurrent
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -3333,25 +3333,25 @@ $Res call({
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$SnAuthDeviceWithChallengeeCopyWithImpl<$Res>
|
class __$SnAuthDeviceWithSessioneCopyWithImpl<$Res>
|
||||||
implements _$SnAuthDeviceWithChallengeeCopyWith<$Res> {
|
implements _$SnAuthDeviceWithSessioneCopyWith<$Res> {
|
||||||
__$SnAuthDeviceWithChallengeeCopyWithImpl(this._self, this._then);
|
__$SnAuthDeviceWithSessioneCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
final _SnAuthDeviceWithChallengee _self;
|
final _SnAuthDeviceWithSessione _self;
|
||||||
final $Res Function(_SnAuthDeviceWithChallengee) _then;
|
final $Res Function(_SnAuthDeviceWithSessione) _then;
|
||||||
|
|
||||||
/// Create a copy of SnAuthDeviceWithChallenge
|
/// Create a copy of SnAuthDeviceWithSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceId = null,Object? deviceName = null,Object? deviceLabel = freezed,Object? accountId = null,Object? platform = null,Object? challenges = null,Object? isCurrent = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceId = null,Object? deviceName = null,Object? deviceLabel = freezed,Object? accountId = null,Object? platform = null,Object? sessions = null,Object? isCurrent = null,}) {
|
||||||
return _then(_SnAuthDeviceWithChallengee(
|
return _then(_SnAuthDeviceWithSessione(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
|
as String,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,deviceLabel: freezed == deviceLabel ? _self.deviceLabel : deviceLabel // ignore: cast_nullable_to_non_nullable
|
as String,deviceLabel: freezed == deviceLabel ? _self.deviceLabel : deviceLabel // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as String?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,platform: null == platform ? _self.platform : platform // ignore: cast_nullable_to_non_nullable
|
as String,platform: null == platform ? _self.platform : platform // ignore: cast_nullable_to_non_nullable
|
||||||
as int,challenges: null == challenges ? _self._challenges : challenges // ignore: cast_nullable_to_non_nullable
|
as int,sessions: null == sessions ? _self._sessions : sessions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<SnAuthChallenge>,isCurrent: null == isCurrent ? _self.isCurrent : isCurrent // ignore: cast_nullable_to_non_nullable
|
as List<SnAuthSession>,isCurrent: null == isCurrent ? _self.isCurrent : isCurrent // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,24 +367,24 @@ Map<String, dynamic> _$SnAuthDeviceToJson(_SnAuthDevice instance) =>
|
|||||||
'is_current': instance.isCurrent,
|
'is_current': instance.isCurrent,
|
||||||
};
|
};
|
||||||
|
|
||||||
_SnAuthDeviceWithChallengee _$SnAuthDeviceWithChallengeeFromJson(
|
_SnAuthDeviceWithSessione _$SnAuthDeviceWithSessioneFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _SnAuthDeviceWithChallengee(
|
) => _SnAuthDeviceWithSessione(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
deviceId: json['device_id'] as String,
|
deviceId: json['device_id'] as String,
|
||||||
deviceName: json['device_name'] as String,
|
deviceName: json['device_name'] as String,
|
||||||
deviceLabel: json['device_label'] as String?,
|
deviceLabel: json['device_label'] as String?,
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
platform: (json['platform'] as num).toInt(),
|
platform: (json['platform'] as num).toInt(),
|
||||||
challenges:
|
sessions:
|
||||||
(json['challenges'] as List<dynamic>)
|
(json['sessions'] as List<dynamic>)
|
||||||
.map((e) => SnAuthChallenge.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnAuthSession.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
isCurrent: json['is_current'] as bool? ?? false,
|
isCurrent: json['is_current'] as bool? ?? false,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnAuthDeviceWithChallengeeToJson(
|
Map<String, dynamic> _$SnAuthDeviceWithSessioneToJson(
|
||||||
_SnAuthDeviceWithChallengee instance,
|
_SnAuthDeviceWithSessione instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'device_id': instance.deviceId,
|
'device_id': instance.deviceId,
|
||||||
@@ -392,7 +392,7 @@ Map<String, dynamic> _$SnAuthDeviceWithChallengeeToJson(
|
|||||||
'device_label': instance.deviceLabel,
|
'device_label': instance.deviceLabel,
|
||||||
'account_id': instance.accountId,
|
'account_id': instance.accountId,
|
||||||
'platform': instance.platform,
|
'platform': instance.platform,
|
||||||
'challenges': instance.challenges.map((e) => e.toJson()).toList(),
|
'sessions': instance.sessions.map((e) => e.toJson()).toList(),
|
||||||
'is_current': instance.isCurrent,
|
'is_current': instance.isCurrent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,9 @@ sealed class SnAuthSession with _$SnAuthSession {
|
|||||||
required DateTime? expiredAt,
|
required DateTime? expiredAt,
|
||||||
required List<dynamic> audiences,
|
required List<dynamic> audiences,
|
||||||
required List<dynamic> scopes,
|
required List<dynamic> scopes,
|
||||||
required String ipAddress,
|
required String? ipAddress,
|
||||||
required String userAgent,
|
required String? userAgent,
|
||||||
|
required GeoIpLocation? location,
|
||||||
required int type,
|
required int type,
|
||||||
required String accountId,
|
required String accountId,
|
||||||
required DateTime createdAt,
|
required DateTime createdAt,
|
||||||
|
|||||||
@@ -885,7 +885,7 @@ $GeoIpLocationCopyWith<$Res>? get location {
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnAuthSession {
|
mixin _$SnAuthSession {
|
||||||
|
|
||||||
String get id; String? get label; DateTime get lastGrantedAt; DateTime? get expiredAt; List<dynamic> get audiences; List<dynamic> get scopes; String get ipAddress; String get userAgent; int get type; String get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
|
String get id; String? get label; DateTime get lastGrantedAt; DateTime? get expiredAt; List<dynamic> get audiences; List<dynamic> get scopes; String? get ipAddress; String? get userAgent; GeoIpLocation? get location; int get type; String get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
|
||||||
/// Create a copy of SnAuthSession
|
/// Create a copy of SnAuthSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -898,16 +898,16 @@ $SnAuthSessionCopyWith<SnAuthSession> get copyWith => _$SnAuthSessionCopyWithImp
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAuthSession&&(identical(other.id, id) || other.id == id)&&(identical(other.label, label) || other.label == label)&&(identical(other.lastGrantedAt, lastGrantedAt) || other.lastGrantedAt == lastGrantedAt)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&const DeepCollectionEquality().equals(other.audiences, audiences)&&const DeepCollectionEquality().equals(other.scopes, scopes)&&(identical(other.ipAddress, ipAddress) || other.ipAddress == ipAddress)&&(identical(other.userAgent, userAgent) || other.userAgent == userAgent)&&(identical(other.type, type) || other.type == type)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAuthSession&&(identical(other.id, id) || other.id == id)&&(identical(other.label, label) || other.label == label)&&(identical(other.lastGrantedAt, lastGrantedAt) || other.lastGrantedAt == lastGrantedAt)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&const DeepCollectionEquality().equals(other.audiences, audiences)&&const DeepCollectionEquality().equals(other.scopes, scopes)&&(identical(other.ipAddress, ipAddress) || other.ipAddress == ipAddress)&&(identical(other.userAgent, userAgent) || other.userAgent == userAgent)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,label,lastGrantedAt,expiredAt,const DeepCollectionEquality().hash(audiences),const DeepCollectionEquality().hash(scopes),ipAddress,userAgent,type,accountId,createdAt,updatedAt,deletedAt);
|
int get hashCode => Object.hash(runtimeType,id,label,lastGrantedAt,expiredAt,const DeepCollectionEquality().hash(audiences),const DeepCollectionEquality().hash(scopes),ipAddress,userAgent,location,type,accountId,createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAuthSession(id: $id, label: $label, lastGrantedAt: $lastGrantedAt, expiredAt: $expiredAt, audiences: $audiences, scopes: $scopes, ipAddress: $ipAddress, userAgent: $userAgent, type: $type, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
return 'SnAuthSession(id: $id, label: $label, lastGrantedAt: $lastGrantedAt, expiredAt: $expiredAt, audiences: $audiences, scopes: $scopes, ipAddress: $ipAddress, userAgent: $userAgent, location: $location, type: $type, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -918,11 +918,11 @@ abstract mixin class $SnAuthSessionCopyWith<$Res> {
|
|||||||
factory $SnAuthSessionCopyWith(SnAuthSession value, $Res Function(SnAuthSession) _then) = _$SnAuthSessionCopyWithImpl;
|
factory $SnAuthSessionCopyWith(SnAuthSession value, $Res Function(SnAuthSession) _then) = _$SnAuthSessionCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String ipAddress, String userAgent, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String? ipAddress, String? userAgent, GeoIpLocation? location, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$GeoIpLocationCopyWith<$Res>? get location;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -935,7 +935,7 @@ class _$SnAuthSessionCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnAuthSession
|
/// Create a copy of SnAuthSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? label = freezed,Object? lastGrantedAt = null,Object? expiredAt = freezed,Object? audiences = null,Object? scopes = null,Object? ipAddress = null,Object? userAgent = null,Object? type = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? label = freezed,Object? lastGrantedAt = null,Object? expiredAt = freezed,Object? audiences = null,Object? scopes = null,Object? ipAddress = freezed,Object? userAgent = freezed,Object? location = freezed,Object? type = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
as String,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -943,9 +943,10 @@ as String?,lastGrantedAt: null == lastGrantedAt ? _self.lastGrantedAt : lastGran
|
|||||||
as DateTime,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,audiences: null == audiences ? _self.audiences : audiences // ignore: cast_nullable_to_non_nullable
|
as DateTime?,audiences: null == audiences ? _self.audiences : audiences // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,scopes: null == scopes ? _self.scopes : scopes // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,scopes: null == scopes ? _self.scopes : scopes // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,ipAddress: freezed == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
|
||||||
as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable
|
as String?,userAgent: freezed == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable
|
||||||
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
|
||||||
|
as GeoIpLocation?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
as int,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as int,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -953,7 +954,19 @@ as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ign
|
|||||||
as DateTime?,
|
as DateTime?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
/// Create a copy of SnAuthSession
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GeoIpLocationCopyWith<$Res>? get location {
|
||||||
|
if (_self.location == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $GeoIpLocationCopyWith<$Res>(_self.location!, (value) {
|
||||||
|
return _then(_self.copyWith(location: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1032,10 +1045,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String ipAddress, String userAgent, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String? ipAddress, String? userAgent, GeoIpLocation? location, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthSession() when $default != null:
|
case _SnAuthSession() when $default != null:
|
||||||
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.location,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1053,10 +1066,10 @@ return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.a
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String ipAddress, String userAgent, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String? ipAddress, String? userAgent, GeoIpLocation? location, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthSession():
|
case _SnAuthSession():
|
||||||
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);}
|
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.location,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -1070,10 +1083,10 @@ return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.a
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String ipAddress, String userAgent, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String? ipAddress, String? userAgent, GeoIpLocation? location, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnAuthSession() when $default != null:
|
case _SnAuthSession() when $default != null:
|
||||||
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.audiences,_that.scopes,_that.ipAddress,_that.userAgent,_that.location,_that.type,_that.accountId,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1098,7 @@ return $default(_that.id,_that.label,_that.lastGrantedAt,_that.expiredAt,_that.a
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnAuthSession implements SnAuthSession {
|
class _SnAuthSession implements SnAuthSession {
|
||||||
const _SnAuthSession({required this.id, required this.label, required this.lastGrantedAt, required this.expiredAt, required final List<dynamic> audiences, required final List<dynamic> scopes, required this.ipAddress, required this.userAgent, required this.type, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt}): _audiences = audiences,_scopes = scopes;
|
const _SnAuthSession({required this.id, required this.label, required this.lastGrantedAt, required this.expiredAt, required final List<dynamic> audiences, required final List<dynamic> scopes, required this.ipAddress, required this.userAgent, required this.location, required this.type, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt}): _audiences = audiences,_scopes = scopes;
|
||||||
factory _SnAuthSession.fromJson(Map<String, dynamic> json) => _$SnAuthSessionFromJson(json);
|
factory _SnAuthSession.fromJson(Map<String, dynamic> json) => _$SnAuthSessionFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@@ -1106,8 +1119,9 @@ class _SnAuthSession implements SnAuthSession {
|
|||||||
return EqualUnmodifiableListView(_scopes);
|
return EqualUnmodifiableListView(_scopes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override final String ipAddress;
|
@override final String? ipAddress;
|
||||||
@override final String userAgent;
|
@override final String? userAgent;
|
||||||
|
@override final GeoIpLocation? location;
|
||||||
@override final int type;
|
@override final int type;
|
||||||
@override final String accountId;
|
@override final String accountId;
|
||||||
@override final DateTime createdAt;
|
@override final DateTime createdAt;
|
||||||
@@ -1127,16 +1141,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAuthSession&&(identical(other.id, id) || other.id == id)&&(identical(other.label, label) || other.label == label)&&(identical(other.lastGrantedAt, lastGrantedAt) || other.lastGrantedAt == lastGrantedAt)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&const DeepCollectionEquality().equals(other._audiences, _audiences)&&const DeepCollectionEquality().equals(other._scopes, _scopes)&&(identical(other.ipAddress, ipAddress) || other.ipAddress == ipAddress)&&(identical(other.userAgent, userAgent) || other.userAgent == userAgent)&&(identical(other.type, type) || other.type == type)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAuthSession&&(identical(other.id, id) || other.id == id)&&(identical(other.label, label) || other.label == label)&&(identical(other.lastGrantedAt, lastGrantedAt) || other.lastGrantedAt == lastGrantedAt)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&const DeepCollectionEquality().equals(other._audiences, _audiences)&&const DeepCollectionEquality().equals(other._scopes, _scopes)&&(identical(other.ipAddress, ipAddress) || other.ipAddress == ipAddress)&&(identical(other.userAgent, userAgent) || other.userAgent == userAgent)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,label,lastGrantedAt,expiredAt,const DeepCollectionEquality().hash(_audiences),const DeepCollectionEquality().hash(_scopes),ipAddress,userAgent,type,accountId,createdAt,updatedAt,deletedAt);
|
int get hashCode => Object.hash(runtimeType,id,label,lastGrantedAt,expiredAt,const DeepCollectionEquality().hash(_audiences),const DeepCollectionEquality().hash(_scopes),ipAddress,userAgent,location,type,accountId,createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAuthSession(id: $id, label: $label, lastGrantedAt: $lastGrantedAt, expiredAt: $expiredAt, audiences: $audiences, scopes: $scopes, ipAddress: $ipAddress, userAgent: $userAgent, type: $type, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
return 'SnAuthSession(id: $id, label: $label, lastGrantedAt: $lastGrantedAt, expiredAt: $expiredAt, audiences: $audiences, scopes: $scopes, ipAddress: $ipAddress, userAgent: $userAgent, location: $location, type: $type, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1147,11 +1161,11 @@ abstract mixin class _$SnAuthSessionCopyWith<$Res> implements $SnAuthSessionCopy
|
|||||||
factory _$SnAuthSessionCopyWith(_SnAuthSession value, $Res Function(_SnAuthSession) _then) = __$SnAuthSessionCopyWithImpl;
|
factory _$SnAuthSessionCopyWith(_SnAuthSession value, $Res Function(_SnAuthSession) _then) = __$SnAuthSessionCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String ipAddress, String userAgent, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
String id, String? label, DateTime lastGrantedAt, DateTime? expiredAt, List<dynamic> audiences, List<dynamic> scopes, String? ipAddress, String? userAgent, GeoIpLocation? location, int type, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $GeoIpLocationCopyWith<$Res>? get location;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -1164,7 +1178,7 @@ class __$SnAuthSessionCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnAuthSession
|
/// Create a copy of SnAuthSession
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? label = freezed,Object? lastGrantedAt = null,Object? expiredAt = freezed,Object? audiences = null,Object? scopes = null,Object? ipAddress = null,Object? userAgent = null,Object? type = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? label = freezed,Object? lastGrantedAt = null,Object? expiredAt = freezed,Object? audiences = null,Object? scopes = null,Object? ipAddress = freezed,Object? userAgent = freezed,Object? location = freezed,Object? type = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
return _then(_SnAuthSession(
|
return _then(_SnAuthSession(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
as String,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -1172,9 +1186,10 @@ as String?,lastGrantedAt: null == lastGrantedAt ? _self.lastGrantedAt : lastGran
|
|||||||
as DateTime,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,audiences: null == audiences ? _self._audiences : audiences // ignore: cast_nullable_to_non_nullable
|
as DateTime?,audiences: null == audiences ? _self._audiences : audiences // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,scopes: null == scopes ? _self._scopes : scopes // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,scopes: null == scopes ? _self._scopes : scopes // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,ipAddress: freezed == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
|
||||||
as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable
|
as String?,userAgent: freezed == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable
|
||||||
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
|
||||||
|
as GeoIpLocation?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
as int,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as int,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -1183,7 +1198,19 @@ as DateTime?,
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SnAuthSession
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GeoIpLocationCopyWith<$Res>? get location {
|
||||||
|
if (_self.location == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $GeoIpLocationCopyWith<$Res>(_self.location!, (value) {
|
||||||
|
return _then(_self.copyWith(location: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,8 +96,14 @@ _SnAuthSession _$SnAuthSessionFromJson(Map<String, dynamic> json) =>
|
|||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
audiences: json['audiences'] as List<dynamic>,
|
audiences: json['audiences'] as List<dynamic>,
|
||||||
scopes: json['scopes'] as List<dynamic>,
|
scopes: json['scopes'] as List<dynamic>,
|
||||||
ipAddress: json['ip_address'] as String,
|
ipAddress: json['ip_address'] as String?,
|
||||||
userAgent: json['user_agent'] as String,
|
userAgent: json['user_agent'] as String?,
|
||||||
|
location:
|
||||||
|
json['location'] == null
|
||||||
|
? null
|
||||||
|
: GeoIpLocation.fromJson(
|
||||||
|
json['location'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
@@ -118,6 +124,7 @@ Map<String, dynamic> _$SnAuthSessionToJson(_SnAuthSession instance) =>
|
|||||||
'scopes': instance.scopes,
|
'scopes': instance.scopes,
|
||||||
'ip_address': instance.ipAddress,
|
'ip_address': instance.ipAddress,
|
||||||
'user_agent': instance.userAgent,
|
'user_agent': instance.userAgent,
|
||||||
|
'location': instance.location?.toJson(),
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
'account_id': instance.accountId,
|
'account_id': instance.accountId,
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ sealed class SnStickerPack with _$SnStickerPack {
|
|||||||
required String description,
|
required String description,
|
||||||
required String prefix,
|
required String prefix,
|
||||||
required String publisherId,
|
required String publisherId,
|
||||||
|
required SnCloudFile? icon,
|
||||||
required SnPublisher? publisher,
|
required SnPublisher? publisher,
|
||||||
required DateTime createdAt,
|
required DateTime createdAt,
|
||||||
required DateTime updatedAt,
|
required DateTime updatedAt,
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ $SnStickerPackCopyWith<$Res>? get pack {
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnStickerPack {
|
mixin _$SnStickerPack {
|
||||||
|
|
||||||
String get id; String get name; String get description; String get prefix; String get publisherId; SnPublisher? get publisher; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; List<SnSticker> get stickers;
|
String get id; String get name; String get description; String get prefix; String get publisherId; SnCloudFile? get icon; SnPublisher? get publisher; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; List<SnSticker> get stickers;
|
||||||
/// Create a copy of SnStickerPack
|
/// Create a copy of SnStickerPack
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -348,16 +348,16 @@ $SnStickerPackCopyWith<SnStickerPack> get copyWith => _$SnStickerPackCopyWithImp
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnStickerPack&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.prefix, prefix) || other.prefix == prefix)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other.stickers, stickers));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnStickerPack&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.prefix, prefix) || other.prefix == prefix)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other.stickers, stickers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,name,description,prefix,publisherId,publisher,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(stickers));
|
int get hashCode => Object.hash(runtimeType,id,name,description,prefix,publisherId,icon,publisher,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(stickers));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnStickerPack(id: $id, name: $name, description: $description, prefix: $prefix, publisherId: $publisherId, publisher: $publisher, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, stickers: $stickers)';
|
return 'SnStickerPack(id: $id, name: $name, description: $description, prefix: $prefix, publisherId: $publisherId, icon: $icon, publisher: $publisher, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, stickers: $stickers)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -368,11 +368,11 @@ abstract mixin class $SnStickerPackCopyWith<$Res> {
|
|||||||
factory $SnStickerPackCopyWith(SnStickerPack value, $Res Function(SnStickerPack) _then) = _$SnStickerPackCopyWithImpl;
|
factory $SnStickerPackCopyWith(SnStickerPack value, $Res Function(SnStickerPack) _then) = _$SnStickerPackCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String description, String prefix, String publisherId, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers
|
String id, String name, String description, String prefix, String publisherId, SnCloudFile? icon, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$SnPublisherCopyWith<$Res>? get publisher;
|
$SnCloudFileCopyWith<$Res>? get icon;$SnPublisherCopyWith<$Res>? get publisher;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -385,14 +385,15 @@ class _$SnStickerPackCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnStickerPack
|
/// Create a copy of SnStickerPack
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = null,Object? prefix = null,Object? publisherId = null,Object? publisher = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? stickers = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = null,Object? prefix = null,Object? publisherId = null,Object? icon = freezed,Object? publisher = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? stickers = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,prefix: null == prefix ? _self.prefix : prefix // ignore: cast_nullable_to_non_nullable
|
as String,prefix: null == prefix ? _self.prefix : prefix // ignore: cast_nullable_to_non_nullable
|
||||||
as String,publisherId: null == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
as String,publisherId: null == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
as String,icon: freezed == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnCloudFile?,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPublisher?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
as SnPublisher?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -404,6 +405,18 @@ as List<SnSticker>,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnCloudFileCopyWith<$Res>? get icon {
|
||||||
|
if (_self.icon == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnCloudFileCopyWith<$Res>(_self.icon!, (value) {
|
||||||
|
return _then(_self.copyWith(icon: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of SnStickerPack
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
$SnPublisherCopyWith<$Res>? get publisher {
|
$SnPublisherCopyWith<$Res>? get publisher {
|
||||||
if (_self.publisher == null) {
|
if (_self.publisher == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -491,10 +504,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String description, String prefix, String publisherId, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String description, String prefix, String publisherId, SnCloudFile? icon, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnStickerPack() when $default != null:
|
case _SnStickerPack() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);case _:
|
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.icon,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -512,10 +525,10 @@ return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publish
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String description, String prefix, String publisherId, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String description, String prefix, String publisherId, SnCloudFile? icon, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnStickerPack():
|
case _SnStickerPack():
|
||||||
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);}
|
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.icon,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -529,10 +542,10 @@ return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publish
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String description, String prefix, String publisherId, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String description, String prefix, String publisherId, SnCloudFile? icon, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnStickerPack() when $default != null:
|
case _SnStickerPack() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);case _:
|
return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publisherId,_that.icon,_that.publisher,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.stickers);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -544,7 +557,7 @@ return $default(_that.id,_that.name,_that.description,_that.prefix,_that.publish
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnStickerPack implements SnStickerPack {
|
class _SnStickerPack implements SnStickerPack {
|
||||||
const _SnStickerPack({required this.id, required this.name, required this.description, required this.prefix, required this.publisherId, required this.publisher, required this.createdAt, required this.updatedAt, required this.deletedAt, final List<SnSticker> stickers = const []}): _stickers = stickers;
|
const _SnStickerPack({required this.id, required this.name, required this.description, required this.prefix, required this.publisherId, required this.icon, required this.publisher, required this.createdAt, required this.updatedAt, required this.deletedAt, final List<SnSticker> stickers = const []}): _stickers = stickers;
|
||||||
factory _SnStickerPack.fromJson(Map<String, dynamic> json) => _$SnStickerPackFromJson(json);
|
factory _SnStickerPack.fromJson(Map<String, dynamic> json) => _$SnStickerPackFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@@ -552,6 +565,7 @@ class _SnStickerPack implements SnStickerPack {
|
|||||||
@override final String description;
|
@override final String description;
|
||||||
@override final String prefix;
|
@override final String prefix;
|
||||||
@override final String publisherId;
|
@override final String publisherId;
|
||||||
|
@override final SnCloudFile? icon;
|
||||||
@override final SnPublisher? publisher;
|
@override final SnPublisher? publisher;
|
||||||
@override final DateTime createdAt;
|
@override final DateTime createdAt;
|
||||||
@override final DateTime updatedAt;
|
@override final DateTime updatedAt;
|
||||||
@@ -577,16 +591,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnStickerPack&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.prefix, prefix) || other.prefix == prefix)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other._stickers, _stickers));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnStickerPack&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.prefix, prefix) || other.prefix == prefix)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other._stickers, _stickers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,name,description,prefix,publisherId,publisher,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(_stickers));
|
int get hashCode => Object.hash(runtimeType,id,name,description,prefix,publisherId,icon,publisher,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(_stickers));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnStickerPack(id: $id, name: $name, description: $description, prefix: $prefix, publisherId: $publisherId, publisher: $publisher, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, stickers: $stickers)';
|
return 'SnStickerPack(id: $id, name: $name, description: $description, prefix: $prefix, publisherId: $publisherId, icon: $icon, publisher: $publisher, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, stickers: $stickers)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -597,11 +611,11 @@ abstract mixin class _$SnStickerPackCopyWith<$Res> implements $SnStickerPackCopy
|
|||||||
factory _$SnStickerPackCopyWith(_SnStickerPack value, $Res Function(_SnStickerPack) _then) = __$SnStickerPackCopyWithImpl;
|
factory _$SnStickerPackCopyWith(_SnStickerPack value, $Res Function(_SnStickerPack) _then) = __$SnStickerPackCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String description, String prefix, String publisherId, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers
|
String id, String name, String description, String prefix, String publisherId, SnCloudFile? icon, SnPublisher? publisher, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List<SnSticker> stickers
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $SnPublisherCopyWith<$Res>? get publisher;
|
@override $SnCloudFileCopyWith<$Res>? get icon;@override $SnPublisherCopyWith<$Res>? get publisher;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -614,14 +628,15 @@ class __$SnStickerPackCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnStickerPack
|
/// Create a copy of SnStickerPack
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = null,Object? prefix = null,Object? publisherId = null,Object? publisher = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? stickers = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = null,Object? prefix = null,Object? publisherId = null,Object? icon = freezed,Object? publisher = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? stickers = null,}) {
|
||||||
return _then(_SnStickerPack(
|
return _then(_SnStickerPack(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,prefix: null == prefix ? _self.prefix : prefix // ignore: cast_nullable_to_non_nullable
|
as String,prefix: null == prefix ? _self.prefix : prefix // ignore: cast_nullable_to_non_nullable
|
||||||
as String,publisherId: null == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
as String,publisherId: null == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
as String,icon: freezed == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnCloudFile?,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPublisher?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
as SnPublisher?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -634,6 +649,18 @@ as List<SnSticker>,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnCloudFileCopyWith<$Res>? get icon {
|
||||||
|
if (_self.icon == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnCloudFileCopyWith<$Res>(_self.icon!, (value) {
|
||||||
|
return _then(_self.copyWith(icon: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of SnStickerPack
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
$SnPublisherCopyWith<$Res>? get publisher {
|
$SnPublisherCopyWith<$Res>? get publisher {
|
||||||
if (_self.publisher == null) {
|
if (_self.publisher == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ _SnStickerPack _$SnStickerPackFromJson(Map<String, dynamic> json) =>
|
|||||||
description: json['description'] as String,
|
description: json['description'] as String,
|
||||||
prefix: json['prefix'] as String,
|
prefix: json['prefix'] as String,
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
|
icon:
|
||||||
|
json['icon'] == null
|
||||||
|
? null
|
||||||
|
: SnCloudFile.fromJson(json['icon'] as Map<String, dynamic>),
|
||||||
publisher:
|
publisher:
|
||||||
json['publisher'] == null
|
json['publisher'] == null
|
||||||
? null
|
? null
|
||||||
@@ -66,6 +70,7 @@ Map<String, dynamic> _$SnStickerPackToJson(_SnStickerPack instance) =>
|
|||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'prefix': instance.prefix,
|
'prefix': instance.prefix,
|
||||||
'publisher_id': instance.publisherId,
|
'publisher_id': instance.publisherId,
|
||||||
|
'icon': instance.icon?.toJson(),
|
||||||
'publisher': instance.publisher?.toJson(),
|
'publisher': instance.publisher?.toJson(),
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
'updated_at': instance.updatedAt.toIso8601String(),
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
|||||||
@@ -330,13 +330,127 @@ class ServerState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerStateNotifier extends StateNotifier<ServerState> {
|
class ServerStateNotifier extends Notifier<ServerState> {
|
||||||
final ActivityRpcServer server;
|
late final ActivityRpcServer server;
|
||||||
final Dio apiClient;
|
late final Dio apiClient;
|
||||||
Timer? _renewalTimer;
|
Timer? _renewalTimer;
|
||||||
|
|
||||||
ServerStateNotifier(this.apiClient, this.server)
|
@override
|
||||||
: super(ServerState(status: 'Server not started'));
|
ServerState build() {
|
||||||
|
apiClient = ref.watch(apiClientProvider);
|
||||||
|
server = ActivityRpcServer({});
|
||||||
|
_setupHandlers();
|
||||||
|
ref.onDispose(() {
|
||||||
|
_stopRenewal();
|
||||||
|
server.stop();
|
||||||
|
});
|
||||||
|
return ServerState(status: 'Server not started');
|
||||||
|
}
|
||||||
|
|
||||||
|
void _setupHandlers() {
|
||||||
|
server.updateHandlers({
|
||||||
|
'connection': (socket) {
|
||||||
|
final clientId =
|
||||||
|
socket is _WsSocketWrapper
|
||||||
|
? socket.clientId
|
||||||
|
: (socket as IpcSocketWrapper).clientId;
|
||||||
|
updateStatus('Client connected (ID: $clientId)');
|
||||||
|
socket.send({
|
||||||
|
'cmd': 'DISPATCH',
|
||||||
|
'data': {
|
||||||
|
'v': 1,
|
||||||
|
'config': {
|
||||||
|
'cdn_host': 'fake.cdn',
|
||||||
|
'api_endpoint': '//fake.api',
|
||||||
|
'environment': 'dev',
|
||||||
|
},
|
||||||
|
'user': {
|
||||||
|
'id': 'fake_user_id',
|
||||||
|
'username': 'FakeUser',
|
||||||
|
'discriminator': '0001',
|
||||||
|
'avatar': null,
|
||||||
|
'bot': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'evt': 'READY',
|
||||||
|
'nonce': '12345',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'message': (socket, dynamic data) async {
|
||||||
|
if (data['cmd'] == 'SET_ACTIVITY') {
|
||||||
|
final activity = data['args']['activity'];
|
||||||
|
final appId = 'rpc:${socket.clientId}';
|
||||||
|
|
||||||
|
final currentId = currentActivityManualId;
|
||||||
|
if (currentId != null && currentId != appId) {
|
||||||
|
talker.info(
|
||||||
|
'Skipped the new SET_ACTIVITY command due to there is one existing...',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addActivity('Activity: ${activity['details'] ?? 'Untitled'}');
|
||||||
|
// https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure
|
||||||
|
final type = switch (activity['type']) {
|
||||||
|
0 => 1, // Discord Playing -> Playing
|
||||||
|
2 => 2, // Discord Music -> Listening
|
||||||
|
3 => 2, // Discord Watching -> Listening
|
||||||
|
_ => 1, // Discord Competing (or null) -> Playing
|
||||||
|
};
|
||||||
|
final title = activity['name'] ?? activity['assets']?['small_text'];
|
||||||
|
final subtitle =
|
||||||
|
activity['details'] ?? activity['assets']?['large_text'];
|
||||||
|
var imageSmall = activity['assets']?['small_image'];
|
||||||
|
var imageLarge = activity['assets']?['large_image'];
|
||||||
|
if (imageSmall != null && !imageSmall!.contains(':')) {
|
||||||
|
imageSmall = 'discord:$imageSmall';
|
||||||
|
}
|
||||||
|
if (imageLarge != null && !imageLarge!.contains(':')) {
|
||||||
|
imageLarge = 'discord:$imageLarge';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final activityData = {
|
||||||
|
'type': type,
|
||||||
|
'manual_id': appId,
|
||||||
|
'title': title,
|
||||||
|
'subtitle': subtitle,
|
||||||
|
'caption': activity['state'],
|
||||||
|
'title_url': activity['assets']?['small_text_url'],
|
||||||
|
'subtitle_url': activity['assets']?['large_text_url'],
|
||||||
|
'small_image': imageSmall,
|
||||||
|
'large_image': imageLarge,
|
||||||
|
'meta': activity,
|
||||||
|
'lease_minutes': kPresenceActivityLease,
|
||||||
|
};
|
||||||
|
|
||||||
|
await apiClient.post('/pass/activities', data: activityData);
|
||||||
|
setCurrentActivity(appId, activityData);
|
||||||
|
} catch (e) {
|
||||||
|
talker.log('Failed to set remote activity status: $e');
|
||||||
|
}
|
||||||
|
socket.send({
|
||||||
|
'cmd': 'SET_ACTIVITY',
|
||||||
|
'data': data['args']['activity'],
|
||||||
|
'evt': null,
|
||||||
|
'nonce': data['nonce'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'close': (socket) async {
|
||||||
|
updateStatus('Client disconnected');
|
||||||
|
final currentId = currentActivityManualId;
|
||||||
|
try {
|
||||||
|
await apiClient.delete(
|
||||||
|
'/pass/activities',
|
||||||
|
queryParameters: {'manualId': currentId},
|
||||||
|
);
|
||||||
|
setCurrentActivity(null, null);
|
||||||
|
} catch (e) {
|
||||||
|
talker.log('Failed to unset remote activity status: $e');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String? get currentActivityManualId => state.currentActivityManualId;
|
String? get currentActivityManualId => state.currentActivityManualId;
|
||||||
|
|
||||||
@@ -408,119 +522,8 @@ class ServerStateNotifier extends StateNotifier<ServerState> {
|
|||||||
const kPresenceActivityLease = 5;
|
const kPresenceActivityLease = 5;
|
||||||
|
|
||||||
// Providers
|
// Providers
|
||||||
final rpcServerStateProvider = StateNotifierProvider<
|
final rpcServerStateProvider =
|
||||||
ServerStateNotifier,
|
NotifierProvider<ServerStateNotifier, ServerState>(ServerStateNotifier.new);
|
||||||
ServerState
|
|
||||||
>((ref) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
final server = ActivityRpcServer({});
|
|
||||||
final notifier = ServerStateNotifier(apiClient, server);
|
|
||||||
server.updateHandlers({
|
|
||||||
'connection': (socket) {
|
|
||||||
final clientId =
|
|
||||||
socket is _WsSocketWrapper
|
|
||||||
? socket.clientId
|
|
||||||
: (socket as IpcSocketWrapper).clientId;
|
|
||||||
notifier.updateStatus('Client connected (ID: $clientId)');
|
|
||||||
socket.send({
|
|
||||||
'cmd': 'DISPATCH',
|
|
||||||
'data': {
|
|
||||||
'v': 1,
|
|
||||||
'config': {
|
|
||||||
'cdn_host': 'fake.cdn',
|
|
||||||
'api_endpoint': '//fake.api',
|
|
||||||
'environment': 'dev',
|
|
||||||
},
|
|
||||||
'user': {
|
|
||||||
'id': 'fake_user_id',
|
|
||||||
'username': 'FakeUser',
|
|
||||||
'discriminator': '0001',
|
|
||||||
'avatar': null,
|
|
||||||
'bot': false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'evt': 'READY',
|
|
||||||
'nonce': '12345',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'message': (socket, dynamic data) async {
|
|
||||||
if (data['cmd'] == 'SET_ACTIVITY') {
|
|
||||||
final activity = data['args']['activity'];
|
|
||||||
final appId = 'rpc:${socket.clientId}';
|
|
||||||
|
|
||||||
final currentId = notifier.currentActivityManualId;
|
|
||||||
if (currentId != null && currentId != appId) {
|
|
||||||
talker.info(
|
|
||||||
'Skipped the new SET_ACTIVITY command due to there is one existing...',
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
notifier.addActivity('Activity: ${activity['details'] ?? 'Untitled'}');
|
|
||||||
// https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure
|
|
||||||
final type = switch (activity['type']) {
|
|
||||||
0 => 1, // Discord Playing -> Playing
|
|
||||||
2 => 2, // Discord Music -> Listening
|
|
||||||
3 => 2, // Discord Watching -> Listening
|
|
||||||
_ => 1, // Discord Competing (or null) -> Playing
|
|
||||||
};
|
|
||||||
final title = activity['name'] ?? activity['assets']?['small_text'];
|
|
||||||
final subtitle =
|
|
||||||
activity['details'] ?? activity['assets']?['large_text'];
|
|
||||||
var imageSmall = activity['assets']?['small_image'];
|
|
||||||
var imageLarge = activity['assets']?['large_image'];
|
|
||||||
if (imageSmall != null && !imageSmall!.contains(':')) {
|
|
||||||
imageSmall = 'discord:$imageSmall';
|
|
||||||
}
|
|
||||||
if (imageLarge != null && !imageLarge!.contains(':')) {
|
|
||||||
imageLarge = 'discord:$imageLarge';
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
final activityData = {
|
|
||||||
'type': type,
|
|
||||||
'manual_id': appId,
|
|
||||||
'title': title,
|
|
||||||
'subtitle': subtitle,
|
|
||||||
'caption': activity['state'],
|
|
||||||
'title_url': activity['assets']?['small_text_url'],
|
|
||||||
'subtitle_url': activity['assets']?['large_text_url'],
|
|
||||||
'small_image': imageSmall,
|
|
||||||
'large_image': imageLarge,
|
|
||||||
'meta': activity,
|
|
||||||
'lease_minutes': kPresenceActivityLease,
|
|
||||||
};
|
|
||||||
|
|
||||||
await apiClient.post('/pass/activities', data: activityData);
|
|
||||||
notifier.setCurrentActivity(appId, activityData);
|
|
||||||
} catch (e) {
|
|
||||||
talker.log('Failed to set remote activity status: $e');
|
|
||||||
}
|
|
||||||
socket.send({
|
|
||||||
'cmd': 'SET_ACTIVITY',
|
|
||||||
'data': data['args']['activity'],
|
|
||||||
'evt': null,
|
|
||||||
'nonce': data['nonce'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'close': (socket) async {
|
|
||||||
notifier.updateStatus('Client disconnected');
|
|
||||||
final currentId = notifier.currentActivityManualId;
|
|
||||||
try {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
await apiClient.delete(
|
|
||||||
'/pass/activities',
|
|
||||||
queryParameters: {'manualId': currentId},
|
|
||||||
);
|
|
||||||
notifier.setCurrentActivity(null, null);
|
|
||||||
} catch (e) {
|
|
||||||
talker.log('Failed to unset remote activity status: $e');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return notifier;
|
|
||||||
});
|
|
||||||
|
|
||||||
final rpcServerProvider = Provider<ActivityRpcServer>((ref) {
|
final rpcServerProvider = Provider<ActivityRpcServer>((ref) {
|
||||||
final notifier = ref.watch(rpcServerStateProvider.notifier);
|
final notifier = ref.watch(rpcServerStateProvider.notifier);
|
||||||
|
|||||||
@@ -6,152 +6,83 @@ part of 'activity_rpc.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$presenceActivitiesHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
@ProviderFor(presenceActivities)
|
@ProviderFor(presenceActivities)
|
||||||
const presenceActivitiesProvider = PresenceActivitiesFamily();
|
const presenceActivitiesProvider = PresenceActivitiesFamily._();
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
final class PresenceActivitiesProvider
|
||||||
class PresenceActivitiesFamily
|
extends
|
||||||
extends Family<AsyncValue<List<SnPresenceActivity>>> {
|
$FunctionalProvider<
|
||||||
/// See also [presenceActivities].
|
AsyncValue<List<SnPresenceActivity>>,
|
||||||
const PresenceActivitiesFamily();
|
List<SnPresenceActivity>,
|
||||||
|
FutureOr<List<SnPresenceActivity>>
|
||||||
/// See also [presenceActivities].
|
>
|
||||||
PresenceActivitiesProvider call(String uname) {
|
with
|
||||||
return PresenceActivitiesProvider(uname);
|
$FutureModifier<List<SnPresenceActivity>>,
|
||||||
}
|
$FutureProvider<List<SnPresenceActivity>> {
|
||||||
|
const PresenceActivitiesProvider._({
|
||||||
@override
|
required PresenceActivitiesFamily super.from,
|
||||||
PresenceActivitiesProvider getProviderOverride(
|
required String super.argument,
|
||||||
covariant PresenceActivitiesProvider provider,
|
}) : super(
|
||||||
) {
|
retry: null,
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'presenceActivitiesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
class PresenceActivitiesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnPresenceActivity>> {
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
PresenceActivitiesProvider(String uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => presenceActivities(ref as PresenceActivitiesRef, uname),
|
|
||||||
from: presenceActivitiesProvider,
|
|
||||||
name: r'presenceActivitiesProvider',
|
name: r'presenceActivitiesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$presenceActivitiesHash,
|
|
||||||
dependencies: PresenceActivitiesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PresenceActivitiesFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PresenceActivitiesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$presenceActivitiesHash();
|
||||||
FutureOr<List<SnPresenceActivity>> Function(PresenceActivitiesRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'presenceActivitiesProvider'
|
||||||
origin: this,
|
''
|
||||||
override: PresenceActivitiesProvider._internal(
|
'($argument)';
|
||||||
(ref) => create(ref as PresenceActivitiesRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnPresenceActivity>> createElement() {
|
$FutureProviderElement<List<SnPresenceActivity>> $createElement(
|
||||||
return _PresenceActivitiesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPresenceActivity>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return presenceActivities(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PresenceActivitiesProvider && other.uname == uname;
|
return other is PresenceActivitiesProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$presenceActivitiesHash() =>
|
||||||
// ignore: unused_element
|
r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2';
|
||||||
mixin PresenceActivitiesRef
|
|
||||||
on AutoDisposeFutureProviderRef<List<SnPresenceActivity>> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PresenceActivitiesProviderElement
|
final class PresenceActivitiesFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<List<SnPresenceActivity>>
|
with $FunctionalFamilyOverride<FutureOr<List<SnPresenceActivity>>, String> {
|
||||||
with PresenceActivitiesRef {
|
const PresenceActivitiesFamily._()
|
||||||
_PresenceActivitiesProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'presenceActivitiesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PresenceActivitiesProvider call(String uname) =>
|
||||||
|
PresenceActivitiesProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get uname => (origin as PresenceActivitiesProvider).uname;
|
String toString() => r'presenceActivitiesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,19 +6,58 @@ part of 'call.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(CallNotifier)
|
||||||
|
const callProvider = CallNotifierProvider._();
|
||||||
|
|
||||||
|
final class CallNotifierProvider
|
||||||
|
extends $NotifierProvider<CallNotifier, CallState> {
|
||||||
|
const CallNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'callProvider',
|
||||||
|
isAutoDispose: false,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$callNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
CallNotifier create() => CallNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(CallState value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<CallState>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3';
|
String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3';
|
||||||
|
|
||||||
/// See also [CallNotifier].
|
abstract class _$CallNotifier extends $Notifier<CallState> {
|
||||||
@ProviderFor(CallNotifier)
|
CallState build();
|
||||||
final callNotifierProvider = NotifierProvider<CallNotifier, CallState>.internal(
|
@$mustCallSuper
|
||||||
CallNotifier.new,
|
@override
|
||||||
name: r'callNotifierProvider',
|
void runBuild() {
|
||||||
debugGetCreateSourceHash:
|
final created = build();
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$callNotifierHash,
|
final ref = this.ref as $Ref<CallState, CallState>;
|
||||||
dependencies: null,
|
final element =
|
||||||
allTransitiveDependencies: null,
|
ref.element
|
||||||
);
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<CallState, CallState>,
|
||||||
typedef _$CallNotifier = Notifier<CallState>;
|
CallState,
|
||||||
// ignore_for_file: type=lint
|
Object?,
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,163 +6,97 @@ part of 'chat_online_count.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$chatOnlineCountNotifierHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'19af8fd0e9f62c65e12a68215406776085235fa3';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$ChatOnlineCountNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<int> {
|
|
||||||
late final String chatroomId;
|
|
||||||
|
|
||||||
FutureOr<int> build(String chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
@ProviderFor(ChatOnlineCountNotifier)
|
@ProviderFor(ChatOnlineCountNotifier)
|
||||||
const chatOnlineCountNotifierProvider = ChatOnlineCountNotifierFamily();
|
const chatOnlineCountProvider = ChatOnlineCountNotifierFamily._();
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
final class ChatOnlineCountNotifierProvider
|
||||||
class ChatOnlineCountNotifierFamily extends Family<AsyncValue<int>> {
|
extends $AsyncNotifierProvider<ChatOnlineCountNotifier, int> {
|
||||||
/// See also [ChatOnlineCountNotifier].
|
const ChatOnlineCountNotifierProvider._({
|
||||||
const ChatOnlineCountNotifierFamily();
|
required ChatOnlineCountNotifierFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [ChatOnlineCountNotifier].
|
}) : super(
|
||||||
ChatOnlineCountNotifierProvider call(String chatroomId) {
|
retry: null,
|
||||||
return ChatOnlineCountNotifierProvider(chatroomId);
|
name: r'chatOnlineCountProvider',
|
||||||
}
|
isAutoDispose: true,
|
||||||
|
|
||||||
@override
|
|
||||||
ChatOnlineCountNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatOnlineCountNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatOnlineCountNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
class ChatOnlineCountNotifierProvider
|
|
||||||
extends AutoDisposeAsyncNotifierProviderImpl<ChatOnlineCountNotifier, int> {
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
ChatOnlineCountNotifierProvider(String chatroomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatOnlineCountNotifier()..chatroomId = chatroomId,
|
|
||||||
from: chatOnlineCountNotifierProvider,
|
|
||||||
name: r'chatOnlineCountNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatOnlineCountNotifierHash,
|
|
||||||
dependencies: ChatOnlineCountNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatOnlineCountNotifierFamily._allTransitiveDependencies,
|
|
||||||
chatroomId: chatroomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatOnlineCountNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.chatroomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String chatroomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<int> runNotifierBuild(covariant ChatOnlineCountNotifier notifier) {
|
|
||||||
return notifier.build(chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatOnlineCountNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatOnlineCountNotifierProvider._internal(
|
|
||||||
() => create()..chatroomId = chatroomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
chatroomId: chatroomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int>
|
String debugGetCreateSourceHash() => _$chatOnlineCountNotifierHash();
|
||||||
createElement() {
|
|
||||||
return _ChatOnlineCountNotifierProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatOnlineCountProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatOnlineCountNotifier create() => ChatOnlineCountNotifier();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is ChatOnlineCountNotifierProvider &&
|
return other is ChatOnlineCountNotifierProvider &&
|
||||||
other.chatroomId == chatroomId;
|
other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, chatroomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatOnlineCountNotifierHash() =>
|
||||||
// ignore: unused_element
|
r'19af8fd0e9f62c65e12a68215406776085235fa3';
|
||||||
mixin ChatOnlineCountNotifierRef on AutoDisposeAsyncNotifierProviderRef<int> {
|
|
||||||
/// The parameter `chatroomId` of this provider.
|
|
||||||
String get chatroomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatOnlineCountNotifierProviderElement
|
final class ChatOnlineCountNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int>
|
$ClassFamilyOverride<
|
||||||
with ChatOnlineCountNotifierRef {
|
ChatOnlineCountNotifier,
|
||||||
_ChatOnlineCountNotifierProviderElement(super.provider);
|
AsyncValue<int>,
|
||||||
|
int,
|
||||||
|
FutureOr<int>,
|
||||||
|
String
|
||||||
|
> {
|
||||||
|
const ChatOnlineCountNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatOnlineCountProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatOnlineCountNotifierProvider call(String chatroomId) =>
|
||||||
|
ChatOnlineCountNotifierProvider._(argument: chatroomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get chatroomId =>
|
String toString() => r'chatOnlineCountProvider';
|
||||||
(origin as ChatOnlineCountNotifierProvider).chatroomId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier<int> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get chatroomId => _$args;
|
||||||
|
|
||||||
|
FutureOr<int> build(String chatroomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<int>, int>,
|
||||||
|
AsyncValue<int>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
396
lib/pods/chat/chat_room.dart
Normal file
396
lib/pods/chat/chat_room.dart
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/database/drift_db.dart';
|
||||||
|
import 'package:island/models/account.dart';
|
||||||
|
import 'package:island/models/chat.dart';
|
||||||
|
import 'package:island/models/file.dart';
|
||||||
|
import 'package:island/pods/database.dart';
|
||||||
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/userinfo.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
part 'chat_room.g.dart';
|
||||||
|
|
||||||
|
final chatSyncingProvider = NotifierProvider<ChatSyncingNotifier, bool>(
|
||||||
|
ChatSyncingNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class ChatSyncingNotifier extends Notifier<bool> {
|
||||||
|
@override
|
||||||
|
bool build() => false;
|
||||||
|
|
||||||
|
void set(bool value) => state = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
final flashingMessagesProvider =
|
||||||
|
NotifierProvider<FlashingMessagesNotifier, Set<String>>(
|
||||||
|
FlashingMessagesNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class FlashingMessagesNotifier extends Notifier<Set<String>> {
|
||||||
|
@override
|
||||||
|
Set<String> build() => {};
|
||||||
|
|
||||||
|
void update(Set<String> Function(Set<String>) cb) {
|
||||||
|
state = cb(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() => state = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {
|
||||||
|
@override
|
||||||
|
Future<List<SnChatRoom>> build() async {
|
||||||
|
final db = ref.watch(databaseProvider);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final localRoomsData = await db.select(db.chatRooms).get();
|
||||||
|
if (localRoomsData.isNotEmpty) {
|
||||||
|
final localRooms = await Future.wait(
|
||||||
|
localRoomsData.map((row) async {
|
||||||
|
final membersRows =
|
||||||
|
await (db.select(db.chatMembers)
|
||||||
|
..where((m) => m.chatRoomId.equals(row.id))).get();
|
||||||
|
final members =
|
||||||
|
membersRows.map((mRow) {
|
||||||
|
final account = SnAccount.fromJson(mRow.account);
|
||||||
|
return SnChatMember(
|
||||||
|
id: mRow.id,
|
||||||
|
chatRoomId: mRow.chatRoomId,
|
||||||
|
accountId: mRow.accountId,
|
||||||
|
account: account,
|
||||||
|
nick: mRow.nick,
|
||||||
|
notify: mRow.notify,
|
||||||
|
joinedAt: mRow.joinedAt,
|
||||||
|
breakUntil: mRow.breakUntil,
|
||||||
|
timeoutUntil: mRow.timeoutUntil,
|
||||||
|
status: null,
|
||||||
|
createdAt: mRow.createdAt,
|
||||||
|
updatedAt: mRow.updatedAt,
|
||||||
|
deletedAt: mRow.deletedAt,
|
||||||
|
chatRoom: null,
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
return SnChatRoom(
|
||||||
|
id: row.id,
|
||||||
|
name: row.name,
|
||||||
|
description: row.description,
|
||||||
|
type: row.type,
|
||||||
|
isPublic: row.isPublic!,
|
||||||
|
isCommunity: row.isCommunity!,
|
||||||
|
picture:
|
||||||
|
row.picture != null
|
||||||
|
? SnCloudFile.fromJson(row.picture!)
|
||||||
|
: null,
|
||||||
|
background:
|
||||||
|
row.background != null
|
||||||
|
? SnCloudFile.fromJson(row.background!)
|
||||||
|
: null,
|
||||||
|
realmId: row.realmId,
|
||||||
|
accountId: row.accountId,
|
||||||
|
realm: null,
|
||||||
|
createdAt: row.createdAt,
|
||||||
|
updatedAt: row.updatedAt,
|
||||||
|
deletedAt: row.deletedAt,
|
||||||
|
members: members,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Background sync
|
||||||
|
Future(() async {
|
||||||
|
try {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat');
|
||||||
|
final remoteRooms =
|
||||||
|
resp.data
|
||||||
|
.map((e) => SnChatRoom.fromJson(e))
|
||||||
|
.cast<SnChatRoom>()
|
||||||
|
.toList();
|
||||||
|
await db.saveChatRooms(remoteRooms, override: true);
|
||||||
|
// Update state with fresh data
|
||||||
|
state = AsyncData(await _buildRoomsFromDb(db));
|
||||||
|
} catch (_) {}
|
||||||
|
}).ignore();
|
||||||
|
|
||||||
|
return localRooms;
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
|
// Fallback to API
|
||||||
|
final client = ref.watch(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat');
|
||||||
|
final rooms =
|
||||||
|
resp.data
|
||||||
|
.map((e) => SnChatRoom.fromJson(e))
|
||||||
|
.cast<SnChatRoom>()
|
||||||
|
.toList();
|
||||||
|
await db.saveChatRooms(rooms, override: true);
|
||||||
|
return rooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<SnChatRoom>> _buildRoomsFromDb(AppDatabase db) async {
|
||||||
|
final localRoomsData = await db.select(db.chatRooms).get();
|
||||||
|
return Future.wait(
|
||||||
|
localRoomsData.map((row) async {
|
||||||
|
final membersRows =
|
||||||
|
await (db.select(db.chatMembers)
|
||||||
|
..where((m) => m.chatRoomId.equals(row.id))).get();
|
||||||
|
final members =
|
||||||
|
membersRows.map((mRow) {
|
||||||
|
final account = SnAccount.fromJson(mRow.account);
|
||||||
|
return SnChatMember(
|
||||||
|
id: mRow.id,
|
||||||
|
chatRoomId: mRow.chatRoomId,
|
||||||
|
accountId: mRow.accountId,
|
||||||
|
account: account,
|
||||||
|
nick: mRow.nick,
|
||||||
|
notify: mRow.notify,
|
||||||
|
joinedAt: mRow.joinedAt,
|
||||||
|
breakUntil: mRow.breakUntil,
|
||||||
|
timeoutUntil: mRow.timeoutUntil,
|
||||||
|
status: null,
|
||||||
|
createdAt: mRow.createdAt,
|
||||||
|
updatedAt: mRow.updatedAt,
|
||||||
|
deletedAt: mRow.deletedAt,
|
||||||
|
chatRoom: null,
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
return SnChatRoom(
|
||||||
|
id: row.id,
|
||||||
|
name: row.name,
|
||||||
|
description: row.description,
|
||||||
|
type: row.type,
|
||||||
|
isPublic: row.isPublic!,
|
||||||
|
isCommunity: row.isCommunity!,
|
||||||
|
picture:
|
||||||
|
row.picture != null ? SnCloudFile.fromJson(row.picture!) : null,
|
||||||
|
background:
|
||||||
|
row.background != null
|
||||||
|
? SnCloudFile.fromJson(row.background!)
|
||||||
|
: null,
|
||||||
|
realmId: row.realmId,
|
||||||
|
accountId: row.accountId,
|
||||||
|
realm: null,
|
||||||
|
createdAt: row.createdAt,
|
||||||
|
updatedAt: row.updatedAt,
|
||||||
|
deletedAt: row.deletedAt,
|
||||||
|
members: members,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class ChatRoomNotifier extends _$ChatRoomNotifier {
|
||||||
|
@override
|
||||||
|
Future<SnChatRoom?> build(String? identifier) async {
|
||||||
|
if (identifier == null) return null;
|
||||||
|
final db = ref.watch(databaseProvider);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Try to get from local database first
|
||||||
|
final localRoomData =
|
||||||
|
await (db.select(db.chatRooms)
|
||||||
|
..where((r) => r.id.equals(identifier))).getSingleOrNull();
|
||||||
|
|
||||||
|
if (localRoomData != null) {
|
||||||
|
// Fetch members for this room
|
||||||
|
final membersRows =
|
||||||
|
await (db.select(db.chatMembers)
|
||||||
|
..where((m) => m.chatRoomId.equals(localRoomData.id))).get();
|
||||||
|
final members =
|
||||||
|
membersRows.map((mRow) {
|
||||||
|
final account = SnAccount.fromJson(mRow.account);
|
||||||
|
return SnChatMember(
|
||||||
|
id: mRow.id,
|
||||||
|
chatRoomId: mRow.chatRoomId,
|
||||||
|
accountId: mRow.accountId,
|
||||||
|
account: account,
|
||||||
|
nick: mRow.nick,
|
||||||
|
notify: mRow.notify,
|
||||||
|
joinedAt: mRow.joinedAt,
|
||||||
|
breakUntil: mRow.breakUntil,
|
||||||
|
timeoutUntil: mRow.timeoutUntil,
|
||||||
|
status: null,
|
||||||
|
createdAt: mRow.createdAt,
|
||||||
|
updatedAt: mRow.updatedAt,
|
||||||
|
deletedAt: mRow.deletedAt,
|
||||||
|
chatRoom: null,
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
final localRoom = SnChatRoom(
|
||||||
|
id: localRoomData.id,
|
||||||
|
name: localRoomData.name,
|
||||||
|
description: localRoomData.description,
|
||||||
|
type: localRoomData.type,
|
||||||
|
isPublic: localRoomData.isPublic!,
|
||||||
|
isCommunity: localRoomData.isCommunity!,
|
||||||
|
picture:
|
||||||
|
localRoomData.picture != null
|
||||||
|
? SnCloudFile.fromJson(localRoomData.picture!)
|
||||||
|
: null,
|
||||||
|
background:
|
||||||
|
localRoomData.background != null
|
||||||
|
? SnCloudFile.fromJson(localRoomData.background!)
|
||||||
|
: null,
|
||||||
|
realmId: localRoomData.realmId,
|
||||||
|
accountId: localRoomData.accountId,
|
||||||
|
realm: null,
|
||||||
|
createdAt: localRoomData.createdAt,
|
||||||
|
updatedAt: localRoomData.updatedAt,
|
||||||
|
deletedAt: localRoomData.deletedAt,
|
||||||
|
members: members,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Background sync
|
||||||
|
Future(() async {
|
||||||
|
try {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat/$identifier');
|
||||||
|
final remoteRoom = SnChatRoom.fromJson(resp.data);
|
||||||
|
// Update state with fresh data directly without saving to DB
|
||||||
|
// DB will be updated by ChatRoomJoinedNotifier's full sync
|
||||||
|
state = AsyncData(remoteRoom);
|
||||||
|
} catch (_) {}
|
||||||
|
}).ignore();
|
||||||
|
|
||||||
|
return localRoom;
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
|
// Fallback to API
|
||||||
|
try {
|
||||||
|
final client = ref.watch(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat/$identifier');
|
||||||
|
final room = SnChatRoom.fromJson(resp.data);
|
||||||
|
await db.saveChatRooms([room]);
|
||||||
|
return room;
|
||||||
|
} catch (err) {
|
||||||
|
if (err is DioException && err.response?.statusCode == 404) {
|
||||||
|
return null; // Chat room not found
|
||||||
|
}
|
||||||
|
rethrow; // Rethrow other errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class ChatRoomIdentityNotifier extends _$ChatRoomIdentityNotifier {
|
||||||
|
@override
|
||||||
|
Future<SnChatMember?> build(String? identifier) async {
|
||||||
|
if (identifier == null) return null;
|
||||||
|
final db = ref.watch(databaseProvider);
|
||||||
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Try to get from local database first
|
||||||
|
if (userInfo.value != null) {
|
||||||
|
final localMemberData =
|
||||||
|
await (db.select(db.chatMembers)
|
||||||
|
..where((m) => m.chatRoomId.equals(identifier))
|
||||||
|
..where((m) => m.accountId.equals(userInfo.value!.id)))
|
||||||
|
.getSingleOrNull();
|
||||||
|
|
||||||
|
if (localMemberData != null) {
|
||||||
|
final account = SnAccount.fromJson(localMemberData.account);
|
||||||
|
final localMember = SnChatMember(
|
||||||
|
id: localMemberData.id,
|
||||||
|
chatRoomId: localMemberData.chatRoomId,
|
||||||
|
accountId: localMemberData.accountId,
|
||||||
|
account: account,
|
||||||
|
nick: localMemberData.nick,
|
||||||
|
notify: localMemberData.notify,
|
||||||
|
joinedAt: localMemberData.joinedAt,
|
||||||
|
breakUntil: localMemberData.breakUntil,
|
||||||
|
timeoutUntil: localMemberData.timeoutUntil,
|
||||||
|
status: null,
|
||||||
|
createdAt: localMemberData.createdAt,
|
||||||
|
updatedAt: localMemberData.updatedAt,
|
||||||
|
deletedAt: localMemberData.deletedAt,
|
||||||
|
chatRoom: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Background sync
|
||||||
|
Future(() async {
|
||||||
|
try {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
final resp = await client.get(
|
||||||
|
'/sphere/chat/$identifier/members/me',
|
||||||
|
);
|
||||||
|
final remoteMember = SnChatMember.fromJson(resp.data);
|
||||||
|
await db.saveMember(remoteMember);
|
||||||
|
// Update state with fresh data
|
||||||
|
if (userInfo.value != null) {
|
||||||
|
state = AsyncData(
|
||||||
|
await _buildMemberFromDb(db, identifier, userInfo.value!.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
}).ignore();
|
||||||
|
|
||||||
|
return localMember;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
|
// Fallback to API
|
||||||
|
try {
|
||||||
|
final client = ref.watch(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat/$identifier/members/me');
|
||||||
|
final member = SnChatMember.fromJson(resp.data);
|
||||||
|
await db.saveMember(member);
|
||||||
|
return member;
|
||||||
|
} catch (err) {
|
||||||
|
if (err is DioException && err.response?.statusCode == 404) {
|
||||||
|
return null; // Chat member not found
|
||||||
|
}
|
||||||
|
rethrow; // Rethrow other errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<SnChatMember?> _buildMemberFromDb(
|
||||||
|
AppDatabase db,
|
||||||
|
String identifier,
|
||||||
|
String accountId,
|
||||||
|
) async {
|
||||||
|
final localMemberData =
|
||||||
|
await (db.select(db.chatMembers)
|
||||||
|
..where((m) => m.chatRoomId.equals(identifier))
|
||||||
|
..where((m) => m.accountId.equals(accountId)))
|
||||||
|
.getSingleOrNull();
|
||||||
|
|
||||||
|
if (localMemberData == null) return null;
|
||||||
|
|
||||||
|
final account = SnAccount.fromJson(localMemberData.account);
|
||||||
|
return SnChatMember(
|
||||||
|
id: localMemberData.id,
|
||||||
|
chatRoomId: localMemberData.chatRoomId,
|
||||||
|
accountId: localMemberData.accountId,
|
||||||
|
account: account,
|
||||||
|
nick: localMemberData.nick,
|
||||||
|
notify: localMemberData.notify,
|
||||||
|
joinedAt: localMemberData.joinedAt,
|
||||||
|
breakUntil: localMemberData.breakUntil,
|
||||||
|
timeoutUntil: localMemberData.timeoutUntil,
|
||||||
|
status: null,
|
||||||
|
createdAt: localMemberData.createdAt,
|
||||||
|
updatedAt: localMemberData.updatedAt,
|
||||||
|
deletedAt: localMemberData.deletedAt,
|
||||||
|
chatRoom: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
Future<List<SnChatMember>> chatroomInvites(Ref ref) async {
|
||||||
|
final client = ref.watch(apiClientProvider);
|
||||||
|
final resp = await client.get('/sphere/chat/invites');
|
||||||
|
return resp.data
|
||||||
|
.map((e) => SnChatMember.fromJson(e))
|
||||||
|
.cast<SnChatMember>()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
282
lib/pods/chat/chat_room.g.dart
Normal file
282
lib/pods/chat/chat_room.g.dart
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'chat_room.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(ChatRoomJoinedNotifier)
|
||||||
|
const chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._();
|
||||||
|
|
||||||
|
final class ChatRoomJoinedNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatRoomJoinedNotifier, List<SnChatRoom>> {
|
||||||
|
const ChatRoomJoinedNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomJoinedProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatRoomJoinedNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomJoinedNotifier create() => ChatRoomJoinedNotifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$chatRoomJoinedNotifierHash() =>
|
||||||
|
r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff';
|
||||||
|
|
||||||
|
abstract class _$ChatRoomJoinedNotifier
|
||||||
|
extends $AsyncNotifier<List<SnChatRoom>> {
|
||||||
|
FutureOr<List<SnChatRoom>> build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build();
|
||||||
|
final ref =
|
||||||
|
this.ref as $Ref<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>,
|
||||||
|
AsyncValue<List<SnChatRoom>>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(ChatRoomNotifier)
|
||||||
|
const chatRoomProvider = ChatRoomNotifierFamily._();
|
||||||
|
|
||||||
|
final class ChatRoomNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatRoomNotifier, SnChatRoom?> {
|
||||||
|
const ChatRoomNotifierProvider._({
|
||||||
|
required ChatRoomNotifierFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatRoomNotifierHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatRoomProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomNotifier create() => ChatRoomNotifier();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is ChatRoomNotifierProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38';
|
||||||
|
|
||||||
|
final class ChatRoomNotifierFamily extends $Family
|
||||||
|
with
|
||||||
|
$ClassFamilyOverride<
|
||||||
|
ChatRoomNotifier,
|
||||||
|
AsyncValue<SnChatRoom?>,
|
||||||
|
SnChatRoom?,
|
||||||
|
FutureOr<SnChatRoom?>,
|
||||||
|
String?
|
||||||
|
> {
|
||||||
|
const ChatRoomNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatRoomNotifierProvider call(String? identifier) =>
|
||||||
|
ChatRoomNotifierProvider._(argument: identifier, from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'chatRoomProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _$ChatRoomNotifier extends $AsyncNotifier<SnChatRoom?> {
|
||||||
|
late final _$args = ref.$arg as String?;
|
||||||
|
String? get identifier => _$args;
|
||||||
|
|
||||||
|
FutureOr<SnChatRoom?> build(String? identifier);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnChatRoom?>, SnChatRoom?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnChatRoom?>, SnChatRoom?>,
|
||||||
|
AsyncValue<SnChatRoom?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(ChatRoomIdentityNotifier)
|
||||||
|
const chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._();
|
||||||
|
|
||||||
|
final class ChatRoomIdentityNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatRoomIdentityNotifier, SnChatMember?> {
|
||||||
|
const ChatRoomIdentityNotifierProvider._({
|
||||||
|
required ChatRoomIdentityNotifierFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomIdentityProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatRoomIdentityNotifierHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatRoomIdentityProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomIdentityNotifier create() => ChatRoomIdentityNotifier();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is ChatRoomIdentityNotifierProvider &&
|
||||||
|
other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$chatRoomIdentityNotifierHash() =>
|
||||||
|
r'27c17d55366d39be81d7209837e5c01f80a68a24';
|
||||||
|
|
||||||
|
final class ChatRoomIdentityNotifierFamily extends $Family
|
||||||
|
with
|
||||||
|
$ClassFamilyOverride<
|
||||||
|
ChatRoomIdentityNotifier,
|
||||||
|
AsyncValue<SnChatMember?>,
|
||||||
|
SnChatMember?,
|
||||||
|
FutureOr<SnChatMember?>,
|
||||||
|
String?
|
||||||
|
> {
|
||||||
|
const ChatRoomIdentityNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomIdentityProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatRoomIdentityNotifierProvider call(String? identifier) =>
|
||||||
|
ChatRoomIdentityNotifierProvider._(argument: identifier, from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'chatRoomIdentityProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _$ChatRoomIdentityNotifier
|
||||||
|
extends $AsyncNotifier<SnChatMember?> {
|
||||||
|
late final _$args = ref.$arg as String?;
|
||||||
|
String? get identifier => _$args;
|
||||||
|
|
||||||
|
FutureOr<SnChatMember?> build(String? identifier);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnChatMember?>, SnChatMember?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnChatMember?>, SnChatMember?>,
|
||||||
|
AsyncValue<SnChatMember?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(chatroomInvites)
|
||||||
|
const chatroomInvitesProvider = ChatroomInvitesProvider._();
|
||||||
|
|
||||||
|
final class ChatroomInvitesProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnChatMember>>,
|
||||||
|
List<SnChatMember>,
|
||||||
|
FutureOr<List<SnChatMember>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnChatMember>>,
|
||||||
|
$FutureProvider<List<SnChatMember>> {
|
||||||
|
const ChatroomInvitesProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'chatroomInvitesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatroomInvitesHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnChatMember>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnChatMember>> create(Ref ref) {
|
||||||
|
return chatroomInvites(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
|
||||||
|
|
||||||
final isSyncingProvider = StateProvider.autoDispose<bool>((ref) => false);
|
|
||||||
|
|
||||||
final flashingMessagesProvider = StateProvider<Set<String>>((ref) => {});
|
|
||||||
@@ -3,23 +3,32 @@ import "dart:convert";
|
|||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:island/models/chat.dart";
|
import "package:island/models/chat.dart";
|
||||||
|
import "package:island/pods/chat/chat_room.dart";
|
||||||
import "package:island/pods/lifecycle.dart";
|
import "package:island/pods/lifecycle.dart";
|
||||||
import "package:island/pods/chat/messages_notifier.dart";
|
import "package:island/pods/chat/messages_notifier.dart";
|
||||||
import "package:island/pods/websocket.dart";
|
import "package:island/pods/websocket.dart";
|
||||||
import "package:island/screens/chat/chat.dart";
|
|
||||||
import "package:island/widgets/chat/call_button.dart";
|
import "package:island/widgets/chat/call_button.dart";
|
||||||
import "package:riverpod_annotation/riverpod_annotation.dart";
|
import "package:riverpod_annotation/riverpod_annotation.dart";
|
||||||
|
|
||||||
part 'chat_subscribe.g.dart';
|
part 'chat_subscribe.g.dart';
|
||||||
|
|
||||||
final currentSubscribedChatIdProvider = StateProvider<String?>((ref) => null);
|
final currentSubscribedChatIdProvider =
|
||||||
|
NotifierProvider<CurrentSubscribedChatIdNotifier, String?>(
|
||||||
|
CurrentSubscribedChatIdNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class CurrentSubscribedChatIdNotifier extends Notifier<String?> {
|
||||||
|
@override
|
||||||
|
String? build() => null;
|
||||||
|
|
||||||
|
void set(String? value) => state = value;
|
||||||
|
}
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
||||||
late final String _roomId;
|
late SnChatRoom _chatRoom;
|
||||||
late final SnChatRoom _chatRoom;
|
late SnChatMember _chatIdentity;
|
||||||
late final SnChatMember _chatIdentity;
|
late MessagesNotifier _messagesNotifier;
|
||||||
late final MessagesNotifier _messagesNotifier;
|
|
||||||
|
|
||||||
final List<SnChatMember> _typingStatuses = [];
|
final List<SnChatMember> _typingStatuses = [];
|
||||||
Timer? _typingCleanupTimer;
|
Timer? _typingCleanupTimer;
|
||||||
@@ -29,11 +38,10 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<SnChatMember> build(String roomId) {
|
List<SnChatMember> build(String roomId) {
|
||||||
_roomId = roomId;
|
|
||||||
final ws = ref.watch(websocketProvider);
|
final ws = ref.watch(websocketProvider);
|
||||||
final chatRoomAsync = ref.watch(chatroomProvider(roomId));
|
final chatRoomAsync = ref.watch(chatRoomProvider(roomId));
|
||||||
final chatIdentityAsync = ref.watch(chatroomIdentityProvider(roomId));
|
final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
_messagesNotifier = ref.watch(messagesNotifierProvider(roomId).notifier);
|
_messagesNotifier = ref.watch(messagesProvider(roomId).notifier);
|
||||||
|
|
||||||
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
||||||
return [];
|
return [];
|
||||||
@@ -59,7 +67,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Future.microtask(
|
Future.microtask(
|
||||||
() => ref.read(currentSubscribedChatIdProvider.notifier).state = roomId,
|
() => ref.read(currentSubscribedChatIdProvider.notifier).set(roomId),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send initial read receipt
|
// Send initial read receipt
|
||||||
@@ -130,7 +138,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
// Cleanup on dispose
|
// Cleanup on dispose
|
||||||
ref.onDispose(() {
|
ref.onDispose(() {
|
||||||
ref.read(currentSubscribedChatIdProvider.notifier).state = null;
|
ref.read(currentSubscribedChatIdProvider.notifier).set(null);
|
||||||
wsState.sendMessage(
|
wsState.sendMessage(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
@@ -199,7 +207,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.read',
|
type: 'messages.read',
|
||||||
data: {'chat_room_id': _roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'sphere',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -216,7 +224,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.typing',
|
type: 'messages.typing',
|
||||||
data: {'chat_room_id': _roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'sphere',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,171 +6,104 @@ part of 'chat_subscribe.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$chatSubscribeNotifierHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'c605e0c9c45df64e5ba7b65f8de9b47bde8e2b3b';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$ChatSubscribeNotifier
|
|
||||||
extends BuildlessAutoDisposeNotifier<List<SnChatMember>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
List<SnChatMember> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
@ProviderFor(ChatSubscribeNotifier)
|
@ProviderFor(ChatSubscribeNotifier)
|
||||||
const chatSubscribeNotifierProvider = ChatSubscribeNotifierFamily();
|
const chatSubscribeProvider = ChatSubscribeNotifierFamily._();
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
final class ChatSubscribeNotifierProvider
|
||||||
class ChatSubscribeNotifierFamily extends Family<List<SnChatMember>> {
|
extends $NotifierProvider<ChatSubscribeNotifier, List<SnChatMember>> {
|
||||||
/// See also [ChatSubscribeNotifier].
|
const ChatSubscribeNotifierProvider._({
|
||||||
const ChatSubscribeNotifierFamily();
|
required ChatSubscribeNotifierFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [ChatSubscribeNotifier].
|
}) : super(
|
||||||
ChatSubscribeNotifierProvider call(String roomId) {
|
retry: null,
|
||||||
return ChatSubscribeNotifierProvider(roomId);
|
name: r'chatSubscribeProvider',
|
||||||
}
|
isAutoDispose: true,
|
||||||
|
|
||||||
@override
|
|
||||||
ChatSubscribeNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatSubscribeNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatSubscribeNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
class ChatSubscribeNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeNotifierProviderImpl<
|
|
||||||
ChatSubscribeNotifier,
|
|
||||||
List<SnChatMember>
|
|
||||||
> {
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
ChatSubscribeNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatSubscribeNotifier()..roomId = roomId,
|
|
||||||
from: chatSubscribeNotifierProvider,
|
|
||||||
name: r'chatSubscribeNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatSubscribeNotifierHash,
|
|
||||||
dependencies: ChatSubscribeNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatSubscribeNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatSubscribeNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<SnChatMember> runNotifierBuild(
|
|
||||||
covariant ChatSubscribeNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatSubscribeNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatSubscribeNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeNotifierProviderElement<ChatSubscribeNotifier, List<SnChatMember>>
|
String debugGetCreateSourceHash() => _$chatSubscribeNotifierHash();
|
||||||
createElement() {
|
|
||||||
return _ChatSubscribeNotifierProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatSubscribeProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatSubscribeNotifier create() => ChatSubscribeNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(List<SnChatMember> value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<List<SnChatMember>>(value),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is ChatSubscribeNotifierProvider && other.roomId == roomId;
|
return other is ChatSubscribeNotifierProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatSubscribeNotifierHash() =>
|
||||||
// ignore: unused_element
|
r'2b9fae96eb1f96a514a074985e5efa1c13d10aa4';
|
||||||
mixin ChatSubscribeNotifierRef
|
|
||||||
on AutoDisposeNotifierProviderRef<List<SnChatMember>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatSubscribeNotifierProviderElement
|
final class ChatSubscribeNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeNotifierProviderElement<
|
$ClassFamilyOverride<
|
||||||
ChatSubscribeNotifier,
|
ChatSubscribeNotifier,
|
||||||
List<SnChatMember>
|
List<SnChatMember>,
|
||||||
>
|
List<SnChatMember>,
|
||||||
with ChatSubscribeNotifierRef {
|
List<SnChatMember>,
|
||||||
_ChatSubscribeNotifierProviderElement(super.provider);
|
String
|
||||||
|
> {
|
||||||
|
const ChatSubscribeNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatSubscribeProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatSubscribeNotifierProvider call(String roomId) =>
|
||||||
|
ChatSubscribeNotifierProvider._(argument: roomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get roomId => (origin as ChatSubscribeNotifierProvider).roomId;
|
String toString() => r'chatSubscribeProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$ChatSubscribeNotifier extends $Notifier<List<SnChatMember>> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get roomId => _$args;
|
||||||
|
|
||||||
|
List<SnChatMember> build(String roomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<List<SnChatMember>, List<SnChatMember>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<List<SnChatMember>, List<SnChatMember>>,
|
||||||
|
List<SnChatMember>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ChatUnreadCountNotifier extends _$ChatUnreadCountNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
@Riverpod(keepAlive: true)
|
||||||
class ChatSummary extends _$ChatSummary {
|
class ChatSummary extends _$ChatSummary {
|
||||||
@override
|
@override
|
||||||
Future<Map<String, SnChatSummary>> build() async {
|
Future<Map<String, SnChatSummary>> build() async {
|
||||||
@@ -99,7 +99,7 @@ class ChatSummary extends _$ChatSummary {
|
|||||||
final unreadToDecrement = summary.unreadCount;
|
final unreadToDecrement = summary.unreadCount;
|
||||||
if (unreadToDecrement > 0) {
|
if (unreadToDecrement > 0) {
|
||||||
ref
|
ref
|
||||||
.read(chatUnreadCountNotifierProvider.notifier)
|
.read(chatUnreadCountProvider.notifier)
|
||||||
.decrement(unreadToDecrement);
|
.decrement(unreadToDecrement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,40 +6,105 @@ part of 'chat_summary.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(ChatUnreadCountNotifier)
|
||||||
|
const chatUnreadCountProvider = ChatUnreadCountNotifierProvider._();
|
||||||
|
|
||||||
|
final class ChatUnreadCountNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatUnreadCountNotifier, int> {
|
||||||
|
const ChatUnreadCountNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'chatUnreadCountProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatUnreadCountNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatUnreadCountNotifier create() => ChatUnreadCountNotifier();
|
||||||
|
}
|
||||||
|
|
||||||
String _$chatUnreadCountNotifierHash() =>
|
String _$chatUnreadCountNotifierHash() =>
|
||||||
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
|
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
|
||||||
|
|
||||||
/// See also [ChatUnreadCountNotifier].
|
abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
|
||||||
@ProviderFor(ChatUnreadCountNotifier)
|
FutureOr<int> build();
|
||||||
final chatUnreadCountNotifierProvider =
|
@$mustCallSuper
|
||||||
AutoDisposeAsyncNotifierProvider<ChatUnreadCountNotifier, int>.internal(
|
@override
|
||||||
ChatUnreadCountNotifier.new,
|
void runBuild() {
|
||||||
name: r'chatUnreadCountNotifierProvider',
|
final created = build();
|
||||||
debugGetCreateSourceHash:
|
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
final element =
|
||||||
? null
|
ref.element
|
||||||
: _$chatUnreadCountNotifierHash,
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<int>, int>,
|
||||||
|
AsyncValue<int>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(ChatSummary)
|
||||||
|
const chatSummaryProvider = ChatSummaryProvider._();
|
||||||
|
|
||||||
|
final class ChatSummaryProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>> {
|
||||||
|
const ChatSummaryProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'chatSummaryProvider',
|
||||||
|
isAutoDispose: false,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef _$ChatUnreadCountNotifier = AutoDisposeAsyncNotifier<int>;
|
@override
|
||||||
String _$chatSummaryHash() => r'8479ef53cfb0b698b800d0117d04774b6f78b3cc';
|
String debugGetCreateSourceHash() => _$chatSummaryHash();
|
||||||
|
|
||||||
/// See also [ChatSummary].
|
@$internal
|
||||||
@ProviderFor(ChatSummary)
|
@override
|
||||||
final chatSummaryProvider = AutoDisposeAsyncNotifierProvider<
|
ChatSummary create() => ChatSummary();
|
||||||
ChatSummary,
|
}
|
||||||
|
|
||||||
|
String _$chatSummaryHash() => r'dfa5e487586482ebdafef8d711f74db68ee86f84';
|
||||||
|
|
||||||
|
abstract class _$ChatSummary
|
||||||
|
extends $AsyncNotifier<Map<String, SnChatSummary>> {
|
||||||
|
FutureOr<Map<String, SnChatSummary>> build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build();
|
||||||
|
final ref =
|
||||||
|
this.ref
|
||||||
|
as $Ref<
|
||||||
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
Map<String, SnChatSummary>
|
Map<String, SnChatSummary>
|
||||||
>.internal(
|
>;
|
||||||
ChatSummary.new,
|
final element =
|
||||||
name: r'chatSummaryProvider',
|
ref.element
|
||||||
debugGetCreateSourceHash:
|
as $ClassProviderElement<
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$chatSummaryHash,
|
AnyNotifier<
|
||||||
dependencies: null,
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
allTransitiveDependencies: null,
|
Map<String, SnChatSummary>
|
||||||
);
|
>,
|
||||||
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
typedef _$ChatSummary = AutoDisposeAsyncNotifier<Map<String, SnChatSummary>>;
|
Object?,
|
||||||
// ignore_for_file: type=lint
|
Object?
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import "package:island/models/chat.dart";
|
|||||||
import "package:island/models/file.dart";
|
import "package:island/models/file.dart";
|
||||||
import "package:island/models/poll.dart";
|
import "package:island/models/poll.dart";
|
||||||
import "package:island/models/wallet.dart";
|
import "package:island/models/wallet.dart";
|
||||||
|
import "package:island/pods/chat/chat_room.dart";
|
||||||
import "package:island/pods/database.dart";
|
import "package:island/pods/database.dart";
|
||||||
import "package:island/pods/lifecycle.dart";
|
import "package:island/pods/lifecycle.dart";
|
||||||
import "package:island/pods/network.dart";
|
import "package:island/pods/network.dart";
|
||||||
@@ -19,18 +20,16 @@ import "package:island/talker.dart";
|
|||||||
import "package:island/widgets/alert.dart";
|
import "package:island/widgets/alert.dart";
|
||||||
import "package:riverpod_annotation/riverpod_annotation.dart";
|
import "package:riverpod_annotation/riverpod_annotation.dart";
|
||||||
import "package:uuid/uuid.dart";
|
import "package:uuid/uuid.dart";
|
||||||
import "package:island/screens/chat/chat.dart";
|
|
||||||
import "package:island/pods/chat/chat_rooms.dart";
|
|
||||||
import "package:island/screens/account/profile.dart";
|
import "package:island/screens/account/profile.dart";
|
||||||
|
|
||||||
part 'messages_notifier.g.dart';
|
part 'messages_notifier.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class MessagesNotifier extends _$MessagesNotifier {
|
class MessagesNotifier extends _$MessagesNotifier {
|
||||||
late final Dio _apiClient;
|
late Dio _apiClient;
|
||||||
late final AppDatabase _database;
|
late AppDatabase _database;
|
||||||
late final SnChatRoom _room;
|
late SnChatRoom _room;
|
||||||
late final SnChatMember _identity;
|
late SnChatMember _identity;
|
||||||
|
|
||||||
final Map<String, LocalChatMessage> _pendingMessages = {};
|
final Map<String, LocalChatMessage> _pendingMessages = {};
|
||||||
final Map<String, Map<int, double?>> _fileUploadProgress = {};
|
final Map<String, Map<int, double?>> _fileUploadProgress = {};
|
||||||
@@ -39,7 +38,6 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
bool? _withLinks;
|
bool? _withLinks;
|
||||||
bool? _withAttachments;
|
bool? _withAttachments;
|
||||||
|
|
||||||
late final String _roomId;
|
|
||||||
static const int _pageSize = 20;
|
static const int _pageSize = 20;
|
||||||
bool _hasMore = true;
|
bool _hasMore = true;
|
||||||
bool _isSyncing = false;
|
bool _isSyncing = false;
|
||||||
@@ -48,15 +46,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
bool _allRemoteMessagesFetched = false;
|
bool _allRemoteMessagesFetched = false;
|
||||||
DateTime? _lastPauseTime;
|
DateTime? _lastPauseTime;
|
||||||
|
|
||||||
late final Future<SnAccount?> Function(String) _fetchAccount;
|
late Future<SnAccount?> Function(String) _fetchAccount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
||||||
_roomId = roomId;
|
|
||||||
_apiClient = ref.watch(apiClientProvider);
|
_apiClient = ref.watch(apiClientProvider);
|
||||||
_database = ref.watch(databaseProvider);
|
_database = ref.watch(databaseProvider);
|
||||||
final room = await ref.watch(chatroomProvider(roomId).future);
|
final room = await ref.watch(chatRoomProvider(roomId).future);
|
||||||
final identity = await ref.watch(chatroomIdentityProvider(roomId).future);
|
final identity = await ref.watch(chatRoomIdentityProvider(roomId).future);
|
||||||
|
|
||||||
// Initialize fetch account method for corrupted data recovery
|
// Initialize fetch account method for corrupted data recovery
|
||||||
_fetchAccount = (String accountId) async {
|
_fetchAccount = (String accountId) async {
|
||||||
@@ -144,14 +141,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
if (searchQuery != null && searchQuery.isNotEmpty) {
|
if (searchQuery != null && searchQuery.isNotEmpty) {
|
||||||
dbMessages = await _database.searchMessages(
|
dbMessages = await _database.searchMessages(
|
||||||
_roomId,
|
roomId,
|
||||||
searchQuery,
|
searchQuery,
|
||||||
withAttachments: withAttachments,
|
withAttachments: withAttachments,
|
||||||
fetchAccount: _fetchAccount,
|
fetchAccount: _fetchAccount,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final chatMessagesFromDb = await _database.getMessagesForRoom(
|
final chatMessagesFromDb = await _database.getMessagesForRoom(
|
||||||
_roomId,
|
roomId,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
limit: take,
|
limit: take,
|
||||||
);
|
);
|
||||||
@@ -194,9 +191,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
final pendingForRoom =
|
final pendingForRoom =
|
||||||
_pendingMessages.values
|
_pendingMessages.values.where((msg) => msg.roomId == roomId).toList();
|
||||||
.where((msg) => msg.roomId == _roomId)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
final allMessages = [...pendingForRoom, ...uniqueMessages];
|
final allMessages = [...pendingForRoom, ...uniqueMessages];
|
||||||
_sortMessages(allMessages); // Use the helper function
|
_sortMessages(allMessages); // Use the helper function
|
||||||
@@ -221,7 +216,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}) async {
|
}) async {
|
||||||
talker.log('Getting all messages for jump from offset $offset, take $take');
|
talker.log('Getting all messages for jump from offset $offset, take $take');
|
||||||
final chatMessagesFromDb = await _database.getMessagesForRoom(
|
final chatMessagesFromDb = await _database.getMessagesForRoom(
|
||||||
_roomId,
|
roomId,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
limit: take,
|
limit: take,
|
||||||
);
|
);
|
||||||
@@ -245,9 +240,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
final pendingForRoom =
|
final pendingForRoom =
|
||||||
_pendingMessages.values
|
_pendingMessages.values.where((msg) => msg.roomId == roomId).toList();
|
||||||
.where((msg) => msg.roomId == _roomId)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
final allMessages = [...pendingForRoom, ...uniqueMessages];
|
final allMessages = [...pendingForRoom, ...uniqueMessages];
|
||||||
_sortMessages(allMessages);
|
_sortMessages(allMessages);
|
||||||
@@ -272,7 +265,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
talker.log('Fetching messages from API, offset $offset, take $take');
|
talker.log('Fetching messages from API, offset $offset, take $take');
|
||||||
if (_totalCount == null) {
|
if (_totalCount == null) {
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$_roomId/messages',
|
'/sphere/chat/$roomId/messages',
|
||||||
queryParameters: {'offset': 0, 'take': 1},
|
queryParameters: {'offset': 0, 'take': 1},
|
||||||
);
|
);
|
||||||
_totalCount = int.parse(response.headers['x-total']?.firstOrNull ?? '0');
|
_totalCount = int.parse(response.headers['x-total']?.firstOrNull ?? '0');
|
||||||
@@ -284,7 +277,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$_roomId/messages',
|
'/sphere/chat/$roomId/messages',
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
queryParameters: {'offset': offset, 'take': take},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -326,7 +319,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_allRemoteMessagesFetched = false;
|
_allRemoteMessagesFetched = false;
|
||||||
|
|
||||||
talker.log('Starting message sync');
|
talker.log('Starting message sync');
|
||||||
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true);
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
||||||
try {
|
try {
|
||||||
final dbMessages = await _database.getMessagesForRoom(
|
final dbMessages = await _database.getMessagesForRoom(
|
||||||
_room.id,
|
_room.id,
|
||||||
@@ -402,9 +395,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
talker.log('Finished message sync');
|
talker.log('Finished message sync');
|
||||||
Future.microtask(
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
||||||
() => ref.read(isSyncingProvider.notifier).state = false,
|
|
||||||
);
|
|
||||||
_isSyncing = false;
|
_isSyncing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,7 +492,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
if (!_hasMore || state is AsyncLoading) return;
|
if (!_hasMore || state is AsyncLoading) return;
|
||||||
talker.log('Loading more messages');
|
talker.log('Loading more messages');
|
||||||
|
|
||||||
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true);
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
||||||
try {
|
try {
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = state.value ?? [];
|
||||||
final offset = currentMessages.length;
|
final offset = currentMessages.length;
|
||||||
@@ -524,9 +515,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
);
|
);
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
Future.microtask(
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
||||||
() => ref.read(isSyncingProvider.notifier).state = false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +535,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
final mockMessage = SnChatMessage(
|
final mockMessage = SnChatMessage(
|
||||||
id: 'pending_$nonce',
|
id: 'pending_$nonce',
|
||||||
chatRoomId: _roomId,
|
chatRoomId: roomId,
|
||||||
senderId: _identity.id,
|
senderId: _identity.id,
|
||||||
content: content,
|
content: content,
|
||||||
createdAt: DateTime.now(),
|
createdAt: DateTime.now(),
|
||||||
@@ -590,8 +579,8 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
final response = await _apiClient.request(
|
final response = await _apiClient.request(
|
||||||
editingTo == null
|
editingTo == null
|
||||||
? '/sphere/chat/$_roomId/messages'
|
? '/sphere/chat/$roomId/messages'
|
||||||
: '/sphere/chat/$_roomId/messages/${editingTo.id}',
|
: '/sphere/chat/$roomId/messages/${editingTo.id}',
|
||||||
data: {
|
data: {
|
||||||
'content': content,
|
'content': content,
|
||||||
'attachments_id': cloudAttachments.map((e) => e.id).toList(),
|
'attachments_id': cloudAttachments.map((e) => e.id).toList(),
|
||||||
@@ -731,7 +720,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> receiveMessage(SnChatMessage remoteMessage) async {
|
Future<void> receiveMessage(SnChatMessage remoteMessage) async {
|
||||||
if (remoteMessage.chatRoomId != _roomId) return;
|
if (remoteMessage.chatRoomId != roomId) return;
|
||||||
|
|
||||||
// Block message receiving during jumps to prevent list resets
|
// Block message receiving during jumps to prevent list resets
|
||||||
if (_isJumping) {
|
if (_isJumping) {
|
||||||
@@ -783,7 +772,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> receiveMessageUpdate(SnChatMessage remoteMessage) async {
|
Future<void> receiveMessageUpdate(SnChatMessage remoteMessage) async {
|
||||||
if (remoteMessage.chatRoomId != _roomId) return;
|
if (remoteMessage.chatRoomId != roomId) return;
|
||||||
|
|
||||||
// Block message updates during jumps to prevent list resets
|
// Block message updates during jumps to prevent list resets
|
||||||
if (_isJumping) {
|
if (_isJumping) {
|
||||||
@@ -883,7 +872,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await _apiClient.delete('/sphere/chat/$_roomId/messages/$messageId');
|
await _apiClient.delete('/sphere/chat/$roomId/messages/$messageId');
|
||||||
await receiveMessageDeletion(messageId);
|
await receiveMessageDeletion(messageId);
|
||||||
} catch (err, stackTrace) {
|
} catch (err, stackTrace) {
|
||||||
talker.log(
|
talker.log(
|
||||||
@@ -991,7 +980,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$_roomId/messages/$messageId',
|
'/sphere/chat/$roomId/messages/$messageId',
|
||||||
);
|
);
|
||||||
final remoteMessage = SnChatMessage.fromJson(response.data);
|
final remoteMessage = SnChatMessage.fromJson(response.data);
|
||||||
final message = LocalChatMessage.fromRemoteMessage(
|
final message = LocalChatMessage.fromRemoteMessage(
|
||||||
@@ -1048,7 +1037,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
final query = _database.customSelect(
|
final query = _database.customSelect(
|
||||||
'SELECT COUNT(*) as count FROM chat_messages WHERE room_id = ? AND created_at > ?',
|
'SELECT COUNT(*) as count FROM chat_messages WHERE room_id = ? AND created_at > ?',
|
||||||
variables: [
|
variables: [
|
||||||
Variable.withString(_roomId),
|
Variable.withString(roomId),
|
||||||
Variable.withDateTime(message.createdAt),
|
Variable.withDateTime(message.createdAt),
|
||||||
],
|
],
|
||||||
readsFrom: {_database.chatMessages},
|
readsFrom: {_database.chatMessages},
|
||||||
|
|||||||
@@ -6,174 +6,101 @@ part of 'messages_notifier.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$messagesNotifierHash() => r'27ce32c54e317a04e1d554ed4a70a24e4503fdd1';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$MessagesNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<List<LocalChatMessage>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
FutureOr<List<LocalChatMessage>> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
@ProviderFor(MessagesNotifier)
|
@ProviderFor(MessagesNotifier)
|
||||||
const messagesNotifierProvider = MessagesNotifierFamily();
|
const messagesProvider = MessagesNotifierFamily._();
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
final class MessagesNotifierProvider
|
||||||
class MessagesNotifierFamily
|
extends $AsyncNotifierProvider<MessagesNotifier, List<LocalChatMessage>> {
|
||||||
extends Family<AsyncValue<List<LocalChatMessage>>> {
|
const MessagesNotifierProvider._({
|
||||||
/// See also [MessagesNotifier].
|
required MessagesNotifierFamily super.from,
|
||||||
const MessagesNotifierFamily();
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
/// See also [MessagesNotifier].
|
retry: null,
|
||||||
MessagesNotifierProvider call(String roomId) {
|
name: r'messagesProvider',
|
||||||
return MessagesNotifierProvider(roomId);
|
isAutoDispose: true,
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MessagesNotifierProvider getProviderOverride(
|
|
||||||
covariant MessagesNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'messagesNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
class MessagesNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
MessagesNotifier,
|
|
||||||
List<LocalChatMessage>
|
|
||||||
> {
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
MessagesNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => MessagesNotifier()..roomId = roomId,
|
|
||||||
from: messagesNotifierProvider,
|
|
||||||
name: r'messagesNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$messagesNotifierHash,
|
|
||||||
dependencies: MessagesNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MessagesNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
MessagesNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<List<LocalChatMessage>> runNotifierBuild(
|
|
||||||
covariant MessagesNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(MessagesNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MessagesNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
String debugGetCreateSourceHash() => _$messagesNotifierHash();
|
||||||
MessagesNotifier,
|
|
||||||
List<LocalChatMessage>
|
@override
|
||||||
>
|
String toString() {
|
||||||
createElement() {
|
return r'messagesProvider'
|
||||||
return _MessagesNotifierProviderElement(this);
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
MessagesNotifier create() => MessagesNotifier();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is MessagesNotifierProvider && other.roomId == roomId;
|
return other is MessagesNotifierProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$messagesNotifierHash() => r'2f3f19cb99357184e82d66e74a31863fcfc48856';
|
||||||
// ignore: unused_element
|
|
||||||
mixin MessagesNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<List<LocalChatMessage>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MessagesNotifierProviderElement
|
final class MessagesNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
$ClassFamilyOverride<
|
||||||
MessagesNotifier,
|
MessagesNotifier,
|
||||||
List<LocalChatMessage>
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
>
|
List<LocalChatMessage>,
|
||||||
with MessagesNotifierRef {
|
FutureOr<List<LocalChatMessage>>,
|
||||||
_MessagesNotifierProviderElement(super.provider);
|
String
|
||||||
|
> {
|
||||||
|
const MessagesNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'messagesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
MessagesNotifierProvider call(String roomId) =>
|
||||||
|
MessagesNotifierProvider._(argument: roomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get roomId => (origin as MessagesNotifierProvider).roomId;
|
String toString() => r'messagesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$MessagesNotifier
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
extends $AsyncNotifier<List<LocalChatMessage>> {
|
||||||
|
late final _$args = ref.$arg as String;
|
||||||
|
String get roomId => _$args;
|
||||||
|
|
||||||
|
FutureOr<List<LocalChatMessage>> build(String roomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref =
|
||||||
|
this.ref
|
||||||
|
as $Ref<AsyncValue<List<LocalChatMessage>>, List<LocalChatMessage>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<
|
||||||
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
|
List<LocalChatMessage>
|
||||||
|
>,
|
||||||
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -294,12 +294,15 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final updateInfoProvider =
|
final updateInfoProvider =
|
||||||
StateNotifierProvider<UpdateInfoNotifier, (String?, String?)>((ref) {
|
NotifierProvider<UpdateInfoNotifier, (String?, String?)>(
|
||||||
return UpdateInfoNotifier();
|
UpdateInfoNotifier.new,
|
||||||
});
|
);
|
||||||
|
|
||||||
class UpdateInfoNotifier extends StateNotifier<(String?, String?)> {
|
class UpdateInfoNotifier extends Notifier<(String?, String?)> {
|
||||||
UpdateInfoNotifier() : super((null, null));
|
@override
|
||||||
|
(String?, String?) build() {
|
||||||
|
return (null, null);
|
||||||
|
}
|
||||||
|
|
||||||
void setUpdate(String newVersion, String newChangelog) {
|
void setUpdate(String newVersion, String newChangelog) {
|
||||||
state = (newVersion, newChangelog);
|
state = (newVersion, newChangelog);
|
||||||
|
|||||||
@@ -29,23 +29,59 @@ Map<String, dynamic> _$ThemeColorsToJson(_ThemeColors instance) =>
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(AppSettingsNotifier)
|
||||||
|
const appSettingsProvider = AppSettingsNotifierProvider._();
|
||||||
|
|
||||||
|
final class AppSettingsNotifierProvider
|
||||||
|
extends $NotifierProvider<AppSettingsNotifier, AppSettings> {
|
||||||
|
const AppSettingsNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'appSettingsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$appSettingsNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
AppSettingsNotifier create() => AppSettingsNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(AppSettings value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<AppSettings>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$appSettingsNotifierHash() =>
|
String _$appSettingsNotifierHash() =>
|
||||||
r'22b695f2023e3251db3296858acd701f7211d757';
|
r'22b695f2023e3251db3296858acd701f7211d757';
|
||||||
|
|
||||||
/// See also [AppSettingsNotifier].
|
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
||||||
@ProviderFor(AppSettingsNotifier)
|
AppSettings build();
|
||||||
final appSettingsNotifierProvider =
|
@$mustCallSuper
|
||||||
AutoDisposeNotifierProvider<AppSettingsNotifier, AppSettings>.internal(
|
@override
|
||||||
AppSettingsNotifier.new,
|
void runBuild() {
|
||||||
name: r'appSettingsNotifierProvider',
|
final created = build();
|
||||||
debugGetCreateSourceHash:
|
final ref = this.ref as $Ref<AppSettings, AppSettings>;
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
final element =
|
||||||
? null
|
ref.element
|
||||||
: _$appSettingsNotifierHash,
|
as $ClassProviderElement<
|
||||||
dependencies: null,
|
AnyNotifier<AppSettings, AppSettings>,
|
||||||
allTransitiveDependencies: null,
|
AppSettings,
|
||||||
);
|
Object?,
|
||||||
|
Object?
|
||||||
typedef _$AppSettingsNotifier = AutoDisposeNotifier<AppSettings>;
|
>;
|
||||||
// ignore_for_file: type=lint
|
element.handleValue(ref, created);
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/models/activity.dart';
|
import 'package:island/models/activity.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|||||||
@@ -6,169 +6,99 @@ part of 'event_calendar.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for fetching event calendar data
|
/// Provider for fetching event calendar data
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
@ProviderFor(eventCalendar)
|
@ProviderFor(eventCalendar)
|
||||||
const eventCalendarProvider = EventCalendarFamily();
|
const eventCalendarProvider = EventCalendarFamily._();
|
||||||
|
|
||||||
/// Provider for fetching event calendar data
|
/// Provider for fetching event calendar data
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
final class EventCalendarProvider
|
||||||
class EventCalendarFamily
|
extends
|
||||||
extends Family<AsyncValue<List<SnEventCalendarEntry>>> {
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnEventCalendarEntry>>,
|
||||||
|
List<SnEventCalendarEntry>,
|
||||||
|
FutureOr<List<SnEventCalendarEntry>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnEventCalendarEntry>>,
|
||||||
|
$FutureProvider<List<SnEventCalendarEntry>> {
|
||||||
/// Provider for fetching event calendar data
|
/// Provider for fetching event calendar data
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
///
|
const EventCalendarProvider._({
|
||||||
/// Copied from [eventCalendar].
|
required EventCalendarFamily super.from,
|
||||||
const EventCalendarFamily();
|
required EventCalendarQuery super.argument,
|
||||||
|
}) : super(
|
||||||
/// Provider for fetching event calendar data
|
retry: null,
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
EventCalendarProvider call(EventCalendarQuery query) {
|
|
||||||
return EventCalendarProvider(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
EventCalendarProvider getProviderOverride(
|
|
||||||
covariant EventCalendarProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'eventCalendarProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for fetching event calendar data
|
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
class EventCalendarProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnEventCalendarEntry>> {
|
|
||||||
/// Provider for fetching event calendar data
|
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
EventCalendarProvider(EventCalendarQuery query)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => eventCalendar(ref as EventCalendarRef, query),
|
|
||||||
from: eventCalendarProvider,
|
|
||||||
name: r'eventCalendarProvider',
|
name: r'eventCalendarProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$eventCalendarHash,
|
|
||||||
dependencies: EventCalendarFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
EventCalendarFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
EventCalendarProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final EventCalendarQuery query;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$eventCalendarHash();
|
||||||
FutureOr<List<SnEventCalendarEntry>> Function(EventCalendarRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'eventCalendarProvider'
|
||||||
origin: this,
|
''
|
||||||
override: EventCalendarProvider._internal(
|
'($argument)';
|
||||||
(ref) => create(ref as EventCalendarRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>> createElement() {
|
$FutureProviderElement<List<SnEventCalendarEntry>> $createElement(
|
||||||
return _EventCalendarProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnEventCalendarEntry>> create(Ref ref) {
|
||||||
|
final argument = this.argument as EventCalendarQuery;
|
||||||
|
return eventCalendar(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is EventCalendarProvider && other.query == query;
|
return other is EventCalendarProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d';
|
||||||
// ignore: unused_element
|
|
||||||
mixin EventCalendarRef
|
|
||||||
on AutoDisposeFutureProviderRef<List<SnEventCalendarEntry>> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
EventCalendarQuery get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _EventCalendarProviderElement
|
/// Provider for fetching event calendar data
|
||||||
extends AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>>
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
with EventCalendarRef {
|
|
||||||
_EventCalendarProviderElement(super.provider);
|
final class EventCalendarFamily extends $Family
|
||||||
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnEventCalendarEntry>>,
|
||||||
|
EventCalendarQuery
|
||||||
|
> {
|
||||||
|
const EventCalendarFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'eventCalendarProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Provider for fetching event calendar data
|
||||||
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
|
|
||||||
|
EventCalendarProvider call(EventCalendarQuery query) =>
|
||||||
|
EventCalendarProvider._(argument: query, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EventCalendarQuery get query => (origin as EventCalendarProvider).query;
|
String toString() => r'eventCalendarProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -2,14 +2,24 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:island/models/file.dart';
|
import 'package:island/models/file.dart';
|
||||||
import 'package:island/models/file_list_item.dart';
|
import 'package:island/models/file_list_item.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
|
|
||||||
part 'file_list.g.dart';
|
part 'file_list.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class CloudFileListNotifier extends _$CloudFileListNotifier
|
Future<Map<String, dynamic>?> billingUsage(Ref ref) async {
|
||||||
with CursorPagingNotifierMixin<FileListItem> {
|
final client = ref.read(apiClientProvider);
|
||||||
|
final response = await client.get('/drive/billing/usage');
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
final indexedCloudFileListProvider = AsyncNotifierProvider(
|
||||||
|
IndexedCloudFileListNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
||||||
|
with AsyncPaginationController<FileListItem> {
|
||||||
String _currentPath = '/';
|
String _currentPath = '/';
|
||||||
String? _poolId;
|
String? _poolId;
|
||||||
String? _query;
|
String? _query;
|
||||||
@@ -42,12 +52,7 @@ class CloudFileListNotifier extends _$CloudFileListNotifier
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<FileListItem>> build() => fetch(cursor: null);
|
Future<List<FileListItem>> fetch() async {
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<FileListItem>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
final queryParameters = <String, String>{'path': _currentPath};
|
final queryParameters = <String, String>{'path': _currentPath};
|
||||||
@@ -83,21 +88,16 @@ class CloudFileListNotifier extends _$CloudFileListNotifier
|
|||||||
...files.map((file) => FileListItem.file(file)),
|
...files.map((file) => FileListItem.file(file)),
|
||||||
];
|
];
|
||||||
|
|
||||||
// The new API returns all files in the path, no pagination
|
return items;
|
||||||
return CursorPagingData(items: items, hasMore: false, nextCursor: null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final unindexedFileListProvider = AsyncNotifierProvider(
|
||||||
Future<Map<String, dynamic>?> billingUsage(Ref ref) async {
|
UnindexedFileListNotifier.new,
|
||||||
final client = ref.read(apiClientProvider);
|
);
|
||||||
final response = await client.get('/drive/billing/usage');
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@riverpod
|
class UnindexedFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
||||||
class UnindexedFileListNotifier extends _$UnindexedFileListNotifier
|
with AsyncPaginationController<FileListItem> {
|
||||||
with CursorPagingNotifierMixin<FileListItem> {
|
|
||||||
String? _poolId;
|
String? _poolId;
|
||||||
bool _recycled = false;
|
bool _recycled = false;
|
||||||
String? _query;
|
String? _query;
|
||||||
@@ -129,21 +129,15 @@ class UnindexedFileListNotifier extends _$UnindexedFileListNotifier
|
|||||||
ref.invalidateSelf();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
static const int pageSize = 20;
|
||||||
Future<CursorPagingData<FileListItem>> build() => fetch(cursor: null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<FileListItem>> fetch({
|
Future<List<FileListItem>> fetch() async {
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
final offset = cursor != null ? int.tryParse(cursor) ?? 0 : 0;
|
|
||||||
const take = 50; // Default page size
|
|
||||||
|
|
||||||
final queryParameters = <String, String>{
|
final queryParameters = <String, String>{
|
||||||
'take': take.toString(),
|
'take': pageSize.toString(),
|
||||||
'offset': offset.toString(),
|
'offset': fetchedCount.toString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_poolId != null) {
|
if (_poolId != null) {
|
||||||
@@ -169,7 +163,7 @@ class UnindexedFileListNotifier extends _$UnindexedFileListNotifier
|
|||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
totalCount = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
||||||
|
|
||||||
final List<SnCloudFile> files =
|
final List<SnCloudFile> files =
|
||||||
(response.data as List)
|
(response.data as List)
|
||||||
@@ -179,14 +173,7 @@ class UnindexedFileListNotifier extends _$UnindexedFileListNotifier
|
|||||||
final List<FileListItem> items =
|
final List<FileListItem> items =
|
||||||
files.map((file) => FileListItem.unindexedFile(file)).toList();
|
files.map((file) => FileListItem.unindexedFile(file)).toList();
|
||||||
|
|
||||||
final hasMore = offset + take < total;
|
return items;
|
||||||
final nextCursor = hasMore ? (offset + take).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,85 +6,87 @@ part of 'file_list.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(billingUsage)
|
||||||
|
const billingUsageProvider = BillingUsageProvider._();
|
||||||
|
|
||||||
|
final class BillingUsageProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<Map<String, dynamic>?>,
|
||||||
|
Map<String, dynamic>?,
|
||||||
|
FutureOr<Map<String, dynamic>?>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
|
const BillingUsageProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'billingUsageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$billingUsageHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<Map<String, dynamic>?> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Map<String, dynamic>?> create(Ref ref) {
|
||||||
|
return billingUsage(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
||||||
|
|
||||||
/// See also [billingUsage].
|
|
||||||
@ProviderFor(billingUsage)
|
|
||||||
final billingUsageProvider =
|
|
||||||
AutoDisposeFutureProvider<Map<String, dynamic>?>.internal(
|
|
||||||
billingUsage,
|
|
||||||
name: r'billingUsageProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$billingUsageHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef BillingUsageRef = AutoDisposeFutureProviderRef<Map<String, dynamic>?>;
|
|
||||||
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';
|
|
||||||
|
|
||||||
/// See also [billingQuota].
|
|
||||||
@ProviderFor(billingQuota)
|
@ProviderFor(billingQuota)
|
||||||
final billingQuotaProvider =
|
const billingQuotaProvider = BillingQuotaProvider._();
|
||||||
AutoDisposeFutureProvider<Map<String, dynamic>?>.internal(
|
|
||||||
billingQuota,
|
final class BillingQuotaProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<Map<String, dynamic>?>,
|
||||||
|
Map<String, dynamic>?,
|
||||||
|
FutureOr<Map<String, dynamic>?>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
|
const BillingQuotaProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'billingQuotaProvider',
|
name: r'billingQuotaProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$billingQuotaHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$billingQuotaHash();
|
||||||
typedef BillingQuotaRef = AutoDisposeFutureProviderRef<Map<String, dynamic>?>;
|
|
||||||
String _$cloudFileListNotifierHash() =>
|
|
||||||
r'533dfa86f920b60cf7491fb4aeb95ece19e428af';
|
|
||||||
|
|
||||||
/// See also [CloudFileListNotifier].
|
@$internal
|
||||||
@ProviderFor(CloudFileListNotifier)
|
@override
|
||||||
final cloudFileListNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
$FutureProviderElement<Map<String, dynamic>?> $createElement(
|
||||||
CloudFileListNotifier,
|
$ProviderPointer pointer,
|
||||||
CursorPagingData<FileListItem>
|
) => $FutureProviderElement(pointer);
|
||||||
>.internal(
|
|
||||||
CloudFileListNotifier.new,
|
|
||||||
name: r'cloudFileListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$cloudFileListNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$CloudFileListNotifier =
|
@override
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<FileListItem>>;
|
FutureOr<Map<String, dynamic>?> create(Ref ref) {
|
||||||
String _$unindexedFileListNotifierHash() =>
|
return billingQuota(ref);
|
||||||
r'afa487d7b956b71b21ca1b073a01364a34ede1d5';
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// See also [UnindexedFileListNotifier].
|
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';
|
||||||
@ProviderFor(UnindexedFileListNotifier)
|
|
||||||
final unindexedFileListNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
|
||||||
UnindexedFileListNotifier,
|
|
||||||
CursorPagingData<FileListItem>
|
|
||||||
>.internal(
|
|
||||||
UnindexedFileListNotifier.new,
|
|
||||||
name: r'unindexedFileListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$unindexedFileListNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$UnindexedFileListNotifier =
|
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<FileListItem>>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ final poolsProvider = FutureProvider<List<SnFilePool>>((ref) async {
|
|||||||
});
|
});
|
||||||
|
|
||||||
String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) {
|
String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) {
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
final configuredId = settings.defaultPoolId;
|
final configuredId = settings.defaultPoolId;
|
||||||
if (configuredId != null && pools.any((p) => p.id == configuredId)) {
|
if (configuredId != null && pools.any((p) => p.id == configuredId)) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:island/models/reference.dart';
|
import 'package:island/models/reference.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|||||||
@@ -6,148 +6,80 @@ part of 'file_references.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
@ProviderFor(fileReferences)
|
@ProviderFor(fileReferences)
|
||||||
const fileReferencesProvider = FileReferencesFamily();
|
const fileReferencesProvider = FileReferencesFamily._();
|
||||||
|
|
||||||
/// See also [fileReferences].
|
final class FileReferencesProvider
|
||||||
class FileReferencesFamily extends Family<AsyncValue<List<Reference>>> {
|
extends
|
||||||
/// See also [fileReferences].
|
$FunctionalProvider<
|
||||||
const FileReferencesFamily();
|
AsyncValue<List<Reference>>,
|
||||||
|
List<Reference>,
|
||||||
/// See also [fileReferences].
|
FutureOr<List<Reference>>
|
||||||
FileReferencesProvider call(String fileId) {
|
>
|
||||||
return FileReferencesProvider(fileId);
|
with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
|
||||||
}
|
const FileReferencesProvider._({
|
||||||
|
required FileReferencesFamily super.from,
|
||||||
@override
|
required String super.argument,
|
||||||
FileReferencesProvider getProviderOverride(
|
}) : super(
|
||||||
covariant FileReferencesProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'fileReferencesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
class FileReferencesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<Reference>> {
|
|
||||||
/// See also [fileReferences].
|
|
||||||
FileReferencesProvider(String fileId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => fileReferences(ref as FileReferencesRef, fileId),
|
|
||||||
from: fileReferencesProvider,
|
|
||||||
name: r'fileReferencesProvider',
|
name: r'fileReferencesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$fileReferencesHash,
|
|
||||||
dependencies: FileReferencesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
FileReferencesFamily._allTransitiveDependencies,
|
|
||||||
fileId: fileId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
FileReferencesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.fileId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String fileId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$fileReferencesHash();
|
||||||
FutureOr<List<Reference>> Function(FileReferencesRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'fileReferencesProvider'
|
||||||
override: FileReferencesProvider._internal(
|
''
|
||||||
(ref) => create(ref as FileReferencesRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
fileId: fileId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<Reference>> createElement() {
|
$FutureProviderElement<List<Reference>> $createElement(
|
||||||
return _FileReferencesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<Reference>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return fileReferences(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is FileReferencesProvider && other.fileId == fileId;
|
return other is FileReferencesProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, fileId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
||||||
// ignore: unused_element
|
|
||||||
mixin FileReferencesRef on AutoDisposeFutureProviderRef<List<Reference>> {
|
|
||||||
/// The parameter `fileId` of this provider.
|
|
||||||
String get fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FileReferencesProviderElement
|
final class FileReferencesFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<List<Reference>>
|
with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
|
||||||
with FileReferencesRef {
|
const FileReferencesFamily._()
|
||||||
_FileReferencesProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'fileReferencesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
FileReferencesProvider call(String fileId) =>
|
||||||
|
FileReferencesProvider._(argument: fileId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get fileId => (origin as FileReferencesProvider).fileId;
|
String toString() => r'fileReferencesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,159 +6,95 @@ part of 'link_preview.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$LinkPreview
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<SnScrappedLink?> {
|
|
||||||
late final String url;
|
|
||||||
|
|
||||||
FutureOr<SnScrappedLink?> build(String url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
@ProviderFor(LinkPreview)
|
@ProviderFor(LinkPreview)
|
||||||
const linkPreviewProvider = LinkPreviewFamily();
|
const linkPreviewProvider = LinkPreviewFamily._();
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
final class LinkPreviewProvider
|
||||||
class LinkPreviewFamily extends Family<AsyncValue<SnScrappedLink?>> {
|
extends $AsyncNotifierProvider<LinkPreview, SnScrappedLink?> {
|
||||||
/// See also [LinkPreview].
|
const LinkPreviewProvider._({
|
||||||
const LinkPreviewFamily();
|
required LinkPreviewFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [LinkPreview].
|
}) : super(
|
||||||
LinkPreviewProvider call(String url) {
|
retry: null,
|
||||||
return LinkPreviewProvider(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
LinkPreviewProvider getProviderOverride(
|
|
||||||
covariant LinkPreviewProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.url);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'linkPreviewProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
class LinkPreviewProvider
|
|
||||||
extends AutoDisposeAsyncNotifierProviderImpl<LinkPreview, SnScrappedLink?> {
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
LinkPreviewProvider(String url)
|
|
||||||
: this._internal(
|
|
||||||
() => LinkPreview()..url = url,
|
|
||||||
from: linkPreviewProvider,
|
|
||||||
name: r'linkPreviewProvider',
|
name: r'linkPreviewProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$linkPreviewHash,
|
|
||||||
dependencies: LinkPreviewFamily._dependencies,
|
|
||||||
allTransitiveDependencies: LinkPreviewFamily._allTransitiveDependencies,
|
|
||||||
url: url,
|
|
||||||
);
|
|
||||||
|
|
||||||
LinkPreviewProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.url,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String url;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<SnScrappedLink?> runNotifierBuild(covariant LinkPreview notifier) {
|
|
||||||
return notifier.build(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(LinkPreview Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: LinkPreviewProvider._internal(
|
|
||||||
() => create()..url = url,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
url: url,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?>
|
String debugGetCreateSourceHash() => _$linkPreviewHash();
|
||||||
createElement() {
|
|
||||||
return _LinkPreviewProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'linkPreviewProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
LinkPreview create() => LinkPreview();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is LinkPreviewProvider && other.url == url;
|
return other is LinkPreviewProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, url.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7';
|
||||||
// ignore: unused_element
|
|
||||||
mixin LinkPreviewRef on AutoDisposeAsyncNotifierProviderRef<SnScrappedLink?> {
|
|
||||||
/// The parameter `url` of this provider.
|
|
||||||
String get url;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LinkPreviewProviderElement
|
final class LinkPreviewFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?>
|
$ClassFamilyOverride<
|
||||||
with LinkPreviewRef {
|
LinkPreview,
|
||||||
_LinkPreviewProviderElement(super.provider);
|
AsyncValue<SnScrappedLink?>,
|
||||||
|
SnScrappedLink?,
|
||||||
|
FutureOr<SnScrappedLink?>,
|
||||||
|
String
|
||||||
|
> {
|
||||||
|
const LinkPreviewFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'linkPreviewProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
LinkPreviewProvider call(String url) =>
|
||||||
|
LinkPreviewProvider._(argument: url, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get url => (origin as LinkPreviewProvider).url;
|
String toString() => r'linkPreviewProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$LinkPreview extends $AsyncNotifier<SnScrappedLink?> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get url => _$args;
|
||||||
|
|
||||||
|
FutureOr<SnScrappedLink?> build(String url);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnScrappedLink?>, SnScrappedLink?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnScrappedLink?>, SnScrappedLink?>,
|
||||||
|
AsyncValue<SnScrappedLink?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
79
lib/pods/paging.dart
Normal file
79
lib/pods/paging.dart
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
abstract class PaginationController<T> {
|
||||||
|
int? get totalCount;
|
||||||
|
int get fetchedCount;
|
||||||
|
|
||||||
|
bool get fetchedAll;
|
||||||
|
|
||||||
|
FutureOr<List<T>> fetch();
|
||||||
|
|
||||||
|
Future<void> refresh();
|
||||||
|
|
||||||
|
Future<void> fetchFurther();
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class PaginationFiltered<F> {
|
||||||
|
late F currentFilter;
|
||||||
|
|
||||||
|
Future<void> applyFilter(F filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin AsyncPaginationController<T> on AsyncNotifier<List<T>>
|
||||||
|
implements PaginationController<T> {
|
||||||
|
@override
|
||||||
|
int? totalCount;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get fetchedCount => state.value?.length ?? 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<T>> build() async => fetch();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> refresh() async {
|
||||||
|
totalCount = null;
|
||||||
|
state = AsyncData<List<T>>([]);
|
||||||
|
|
||||||
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
|
return await fetch();
|
||||||
|
});
|
||||||
|
state = newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> fetchFurther() async {
|
||||||
|
if (fetchedAll) return;
|
||||||
|
|
||||||
|
state = AsyncLoading<List<T>>();
|
||||||
|
|
||||||
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
|
final elements = await fetch();
|
||||||
|
return [...?state.value, ...elements];
|
||||||
|
});
|
||||||
|
|
||||||
|
state = newState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin AsyncPaginationFilter<F, T> on AsyncPaginationController<T>
|
||||||
|
implements PaginationFiltered<F> {
|
||||||
|
@override
|
||||||
|
Future<void> applyFilter(F filter) async {
|
||||||
|
if (currentFilter == filter) return;
|
||||||
|
// Reset the data
|
||||||
|
totalCount = null;
|
||||||
|
state = AsyncData<List<T>>([]);
|
||||||
|
currentFilter = filter;
|
||||||
|
|
||||||
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
|
return await fetch();
|
||||||
|
});
|
||||||
|
state = newState;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,16 +55,12 @@ Future<String> siteFileContentRaw(
|
|||||||
return resp.data is String ? resp.data : resp.data['content'] as String;
|
return resp.data is String ? resp.data : resp.data['content'] as String;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SiteFilesNotifier
|
class SiteFilesNotifier extends AsyncNotifier<List<SnSiteFileEntry>> {
|
||||||
extends
|
final ({String siteId, String? path}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SiteFilesNotifier(this.arg);
|
||||||
List<SnSiteFileEntry>,
|
|
||||||
({String siteId, String? path})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnSiteFileEntry>> build(
|
Future<List<SnSiteFileEntry>> build() async {
|
||||||
({String siteId, String? path}) arg,
|
|
||||||
) async {
|
|
||||||
return fetchFiles();
|
return fetchFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +148,6 @@ class SiteFilesNotifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family<
|
final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family(
|
||||||
SiteFilesNotifier,
|
SiteFilesNotifier.new,
|
||||||
List<SnSiteFileEntry>,
|
);
|
||||||
({String siteId, String? path})
|
|
||||||
>(SiteFilesNotifier.new);
|
|
||||||
|
|||||||
@@ -6,446 +6,257 @@ part of 'site_files.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFiles].
|
|
||||||
@ProviderFor(siteFiles)
|
@ProviderFor(siteFiles)
|
||||||
const siteFilesProvider = SiteFilesFamily();
|
const siteFilesProvider = SiteFilesFamily._();
|
||||||
|
|
||||||
/// See also [siteFiles].
|
final class SiteFilesProvider
|
||||||
class SiteFilesFamily extends Family<AsyncValue<List<SnSiteFileEntry>>> {
|
extends
|
||||||
/// See also [siteFiles].
|
$FunctionalProvider<
|
||||||
const SiteFilesFamily();
|
AsyncValue<List<SnSiteFileEntry>>,
|
||||||
|
List<SnSiteFileEntry>,
|
||||||
/// See also [siteFiles].
|
FutureOr<List<SnSiteFileEntry>>
|
||||||
SiteFilesProvider call({required String siteId, String? path}) {
|
>
|
||||||
return SiteFilesProvider(siteId: siteId, path: path);
|
with
|
||||||
}
|
$FutureModifier<List<SnSiteFileEntry>>,
|
||||||
|
$FutureProvider<List<SnSiteFileEntry>> {
|
||||||
@override
|
const SiteFilesProvider._({
|
||||||
SiteFilesProvider getProviderOverride(covariant SiteFilesProvider provider) {
|
required SiteFilesFamily super.from,
|
||||||
return call(siteId: provider.siteId, path: provider.path);
|
required ({String siteId, String? path}) super.argument,
|
||||||
}
|
}) : super(
|
||||||
|
retry: null,
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFilesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFiles].
|
|
||||||
class SiteFilesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnSiteFileEntry>> {
|
|
||||||
/// See also [siteFiles].
|
|
||||||
SiteFilesProvider({required String siteId, String? path})
|
|
||||||
: this._internal(
|
|
||||||
(ref) => siteFiles(ref as SiteFilesRef, siteId: siteId, path: path),
|
|
||||||
from: siteFilesProvider,
|
|
||||||
name: r'siteFilesProvider',
|
name: r'siteFilesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$siteFilesHash,
|
|
||||||
dependencies: SiteFilesFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SiteFilesFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
path: path,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFilesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.path,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String? path;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$siteFilesHash();
|
||||||
FutureOr<List<SnSiteFileEntry>> Function(SiteFilesRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'siteFilesProvider'
|
||||||
override: SiteFilesProvider._internal(
|
''
|
||||||
(ref) => create(ref as SiteFilesRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
path: path,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnSiteFileEntry>> createElement() {
|
$FutureProviderElement<List<SnSiteFileEntry>> $createElement(
|
||||||
return _SiteFilesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnSiteFileEntry>> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String? path});
|
||||||
|
return siteFiles(ref, siteId: argument.siteId, path: argument.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SiteFilesProvider &&
|
return other is SiteFilesProvider && other.argument == argument;
|
||||||
other.siteId == siteId &&
|
|
||||||
other.path == path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, path.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8';
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFilesRef on AutoDisposeFutureProviderRef<List<SnSiteFileEntry>> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `path` of this provider.
|
final class SiteFilesFamily extends $Family
|
||||||
String? get path;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnSiteFileEntry>>,
|
||||||
|
({String siteId, String? path})
|
||||||
|
> {
|
||||||
|
const SiteFilesFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFilesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
SiteFilesProvider call({required String siteId, String? path}) =>
|
||||||
|
SiteFilesProvider._(argument: (siteId: siteId, path: path), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'siteFilesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SiteFilesProviderElement
|
@ProviderFor(siteFileContent)
|
||||||
extends AutoDisposeFutureProviderElement<List<SnSiteFileEntry>>
|
const siteFileContentProvider = SiteFileContentFamily._();
|
||||||
with SiteFilesRef {
|
|
||||||
_SiteFilesProviderElement(super.provider);
|
final class SiteFileContentProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnFileContent>,
|
||||||
|
SnFileContent,
|
||||||
|
FutureOr<SnFileContent>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnFileContent>, $FutureProvider<SnFileContent> {
|
||||||
|
const SiteFileContentProvider._({
|
||||||
|
required SiteFileContentFamily super.from,
|
||||||
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get siteId => (origin as SiteFilesProvider).siteId;
|
String debugGetCreateSourceHash() => _$siteFileContentHash();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get path => (origin as SiteFilesProvider).path;
|
String toString() {
|
||||||
|
return r'siteFileContentProvider'
|
||||||
|
''
|
||||||
|
'$argument';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnFileContent> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnFileContent> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String relativePath});
|
||||||
|
return siteFileContent(
|
||||||
|
ref,
|
||||||
|
siteId: argument.siteId,
|
||||||
|
relativePath: argument.relativePath,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is SiteFileContentProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1';
|
String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1';
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
final class SiteFileContentFamily extends $Family
|
||||||
@ProviderFor(siteFileContent)
|
with
|
||||||
const siteFileContentProvider = SiteFileContentFamily();
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<SnFileContent>,
|
||||||
|
({String siteId, String relativePath})
|
||||||
|
> {
|
||||||
|
const SiteFileContentFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
class SiteFileContentFamily extends Family<AsyncValue<SnFileContent>> {
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
const SiteFileContentFamily();
|
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
SiteFileContentProvider call({
|
SiteFileContentProvider call({
|
||||||
required String siteId,
|
required String siteId,
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
}) {
|
}) => SiteFileContentProvider._(
|
||||||
return SiteFileContentProvider(siteId: siteId, relativePath: relativePath);
|
argument: (siteId: siteId, relativePath: relativePath),
|
||||||
}
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SiteFileContentProvider getProviderOverride(
|
String toString() => r'siteFileContentProvider';
|
||||||
covariant SiteFileContentProvider provider,
|
|
||||||
) {
|
|
||||||
return call(siteId: provider.siteId, relativePath: provider.relativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFileContentProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
@ProviderFor(siteFileContentRaw)
|
||||||
class SiteFileContentProvider extends AutoDisposeFutureProvider<SnFileContent> {
|
const siteFileContentRawProvider = SiteFileContentRawFamily._();
|
||||||
/// See also [siteFileContent].
|
|
||||||
SiteFileContentProvider({
|
final class SiteFileContentRawProvider
|
||||||
required String siteId,
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
required String relativePath,
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
}) : this._internal(
|
const SiteFileContentRawProvider._({
|
||||||
(ref) => siteFileContent(
|
required SiteFileContentRawFamily super.from,
|
||||||
ref as SiteFileContentRef,
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
siteId: siteId,
|
}) : super(
|
||||||
relativePath: relativePath,
|
retry: null,
|
||||||
),
|
name: r'siteFileContentRawProvider',
|
||||||
from: siteFileContentProvider,
|
isAutoDispose: true,
|
||||||
name: r'siteFileContentProvider',
|
dependencies: null,
|
||||||
debugGetCreateSourceHash:
|
$allTransitiveDependencies: null,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$siteFileContentHash,
|
|
||||||
dependencies: SiteFileContentFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
SiteFileContentFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFileContentProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.relativePath,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String relativePath;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$siteFileContentRawHash();
|
||||||
FutureOr<SnFileContent> Function(SiteFileContentRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'siteFileContentRawProvider'
|
||||||
override: SiteFileContentProvider._internal(
|
''
|
||||||
(ref) => create(ref as SiteFileContentRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnFileContent> createElement() {
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
return _SiteFileContentProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String relativePath});
|
||||||
|
return siteFileContentRaw(
|
||||||
|
ref,
|
||||||
|
siteId: argument.siteId,
|
||||||
|
relativePath: argument.relativePath,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SiteFileContentProvider &&
|
return other is SiteFileContentRawProvider && other.argument == argument;
|
||||||
other.siteId == siteId &&
|
|
||||||
other.relativePath == relativePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, relativePath.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFileContentRef on AutoDisposeFutureProviderRef<SnFileContent> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `relativePath` of this provider.
|
|
||||||
String get relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SiteFileContentProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnFileContent>
|
|
||||||
with SiteFileContentRef {
|
|
||||||
_SiteFileContentProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get siteId => (origin as SiteFileContentProvider).siteId;
|
|
||||||
@override
|
|
||||||
String get relativePath => (origin as SiteFileContentProvider).relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$siteFileContentRawHash() =>
|
String _$siteFileContentRawHash() =>
|
||||||
r'd0331c30698a9f4b90fe9b79273ff5914fa46616';
|
r'd0331c30698a9f4b90fe9b79273ff5914fa46616';
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
final class SiteFileContentRawFamily extends $Family
|
||||||
@ProviderFor(siteFileContentRaw)
|
with
|
||||||
const siteFileContentRawProvider = SiteFileContentRawFamily();
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<String>,
|
||||||
|
({String siteId, String relativePath})
|
||||||
|
> {
|
||||||
|
const SiteFileContentRawFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentRawProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
class SiteFileContentRawFamily extends Family<AsyncValue<String>> {
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
const SiteFileContentRawFamily();
|
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
SiteFileContentRawProvider call({
|
SiteFileContentRawProvider call({
|
||||||
required String siteId,
|
required String siteId,
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
}) {
|
}) => SiteFileContentRawProvider._(
|
||||||
return SiteFileContentRawProvider(
|
argument: (siteId: siteId, relativePath: relativePath),
|
||||||
siteId: siteId,
|
from: this,
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SiteFileContentRawProvider getProviderOverride(
|
|
||||||
covariant SiteFileContentRawProvider provider,
|
|
||||||
) {
|
|
||||||
return call(siteId: provider.siteId, relativePath: provider.relativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFileContentRawProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
class SiteFileContentRawProvider extends AutoDisposeFutureProvider<String> {
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
SiteFileContentRawProvider({
|
|
||||||
required String siteId,
|
|
||||||
required String relativePath,
|
|
||||||
}) : this._internal(
|
|
||||||
(ref) => siteFileContentRaw(
|
|
||||||
ref as SiteFileContentRawRef,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
from: siteFileContentRawProvider,
|
|
||||||
name: r'siteFileContentRawProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$siteFileContentRawHash,
|
|
||||||
dependencies: SiteFileContentRawFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
SiteFileContentRawFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFileContentRawProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.relativePath,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String relativePath;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String toString() => r'siteFileContentRawProvider';
|
||||||
FutureOr<String> Function(SiteFileContentRawRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: SiteFileContentRawProvider._internal(
|
|
||||||
(ref) => create(ref as SiteFileContentRawRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<String> createElement() {
|
|
||||||
return _SiteFileContentRawProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is SiteFileContentRawProvider &&
|
|
||||||
other.siteId == siteId &&
|
|
||||||
other.relativePath == relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, relativePath.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFileContentRawRef on AutoDisposeFutureProviderRef<String> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `relativePath` of this provider.
|
|
||||||
String get relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SiteFileContentRawProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<String>
|
|
||||||
with SiteFileContentRawRef {
|
|
||||||
_SiteFileContentRawProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get siteId => (origin as SiteFileContentRawProvider).siteId;
|
|
||||||
@override
|
|
||||||
String get relativePath =>
|
|
||||||
(origin as SiteFileContentRawProvider).relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -25,16 +25,12 @@ Future<SnPublicationPage> sitePage(Ref ref, String pageId) async {
|
|||||||
return SnPublicationPage.fromJson(resp.data);
|
return SnPublicationPage.fromJson(resp.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SitePagesNotifier
|
class SitePagesNotifier extends AsyncNotifier<List<SnPublicationPage>> {
|
||||||
extends
|
final ({String pubName, String siteSlug}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SitePagesNotifier(this.arg);
|
||||||
List<SnPublicationPage>,
|
|
||||||
({String pubName, String siteSlug})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPublicationPage>> build(
|
Future<List<SnPublicationPage>> build() async {
|
||||||
({String pubName, String siteSlug}) arg,
|
|
||||||
) async {
|
|
||||||
return fetchPages();
|
return fetchPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,275 +6,163 @@ part of 'site_pages.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePages].
|
|
||||||
@ProviderFor(sitePages)
|
@ProviderFor(sitePages)
|
||||||
const sitePagesProvider = SitePagesFamily();
|
const sitePagesProvider = SitePagesFamily._();
|
||||||
|
|
||||||
/// See also [sitePages].
|
final class SitePagesProvider
|
||||||
class SitePagesFamily extends Family<AsyncValue<List<SnPublicationPage>>> {
|
extends
|
||||||
/// See also [sitePages].
|
$FunctionalProvider<
|
||||||
const SitePagesFamily();
|
AsyncValue<List<SnPublicationPage>>,
|
||||||
|
List<SnPublicationPage>,
|
||||||
/// See also [sitePages].
|
FutureOr<List<SnPublicationPage>>
|
||||||
SitePagesProvider call(String pubName, String siteSlug) {
|
>
|
||||||
return SitePagesProvider(pubName, siteSlug);
|
with
|
||||||
}
|
$FutureModifier<List<SnPublicationPage>>,
|
||||||
|
$FutureProvider<List<SnPublicationPage>> {
|
||||||
@override
|
const SitePagesProvider._({
|
||||||
SitePagesProvider getProviderOverride(covariant SitePagesProvider provider) {
|
required SitePagesFamily super.from,
|
||||||
return call(provider.pubName, provider.siteSlug);
|
required (String, String) super.argument,
|
||||||
}
|
}) : super(
|
||||||
|
retry: null,
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'sitePagesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePages].
|
|
||||||
class SitePagesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnPublicationPage>> {
|
|
||||||
/// See also [sitePages].
|
|
||||||
SitePagesProvider(String pubName, String siteSlug)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => sitePages(ref as SitePagesRef, pubName, siteSlug),
|
|
||||||
from: sitePagesProvider,
|
|
||||||
name: r'sitePagesProvider',
|
name: r'sitePagesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$sitePagesHash,
|
|
||||||
dependencies: SitePagesFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SitePagesFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SitePagesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
required this.siteSlug,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
final String siteSlug;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$sitePagesHash();
|
||||||
FutureOr<List<SnPublicationPage>> Function(SitePagesRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'sitePagesProvider'
|
||||||
override: SitePagesProvider._internal(
|
''
|
||||||
(ref) => create(ref as SitePagesRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnPublicationPage>> createElement() {
|
$FutureProviderElement<List<SnPublicationPage>> $createElement(
|
||||||
return _SitePagesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPublicationPage>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return sitePages(ref, argument.$1, argument.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SitePagesProvider &&
|
return other is SitePagesProvider && other.argument == argument;
|
||||||
other.pubName == pubName &&
|
|
||||||
other.siteSlug == siteSlug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, siteSlug.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03';
|
||||||
// ignore: unused_element
|
|
||||||
mixin SitePagesRef on AutoDisposeFutureProviderRef<List<SnPublicationPage>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
|
|
||||||
/// The parameter `siteSlug` of this provider.
|
final class SitePagesFamily extends $Family
|
||||||
String get siteSlug;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnPublicationPage>>,
|
||||||
|
(String, String)
|
||||||
|
> {
|
||||||
|
const SitePagesFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'sitePagesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
SitePagesProvider call(String pubName, String siteSlug) =>
|
||||||
|
SitePagesProvider._(argument: (pubName, siteSlug), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'sitePagesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SitePagesProviderElement
|
@ProviderFor(sitePage)
|
||||||
extends AutoDisposeFutureProviderElement<List<SnPublicationPage>>
|
const sitePageProvider = SitePageFamily._();
|
||||||
with SitePagesRef {
|
|
||||||
_SitePagesProviderElement(super.provider);
|
final class SitePageProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnPublicationPage>,
|
||||||
|
SnPublicationPage,
|
||||||
|
FutureOr<SnPublicationPage>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<SnPublicationPage>,
|
||||||
|
$FutureProvider<SnPublicationPage> {
|
||||||
|
const SitePageProvider._({
|
||||||
|
required SitePageFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'sitePageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get pubName => (origin as SitePagesProvider).pubName;
|
String debugGetCreateSourceHash() => _$sitePageHash();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get siteSlug => (origin as SitePagesProvider).siteSlug;
|
String toString() {
|
||||||
|
return r'sitePageProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnPublicationPage> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublicationPage> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return sitePage(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is SitePageProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
|
String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
|
||||||
|
|
||||||
/// See also [sitePage].
|
final class SitePageFamily extends $Family
|
||||||
@ProviderFor(sitePage)
|
with $FunctionalFamilyOverride<FutureOr<SnPublicationPage>, String> {
|
||||||
const sitePageProvider = SitePageFamily();
|
const SitePageFamily._()
|
||||||
|
: super(
|
||||||
/// See also [sitePage].
|
retry: null,
|
||||||
class SitePageFamily extends Family<AsyncValue<SnPublicationPage>> {
|
|
||||||
/// See also [sitePage].
|
|
||||||
const SitePageFamily();
|
|
||||||
|
|
||||||
/// See also [sitePage].
|
|
||||||
SitePageProvider call(String pageId) {
|
|
||||||
return SitePageProvider(pageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SitePageProvider getProviderOverride(covariant SitePageProvider provider) {
|
|
||||||
return call(provider.pageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'sitePageProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePage].
|
|
||||||
class SitePageProvider extends AutoDisposeFutureProvider<SnPublicationPage> {
|
|
||||||
/// See also [sitePage].
|
|
||||||
SitePageProvider(String pageId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => sitePage(ref as SitePageRef, pageId),
|
|
||||||
from: sitePageProvider,
|
|
||||||
name: r'sitePageProvider',
|
name: r'sitePageProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$sitePageHash,
|
|
||||||
dependencies: SitePageFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SitePageFamily._allTransitiveDependencies,
|
|
||||||
pageId: pageId,
|
|
||||||
);
|
|
||||||
|
|
||||||
SitePageProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pageId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pageId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnPublicationPage> Function(SitePageRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: SitePageProvider._internal(
|
|
||||||
(ref) => create(ref as SitePageRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
pageId: pageId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
SitePageProvider call(String pageId) =>
|
||||||
|
SitePageProvider._(argument: pageId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublicationPage> createElement() {
|
String toString() => r'sitePageProvider';
|
||||||
return _SitePageProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is SitePageProvider && other.pageId == pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pageId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SitePageRef on AutoDisposeFutureProviderRef<SnPublicationPage> {
|
|
||||||
/// The parameter `pageId` of this provider.
|
|
||||||
String get pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SitePageProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPublicationPage>
|
|
||||||
with SitePageRef {
|
|
||||||
_SitePageProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get pageId => (origin as SitePageProvider).pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -4,16 +4,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:island/models/publication_site.dart';
|
import 'package:island/models/publication_site.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|
||||||
class SiteNotifier
|
class SiteNotifier extends AsyncNotifier<SnPublicationSite> {
|
||||||
extends
|
final ({String pubName, String? siteId}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SiteNotifier(this.arg);
|
||||||
SnPublicationSite,
|
|
||||||
({String pubName, String? siteId})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
FutureOr<SnPublicationSite> build(
|
FutureOr<SnPublicationSite> build() async {
|
||||||
({String pubName, String? siteId}) arg,
|
|
||||||
) async {
|
|
||||||
if (arg.siteId == null || arg.siteId!.isEmpty) {
|
if (arg.siteId == null || arg.siteId!.isEmpty) {
|
||||||
return SnPublicationSite(
|
return SnPublicationSite(
|
||||||
id: '',
|
id: '',
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:island/pods/config.dart';
|
import 'package:island/pods/config.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
part 'theme.g.dart';
|
part 'theme.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
ThemeSet theme(Ref ref) {
|
ThemeSet theme(Ref ref) {
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
return createAppThemeSet(settings);
|
return createAppThemeSet(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,46 @@ part of 'theme.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$themeHash() => r'a12dbf8b83d75713b7ae4c68e9cdd1a1cc3a35f0';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [theme].
|
|
||||||
@ProviderFor(theme)
|
@ProviderFor(theme)
|
||||||
final themeProvider = AutoDisposeProvider<ThemeSet>.internal(
|
const themeProvider = ThemeProvider._();
|
||||||
theme,
|
|
||||||
name: r'themeProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$themeHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
final class ThemeProvider
|
||||||
// ignore: unused_element
|
extends $FunctionalProvider<ThemeSet, ThemeSet, ThemeSet>
|
||||||
typedef ThemeRef = AutoDisposeProviderRef<ThemeSet>;
|
with $Provider<ThemeSet> {
|
||||||
// ignore_for_file: type=lint
|
const ThemeProvider._()
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'themeProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$themeHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<ThemeSet> $createElement($ProviderPointer pointer) =>
|
||||||
|
$ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
ThemeSet create(Ref ref) {
|
||||||
|
return theme(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(ThemeSet value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<ThemeSet>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$themeHash() => r'5b41b68e2fc59431bb195ff75f63383982f7730f';
|
||||||
|
|||||||
62
lib/pods/timeline.dart
Normal file
62
lib/pods/timeline.dart
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/activity.dart';
|
||||||
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
|
final activityListProvider =
|
||||||
|
AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>(
|
||||||
|
ActivityListNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||||
|
with
|
||||||
|
AsyncPaginationController<SnTimelineEvent>,
|
||||||
|
AsyncPaginationFilter<String?, SnTimelineEvent> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? currentFilter;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<SnTimelineEvent>> fetch() async {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
|
final cursor = state.value?.lastOrNull?.createdAt.toUtc().toIso8601String();
|
||||||
|
|
||||||
|
final queryParameters = {
|
||||||
|
if (cursor != null) 'cursor': cursor,
|
||||||
|
'take': pageSize,
|
||||||
|
if (currentFilter != null) 'filter': currentFilter,
|
||||||
|
if (kDebugMode)
|
||||||
|
'debugInclude': 'realms,publishers,articles,shuffledPosts',
|
||||||
|
};
|
||||||
|
|
||||||
|
final response = await client.get(
|
||||||
|
'/sphere/timeline',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<SnTimelineEvent> items =
|
||||||
|
(response.data as List)
|
||||||
|
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
||||||
|
|
||||||
|
totalCount =
|
||||||
|
(state.value?.length ?? 0) + items.length + (hasMore ? pageSize : 0);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateOne(int index, SnTimelineEvent activity) {
|
||||||
|
final currentState = state.value;
|
||||||
|
if (currentState == null) return;
|
||||||
|
|
||||||
|
final updatedItems = [...currentState];
|
||||||
|
updatedItems[index] = activity;
|
||||||
|
|
||||||
|
state = AsyncData(updatedItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -6,269 +6,152 @@ part of 'translate.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [translateString].
|
|
||||||
@ProviderFor(translateString)
|
@ProviderFor(translateString)
|
||||||
const translateStringProvider = TranslateStringFamily();
|
const translateStringProvider = TranslateStringFamily._();
|
||||||
|
|
||||||
/// See also [translateString].
|
final class TranslateStringProvider
|
||||||
class TranslateStringFamily extends Family<AsyncValue<String>> {
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
/// See also [translateString].
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
const TranslateStringFamily();
|
const TranslateStringProvider._({
|
||||||
|
required TranslateStringFamily super.from,
|
||||||
/// See also [translateString].
|
required TranslateQuery super.argument,
|
||||||
TranslateStringProvider call(TranslateQuery query) {
|
}) : super(
|
||||||
return TranslateStringProvider(query);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TranslateStringProvider getProviderOverride(
|
|
||||||
covariant TranslateStringProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'translateStringProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [translateString].
|
|
||||||
class TranslateStringProvider extends AutoDisposeFutureProvider<String> {
|
|
||||||
/// See also [translateString].
|
|
||||||
TranslateStringProvider(TranslateQuery query)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => translateString(ref as TranslateStringRef, query),
|
|
||||||
from: translateStringProvider,
|
|
||||||
name: r'translateStringProvider',
|
name: r'translateStringProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$translateStringHash,
|
|
||||||
dependencies: TranslateStringFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
TranslateStringFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
TranslateStringProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final TranslateQuery query;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$translateStringHash();
|
||||||
FutureOr<String> Function(TranslateStringRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'translateStringProvider'
|
||||||
override: TranslateStringProvider._internal(
|
''
|
||||||
(ref) => create(ref as TranslateStringRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<String> createElement() {
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
return _TranslateStringProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
final argument = this.argument as TranslateQuery;
|
||||||
|
return translateString(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is TranslateStringProvider && other.query == query;
|
return other is TranslateStringProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
|
||||||
// ignore: unused_element
|
|
||||||
mixin TranslateStringRef on AutoDisposeFutureProviderRef<String> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
TranslateQuery get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TranslateStringProviderElement
|
final class TranslateStringFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<String>
|
with $FunctionalFamilyOverride<FutureOr<String>, TranslateQuery> {
|
||||||
with TranslateStringRef {
|
const TranslateStringFamily._()
|
||||||
_TranslateStringProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'translateStringProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
TranslateStringProvider call(TranslateQuery query) =>
|
||||||
|
TranslateStringProvider._(argument: query, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TranslateQuery get query => (origin as TranslateStringProvider).query;
|
String toString() => r'translateStringProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(detectStringLanguage)
|
||||||
|
const detectStringLanguageProvider = DetectStringLanguageFamily._();
|
||||||
|
|
||||||
|
final class DetectStringLanguageProvider
|
||||||
|
extends $FunctionalProvider<String?, String?, String?>
|
||||||
|
with $Provider<String?> {
|
||||||
|
const DetectStringLanguageProvider._({
|
||||||
|
required DetectStringLanguageFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'detectStringLanguageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$detectStringLanguageHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'detectStringLanguageProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<String?> $createElement($ProviderPointer pointer) =>
|
||||||
|
$ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return detectStringLanguage(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(String? value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<String?>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is DetectStringLanguageProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$detectStringLanguageHash() =>
|
String _$detectStringLanguageHash() =>
|
||||||
r'24fbf52edbbffcc8dc4f09f7206f82d69728e703';
|
r'24fbf52edbbffcc8dc4f09f7206f82d69728e703';
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
final class DetectStringLanguageFamily extends $Family
|
||||||
@ProviderFor(detectStringLanguage)
|
with $FunctionalFamilyOverride<String?, String> {
|
||||||
const detectStringLanguageProvider = DetectStringLanguageFamily();
|
const DetectStringLanguageFamily._()
|
||||||
|
: super(
|
||||||
/// See also [detectStringLanguage].
|
retry: null,
|
||||||
class DetectStringLanguageFamily extends Family<String?> {
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
const DetectStringLanguageFamily();
|
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
DetectStringLanguageProvider call(String text) {
|
|
||||||
return DetectStringLanguageProvider(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
DetectStringLanguageProvider getProviderOverride(
|
|
||||||
covariant DetectStringLanguageProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'detectStringLanguageProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
class DetectStringLanguageProvider extends AutoDisposeProvider<String?> {
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
DetectStringLanguageProvider(String text)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => detectStringLanguage(ref as DetectStringLanguageRef, text),
|
|
||||||
from: detectStringLanguageProvider,
|
|
||||||
name: r'detectStringLanguageProvider',
|
name: r'detectStringLanguageProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$detectStringLanguageHash,
|
|
||||||
dependencies: DetectStringLanguageFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
DetectStringLanguageFamily._allTransitiveDependencies,
|
|
||||||
text: text,
|
|
||||||
);
|
|
||||||
|
|
||||||
DetectStringLanguageProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.text,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String text;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
String? Function(DetectStringLanguageRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: DetectStringLanguageProvider._internal(
|
|
||||||
(ref) => create(ref as DetectStringLanguageRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
text: text,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
DetectStringLanguageProvider call(String text) =>
|
||||||
|
DetectStringLanguageProvider._(argument: text, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeProviderElement<String?> createElement() {
|
String toString() => r'detectStringLanguageProvider';
|
||||||
return _DetectStringLanguageProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is DetectStringLanguageProvider && other.text == text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, text.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin DetectStringLanguageRef on AutoDisposeProviderRef<String?> {
|
|
||||||
/// The parameter `text` of this provider.
|
|
||||||
String get text;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DetectStringLanguageProviderElement
|
|
||||||
extends AutoDisposeProviderElement<String?>
|
|
||||||
with DetectStringLanguageRef {
|
|
||||||
_DetectStringLanguageProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get text => (origin as DetectStringLanguageProvider).text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -9,18 +9,16 @@ import 'package:island/pods/websocket.dart';
|
|||||||
import 'package:island/services/file_uploader.dart';
|
import 'package:island/services/file_uploader.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
|
|
||||||
final uploadTasksProvider =
|
final uploadTasksProvider = NotifierProvider(UploadTasksNotifier.new);
|
||||||
StateNotifierProvider<UploadTasksNotifier, List<DriveTask>>(
|
|
||||||
(ref) => UploadTasksNotifier(ref),
|
|
||||||
);
|
|
||||||
|
|
||||||
class UploadTasksNotifier extends StateNotifier<List<DriveTask>> {
|
class UploadTasksNotifier extends Notifier<List<DriveTask>> {
|
||||||
final Ref ref;
|
|
||||||
StreamSubscription? _websocketSubscription;
|
StreamSubscription? _websocketSubscription;
|
||||||
final Map<String, Map<String, dynamic>> _pendingUploads = {};
|
final Map<String, Map<String, dynamic>> _pendingUploads = {};
|
||||||
|
|
||||||
UploadTasksNotifier(this.ref) : super([]) {
|
@override
|
||||||
|
List<DriveTask> build() {
|
||||||
_listenToWebSocket();
|
_listenToWebSocket();
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _listenToWebSocket() {
|
void _listenToWebSocket() {
|
||||||
@@ -334,10 +332,8 @@ class UploadTasksNotifier extends StateNotifier<List<DriveTask>> {
|
|||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_websocketSubscription?.cancel();
|
_websocketSubscription?.cancel();
|
||||||
super.dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,26 +14,27 @@ import 'package:island/pods/config.dart';
|
|||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
|
|
||||||
class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
||||||
final Ref _ref;
|
@override
|
||||||
|
Future<SnAccount?> build() async {
|
||||||
UserInfoNotifier(this._ref) : super(const AsyncValue.data(null));
|
final token = ref.watch(tokenProvider);
|
||||||
|
|
||||||
Future<void> fetchUser() async {
|
|
||||||
final token = _ref.watch(tokenProvider);
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
talker.info('[UserInfo] No token found, not going to fetch...');
|
talker.info('[UserInfo] No token found, not going to fetch...');
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
return _fetchUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<SnAccount?> _fetchUser() async {
|
||||||
try {
|
try {
|
||||||
final client = _ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final response = await client.get('/pass/accounts/me');
|
final response = await client.get('/pass/accounts/me');
|
||||||
final user = SnAccount.fromJson(response.data);
|
final user = SnAccount.fromJson(response.data);
|
||||||
state = AsyncValue.data(user);
|
|
||||||
|
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
||||||
FirebaseAnalytics.instance.setUserId(id: user.id);
|
FirebaseAnalytics.instance.setUserId(id: user.id);
|
||||||
}
|
}
|
||||||
|
return user;
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
if (!kIsWeb) {
|
if (!kIsWeb) {
|
||||||
if (error is DioException) {
|
if (error is DioException) {
|
||||||
@@ -69,10 +70,10 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
fetchUser();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
showOverlayDialog<bool>(
|
showOverlayDialog<bool>(
|
||||||
builder:
|
builder:
|
||||||
(context, close) => AlertDialog(
|
(context, close) => AlertDialog(
|
||||||
@@ -96,31 +97,36 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
fetchUser();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
talker.error(
|
talker.error(
|
||||||
"[UserInfo] Failed to fetch user info...",
|
"[UserInfo] Failed to fetch user info...",
|
||||||
error,
|
error,
|
||||||
stackTrace,
|
stackTrace,
|
||||||
);
|
);
|
||||||
state = AsyncValue.data(null);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> fetchUser() async {
|
||||||
|
ref.invalidateSelf();
|
||||||
|
await future;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> logOut() async {
|
Future<void> logOut() async {
|
||||||
state = const AsyncValue.data(null);
|
state = const AsyncValue.data(null);
|
||||||
final prefs = _ref.read(sharedPreferencesProvider);
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
await prefs.remove(kTokenPairStoreKey);
|
await prefs.remove(kTokenPairStoreKey);
|
||||||
_ref.invalidate(tokenProvider);
|
ref.invalidate(tokenProvider);
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
||||||
FirebaseAnalytics.instance.setUserId(id: null);
|
FirebaseAnalytics.instance.setUserId(id: null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final userInfoProvider =
|
final userInfoProvider = AsyncNotifierProvider<UserInfoNotifier, SnAccount?>(
|
||||||
StateNotifierProvider<UserInfoNotifier, AsyncValue<SnAccount?>>(
|
UserInfoNotifier.new,
|
||||||
(ref) => UserInfoNotifier(ref),
|
);
|
||||||
);
|
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ class WebAuthServerState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebAuthServerNotifier extends StateNotifier<WebAuthServerState> {
|
class WebAuthServerNotifier extends Notifier<WebAuthServerState> {
|
||||||
final WebAuthServer _server;
|
late final WebAuthServer _server;
|
||||||
|
|
||||||
WebAuthServerNotifier(this._server) : super(WebAuthServerState());
|
@override
|
||||||
|
WebAuthServerState build() {
|
||||||
|
_server = ref.watch(webAuthServerProvider);
|
||||||
|
return WebAuthServerState();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> start() async {
|
Future<void> start() async {
|
||||||
try {
|
try {
|
||||||
@@ -47,7 +51,6 @@ final webAuthServerProvider = Provider<WebAuthServer>((ref) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final webAuthServerStateProvider =
|
final webAuthServerStateProvider =
|
||||||
StateNotifierProvider<WebAuthServerNotifier, WebAuthServerState>((ref) {
|
NotifierProvider<WebAuthServerNotifier, WebAuthServerState>(
|
||||||
final server = ref.watch(webAuthServerProvider);
|
WebAuthServerNotifier.new,
|
||||||
return WebAuthServerNotifier(server);
|
);
|
||||||
});
|
|
||||||
|
|||||||
@@ -16,14 +16,12 @@ final webFeedListProvider = FutureProvider.family<List<SnWebFeed>, String>((
|
|||||||
.toList();
|
.toList();
|
||||||
});
|
});
|
||||||
|
|
||||||
class WebFeedNotifier
|
class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
||||||
extends
|
final ({String pubName, String? feedId}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
WebFeedNotifier(this.arg);
|
||||||
SnWebFeed,
|
|
||||||
({String pubName, String? feedId})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
FutureOr<SnWebFeed> build(({String pubName, String? feedId}) arg) async {
|
FutureOr<SnWebFeed> build() async {
|
||||||
if (arg.feedId == null || arg.feedId!.isEmpty) {
|
if (arg.feedId == null || arg.feedId!.isEmpty) {
|
||||||
return SnWebFeed(
|
return SnWebFeed(
|
||||||
id: '',
|
id: '',
|
||||||
|
|||||||
@@ -100,12 +100,16 @@ class WebSocketService {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDone: () {
|
onDone: () {
|
||||||
talker.info('[WebSocket] Connection closed, attempting to reconnect...');
|
talker.info(
|
||||||
|
'[WebSocket] Connection closed, attempting to reconnect...',
|
||||||
|
);
|
||||||
_scheduleReconnect();
|
_scheduleReconnect();
|
||||||
_statusStreamController.sink.add(WebSocketState.disconnected());
|
_statusStreamController.sink.add(WebSocketState.disconnected());
|
||||||
},
|
},
|
||||||
onError: (error) {
|
onError: (error) {
|
||||||
talker.error('[WebSocket] Error occurred: $error, attempting to reconnect...');
|
talker.error(
|
||||||
|
'[WebSocket] Error occurred: $error, attempting to reconnect...',
|
||||||
|
);
|
||||||
_scheduleReconnect();
|
_scheduleReconnect();
|
||||||
_statusStreamController.sink.add(
|
_statusStreamController.sink.add(
|
||||||
WebSocketState.error(error.toString()),
|
WebSocketState.error(error.toString()),
|
||||||
@@ -152,15 +156,20 @@ class WebSocketService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final websocketStateProvider =
|
final websocketStateProvider =
|
||||||
StateNotifierProvider<WebSocketStateNotifier, WebSocketState>(
|
NotifierProvider<WebSocketStateNotifier, WebSocketState>(
|
||||||
(ref) => WebSocketStateNotifier(ref),
|
WebSocketStateNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class WebSocketStateNotifier extends StateNotifier<WebSocketState> {
|
class WebSocketStateNotifier extends Notifier<WebSocketState> {
|
||||||
final Ref ref;
|
|
||||||
Timer? _reconnectTimer;
|
Timer? _reconnectTimer;
|
||||||
|
|
||||||
WebSocketStateNotifier(this.ref) : super(const WebSocketState.disconnected());
|
@override
|
||||||
|
WebSocketState build() {
|
||||||
|
ref.onDispose(() {
|
||||||
|
_reconnectTimer?.cancel();
|
||||||
|
});
|
||||||
|
return const WebSocketState.disconnected();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> connect() async {
|
Future<void> connect() async {
|
||||||
state = const WebSocketState.connecting();
|
state = const WebSocketState.connecting();
|
||||||
@@ -169,7 +178,7 @@ class WebSocketStateNotifier extends StateNotifier<WebSocketState> {
|
|||||||
await service.connect(ref);
|
await service.connect(ref);
|
||||||
state = const WebSocketState.connected();
|
state = const WebSocketState.connected();
|
||||||
service.statusStream.listen((event) {
|
service.statusStream.listen((event) {
|
||||||
if (mounted) state = event;
|
state = event;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
state = WebSocketState.error('Failed to connect: $err');
|
state = WebSocketState.error('Failed to connect: $err');
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
final notificationUnreadCount = ref.watch(
|
final notificationUnreadCount = ref.watch(notificationUnreadCountProvider);
|
||||||
notificationUnreadCountNotifierProvider,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (user.value == null || user.value == null) {
|
if (user.value == null || user.value == null) {
|
||||||
return _UnauthorizedAccountScreen();
|
return _UnauthorizedAccountScreen();
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/account.dart';
|
import 'package:island/models/account.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
|
import 'package:island/services/time.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'credits.g.dart';
|
part 'credits.g.dart';
|
||||||
@@ -21,40 +23,35 @@ Future<double> socialCredits(Ref ref) async {
|
|||||||
return response.data?.toDouble() ?? 0.0;
|
return response.data?.toDouble() ?? 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final socialCreditHistoryNotifierProvider = AsyncNotifierProvider(
|
||||||
class SocialCreditHistoryNotifier extends _$SocialCreditHistoryNotifier
|
SocialCreditHistoryNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnSocialCreditRecord> {
|
);
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
class SocialCreditHistoryNotifier
|
||||||
|
extends AsyncNotifier<List<SnSocialCreditRecord>>
|
||||||
|
with AsyncPaginationController<SnSocialCreditRecord> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnSocialCreditRecord>> build() => fetch(cursor: null);
|
Future<List<SnSocialCreditRecord>> fetch() async {
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnSocialCreditRecord>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final queryParams = {'offset': offset, 'take': _pageSize};
|
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/pass/accounts/me/credits/history',
|
'/pass/accounts/me/credits/history',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
|
||||||
final records =
|
final records =
|
||||||
data.map((json) => SnSocialCreditRecord.fromJson(json)).toList();
|
response.data
|
||||||
|
.map((json) => SnSocialCreditRecord.fromJson(json))
|
||||||
|
.cast<SnSocialCreditRecord>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + records.length < total;
|
return records;
|
||||||
final nextCursor = hasMore ? (offset + records.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: records,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,31 +107,39 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
.padding(horizontal: 20, vertical: 16),
|
.padding(horizontal: 20, vertical: 16),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: socialCreditHistoryNotifierProvider,
|
|
||||||
futureRefreshable: socialCreditHistoryNotifierProvider.future,
|
|
||||||
notifierRefreshable: socialCreditHistoryNotifierProvider.notifier,
|
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => ListView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: widgetCount,
|
provider: socialCreditHistoryNotifierProvider,
|
||||||
itemBuilder: (context, index) {
|
notifier: socialCreditHistoryNotifierProvider.notifier,
|
||||||
if (index == widgetCount - 1) {
|
itemBuilder: (context, idx, record) {
|
||||||
return endItemView;
|
final isExpired =
|
||||||
}
|
record.expiredAt != null &&
|
||||||
final record = data.items[index];
|
record.expiredAt!.isBefore(DateTime.now());
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
horizontal: 24,
|
title: Text(
|
||||||
|
record.reason,
|
||||||
|
style:
|
||||||
|
isExpired
|
||||||
|
? TextStyle(
|
||||||
|
decoration: TextDecoration.lineThrough,
|
||||||
|
color: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.onSurface.withOpacity(0.8),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
title: Text(record.reason),
|
subtitle: Row(
|
||||||
subtitle: Text(
|
spacing: 4,
|
||||||
DateFormat.yMMMd().format(record.createdAt),
|
children: [
|
||||||
|
Text(record.createdAt.formatSystem()),
|
||||||
|
Text('to'),
|
||||||
|
if (record.expiredAt != null)
|
||||||
|
Text(record.expiredAt!.formatSystem()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
trailing: Text(
|
trailing: Text(
|
||||||
record.delta > 0
|
record.delta > 0 ? '+${record.delta}' : '${record.delta}',
|
||||||
? '+${record.delta}'
|
|
||||||
: '${record.delta}',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: record.delta > 0 ? Colors.green : Colors.red,
|
color: record.delta > 0 ? Colors.green : Colors.red,
|
||||||
),
|
),
|
||||||
@@ -143,7 +148,6 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,44 +6,38 @@ part of 'credits.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [socialCredits].
|
|
||||||
@ProviderFor(socialCredits)
|
@ProviderFor(socialCredits)
|
||||||
final socialCreditsProvider = AutoDisposeFutureProvider<double>.internal(
|
const socialCreditsProvider = SocialCreditsProvider._();
|
||||||
socialCredits,
|
|
||||||
|
final class SocialCreditsProvider
|
||||||
|
extends $FunctionalProvider<AsyncValue<double>, double, FutureOr<double>>
|
||||||
|
with $FutureModifier<double>, $FutureProvider<double> {
|
||||||
|
const SocialCreditsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'socialCreditsProvider',
|
name: r'socialCreditsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$socialCreditsHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$socialCreditsHash();
|
||||||
typedef SocialCreditsRef = AutoDisposeFutureProviderRef<double>;
|
|
||||||
String _$socialCreditHistoryNotifierHash() =>
|
|
||||||
r'3e87af246cc5dc72a1f3a87b81d1c87169bdfb5b';
|
|
||||||
|
|
||||||
/// See also [SocialCreditHistoryNotifier].
|
@$internal
|
||||||
@ProviderFor(SocialCreditHistoryNotifier)
|
@override
|
||||||
final socialCreditHistoryNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
$FutureProviderElement<double> $createElement($ProviderPointer pointer) =>
|
||||||
SocialCreditHistoryNotifier,
|
$FutureProviderElement(pointer);
|
||||||
CursorPagingData<SnSocialCreditRecord>
|
|
||||||
>.internal(
|
|
||||||
SocialCreditHistoryNotifier.new,
|
|
||||||
name: r'socialCreditHistoryNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$socialCreditHistoryNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$SocialCreditHistoryNotifier =
|
@override
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<SnSocialCreditRecord>>;
|
FutureOr<double> create(Ref ref) {
|
||||||
// ignore_for_file: type=lint
|
return socialCredits(ref);
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69';
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/account.dart';
|
import 'package:island/models/account.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/screens/account/credits.dart';
|
import 'package:island/screens/account/credits.dart';
|
||||||
import 'package:island/services/time.dart';
|
import 'package:island/services/time.dart';
|
||||||
@@ -10,46 +11,37 @@ import 'package:island/widgets/account/leveling_progress.dart';
|
|||||||
import 'package:island/widgets/account/stellar_program_tab.dart';
|
import 'package:island/widgets/account/stellar_program_tab.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'leveling.g.dart';
|
final levelingHistoryNotifierProvider = AsyncNotifierProvider(
|
||||||
|
LevelingHistoryNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
@riverpod
|
class LevelingHistoryNotifier extends AsyncNotifier<List<SnExperienceRecord>>
|
||||||
class LevelingHistoryNotifier extends _$LevelingHistoryNotifier
|
with AsyncPaginationController<SnExperienceRecord> {
|
||||||
with CursorPagingNotifierMixin<SnExperienceRecord> {
|
static const int pageSize = 20;
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnExperienceRecord>> build() => fetch(cursor: null);
|
Future<List<SnExperienceRecord>> fetch() async {
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnExperienceRecord>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final queryParams = {'offset': offset, 'take': _pageSize};
|
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/pass/accounts/me/leveling',
|
'/pass/accounts/me/leveling',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final records =
|
|
||||||
data.map((json) => SnExperienceRecord.fromJson(json)).toList();
|
|
||||||
|
|
||||||
final hasMore = offset + records.length < total;
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final nextCursor = hasMore ? (offset + records.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
final List<SnExperienceRecord> records =
|
||||||
items: records,
|
response.data
|
||||||
hasMore: hasMore,
|
.map((json) => SnExperienceRecord.fromJson(json))
|
||||||
nextCursor: nextCursor,
|
.cast<SnExperienceRecord>()
|
||||||
);
|
.toList();
|
||||||
|
|
||||||
|
return records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,19 +181,13 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SliverGap(8),
|
const SliverGap(8),
|
||||||
PagingHelperSliverView(
|
PaginationList(
|
||||||
provider: levelingHistoryNotifierProvider,
|
provider: levelingHistoryNotifierProvider,
|
||||||
futureRefreshable: levelingHistoryNotifierProvider.future,
|
notifier: levelingHistoryNotifierProvider.notifier,
|
||||||
notifierRefreshable: levelingHistoryNotifierProvider.notifier,
|
isRefreshable: false,
|
||||||
contentBuilder:
|
isSliver: true,
|
||||||
(data, widgetCount, endItemView) => SliverList.builder(
|
itemBuilder:
|
||||||
itemCount: widgetCount,
|
(context, idx, record) => ListTile(
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
final record = data.items[index];
|
|
||||||
return ListTile(
|
|
||||||
title: Column(
|
title: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@@ -214,9 +200,7 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
record.createdAt.formatRelative(context),
|
record.createdAt.formatRelative(context),
|
||||||
).fontSize(13),
|
).fontSize(13),
|
||||||
Text('·').fontSize(13).bold(),
|
Text('·').fontSize(13).bold(),
|
||||||
Text(
|
Text(record.createdAt.formatSystem()).fontSize(13),
|
||||||
record.createdAt.formatSystem(),
|
|
||||||
).fontSize(13),
|
|
||||||
],
|
],
|
||||||
).opacity(0.8),
|
).opacity(0.8),
|
||||||
],
|
],
|
||||||
@@ -233,8 +217,6 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
minTileHeight: 56,
|
minTileHeight: 56,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'leveling.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$levelingHistoryNotifierHash() =>
|
|
||||||
r'de51012e1590ac46388b6f3f2050b21cb96698d1';
|
|
||||||
|
|
||||||
/// See also [LevelingHistoryNotifier].
|
|
||||||
@ProviderFor(LevelingHistoryNotifier)
|
|
||||||
final levelingHistoryNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
|
||||||
LevelingHistoryNotifier,
|
|
||||||
CursorPagingData<SnExperienceRecord>
|
|
||||||
>.internal(
|
|
||||||
LevelingHistoryNotifier.new,
|
|
||||||
name: r'levelingHistoryNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$levelingHistoryNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$LevelingHistoryNotifier =
|
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<SnExperienceRecord>>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
@@ -6,64 +6,129 @@ part of 'account_settings.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(authFactors)
|
||||||
|
const authFactorsProvider = AuthFactorsProvider._();
|
||||||
|
|
||||||
|
final class AuthFactorsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnAuthFactor>>,
|
||||||
|
List<SnAuthFactor>,
|
||||||
|
FutureOr<List<SnAuthFactor>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnAuthFactor>>,
|
||||||
|
$FutureProvider<List<SnAuthFactor>> {
|
||||||
|
const AuthFactorsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'authFactorsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$authFactorsHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnAuthFactor>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnAuthFactor>> create(Ref ref) {
|
||||||
|
return authFactors(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
||||||
|
|
||||||
/// See also [authFactors].
|
@ProviderFor(contactMethods)
|
||||||
@ProviderFor(authFactors)
|
const contactMethodsProvider = ContactMethodsProvider._();
|
||||||
final authFactorsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnAuthFactor>>.internal(
|
final class ContactMethodsProvider
|
||||||
authFactors,
|
extends
|
||||||
name: r'authFactorsProvider',
|
$FunctionalProvider<
|
||||||
debugGetCreateSourceHash:
|
AsyncValue<List<SnContactMethod>>,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
List<SnContactMethod>,
|
||||||
? null
|
FutureOr<List<SnContactMethod>>
|
||||||
: _$authFactorsHash,
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnContactMethod>>,
|
||||||
|
$FutureProvider<List<SnContactMethod>> {
|
||||||
|
const ContactMethodsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'contactMethodsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$contactMethodsHash();
|
||||||
typedef AuthFactorsRef = AutoDisposeFutureProviderRef<List<SnAuthFactor>>;
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnContactMethod>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnContactMethod>> create(Ref ref) {
|
||||||
|
return contactMethods(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
||||||
|
|
||||||
/// See also [contactMethods].
|
@ProviderFor(accountConnections)
|
||||||
@ProviderFor(contactMethods)
|
const accountConnectionsProvider = AccountConnectionsProvider._();
|
||||||
final contactMethodsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnContactMethod>>.internal(
|
final class AccountConnectionsProvider
|
||||||
contactMethods,
|
extends
|
||||||
name: r'contactMethodsProvider',
|
$FunctionalProvider<
|
||||||
debugGetCreateSourceHash:
|
AsyncValue<List<SnAccountConnection>>,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
List<SnAccountConnection>,
|
||||||
? null
|
FutureOr<List<SnAccountConnection>>
|
||||||
: _$contactMethodsHash,
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnAccountConnection>>,
|
||||||
|
$FutureProvider<List<SnAccountConnection>> {
|
||||||
|
const AccountConnectionsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'accountConnectionsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$accountConnectionsHash();
|
||||||
typedef ContactMethodsRef = AutoDisposeFutureProviderRef<List<SnContactMethod>>;
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnAccountConnection>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnAccountConnection>> create(Ref ref) {
|
||||||
|
return accountConnections(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$accountConnectionsHash() =>
|
String _$accountConnectionsHash() =>
|
||||||
r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22';
|
r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22';
|
||||||
|
|
||||||
/// See also [accountConnections].
|
|
||||||
@ProviderFor(accountConnections)
|
|
||||||
final accountConnectionsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnAccountConnection>>.internal(
|
|
||||||
accountConnections,
|
|
||||||
name: r'accountConnectionsProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$accountConnectionsHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef AccountConnectionsRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnAccountConnection>>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,16 +3,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/widgets/account/account_pfc.dart';
|
import 'package:island/widgets/account/account_pfc.dart';
|
||||||
import 'package:island/widgets/account/account_picker.dart';
|
import 'package:island/widgets/account/account_picker.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/content/cloud_files.dart';
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:relative_time/relative_time.dart';
|
import 'package:relative_time/relative_time.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:island/models/relationship.dart';
|
import 'package:island/models/relationship.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|
||||||
@@ -28,39 +29,31 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final relationshipListNotifierProvider = AsyncNotifierProvider(
|
||||||
class RelationshipListNotifier extends _$RelationshipListNotifier
|
RelationshipListNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnRelationship> {
|
);
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnRelationship>> build() => fetch(cursor: null);
|
|
||||||
|
|
||||||
|
class RelationshipListNotifier extends AsyncNotifier<List<SnRelationship>>
|
||||||
|
with AsyncPaginationController<SnRelationship> {
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnRelationship>> fetch({
|
Future<List<SnRelationship>> fetch() async {
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
final take = 20;
|
final take = 20;
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/pass/relationships',
|
'/pass/relationships',
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
queryParameters: {'offset': fetchedCount.toString(), 'take': take},
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<SnRelationship> items =
|
final List<SnRelationship> items =
|
||||||
(response.data as List)
|
(response.data as List)
|
||||||
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
||||||
|
.cast<SnRelationship>()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final total = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
totalCount = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
||||||
final hasMore = offset + items.length < total;
|
|
||||||
final nextCursor = hasMore ? (offset + items.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
return items;
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +235,7 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
await client.post(
|
await client.post(
|
||||||
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
||||||
);
|
);
|
||||||
relationshipNotifier.forceRefresh();
|
relationshipNotifier.refresh();
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
if (isAccept) {
|
if (isAccept) {
|
||||||
showSnackBar(
|
showSnackBar(
|
||||||
@@ -270,7 +263,7 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
'/pass/relationships/${relationship.accountId}',
|
'/pass/relationships/${relationship.accountId}',
|
||||||
data: {'status': newStatus},
|
data: {'status': newStatus},
|
||||||
);
|
);
|
||||||
relationshipNotifier.forceRefresh();
|
relationshipNotifier.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
@@ -305,26 +298,15 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: relationshipListNotifierProvider,
|
provider: relationshipListNotifierProvider,
|
||||||
futureRefreshable: relationshipListNotifierProvider.future,
|
notifier: relationshipListNotifierProvider.notifier,
|
||||||
notifierRefreshable: relationshipListNotifierProvider.notifier,
|
itemBuilder: (context, index, relationship) {
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => ListView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final relationship = data.items[index];
|
|
||||||
return RelationshipListTile(
|
return RelationshipListTile(
|
||||||
relationship: relationship,
|
relationship: relationship,
|
||||||
submitting: submitting.value,
|
submitting: submitting.value,
|
||||||
onAccept: () => handleFriendRequest(relationship, true),
|
onAccept: () => handleFriendRequest(relationship, true),
|
||||||
onDecline:
|
onDecline: () => handleFriendRequest(relationship, false),
|
||||||
() => handleFriendRequest(relationship, false),
|
|
||||||
currentUserId: user.value?.id,
|
currentUserId: user.value?.id,
|
||||||
showRelatedAccount: false,
|
showRelatedAccount: false,
|
||||||
onUpdateStatus: updateRelationship,
|
onUpdateStatus: updateRelationship,
|
||||||
@@ -332,7 +314,6 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,46 +6,46 @@ part of 'relationship.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [sentFriendRequest].
|
|
||||||
@ProviderFor(sentFriendRequest)
|
@ProviderFor(sentFriendRequest)
|
||||||
final sentFriendRequestProvider =
|
const sentFriendRequestProvider = SentFriendRequestProvider._();
|
||||||
AutoDisposeFutureProvider<List<SnRelationship>>.internal(
|
|
||||||
sentFriendRequest,
|
final class SentFriendRequestProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnRelationship>>,
|
||||||
|
List<SnRelationship>,
|
||||||
|
FutureOr<List<SnRelationship>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnRelationship>>,
|
||||||
|
$FutureProvider<List<SnRelationship>> {
|
||||||
|
const SentFriendRequestProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'sentFriendRequestProvider',
|
name: r'sentFriendRequestProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$sentFriendRequestHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$sentFriendRequestHash();
|
||||||
typedef SentFriendRequestRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnRelationship>>;
|
|
||||||
String _$relationshipListNotifierHash() =>
|
|
||||||
r'fc46920256f7c48445c00652165e879890f2c9a3';
|
|
||||||
|
|
||||||
/// See also [RelationshipListNotifier].
|
@$internal
|
||||||
@ProviderFor(RelationshipListNotifier)
|
@override
|
||||||
final relationshipListNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
$FutureProviderElement<List<SnRelationship>> $createElement(
|
||||||
RelationshipListNotifier,
|
$ProviderPointer pointer,
|
||||||
CursorPagingData<SnRelationship>
|
) => $FutureProviderElement(pointer);
|
||||||
>.internal(
|
|
||||||
RelationshipListNotifier.new,
|
|
||||||
name: r'relationshipListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$relationshipListNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$RelationshipListNotifier =
|
@override
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<SnRelationship>>;
|
FutureOr<List<SnRelationship>> create(Ref ref) {
|
||||||
// ignore_for_file: type=lint
|
return sentFriendRequest(ref);
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,38 @@ part of 'captcha.config.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [captchaUrl].
|
|
||||||
@ProviderFor(captchaUrl)
|
@ProviderFor(captchaUrl)
|
||||||
final captchaUrlProvider = AutoDisposeFutureProvider<String>.internal(
|
const captchaUrlProvider = CaptchaUrlProvider._();
|
||||||
captchaUrl,
|
|
||||||
name: r'captchaUrlProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$captchaUrlHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
final class CaptchaUrlProvider
|
||||||
// ignore: unused_element
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
typedef CaptchaUrlRef = AutoDisposeFutureProviderRef<String>;
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
// ignore_for_file: type=lint
|
const CaptchaUrlProvider._()
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'captchaUrlProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$captchaUrlHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
return captchaUrl(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6';
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class CallScreen extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final ongoingCall = ref.watch(ongoingCallProvider(room.id));
|
final ongoingCall = ref.watch(ongoingCallProvider(room.id));
|
||||||
final callState = ref.watch(callNotifierProvider);
|
final callState = ref.watch(callProvider);
|
||||||
final callNotifier = ref.watch(callNotifierProvider.notifier);
|
final callNotifier = ref.watch(callProvider.notifier);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
talker.info('[Call] Joining the call...');
|
talker.info('[Call] Joining the call...');
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
@@ -7,9 +6,6 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/models/file.dart';
|
|
||||||
import 'package:island/models/account.dart';
|
|
||||||
import 'package:island/pods/database.dart';
|
|
||||||
import 'package:island/pods/chat/chat_summary.dart';
|
import 'package:island/pods/chat/chat_summary.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
@@ -24,11 +20,9 @@ import 'package:island/widgets/navigation/fab_menu.dart';
|
|||||||
import 'package:island/widgets/response.dart';
|
import 'package:island/widgets/response.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:relative_time/relative_time.dart';
|
import 'package:relative_time/relative_time.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:super_sliver_list/super_sliver_list.dart';
|
import 'package:super_sliver_list/super_sliver_list.dart';
|
||||||
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
part 'chat.g.dart';
|
|
||||||
|
|
||||||
class ChatRoomListTile extends HookConsumerWidget {
|
class ChatRoomListTile extends HookConsumerWidget {
|
||||||
final SnChatRoom room;
|
final SnChatRoom room;
|
||||||
@@ -183,90 +177,6 @@ class ChatRoomListTile extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
|
||||||
Future<List<SnChatRoom>> chatroomsJoined(Ref ref) async {
|
|
||||||
final db = ref.watch(databaseProvider);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final localRoomsData = await db.select(db.chatRooms).get();
|
|
||||||
if (localRoomsData.isNotEmpty) {
|
|
||||||
final localRooms = await Future.wait(
|
|
||||||
localRoomsData.map((row) async {
|
|
||||||
final membersRows =
|
|
||||||
await (db.select(db.chatMembers)
|
|
||||||
..where((m) => m.chatRoomId.equals(row.id))).get();
|
|
||||||
final members =
|
|
||||||
membersRows.map((mRow) {
|
|
||||||
final account = SnAccount.fromJson(mRow.account);
|
|
||||||
return SnChatMember(
|
|
||||||
id: mRow.id,
|
|
||||||
chatRoomId: mRow.chatRoomId,
|
|
||||||
accountId: mRow.accountId,
|
|
||||||
account: account,
|
|
||||||
nick: mRow.nick,
|
|
||||||
notify: mRow.notify,
|
|
||||||
joinedAt: mRow.joinedAt,
|
|
||||||
breakUntil: mRow.breakUntil,
|
|
||||||
timeoutUntil: mRow.timeoutUntil,
|
|
||||||
status: null,
|
|
||||||
createdAt: mRow.createdAt,
|
|
||||||
updatedAt: mRow.updatedAt,
|
|
||||||
deletedAt: mRow.deletedAt,
|
|
||||||
chatRoom: null,
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
return SnChatRoom(
|
|
||||||
id: row.id,
|
|
||||||
name: row.name,
|
|
||||||
description: row.description,
|
|
||||||
type: row.type,
|
|
||||||
isPublic: row.isPublic!,
|
|
||||||
isCommunity: row.isCommunity!,
|
|
||||||
picture:
|
|
||||||
row.picture != null ? SnCloudFile.fromJson(row.picture!) : null,
|
|
||||||
background:
|
|
||||||
row.background != null
|
|
||||||
? SnCloudFile.fromJson(row.background!)
|
|
||||||
: null,
|
|
||||||
realmId: row.realmId,
|
|
||||||
accountId: row.accountId,
|
|
||||||
realm: null,
|
|
||||||
createdAt: row.createdAt,
|
|
||||||
updatedAt: row.updatedAt,
|
|
||||||
deletedAt: row.deletedAt,
|
|
||||||
members: members,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Background sync
|
|
||||||
Future(() async {
|
|
||||||
try {
|
|
||||||
final client = ref.read(apiClientProvider);
|
|
||||||
final resp = await client.get('/sphere/chat');
|
|
||||||
final remoteRooms =
|
|
||||||
resp.data
|
|
||||||
.map((e) => SnChatRoom.fromJson(e))
|
|
||||||
.cast<SnChatRoom>()
|
|
||||||
.toList();
|
|
||||||
await db.saveChatRooms(remoteRooms);
|
|
||||||
ref.invalidateSelf();
|
|
||||||
} catch (_) {}
|
|
||||||
}).ignore();
|
|
||||||
|
|
||||||
return localRooms;
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
|
|
||||||
// Fallback to API
|
|
||||||
final client = ref.watch(apiClientProvider);
|
|
||||||
final resp = await client.get('/sphere/chat');
|
|
||||||
final rooms =
|
|
||||||
resp.data.map((e) => SnChatRoom.fromJson(e)).cast<SnChatRoom>().toList();
|
|
||||||
await db.saveChatRooms(rooms);
|
|
||||||
return rooms;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChatListBodyWidget extends HookConsumerWidget {
|
class ChatListBodyWidget extends HookConsumerWidget {
|
||||||
final bool isFloating;
|
final bool isFloating;
|
||||||
final TabController tabController;
|
final TabController tabController;
|
||||||
@@ -281,7 +191,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chats = ref.watch(chatroomsJoinedProvider);
|
final chats = ref.watch(chatRoomJoinedProvider);
|
||||||
|
|
||||||
Widget bodyWidget = Column(
|
Widget bodyWidget = Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -304,7 +214,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
(items) => RefreshIndicator(
|
(items) => RefreshIndicator(
|
||||||
onRefresh:
|
onRefresh:
|
||||||
() => Future.sync(() {
|
() => Future.sync(() {
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
}),
|
}),
|
||||||
child: SuperListView.builder(
|
child: SuperListView.builder(
|
||||||
padding: EdgeInsets.only(bottom: 96),
|
padding: EdgeInsets.only(bottom: 96),
|
||||||
@@ -354,7 +264,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
(error, stack) => ResponseErrorWidget(
|
(error, stack) => ResponseErrorWidget(
|
||||||
error: error,
|
error: error,
|
||||||
onRetry: () {
|
onRetry: () {
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -431,7 +341,7 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Listen for chat rooms refresh events
|
// Listen for chat rooms refresh events
|
||||||
final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) {
|
final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) {
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
});
|
});
|
||||||
|
|
||||||
return () {
|
return () {
|
||||||
@@ -443,13 +353,14 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
// Set FAB type to chat
|
// Set FAB type to chat
|
||||||
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
|
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
|
||||||
Future(() {
|
Future(() {
|
||||||
fabMenuNotifier.state = FabMenuType.chat;
|
fabMenuNotifier.setMenuType(FabMenuType.chat);
|
||||||
});
|
});
|
||||||
return () {
|
return () {
|
||||||
// Clean up: reset FAB type to main
|
// Clean up: reset FAB type to main
|
||||||
|
final fabMenu = ref.read(fabMenuTypeProvider);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (fabMenuNotifier.state == FabMenuType.chat) {
|
if (fabMenu == FabMenuType.chat) {
|
||||||
fabMenuNotifier.state = FabMenuType.main;
|
fabMenuNotifier.setMenuType(FabMenuType.main);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -599,46 +510,6 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
|
||||||
Future<SnChatRoom?> chatroom(Ref ref, String? identifier) async {
|
|
||||||
if (identifier == null) return null;
|
|
||||||
try {
|
|
||||||
final client = ref.watch(apiClientProvider);
|
|
||||||
final resp = await client.get('/sphere/chat/$identifier');
|
|
||||||
return SnChatRoom.fromJson(resp.data);
|
|
||||||
} catch (err) {
|
|
||||||
if (err is DioException && err.response?.statusCode == 404) {
|
|
||||||
return null; // Chat room not found
|
|
||||||
}
|
|
||||||
rethrow; // Rethrow other errors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@riverpod
|
|
||||||
Future<SnChatMember?> chatroomIdentity(Ref ref, String? identifier) async {
|
|
||||||
if (identifier == null) return null;
|
|
||||||
try {
|
|
||||||
final client = ref.watch(apiClientProvider);
|
|
||||||
final resp = await client.get('/sphere/chat/$identifier/members/me');
|
|
||||||
return SnChatMember.fromJson(resp.data);
|
|
||||||
} catch (err) {
|
|
||||||
if (err is DioException && err.response?.statusCode == 404) {
|
|
||||||
return null; // Chat member not found
|
|
||||||
}
|
|
||||||
rethrow; // Rethrow other errors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@riverpod
|
|
||||||
Future<List<SnChatMember>> chatroomInvites(Ref ref) async {
|
|
||||||
final client = ref.watch(apiClientProvider);
|
|
||||||
final resp = await client.get('/sphere/chat/invites');
|
|
||||||
return resp.data
|
|
||||||
.map((e) => SnChatMember.fromJson(e))
|
|
||||||
.cast<SnChatMember>()
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatInvitesSheet extends HookConsumerWidget {
|
class _ChatInvitesSheet extends HookConsumerWidget {
|
||||||
const _ChatInvitesSheet();
|
const _ChatInvitesSheet();
|
||||||
|
|
||||||
@@ -651,7 +522,7 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
|
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
|
||||||
ref.invalidate(chatroomInvitesProvider);
|
ref.invalidate(chatroomInvitesProvider);
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,309 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'chat.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$chatroomsJoinedHash() => r'50abce4f03a7a8509f16d5ad0b1dbf8e3aeb73b6';
|
|
||||||
|
|
||||||
/// See also [chatroomsJoined].
|
|
||||||
@ProviderFor(chatroomsJoined)
|
|
||||||
final chatroomsJoinedProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnChatRoom>>.internal(
|
|
||||||
chatroomsJoined,
|
|
||||||
name: r'chatroomsJoinedProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatroomsJoinedHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef ChatroomsJoinedRef = AutoDisposeFutureProviderRef<List<SnChatRoom>>;
|
|
||||||
String _$chatroomHash() => r'2b17d94728026420d18d6c383d2400cf4a070913';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [chatroom].
|
|
||||||
@ProviderFor(chatroom)
|
|
||||||
const chatroomProvider = ChatroomFamily();
|
|
||||||
|
|
||||||
/// See also [chatroom].
|
|
||||||
class ChatroomFamily extends Family<AsyncValue<SnChatRoom?>> {
|
|
||||||
/// See also [chatroom].
|
|
||||||
const ChatroomFamily();
|
|
||||||
|
|
||||||
/// See also [chatroom].
|
|
||||||
ChatroomProvider call(String? identifier) {
|
|
||||||
return ChatroomProvider(identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ChatroomProvider getProviderOverride(covariant ChatroomProvider provider) {
|
|
||||||
return call(provider.identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatroomProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [chatroom].
|
|
||||||
class ChatroomProvider extends AutoDisposeFutureProvider<SnChatRoom?> {
|
|
||||||
/// See also [chatroom].
|
|
||||||
ChatroomProvider(String? identifier)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => chatroom(ref as ChatroomRef, identifier),
|
|
||||||
from: chatroomProvider,
|
|
||||||
name: r'chatroomProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatroomHash,
|
|
||||||
dependencies: ChatroomFamily._dependencies,
|
|
||||||
allTransitiveDependencies: ChatroomFamily._allTransitiveDependencies,
|
|
||||||
identifier: identifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatroomProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.identifier,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? identifier;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnChatRoom?> Function(ChatroomRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatroomProvider._internal(
|
|
||||||
(ref) => create(ref as ChatroomRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
identifier: identifier,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<SnChatRoom?> createElement() {
|
|
||||||
return _ChatroomProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is ChatroomProvider && other.identifier == identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, identifier.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatroomRef on AutoDisposeFutureProviderRef<SnChatRoom?> {
|
|
||||||
/// The parameter `identifier` of this provider.
|
|
||||||
String? get identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatroomProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnChatRoom?>
|
|
||||||
with ChatroomRef {
|
|
||||||
_ChatroomProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get identifier => (origin as ChatroomProvider).identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$chatroomIdentityHash() => r'35e19a5a3e31752c79b97ba0358a7ec8fb8f6e99';
|
|
||||||
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
@ProviderFor(chatroomIdentity)
|
|
||||||
const chatroomIdentityProvider = ChatroomIdentityFamily();
|
|
||||||
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
class ChatroomIdentityFamily extends Family<AsyncValue<SnChatMember?>> {
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
const ChatroomIdentityFamily();
|
|
||||||
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
ChatroomIdentityProvider call(String? identifier) {
|
|
||||||
return ChatroomIdentityProvider(identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ChatroomIdentityProvider getProviderOverride(
|
|
||||||
covariant ChatroomIdentityProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatroomIdentityProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
class ChatroomIdentityProvider
|
|
||||||
extends AutoDisposeFutureProvider<SnChatMember?> {
|
|
||||||
/// See also [chatroomIdentity].
|
|
||||||
ChatroomIdentityProvider(String? identifier)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => chatroomIdentity(ref as ChatroomIdentityRef, identifier),
|
|
||||||
from: chatroomIdentityProvider,
|
|
||||||
name: r'chatroomIdentityProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatroomIdentityHash,
|
|
||||||
dependencies: ChatroomIdentityFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatroomIdentityFamily._allTransitiveDependencies,
|
|
||||||
identifier: identifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatroomIdentityProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.identifier,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? identifier;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnChatMember?> Function(ChatroomIdentityRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatroomIdentityProvider._internal(
|
|
||||||
(ref) => create(ref as ChatroomIdentityRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
identifier: identifier,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<SnChatMember?> createElement() {
|
|
||||||
return _ChatroomIdentityProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is ChatroomIdentityProvider && other.identifier == identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, identifier.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatroomIdentityRef on AutoDisposeFutureProviderRef<SnChatMember?> {
|
|
||||||
/// The parameter `identifier` of this provider.
|
|
||||||
String? get identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatroomIdentityProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnChatMember?>
|
|
||||||
with ChatroomIdentityRef {
|
|
||||||
_ChatroomIdentityProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get identifier => (origin as ChatroomIdentityProvider).identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
|
|
||||||
|
|
||||||
/// See also [chatroomInvites].
|
|
||||||
@ProviderFor(chatroomInvites)
|
|
||||||
final chatroomInvitesProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnChatMember>>.internal(
|
|
||||||
chatroomInvites,
|
|
||||||
name: r'chatroomInvitesProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatroomInvitesHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef ChatroomInvitesRef = AutoDisposeFutureProviderRef<List<SnChatMember>>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
@@ -10,8 +10,8 @@ import 'package:image_picker/image_picker.dart';
|
|||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/models/file.dart';
|
import 'package:island/models/file.dart';
|
||||||
import 'package:island/models/realm.dart';
|
import 'package:island/models/realm.dart';
|
||||||
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/screens/chat/chat.dart';
|
|
||||||
import 'package:island/screens/realm/realms.dart';
|
import 'package:island/screens/realm/realms.dart';
|
||||||
import 'package:island/services/file.dart';
|
import 'package:island/services/file.dart';
|
||||||
import 'package:island/services/file_uploader.dart';
|
import 'package:island/services/file_uploader.dart';
|
||||||
@@ -47,7 +47,7 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
final isPublic = useState(true);
|
final isPublic = useState(true);
|
||||||
final isCommunity = useState(false);
|
final isCommunity = useState(false);
|
||||||
|
|
||||||
final chat = ref.watch(chatroomProvider(id));
|
final chat = ref.watch(chatRoomProvider(id));
|
||||||
|
|
||||||
final joinedRealms = ref.watch(realmsJoinedProvider);
|
final joinedRealms = ref.watch(realmsJoinedProvider);
|
||||||
final currentRealm = useState<SnRealm?>(null);
|
final currentRealm = useState<SnRealm?>(null);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import "package:flutter_hooks/flutter_hooks.dart";
|
|||||||
import "package:gap/gap.dart";
|
import "package:gap/gap.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||||
import "package:island/database/message.dart";
|
import "package:island/database/message.dart";
|
||||||
import "package:island/screens/chat/chat.dart";
|
import "package:island/pods/chat/chat_room.dart";
|
||||||
import "package:island/widgets/content/cloud_files.dart";
|
import "package:island/widgets/content/cloud_files.dart";
|
||||||
import "package:super_sliver_list/super_sliver_list.dart";
|
import "package:super_sliver_list/super_sliver_list.dart";
|
||||||
import "package:easy_localization/easy_localization.dart";
|
import "package:easy_localization/easy_localization.dart";
|
||||||
@@ -27,8 +27,8 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final messages = ref.watch(messagesNotifierProvider(id));
|
final messages = ref.watch(messagesProvider(id));
|
||||||
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier);
|
final messagesNotifier = ref.read(messagesProvider(id).notifier);
|
||||||
final scrollController = useScrollController();
|
final scrollController = useScrollController();
|
||||||
|
|
||||||
final listController = useMemoized(() => ListController(), []);
|
final listController = useMemoized(() => ListController(), []);
|
||||||
@@ -203,7 +203,7 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
showLoadingModal(context);
|
showLoadingModal(context);
|
||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
await apiClient.post('/sphere/chat/${room.id}/members/me');
|
await apiClient.post('/sphere/chat/${room.id}/members/me');
|
||||||
ref.invalidate(chatroomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ import "package:island/models/chat.dart";
|
|||||||
import "package:island/models/file.dart";
|
import "package:island/models/file.dart";
|
||||||
import "package:island/models/poll.dart";
|
import "package:island/models/poll.dart";
|
||||||
import "package:island/models/wallet.dart";
|
import "package:island/models/wallet.dart";
|
||||||
import "package:island/pods/chat/chat_rooms.dart";
|
import "package:island/pods/chat/chat_room.dart";
|
||||||
import "package:island/pods/chat/chat_subscribe.dart";
|
import "package:island/pods/chat/chat_subscribe.dart";
|
||||||
import "package:island/pods/chat/messages_notifier.dart";
|
import "package:island/pods/chat/messages_notifier.dart";
|
||||||
import "package:island/pods/network.dart";
|
import "package:island/pods/network.dart";
|
||||||
import "package:island/pods/chat/chat_online_count.dart";
|
import "package:island/pods/chat/chat_online_count.dart";
|
||||||
import "package:island/pods/config.dart";
|
import "package:island/pods/config.dart";
|
||||||
|
import "package:island/pods/userinfo.dart";
|
||||||
import "package:island/screens/chat/search_messages.dart";
|
import "package:island/screens/chat/search_messages.dart";
|
||||||
import "package:island/services/file_uploader.dart";
|
import "package:island/services/file_uploader.dart";
|
||||||
import "package:island/screens/chat/chat.dart";
|
|
||||||
import "package:island/services/responsive.dart";
|
import "package:island/services/responsive.dart";
|
||||||
import "package:island/widgets/alert.dart";
|
import "package:island/widgets/alert.dart";
|
||||||
import "package:island/widgets/app_scaffold.dart";
|
import "package:island/widgets/app_scaffold.dart";
|
||||||
@@ -48,13 +48,11 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chatRoom = ref.watch(chatroomProvider(id));
|
final chatRoom = ref.watch(chatRoomProvider(id));
|
||||||
final chatIdentity = ref.watch(chatroomIdentityProvider(id));
|
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final isSyncing = ref.watch(isSyncingProvider);
|
final isSyncing = ref.watch(chatSyncingProvider);
|
||||||
final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id));
|
final onlineCount = ref.watch(chatOnlineCountProvider(id));
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
final hasOnlineCount = onlineCount.hasValue;
|
|
||||||
|
|
||||||
if (chatIdentity.isLoading || chatRoom.isLoading) {
|
if (chatIdentity.isLoading || chatRoom.isLoading) {
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
@@ -102,7 +100,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
await apiClient.post(
|
await apiClient.post(
|
||||||
'/sphere/chat/${room.id}/members/me',
|
'/sphere/chat/${room.id}/members/me',
|
||||||
);
|
);
|
||||||
ref.invalidate(chatroomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -131,17 +129,15 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
appBar: AppBar(leading: const PageBackButton()),
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
body: ResponseErrorWidget(
|
body: ResponseErrorWidget(
|
||||||
error: error,
|
error: error,
|
||||||
onRetry: () => ref.refresh(chatroomProvider(id)),
|
onRetry: () => ref.refresh(chatRoomProvider(id)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final messages = ref.watch(messagesNotifierProvider(id));
|
final messages = ref.watch(messagesProvider(id));
|
||||||
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier);
|
final messagesNotifier = ref.read(messagesProvider(id).notifier);
|
||||||
final chatSubscribeNotifier = ref.read(
|
final chatSubscribeNotifier = ref.read(chatSubscribeProvider(id).notifier);
|
||||||
chatSubscribeNotifierProvider(id).notifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
final messageController = useTextEditingController();
|
final messageController = useTextEditingController();
|
||||||
final scrollController = useScrollController();
|
final scrollController = useScrollController();
|
||||||
@@ -384,7 +380,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Convert selected message IDs to message data
|
// Convert selected message IDs to message data
|
||||||
final selectedMessageData =
|
final selectedMessageData =
|
||||||
messages.valueOrNull
|
messages.value
|
||||||
?.where((msg) => selectedMessages.value.contains(msg.id))
|
?.where((msg) => selectedMessages.value.contains(msg.id))
|
||||||
.map(
|
.map(
|
||||||
(msg) => {
|
(msg) => {
|
||||||
@@ -410,19 +406,27 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
final compactHeader = isWideScreen(context);
|
final compactHeader = isWideScreen(context);
|
||||||
|
|
||||||
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
|
||||||
|
List<SnChatMember> getValidMembers(List<SnChatMember> members) {
|
||||||
|
return members
|
||||||
|
.where((member) => member.accountId != userInfo.value?.id)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
Widget comfortHeaderWidget(SnChatRoom? room) => Column(
|
Widget comfortHeaderWidget(SnChatRoom? room) => Column(
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Badge(
|
Badge(
|
||||||
isLabelVisible: hasOnlineCount,
|
isLabelVisible: (onlineCount.value ?? 0) > 1,
|
||||||
label: Text('${(onlineCount as AsyncData?)?.value}'),
|
label: Text('${(onlineCount.value ?? 0)}'),
|
||||||
|
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
||||||
|
textColor: Colors.white,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
(onlineCount as AsyncData?)?.value != null &&
|
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
|
||||||
(onlineCount as AsyncData).value > 1
|
offset: Offset(6, 14),
|
||||||
? Colors.green
|
|
||||||
: Colors.grey,
|
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 26,
|
height: 26,
|
||||||
width: 26,
|
width: 26,
|
||||||
@@ -430,9 +434,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
(room!.type == 1 && room.picture?.id == null)
|
(room!.type == 1 && room.picture?.id == null)
|
||||||
? SplitAvatarWidget(
|
? SplitAvatarWidget(
|
||||||
filesId:
|
filesId:
|
||||||
room.members!
|
getValidMembers(
|
||||||
.map((e) => e.account.profile.picture?.id)
|
room.members!,
|
||||||
.toList(),
|
).map((e) => e.account.profile.picture?.id).toList(),
|
||||||
)
|
)
|
||||||
: room.picture?.id != null
|
: room.picture?.id != null
|
||||||
? ProfilePictureWidget(
|
? ProfilePictureWidget(
|
||||||
@@ -449,7 +453,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
? room.members!.map((e) => e.account.nick).join(', ')
|
? getValidMembers(
|
||||||
|
room.members!,
|
||||||
|
).map((e) => e.account.nick).join(', ')
|
||||||
: room.name!,
|
: room.name!,
|
||||||
).fontSize(15),
|
).fontSize(15),
|
||||||
],
|
],
|
||||||
@@ -462,7 +468,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
Badge(
|
Badge(
|
||||||
isLabelVisible: (onlineCount.value ?? 0) > 1,
|
isLabelVisible: (onlineCount.value ?? 0) > 1,
|
||||||
label: Text('${(onlineCount as AsyncData?)?.value}'),
|
label: Text('${(onlineCount.value ?? 0)}'),
|
||||||
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
|
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
|
||||||
@@ -475,9 +481,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
(room!.type == 1 && room.picture?.id == null)
|
(room!.type == 1 && room.picture?.id == null)
|
||||||
? SplitAvatarWidget(
|
? SplitAvatarWidget(
|
||||||
filesId:
|
filesId:
|
||||||
room.members!
|
getValidMembers(
|
||||||
.map((e) => e.account.profile.picture?.id)
|
room.members!,
|
||||||
.toList(),
|
).map((e) => e.account.profile.picture?.id).toList(),
|
||||||
)
|
)
|
||||||
: room.picture?.id != null
|
: room.picture?.id != null
|
||||||
? ProfilePictureWidget(
|
? ProfilePictureWidget(
|
||||||
@@ -494,7 +500,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
? room.members!.map((e) => e.account.nick).join(', ')
|
? getValidMembers(
|
||||||
|
room.members!,
|
||||||
|
).map((e) => e.account.nick).join(', ')
|
||||||
: room.name!,
|
: room.name!,
|
||||||
).fontSize(19),
|
).fontSize(19),
|
||||||
],
|
],
|
||||||
@@ -734,7 +742,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: !compactHeader ? const Center(child: PageBackButton()) : null,
|
leading: !compactHeader ? const Center(child: PageBackButton()) : null,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
toolbarHeight: compactHeader ? null : 80,
|
toolbarHeight: compactHeader ? null : 74,
|
||||||
title: chatRoom.when(
|
title: chatRoom.when(
|
||||||
data:
|
data:
|
||||||
(room) =>
|
(room) =>
|
||||||
@@ -761,8 +769,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
'chatDetail',
|
'chatDetail',
|
||||||
pathParameters: {'id': id},
|
pathParameters: {'id': id},
|
||||||
);
|
);
|
||||||
if (result is SearchMessagesResult &&
|
if (result is SearchMessagesResult && messages.value != null) {
|
||||||
messages.valueOrNull != null) {
|
|
||||||
final messageId = result.messageId;
|
final messageId = result.messageId;
|
||||||
|
|
||||||
// Jump to the message and trigger flash effect
|
// Jump to the message and trigger flash effect
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/screens/chat/chat.dart';
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/account/account_pfc.dart';
|
import 'package:island/widgets/account/account_pfc.dart';
|
||||||
import 'package:island/widgets/account/account_picker.dart';
|
import 'package:island/widgets/account/account_picker.dart';
|
||||||
import 'package:island/widgets/account/status.dart';
|
import 'package:island/widgets/account/status.dart';
|
||||||
@@ -17,9 +16,9 @@ import 'package:island/widgets/app_scaffold.dart';
|
|||||||
import 'package:island/widgets/content/cloud_files.dart';
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
import 'package:island/screens/chat/chat_form.dart';
|
import 'package:island/screens/chat/chat_form.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:island/pods/database.dart';
|
import 'package:island/pods/database.dart';
|
||||||
import 'package:island/screens/chat/search_messages.dart';
|
import 'package:island/screens/chat/search_messages.dart';
|
||||||
@@ -39,8 +38,8 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final roomState = ref.watch(chatroomProvider(id));
|
final roomState = ref.watch(chatRoomProvider(id));
|
||||||
final roomIdentity = ref.watch(chatroomIdentityProvider(id));
|
final roomIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final totalMessages = ref.watch(totalMessagesCountProvider(id));
|
final totalMessages = ref.watch(totalMessagesCountProvider(id));
|
||||||
|
|
||||||
const kNotifyLevelText = [
|
const kNotifyLevelText = [
|
||||||
@@ -56,7 +55,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
'/sphere/chat/$id/members/me/notify',
|
'/sphere/chat/$id/members/me/notify',
|
||||||
data: {'notify_level': level},
|
data: {'notify_level': level},
|
||||||
);
|
);
|
||||||
ref.invalidate(chatroomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
showSnackBar(
|
showSnackBar(
|
||||||
'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]),
|
'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]),
|
||||||
@@ -74,7 +73,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
'/sphere/chat/$id/members/me/notify',
|
'/sphere/chat/$id/members/me/notify',
|
||||||
data: {'break_until': until.toUtc().toIso8601String()},
|
data: {'break_until': until.toUtc().toIso8601String()},
|
||||||
);
|
);
|
||||||
ref.invalidate(chatroomProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -439,8 +438,8 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chatIdentity = ref.watch(chatroomIdentityProvider(id));
|
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final chatRoom = ref.watch(chatroomProvider(id));
|
final chatRoom = ref.watch(chatRoomProvider(id));
|
||||||
|
|
||||||
final isManagable =
|
final isManagable =
|
||||||
chatIdentity.value?.accountId == chatRoom.value?.accountId ||
|
chatIdentity.value?.accountId == chatRoom.value?.accountId ||
|
||||||
@@ -461,7 +460,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// Invalidate to refresh room data after edit
|
// Invalidate to refresh room data after edit
|
||||||
ref.invalidate(chatroomProvider(id));
|
ref.invalidate(chatMemberListProvider(id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -497,7 +496,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.delete('/sphere/chat/$id');
|
await client.delete('/sphere/chat/$id');
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
@@ -530,7 +529,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.delete('/sphere/chat/$id/members/me');
|
await client.delete('/sphere/chat/$id/members/me');
|
||||||
ref.invalidate(chatroomsJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
@@ -553,86 +552,37 @@ sealed class ChatRoomMemberState with _$ChatRoomMemberState {
|
|||||||
}) = _ChatRoomMemberState;
|
}) = _ChatRoomMemberState;
|
||||||
}
|
}
|
||||||
|
|
||||||
final chatMemberStateProvider = StateNotifierProvider.family<
|
final chatMemberListProvider = AsyncNotifierProvider.autoDispose.family(
|
||||||
ChatMemberNotifier,
|
ChatMemberListNotifier.new,
|
||||||
ChatRoomMemberState,
|
);
|
||||||
String
|
|
||||||
>((ref, roomId) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
return ChatMemberNotifier(apiClient, roomId);
|
|
||||||
});
|
|
||||||
|
|
||||||
class ChatMemberNotifier extends StateNotifier<ChatRoomMemberState> {
|
class ChatMemberListNotifier extends AsyncNotifier<List<SnChatMember>>
|
||||||
final String roomId;
|
with AsyncPaginationController<SnChatMember> {
|
||||||
final Dio _apiClient;
|
static const pageSize = 20;
|
||||||
|
|
||||||
ChatMemberNotifier(this._apiClient, this.roomId)
|
final String arg;
|
||||||
: super(const ChatRoomMemberState(members: [], isLoading: false, total: 0));
|
ChatMemberListNotifier(this.arg);
|
||||||
|
|
||||||
Future<void> loadMore({int offset = 0, int take = 20}) async {
|
|
||||||
if (state.isLoading) return;
|
|
||||||
if (state.total > 0 && state.members.length >= state.total) return;
|
|
||||||
|
|
||||||
state = state.copyWith(isLoading: true, error: null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
'/sphere/chat/$roomId/members',
|
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
|
||||||
);
|
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final members = data.map((e) => SnChatMember.fromJson(e)).toList();
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
members: [...state.members, ...members],
|
|
||||||
total: total,
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
state = state.copyWith(error: e.toString(), isLoading: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
state = const ChatRoomMemberState(members: [], isLoading: false, total: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@riverpod
|
|
||||||
class ChatMemberListNotifier extends _$ChatMemberListNotifier
|
|
||||||
with CursorPagingNotifierMixin<SnChatMember> {
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnChatMember>> build(String roomId) {
|
|
||||||
return fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnChatMember>> fetch({String? cursor}) async {
|
Future<List<SnChatMember>> fetch() async {
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
final take = 20;
|
|
||||||
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/chat/$roomId/members',
|
'/sphere/chat/$arg/members',
|
||||||
queryParameters: {'offset': offset, 'take': take, 'withStatus': true},
|
queryParameters: {
|
||||||
|
'offset': fetchedCount.toString(),
|
||||||
|
'take': pageSize,
|
||||||
|
'withStatus': true,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final members =
|
||||||
final members = data.map((e) => SnChatMember.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnChatMember.fromJson(e))
|
||||||
|
.cast<SnChatMember>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Calculate next cursor based on total count
|
return members;
|
||||||
final nextOffset = offset + members.length;
|
|
||||||
final String? nextCursor =
|
|
||||||
nextOffset < total ? nextOffset.toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: members,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
hasMore: members.length < total,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,26 +592,15 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final memberListProvider = chatMemberListNotifierProvider(roomId);
|
final memberNotifier = ref.read(chatMemberListProvider(roomId).notifier);
|
||||||
|
|
||||||
// For backward compatibility and to show total count in the header
|
final roomIdentity = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
final memberState = ref.watch(chatMemberStateProvider(roomId));
|
final chatRoom = ref.watch(chatRoomProvider(roomId));
|
||||||
final memberNotifier = ref.read(chatMemberStateProvider(roomId).notifier);
|
|
||||||
|
|
||||||
final roomIdentity = ref.watch(chatroomIdentityProvider(roomId));
|
|
||||||
final chatRoom = ref.watch(chatroomProvider(roomId));
|
|
||||||
|
|
||||||
final isManagable =
|
final isManagable =
|
||||||
chatRoom.value?.accountId == roomIdentity.value?.accountId ||
|
chatRoom.value?.accountId == roomIdentity.value?.accountId ||
|
||||||
chatRoom.value?.type == 1;
|
chatRoom.value?.type == 1;
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
Future(() {
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
Future<void> invitePerson() async {
|
Future<void> invitePerson() async {
|
||||||
final result = await showModalBottomSheet(
|
final result = await showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -676,10 +615,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
'/sphere/chat/invites/$roomId',
|
'/sphere/chat/invites/$roomId',
|
||||||
data: {'related_user_id': result.id, 'role': 0},
|
data: {'related_user_id': result.id, 'role': 0},
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
await memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -696,7 +632,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'members'.plural(memberState.total),
|
'members'.plural(memberNotifier.totalCount ?? 0),
|
||||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
letterSpacing: -0.5,
|
letterSpacing: -0.5,
|
||||||
@@ -711,10 +647,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.refresh),
|
icon: const Icon(Symbols.refresh),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -727,19 +660,10 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: memberListProvider,
|
provider: chatMemberListProvider(roomId),
|
||||||
futureRefreshable: memberListProvider.future,
|
notifier: chatMemberListProvider(roomId).notifier,
|
||||||
notifierRefreshable: memberListProvider.notifier,
|
itemBuilder: (context, idx, member) {
|
||||||
contentBuilder: (data, widgetCount, endItemView) {
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == data.items.length) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final member = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: AccountPfcGestureDetector(
|
leading: AccountPfcGestureDetector(
|
||||||
@@ -776,16 +700,12 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm != true) return;
|
if (confirm != true) return;
|
||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
apiClientProvider,
|
|
||||||
);
|
|
||||||
await apiClient.delete(
|
await apiClient.delete(
|
||||||
'/sphere/chat/$roomId/members/${member.accountId}',
|
'/sphere/chat/$roomId/members/${member.accountId}',
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
// Refresh both providers
|
||||||
memberNotifier.reset();
|
memberNotifier.refresh();
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -796,8 +716,6 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -6,297 +6,75 @@ part of 'room_detail.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(totalMessagesCount)
|
||||||
|
const totalMessagesCountProvider = TotalMessagesCountFamily._();
|
||||||
|
|
||||||
|
final class TotalMessagesCountProvider
|
||||||
|
extends $FunctionalProvider<AsyncValue<int>, int, FutureOr<int>>
|
||||||
|
with $FutureModifier<int>, $FutureProvider<int> {
|
||||||
|
const TotalMessagesCountProvider._({
|
||||||
|
required TotalMessagesCountFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'totalMessagesCountProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$totalMessagesCountHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'totalMessagesCountProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<int> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<int> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return totalMessagesCount(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is TotalMessagesCountProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$totalMessagesCountHash() =>
|
String _$totalMessagesCountHash() =>
|
||||||
r'd55f1507aba2acdce5e468c1c2e15dba7640c571';
|
r'd55f1507aba2acdce5e468c1c2e15dba7640c571';
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
final class TotalMessagesCountFamily extends $Family
|
||||||
class _SystemHash {
|
with $FunctionalFamilyOverride<FutureOr<int>, String> {
|
||||||
_SystemHash._();
|
const TotalMessagesCountFamily._()
|
||||||
|
: super(
|
||||||
static int combine(int hash, int value) {
|
retry: null,
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
@ProviderFor(totalMessagesCount)
|
|
||||||
const totalMessagesCountProvider = TotalMessagesCountFamily();
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
class TotalMessagesCountFamily extends Family<AsyncValue<int>> {
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
const TotalMessagesCountFamily();
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
TotalMessagesCountProvider call(String roomId) {
|
|
||||||
return TotalMessagesCountProvider(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TotalMessagesCountProvider getProviderOverride(
|
|
||||||
covariant TotalMessagesCountProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'totalMessagesCountProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
class TotalMessagesCountProvider extends AutoDisposeFutureProvider<int> {
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
TotalMessagesCountProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => totalMessagesCount(ref as TotalMessagesCountRef, roomId),
|
|
||||||
from: totalMessagesCountProvider,
|
|
||||||
name: r'totalMessagesCountProvider',
|
name: r'totalMessagesCountProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$totalMessagesCountHash,
|
|
||||||
dependencies: TotalMessagesCountFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
TotalMessagesCountFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
TotalMessagesCountProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<int> Function(TotalMessagesCountRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: TotalMessagesCountProvider._internal(
|
|
||||||
(ref) => create(ref as TotalMessagesCountRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<int> createElement() {
|
|
||||||
return _TotalMessagesCountProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is TotalMessagesCountProvider && other.roomId == roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin TotalMessagesCountRef on AutoDisposeFutureProviderRef<int> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TotalMessagesCountProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<int>
|
|
||||||
with TotalMessagesCountRef {
|
|
||||||
_TotalMessagesCountProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get roomId => (origin as TotalMessagesCountProvider).roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$chatMemberListNotifierHash() =>
|
|
||||||
r'3ea30150278523e9f6b23f9200ea9a9fbae9c973';
|
|
||||||
|
|
||||||
abstract class _$ChatMemberListNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnChatMember>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnChatMember>> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
@ProviderFor(ChatMemberListNotifier)
|
|
||||||
const chatMemberListNotifierProvider = ChatMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
class ChatMemberListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnChatMember>>> {
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
const ChatMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
ChatMemberListNotifierProvider call(String roomId) {
|
|
||||||
return ChatMemberListNotifierProvider(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ChatMemberListNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatMemberListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatMemberListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
class ChatMemberListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
> {
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
ChatMemberListNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatMemberListNotifier()..roomId = roomId,
|
|
||||||
from: chatMemberListNotifierProvider,
|
|
||||||
name: r'chatMemberListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatMemberListNotifierHash,
|
|
||||||
dependencies: ChatMemberListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatMemberListNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ChatMemberListNotifierProvider._internal(
|
TotalMessagesCountProvider call(String roomId) =>
|
||||||
super._createNotifier, {
|
TotalMessagesCountProvider._(argument: roomId, from: this);
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnChatMember>> runNotifierBuild(
|
String toString() => r'totalMessagesCountProvider';
|
||||||
covariant ChatMemberListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatMemberListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatMemberListNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _ChatMemberListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is ChatMemberListNotifierProvider && other.roomId == roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatMemberListNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnChatMember>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatMemberListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
>
|
|
||||||
with ChatMemberListNotifierRef {
|
|
||||||
_ChatMemberListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get roomId => (origin as ChatMemberListNotifierProvider).roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
import 'package:island/pods/chat/messages_notifier.dart';
|
import 'package:island/pods/chat/messages_notifier.dart';
|
||||||
import 'package:island/pods/chat/chat_rooms.dart';
|
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/chat/message_list_tile.dart';
|
import 'package:island/widgets/chat/message_list_tile.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
@@ -124,9 +124,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
|
|||||||
// Debounce timer for search optimization
|
// Debounce timer for search optimization
|
||||||
final debounceTimer = useRef<Timer?>(null);
|
final debounceTimer = useRef<Timer?>(null);
|
||||||
|
|
||||||
final messagesNotifier = ref.read(
|
final messagesNotifier = ref.read(messagesProvider(roomId).notifier);
|
||||||
messagesNotifierProvider(roomId).notifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Optimized search function with debouncing
|
// Optimized search function with debouncing
|
||||||
void performSearch(String query) async {
|
void performSearch(String query) async {
|
||||||
@@ -180,7 +178,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
|
|||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// Clear flashing messages when entering search screen
|
// Clear flashing messages when entering search screen
|
||||||
ref.read(flashingMessagesProvider.notifier).state = {};
|
ref.read(flashingMessagesProvider.notifier).clear();
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -1,14 +1,28 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import 'package:island/database/message.dart';
|
import 'package:island/database/message.dart';
|
||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/widgets/chat/message_item.dart';
|
import 'package:island/widgets/chat/message_item.dart';
|
||||||
|
|
||||||
// Provider to track animated messages to prevent replay
|
// Provider to track animated messages to prevent replay
|
||||||
final animatedMessagesProvider = StateProvider<Set<String>>((ref) => {});
|
final animatedMessagesProvider =
|
||||||
|
NotifierProvider<AnimatedMessagesNotifier, Set<String>>(
|
||||||
|
AnimatedMessagesNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
class MessageItemWrapper extends HookConsumerWidget {
|
class AnimatedMessagesNotifier extends Notifier<Set<String>> {
|
||||||
|
@override
|
||||||
|
Set<String> build() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void addMessage(String messageId) {
|
||||||
|
state = {...state, messageId};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MessageItemWrapper extends ConsumerWidget {
|
||||||
final LocalChatMessage message;
|
final LocalChatMessage message;
|
||||||
final int index;
|
final int index;
|
||||||
final bool isLastInGroup;
|
final bool isLastInGroup;
|
||||||
@@ -78,9 +92,7 @@ class MessageItemWrapper extends HookConsumerWidget {
|
|||||||
onEnd: () {
|
onEnd: () {
|
||||||
// Mark as animated
|
// Mark as animated
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
ref
|
ref.read(animatedMessagesProvider.notifier).addMessage(message.id);
|
||||||
.read(animatedMessagesProvider.notifier)
|
|
||||||
.update((state) => {...state, message.id});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:island/models/post.dart';
|
|||||||
import 'package:island/models/publisher.dart';
|
import 'package:island/models/publisher.dart';
|
||||||
import 'package:island/models/heatmap.dart';
|
import 'package:island/models/heatmap.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/screens/creators/publishers_form.dart';
|
import 'package:island/screens/creators/publishers_form.dart';
|
||||||
import 'package:island/services/responsive.dart';
|
import 'package:island/services/responsive.dart';
|
||||||
import 'package:island/utils/text.dart';
|
import 'package:island/utils/text.dart';
|
||||||
@@ -18,11 +19,11 @@ import 'package:island/widgets/alert.dart';
|
|||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/content/cloud_files.dart';
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/response.dart';
|
import 'package:island/widgets/response.dart';
|
||||||
import 'package:island/widgets/activity_heatmap.dart';
|
import 'package:island/widgets/activity_heatmap.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'hub.g.dart';
|
part 'hub.g.dart';
|
||||||
@@ -77,38 +78,33 @@ Future<List<SnPublisherMember>> publisherInvites(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
|
||||||
class PublisherMemberListNotifier extends _$PublisherMemberListNotifier
|
.autoDispose(PublisherMemberListNotifier.new);
|
||||||
with CursorPagingNotifierMixin<SnPublisherMember> {
|
|
||||||
static const int _pageSize = 20;
|
class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
|
||||||
|
with AsyncPaginationController<SnPublisherMember> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String arg;
|
||||||
|
PublisherMemberListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnPublisherMember>> build(String uname) async {
|
Future<List<SnPublisherMember>> fetch() async {
|
||||||
return fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnPublisherMember>> fetch({String? cursor}) async {
|
|
||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
final offset = cursor != null ? int.parse(cursor) : 0;
|
|
||||||
|
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/publishers/$uname/members',
|
'/sphere/publishers/$arg/members',
|
||||||
queryParameters: {'offset': offset, 'take': _pageSize},
|
queryParameters: {'offset': fetchedCount.toString(), 'take': pageSize},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final members =
|
||||||
final members = data.map((e) => SnPublisherMember.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnPublisherMember.fromJson(e))
|
||||||
|
.cast<SnPublisherMember>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + members.length < total;
|
return members;
|
||||||
final nextCursor = hasMore ? (offset + members.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: members,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,6 +569,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
child: publisherStats.when(
|
child: publisherStats.when(
|
||||||
data:
|
data:
|
||||||
(stats) => SingleChildScrollView(
|
(stats) => SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||||
child:
|
child:
|
||||||
currentPublisher.value == null
|
currentPublisher.value == null
|
||||||
? ConstrainedBox(
|
? ConstrainedBox(
|
||||||
@@ -602,7 +599,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
).padding(horizontal: 12),
|
).padding(horizontal: 12),
|
||||||
buildNavigationWidget(true),
|
buildNavigationWidget(true),
|
||||||
],
|
],
|
||||||
).padding(vertical: 24)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
spacing: 12,
|
spacing: 12,
|
||||||
children: [
|
children: [
|
||||||
@@ -764,55 +761,6 @@ class PublisherMemberState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final publisherMemberStateProvider = StateNotifierProvider.family<
|
|
||||||
PublisherMemberNotifier,
|
|
||||||
PublisherMemberState,
|
|
||||||
String
|
|
||||||
>((ref, publisherUname) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
return PublisherMemberNotifier(apiClient, publisherUname);
|
|
||||||
});
|
|
||||||
|
|
||||||
class PublisherMemberNotifier extends StateNotifier<PublisherMemberState> {
|
|
||||||
final String publisherUname;
|
|
||||||
final Dio _apiClient;
|
|
||||||
|
|
||||||
PublisherMemberNotifier(this._apiClient, this.publisherUname)
|
|
||||||
: super(
|
|
||||||
const PublisherMemberState(members: [], isLoading: false, total: 0),
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<void> loadMore({int offset = 0, int take = 20}) async {
|
|
||||||
if (state.isLoading) return;
|
|
||||||
if (state.total > 0 && state.members.length >= state.total) return;
|
|
||||||
|
|
||||||
state = state.copyWith(isLoading: true, error: null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
'/sphere/publishers/$publisherUname/members',
|
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
|
||||||
);
|
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final members = data.map((e) => SnPublisherMember.fromJson(e)).toList();
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
members: [...state.members, ...members],
|
|
||||||
total: total,
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
state = state.copyWith(error: e.toString(), isLoading: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
state = const PublisherMemberState(members: [], isLoading: false, total: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherMemberListSheet extends HookConsumerWidget {
|
class _PublisherMemberListSheet extends HookConsumerWidget {
|
||||||
final String publisherUname;
|
final String publisherUname;
|
||||||
const _PublisherMemberListSheet({required this.publisherUname});
|
const _PublisherMemberListSheet({required this.publisherUname});
|
||||||
@@ -825,18 +773,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
final memberListProvider = publisherMemberListNotifierProvider(
|
final memberListProvider = publisherMemberListNotifierProvider(
|
||||||
publisherUname,
|
publisherUname,
|
||||||
);
|
);
|
||||||
final memberState = ref.watch(publisherMemberStateProvider(publisherUname));
|
|
||||||
final memberNotifier = ref.read(
|
final memberNotifier = ref.read(
|
||||||
publisherMemberStateProvider(publisherUname).notifier,
|
publisherMemberListNotifierProvider(publisherUname).notifier,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
Future(() {
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
Future<void> invitePerson() async {
|
Future<void> invitePerson() async {
|
||||||
final result = await showModalBottomSheet(
|
final result = await showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@@ -851,10 +791,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
'/sphere/publishers/invites/$publisherUname',
|
'/sphere/publishers/invites/$publisherUname',
|
||||||
data: {'related_user_id': result.id, 'role': 0},
|
data: {'related_user_id': result.id, 'role': 0},
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
await memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -871,7 +808,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'members'.plural(memberState.total),
|
'members'.plural(memberNotifier.totalCount ?? 0),
|
||||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
letterSpacing: -0.5,
|
letterSpacing: -0.5,
|
||||||
@@ -886,9 +823,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.refresh),
|
icon: const Icon(Symbols.refresh),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
memberNotifier.reset();
|
memberNotifier.refresh();
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -901,19 +836,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: memberListProvider,
|
provider: memberListProvider,
|
||||||
futureRefreshable: memberListProvider.future,
|
notifier: memberListProvider.notifier,
|
||||||
notifierRefreshable: memberListProvider.notifier,
|
itemBuilder: (context, index, member) {
|
||||||
contentBuilder: (data, widgetCount, endItemView) {
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == data.items.length) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final member = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
@@ -957,10 +883,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -975,16 +898,11 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm != true) return;
|
if (confirm != true) return;
|
||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
apiClientProvider,
|
|
||||||
);
|
|
||||||
await apiClient.delete(
|
await apiClient.delete(
|
||||||
'/sphere/publishers/$publisherUname/members/${member.accountId}',
|
'/sphere/publishers/$publisherUname/members/${member.accountId}',
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -995,8 +913,6 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -6,686 +6,351 @@ part of 'hub.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherStats].
|
|
||||||
@ProviderFor(publisherStats)
|
@ProviderFor(publisherStats)
|
||||||
const publisherStatsProvider = PublisherStatsFamily();
|
const publisherStatsProvider = PublisherStatsFamily._();
|
||||||
|
|
||||||
/// See also [publisherStats].
|
final class PublisherStatsProvider
|
||||||
class PublisherStatsFamily extends Family<AsyncValue<SnPublisherStats?>> {
|
extends
|
||||||
/// See also [publisherStats].
|
$FunctionalProvider<
|
||||||
const PublisherStatsFamily();
|
AsyncValue<SnPublisherStats?>,
|
||||||
|
SnPublisherStats?,
|
||||||
/// See also [publisherStats].
|
FutureOr<SnPublisherStats?>
|
||||||
PublisherStatsProvider call(String? uname) {
|
>
|
||||||
return PublisherStatsProvider(uname);
|
with
|
||||||
}
|
$FutureModifier<SnPublisherStats?>,
|
||||||
|
$FutureProvider<SnPublisherStats?> {
|
||||||
@override
|
const PublisherStatsProvider._({
|
||||||
PublisherStatsProvider getProviderOverride(
|
required PublisherStatsFamily super.from,
|
||||||
covariant PublisherStatsProvider provider,
|
required String? super.argument,
|
||||||
) {
|
}) : super(
|
||||||
return call(provider.uname);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherStatsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherStats].
|
|
||||||
class PublisherStatsProvider
|
|
||||||
extends AutoDisposeFutureProvider<SnPublisherStats?> {
|
|
||||||
/// See also [publisherStats].
|
|
||||||
PublisherStatsProvider(String? uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publisherStats(ref as PublisherStatsRef, uname),
|
|
||||||
from: publisherStatsProvider,
|
|
||||||
name: r'publisherStatsProvider',
|
name: r'publisherStatsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$publisherStatsHash,
|
|
||||||
dependencies: PublisherStatsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherStatsFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherStatsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherStatsHash();
|
||||||
FutureOr<SnPublisherStats?> Function(PublisherStatsRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherStatsProvider'
|
||||||
override: PublisherStatsProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherStatsRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublisherStats?> createElement() {
|
$FutureProviderElement<SnPublisherStats?> $createElement(
|
||||||
return _PublisherStatsProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublisherStats?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherStats(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherStatsProvider && other.uname == uname;
|
return other is PublisherStatsProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherStatsRef on AutoDisposeFutureProviderRef<SnPublisherStats?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherStatsProviderElement
|
final class PublisherStatsFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<SnPublisherStats?>
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherStats?>, String?> {
|
||||||
with PublisherStatsRef {
|
const PublisherStatsFamily._()
|
||||||
_PublisherStatsProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherStatsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PublisherStatsProvider call(String? uname) =>
|
||||||
|
PublisherStatsProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get uname => (origin as PublisherStatsProvider).uname;
|
String toString() => r'publisherStatsProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(publisherHeatmap)
|
||||||
|
const publisherHeatmapProvider = PublisherHeatmapFamily._();
|
||||||
|
|
||||||
|
final class PublisherHeatmapProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnHeatmap?>,
|
||||||
|
SnHeatmap?,
|
||||||
|
FutureOr<SnHeatmap?>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
|
||||||
|
const PublisherHeatmapProvider._({
|
||||||
|
required PublisherHeatmapFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherHeatmapProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$publisherHeatmapHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'publisherHeatmapProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnHeatmap?> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnHeatmap?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherHeatmap(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is PublisherHeatmapProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
|
String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
final class PublisherHeatmapFamily extends $Family
|
||||||
@ProviderFor(publisherHeatmap)
|
with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String?> {
|
||||||
const publisherHeatmapProvider = PublisherHeatmapFamily();
|
const PublisherHeatmapFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherHeatmapProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
PublisherHeatmapProvider call(String? uname) =>
|
||||||
class PublisherHeatmapFamily extends Family<AsyncValue<SnHeatmap?>> {
|
PublisherHeatmapProvider._(argument: uname, from: this);
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
const PublisherHeatmapFamily();
|
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
PublisherHeatmapProvider call(String? uname) {
|
|
||||||
return PublisherHeatmapProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PublisherHeatmapProvider getProviderOverride(
|
String toString() => r'publisherHeatmapProvider';
|
||||||
covariant PublisherHeatmapProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherHeatmapProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
@ProviderFor(publisherIdentity)
|
||||||
class PublisherHeatmapProvider extends AutoDisposeFutureProvider<SnHeatmap?> {
|
const publisherIdentityProvider = PublisherIdentityFamily._();
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
PublisherHeatmapProvider(String? uname)
|
final class PublisherIdentityProvider
|
||||||
: this._internal(
|
extends
|
||||||
(ref) => publisherHeatmap(ref as PublisherHeatmapRef, uname),
|
$FunctionalProvider<
|
||||||
from: publisherHeatmapProvider,
|
AsyncValue<SnPublisherMember?>,
|
||||||
name: r'publisherHeatmapProvider',
|
SnPublisherMember?,
|
||||||
debugGetCreateSourceHash:
|
FutureOr<SnPublisherMember?>
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
>
|
||||||
? null
|
with
|
||||||
: _$publisherHeatmapHash,
|
$FutureModifier<SnPublisherMember?>,
|
||||||
dependencies: PublisherHeatmapFamily._dependencies,
|
$FutureProvider<SnPublisherMember?> {
|
||||||
allTransitiveDependencies:
|
const PublisherIdentityProvider._({
|
||||||
PublisherHeatmapFamily._allTransitiveDependencies,
|
required PublisherIdentityFamily super.from,
|
||||||
uname: uname,
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherIdentityProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherHeatmapProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherIdentityHash();
|
||||||
FutureOr<SnHeatmap?> Function(PublisherHeatmapRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherIdentityProvider'
|
||||||
override: PublisherHeatmapProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherHeatmapRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnHeatmap?> createElement() {
|
$FutureProviderElement<SnPublisherMember?> $createElement(
|
||||||
return _PublisherHeatmapProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublisherMember?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return publisherIdentity(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherHeatmapProvider && other.uname == uname;
|
return other is PublisherIdentityProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherHeatmapRef on AutoDisposeFutureProviderRef<SnHeatmap?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherHeatmapProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnHeatmap?>
|
|
||||||
with PublisherHeatmapRef {
|
|
||||||
_PublisherHeatmapProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get uname => (origin as PublisherHeatmapProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
|
String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
final class PublisherIdentityFamily extends $Family
|
||||||
@ProviderFor(publisherIdentity)
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherMember?>, String> {
|
||||||
const publisherIdentityProvider = PublisherIdentityFamily();
|
const PublisherIdentityFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherIdentityProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
PublisherIdentityProvider call(String uname) =>
|
||||||
class PublisherIdentityFamily extends Family<AsyncValue<SnPublisherMember?>> {
|
PublisherIdentityProvider._(argument: uname, from: this);
|
||||||
/// See also [publisherIdentity].
|
|
||||||
const PublisherIdentityFamily();
|
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
|
||||||
PublisherIdentityProvider call(String uname) {
|
|
||||||
return PublisherIdentityProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PublisherIdentityProvider getProviderOverride(
|
String toString() => r'publisherIdentityProvider';
|
||||||
covariant PublisherIdentityProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherIdentityProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
@ProviderFor(publisherFeatures)
|
||||||
class PublisherIdentityProvider
|
const publisherFeaturesProvider = PublisherFeaturesFamily._();
|
||||||
extends AutoDisposeFutureProvider<SnPublisherMember?> {
|
|
||||||
/// See also [publisherIdentity].
|
final class PublisherFeaturesProvider
|
||||||
PublisherIdentityProvider(String uname)
|
extends
|
||||||
: this._internal(
|
$FunctionalProvider<
|
||||||
(ref) => publisherIdentity(ref as PublisherIdentityRef, uname),
|
AsyncValue<Map<String, bool>>,
|
||||||
from: publisherIdentityProvider,
|
Map<String, bool>,
|
||||||
name: r'publisherIdentityProvider',
|
FutureOr<Map<String, bool>>
|
||||||
debugGetCreateSourceHash:
|
>
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
with
|
||||||
? null
|
$FutureModifier<Map<String, bool>>,
|
||||||
: _$publisherIdentityHash,
|
$FutureProvider<Map<String, bool>> {
|
||||||
dependencies: PublisherIdentityFamily._dependencies,
|
const PublisherFeaturesProvider._({
|
||||||
allTransitiveDependencies:
|
required PublisherFeaturesFamily super.from,
|
||||||
PublisherIdentityFamily._allTransitiveDependencies,
|
required String? super.argument,
|
||||||
uname: uname,
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherFeaturesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherIdentityProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherFeaturesHash();
|
||||||
FutureOr<SnPublisherMember?> Function(PublisherIdentityRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherFeaturesProvider'
|
||||||
override: PublisherIdentityProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherIdentityRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublisherMember?> createElement() {
|
$FutureProviderElement<Map<String, bool>> $createElement(
|
||||||
return _PublisherIdentityProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Map<String, bool>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherFeatures(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherIdentityProvider && other.uname == uname;
|
return other is PublisherFeaturesProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherIdentityRef on AutoDisposeFutureProviderRef<SnPublisherMember?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherIdentityProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPublisherMember?>
|
|
||||||
with PublisherIdentityRef {
|
|
||||||
_PublisherIdentityProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get uname => (origin as PublisherIdentityProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
|
String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
final class PublisherFeaturesFamily extends $Family
|
||||||
@ProviderFor(publisherFeatures)
|
with $FunctionalFamilyOverride<FutureOr<Map<String, bool>>, String?> {
|
||||||
const publisherFeaturesProvider = PublisherFeaturesFamily();
|
const PublisherFeaturesFamily._()
|
||||||
|
: super(
|
||||||
/// See also [publisherFeatures].
|
retry: null,
|
||||||
class PublisherFeaturesFamily extends Family<AsyncValue<Map<String, bool>>> {
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
const PublisherFeaturesFamily();
|
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
PublisherFeaturesProvider call(String? uname) {
|
|
||||||
return PublisherFeaturesProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PublisherFeaturesProvider getProviderOverride(
|
|
||||||
covariant PublisherFeaturesProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherFeaturesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
class PublisherFeaturesProvider
|
|
||||||
extends AutoDisposeFutureProvider<Map<String, bool>> {
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
PublisherFeaturesProvider(String? uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publisherFeatures(ref as PublisherFeaturesRef, uname),
|
|
||||||
from: publisherFeaturesProvider,
|
|
||||||
name: r'publisherFeaturesProvider',
|
name: r'publisherFeaturesProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherFeaturesHash,
|
|
||||||
dependencies: PublisherFeaturesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherFeaturesFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
|
||||||
|
|
||||||
PublisherFeaturesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<Map<String, bool>> Function(PublisherFeaturesRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PublisherFeaturesProvider._internal(
|
|
||||||
(ref) => create(ref as PublisherFeaturesRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
PublisherFeaturesProvider call(String? uname) =>
|
||||||
|
PublisherFeaturesProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<Map<String, bool>> createElement() {
|
String toString() => r'publisherFeaturesProvider';
|
||||||
return _PublisherFeaturesProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PublisherFeaturesProvider && other.uname == uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@ProviderFor(publisherInvites)
|
||||||
// ignore: unused_element
|
const publisherInvitesProvider = PublisherInvitesProvider._();
|
||||||
mixin PublisherFeaturesRef on AutoDisposeFutureProviderRef<Map<String, bool>> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherFeaturesProviderElement
|
final class PublisherInvitesProvider
|
||||||
extends AutoDisposeFutureProviderElement<Map<String, bool>>
|
extends
|
||||||
with PublisherFeaturesRef {
|
$FunctionalProvider<
|
||||||
_PublisherFeaturesProviderElement(super.provider);
|
AsyncValue<List<SnPublisherMember>>,
|
||||||
|
List<SnPublisherMember>,
|
||||||
|
FutureOr<List<SnPublisherMember>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnPublisherMember>>,
|
||||||
|
$FutureProvider<List<SnPublisherMember>> {
|
||||||
|
const PublisherInvitesProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherInvitesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get uname => (origin as PublisherFeaturesProvider).uname;
|
String debugGetCreateSourceHash() => _$publisherInvitesHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnPublisherMember>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPublisherMember>> create(Ref ref) {
|
||||||
|
return publisherInvites(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
||||||
|
|
||||||
/// See also [publisherInvites].
|
|
||||||
@ProviderFor(publisherInvites)
|
|
||||||
final publisherInvitesProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnPublisherMember>>.internal(
|
|
||||||
publisherInvites,
|
|
||||||
name: r'publisherInvitesProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherInvitesHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef PublisherInvitesRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnPublisherMember>>;
|
|
||||||
String _$publisherMemberListNotifierHash() =>
|
|
||||||
r'b4afd5d591a6f3d29f1b45fb1b6d17cb34f3f11b';
|
|
||||||
|
|
||||||
abstract class _$PublisherMemberListNotifier
|
|
||||||
extends
|
|
||||||
BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnPublisherMember>> {
|
|
||||||
late final String uname;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnPublisherMember>> build(String uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
@ProviderFor(PublisherMemberListNotifier)
|
|
||||||
const publisherMemberListNotifierProvider = PublisherMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
class PublisherMemberListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnPublisherMember>>> {
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
const PublisherMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
PublisherMemberListNotifierProvider call(String uname) {
|
|
||||||
return PublisherMemberListNotifierProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PublisherMemberListNotifierProvider getProviderOverride(
|
|
||||||
covariant PublisherMemberListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherMemberListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
class PublisherMemberListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
> {
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
PublisherMemberListNotifierProvider(String uname)
|
|
||||||
: this._internal(
|
|
||||||
() => PublisherMemberListNotifier()..uname = uname,
|
|
||||||
from: publisherMemberListNotifierProvider,
|
|
||||||
name: r'publisherMemberListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherMemberListNotifierHash,
|
|
||||||
dependencies: PublisherMemberListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherMemberListNotifierFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
|
||||||
|
|
||||||
PublisherMemberListNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnPublisherMember>> runNotifierBuild(
|
|
||||||
covariant PublisherMemberListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(PublisherMemberListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PublisherMemberListNotifierProvider._internal(
|
|
||||||
() => create()..uname = uname,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _PublisherMemberListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PublisherMemberListNotifierProvider && other.uname == uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherMemberListNotifierRef
|
|
||||||
on
|
|
||||||
AutoDisposeAsyncNotifierProviderRef<
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherMemberListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
>
|
|
||||||
with PublisherMemberListNotifierRef {
|
|
||||||
_PublisherMemberListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get uname => (origin as PublisherMemberListNotifierProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -4,60 +4,53 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/poll.dart';
|
import 'package:island/models/poll.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/screens/poll/poll_editor.dart';
|
import 'package:island/screens/poll/poll_editor.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/poll/poll_feedback.dart';
|
import 'package:island/widgets/poll/poll_feedback.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:island/widgets/extended_refresh_indicator.dart';
|
import 'package:island/widgets/extended_refresh_indicator.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'poll_list.g.dart';
|
part 'poll_list.g.dart';
|
||||||
|
|
||||||
@riverpod
|
final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||||
class PollListNotifier extends _$PollListNotifier
|
PollListNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnPollWithStats> {
|
);
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
|
||||||
|
with AsyncPaginationController<SnPollWithStats> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String? arg;
|
||||||
|
PollListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnPollWithStats>> build(String? pubName) {
|
Future<List<SnPollWithStats>> fetch() async {
|
||||||
// immediately load first page
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnPollWithStats>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
// read the current family argument passed to provider
|
// read the current family argument passed to provider
|
||||||
final currentPub = pubName;
|
|
||||||
final queryParams = {
|
final queryParams = {
|
||||||
'offset': offset,
|
'offset': fetchedCount.toString(),
|
||||||
'take': _pageSize,
|
'take': pageSize,
|
||||||
if (currentPub != null) 'pub': currentPub,
|
if (arg != null) 'pub': arg,
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/polls/me',
|
'/sphere/polls/me',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final items =
|
||||||
final items = data.map((json) => SnPollWithStats.fromJson(json)).toList();
|
response.data
|
||||||
|
.map((json) => SnPollWithStats.fromJson(json))
|
||||||
|
.cast<SnPollWithStats>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + items.length < total;
|
return items;
|
||||||
final nextCursor = hasMore ? (offset + items.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,20 +90,11 @@ class CreatorPollListScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: ExtendedRefreshIndicator(
|
body: ExtendedRefreshIndicator(
|
||||||
onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future),
|
onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future),
|
||||||
child: CustomScrollView(
|
child: PaginationList(
|
||||||
slivers: [
|
|
||||||
PagingHelperSliverView(
|
|
||||||
provider: pollListNotifierProvider(pubName),
|
provider: pollListNotifierProvider(pubName),
|
||||||
futureRefreshable: pollListNotifierProvider(pubName).future,
|
notifier: pollListNotifierProvider(pubName).notifier,
|
||||||
notifierRefreshable: pollListNotifierProvider(pubName).notifier,
|
padding: const EdgeInsets.only(top: 12),
|
||||||
contentBuilder:
|
itemBuilder: (context, index, pollWithStats) {
|
||||||
(data, widgetCount, endItemView) => SliverList.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
final pollWithStats = data.items[index];
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 640),
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
child: _CreatorPollItem(
|
child: _CreatorPollItem(
|
||||||
@@ -121,9 +105,6 @@ class CreatorPollListScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,296 +6,80 @@ part of 'poll_list.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(pollWithStats)
|
||||||
|
const pollWithStatsProvider = PollWithStatsFamily._();
|
||||||
|
|
||||||
|
final class PollWithStatsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnPollWithStats>,
|
||||||
|
SnPollWithStats,
|
||||||
|
FutureOr<SnPollWithStats>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnPollWithStats>, $FutureProvider<SnPollWithStats> {
|
||||||
|
const PollWithStatsProvider._({
|
||||||
|
required PollWithStatsFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'pollWithStatsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$pollWithStatsHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'pollWithStatsProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnPollWithStats> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPollWithStats> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return pollWithStats(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is PollWithStatsProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
|
String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
final class PollWithStatsFamily extends $Family
|
||||||
class _SystemHash {
|
with $FunctionalFamilyOverride<FutureOr<SnPollWithStats>, String> {
|
||||||
_SystemHash._();
|
const PollWithStatsFamily._()
|
||||||
|
: super(
|
||||||
static int combine(int hash, int value) {
|
retry: null,
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
@ProviderFor(pollWithStats)
|
|
||||||
const pollWithStatsProvider = PollWithStatsFamily();
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
class PollWithStatsFamily extends Family<AsyncValue<SnPollWithStats>> {
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
const PollWithStatsFamily();
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
PollWithStatsProvider call(String id) {
|
|
||||||
return PollWithStatsProvider(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PollWithStatsProvider getProviderOverride(
|
|
||||||
covariant PollWithStatsProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'pollWithStatsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
class PollWithStatsProvider extends AutoDisposeFutureProvider<SnPollWithStats> {
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
PollWithStatsProvider(String id)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => pollWithStats(ref as PollWithStatsRef, id),
|
|
||||||
from: pollWithStatsProvider,
|
|
||||||
name: r'pollWithStatsProvider',
|
name: r'pollWithStatsProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$pollWithStatsHash,
|
|
||||||
dependencies: PollWithStatsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PollWithStatsFamily._allTransitiveDependencies,
|
|
||||||
id: id,
|
|
||||||
);
|
|
||||||
|
|
||||||
PollWithStatsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.id,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnPollWithStats> Function(PollWithStatsRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PollWithStatsProvider._internal(
|
|
||||||
(ref) => create(ref as PollWithStatsRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
id: id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<SnPollWithStats> createElement() {
|
|
||||||
return _PollWithStatsProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PollWithStatsProvider && other.id == id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, id.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PollWithStatsRef on AutoDisposeFutureProviderRef<SnPollWithStats> {
|
|
||||||
/// The parameter `id` of this provider.
|
|
||||||
String get id;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PollWithStatsProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPollWithStats>
|
|
||||||
with PollWithStatsRef {
|
|
||||||
_PollWithStatsProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get id => (origin as PollWithStatsProvider).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$pollListNotifierHash() => r'd5b822e737788be8982f5cb3b501d460441930c1';
|
|
||||||
|
|
||||||
abstract class _$PollListNotifier
|
|
||||||
extends
|
|
||||||
BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnPollWithStats>> {
|
|
||||||
late final String? pubName;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnPollWithStats>> build(String? pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
@ProviderFor(PollListNotifier)
|
|
||||||
const pollListNotifierProvider = PollListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
class PollListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnPollWithStats>>> {
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
const PollListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
PollListNotifierProvider call(String? pubName) {
|
|
||||||
return PollListNotifierProvider(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PollListNotifierProvider getProviderOverride(
|
|
||||||
covariant PollListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'pollListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
class PollListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
> {
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
PollListNotifierProvider(String? pubName)
|
|
||||||
: this._internal(
|
|
||||||
() => PollListNotifier()..pubName = pubName,
|
|
||||||
from: pollListNotifierProvider,
|
|
||||||
name: r'pollListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$pollListNotifierHash,
|
|
||||||
dependencies: PollListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PollListNotifierFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PollListNotifierProvider._internal(
|
PollWithStatsProvider call(String id) =>
|
||||||
super._createNotifier, {
|
PollWithStatsProvider._(argument: id, from: this);
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? pubName;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnPollWithStats>> runNotifierBuild(
|
String toString() => r'pollWithStatsProvider';
|
||||||
covariant PollListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(PollListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PollListNotifierProvider._internal(
|
|
||||||
() => create()..pubName = pubName,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _PollListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PollListNotifierProvider && other.pubName == pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PollListNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnPollWithStats>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String? get pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PollListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
>
|
|
||||||
with PollListNotifierRef {
|
|
||||||
_PollListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get pubName => (origin as PollListNotifierProvider).pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,163 +6,121 @@ part of 'publishers_form.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(publishersManaged)
|
||||||
|
const publishersManagedProvider = PublishersManagedProvider._();
|
||||||
|
|
||||||
|
final class PublishersManagedProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnPublisher>>,
|
||||||
|
List<SnPublisher>,
|
||||||
|
FutureOr<List<SnPublisher>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnPublisher>>,
|
||||||
|
$FutureProvider<List<SnPublisher>> {
|
||||||
|
const PublishersManagedProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'publishersManagedProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$publishersManagedHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnPublisher>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPublisher>> create(Ref ref) {
|
||||||
|
return publishersManaged(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3';
|
String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3';
|
||||||
|
|
||||||
/// See also [publishersManaged].
|
|
||||||
@ProviderFor(publishersManaged)
|
|
||||||
final publishersManagedProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnPublisher>>.internal(
|
|
||||||
publishersManaged,
|
|
||||||
name: r'publishersManagedProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publishersManagedHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef PublishersManagedRef = AutoDisposeFutureProviderRef<List<SnPublisher>>;
|
|
||||||
String _$publisherHash() => r'18fb5c6b3d79dd8af4fbee108dec1a0e8a034038';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisher].
|
|
||||||
@ProviderFor(publisher)
|
@ProviderFor(publisher)
|
||||||
const publisherProvider = PublisherFamily();
|
const publisherProvider = PublisherFamily._();
|
||||||
|
|
||||||
/// See also [publisher].
|
final class PublisherProvider
|
||||||
class PublisherFamily extends Family<AsyncValue<SnPublisher?>> {
|
extends
|
||||||
/// See also [publisher].
|
$FunctionalProvider<
|
||||||
const PublisherFamily();
|
AsyncValue<SnPublisher?>,
|
||||||
|
SnPublisher?,
|
||||||
/// See also [publisher].
|
FutureOr<SnPublisher?>
|
||||||
PublisherProvider call(String? identifier) {
|
>
|
||||||
return PublisherProvider(identifier);
|
with $FutureModifier<SnPublisher?>, $FutureProvider<SnPublisher?> {
|
||||||
}
|
const PublisherProvider._({
|
||||||
|
required PublisherFamily super.from,
|
||||||
@override
|
required String? super.argument,
|
||||||
PublisherProvider getProviderOverride(covariant PublisherProvider provider) {
|
}) : super(
|
||||||
return call(provider.identifier);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisher].
|
|
||||||
class PublisherProvider extends AutoDisposeFutureProvider<SnPublisher?> {
|
|
||||||
/// See also [publisher].
|
|
||||||
PublisherProvider(String? identifier)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publisher(ref as PublisherRef, identifier),
|
|
||||||
from: publisherProvider,
|
|
||||||
name: r'publisherProvider',
|
name: r'publisherProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$publisherHash,
|
|
||||||
dependencies: PublisherFamily._dependencies,
|
|
||||||
allTransitiveDependencies: PublisherFamily._allTransitiveDependencies,
|
|
||||||
identifier: identifier,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.identifier,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? identifier;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherHash();
|
||||||
FutureOr<SnPublisher?> Function(PublisherRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherProvider'
|
||||||
override: PublisherProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
identifier: identifier,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublisher?> createElement() {
|
$FutureProviderElement<SnPublisher?> $createElement(
|
||||||
return _PublisherProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublisher?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisher(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherProvider && other.identifier == identifier;
|
return other is PublisherProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, identifier.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$publisherHash() => r'18fb5c6b3d79dd8af4fbee108dec1a0e8a034038';
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherRef on AutoDisposeFutureProviderRef<SnPublisher?> {
|
|
||||||
/// The parameter `identifier` of this provider.
|
|
||||||
String? get identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherProviderElement
|
final class PublisherFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<SnPublisher?>
|
with $FunctionalFamilyOverride<FutureOr<SnPublisher?>, String?> {
|
||||||
with PublisherRef {
|
const PublisherFamily._()
|
||||||
_PublisherProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PublisherProvider call(String? identifier) =>
|
||||||
|
PublisherProvider._(argument: identifier, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get identifier => (origin as PublisherProvider).identifier;
|
String toString() => r'publisherProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,168 +6,90 @@ part of 'site_detail.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$publicationSiteDetailHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'e5d259ea39c4ba47e92d37e644fc3d84984927a9';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publicationSiteDetail].
|
|
||||||
@ProviderFor(publicationSiteDetail)
|
@ProviderFor(publicationSiteDetail)
|
||||||
const publicationSiteDetailProvider = PublicationSiteDetailFamily();
|
const publicationSiteDetailProvider = PublicationSiteDetailFamily._();
|
||||||
|
|
||||||
/// See also [publicationSiteDetail].
|
final class PublicationSiteDetailProvider
|
||||||
class PublicationSiteDetailFamily
|
extends
|
||||||
extends Family<AsyncValue<SnPublicationSite>> {
|
$FunctionalProvider<
|
||||||
/// See also [publicationSiteDetail].
|
AsyncValue<SnPublicationSite>,
|
||||||
const PublicationSiteDetailFamily();
|
SnPublicationSite,
|
||||||
|
FutureOr<SnPublicationSite>
|
||||||
/// See also [publicationSiteDetail].
|
>
|
||||||
PublicationSiteDetailProvider call(String pubName, String siteSlug) {
|
with
|
||||||
return PublicationSiteDetailProvider(pubName, siteSlug);
|
$FutureModifier<SnPublicationSite>,
|
||||||
}
|
$FutureProvider<SnPublicationSite> {
|
||||||
|
const PublicationSiteDetailProvider._({
|
||||||
@override
|
required PublicationSiteDetailFamily super.from,
|
||||||
PublicationSiteDetailProvider getProviderOverride(
|
required (String, String) super.argument,
|
||||||
covariant PublicationSiteDetailProvider provider,
|
}) : super(
|
||||||
) {
|
retry: null,
|
||||||
return call(provider.pubName, provider.siteSlug);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publicationSiteDetailProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publicationSiteDetail].
|
|
||||||
class PublicationSiteDetailProvider
|
|
||||||
extends AutoDisposeFutureProvider<SnPublicationSite> {
|
|
||||||
/// See also [publicationSiteDetail].
|
|
||||||
PublicationSiteDetailProvider(String pubName, String siteSlug)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publicationSiteDetail(
|
|
||||||
ref as PublicationSiteDetailRef,
|
|
||||||
pubName,
|
|
||||||
siteSlug,
|
|
||||||
),
|
|
||||||
from: publicationSiteDetailProvider,
|
|
||||||
name: r'publicationSiteDetailProvider',
|
name: r'publicationSiteDetailProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$publicationSiteDetailHash,
|
|
||||||
dependencies: PublicationSiteDetailFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublicationSiteDetailFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PublicationSiteDetailProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
required this.siteSlug,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
final String siteSlug;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publicationSiteDetailHash();
|
||||||
FutureOr<SnPublicationSite> Function(PublicationSiteDetailRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'publicationSiteDetailProvider'
|
||||||
origin: this,
|
''
|
||||||
override: PublicationSiteDetailProvider._internal(
|
'$argument';
|
||||||
(ref) => create(ref as PublicationSiteDetailRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublicationSite> createElement() {
|
$FutureProviderElement<SnPublicationSite> $createElement(
|
||||||
return _PublicationSiteDetailProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublicationSite> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return publicationSiteDetail(ref, argument.$1, argument.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublicationSiteDetailProvider &&
|
return other is PublicationSiteDetailProvider && other.argument == argument;
|
||||||
other.pubName == pubName &&
|
|
||||||
other.siteSlug == siteSlug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, siteSlug.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$publicationSiteDetailHash() =>
|
||||||
// ignore: unused_element
|
r'e5d259ea39c4ba47e92d37e644fc3d84984927a9';
|
||||||
mixin PublicationSiteDetailRef
|
|
||||||
on AutoDisposeFutureProviderRef<SnPublicationSite> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
|
|
||||||
/// The parameter `siteSlug` of this provider.
|
final class PublicationSiteDetailFamily extends $Family
|
||||||
String get siteSlug;
|
with
|
||||||
}
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<SnPublicationSite>,
|
||||||
|
(String, String)
|
||||||
|
> {
|
||||||
|
const PublicationSiteDetailFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publicationSiteDetailProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
class _PublicationSiteDetailProviderElement
|
PublicationSiteDetailProvider call(String pubName, String siteSlug) =>
|
||||||
extends AutoDisposeFutureProviderElement<SnPublicationSite>
|
PublicationSiteDetailProvider._(
|
||||||
with PublicationSiteDetailRef {
|
argument: (pubName, siteSlug),
|
||||||
_PublicationSiteDetailProviderElement(super.provider);
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get pubName => (origin as PublicationSiteDetailProvider).pubName;
|
String toString() => r'publicationSiteDetailProvider';
|
||||||
@override
|
|
||||||
String get siteSlug => (origin as PublicationSiteDetailProvider).siteSlug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,54 +6,45 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/publication_site.dart';
|
import 'package:island/models/publication_site.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/screens/creators/sites/site_edit.dart';
|
import 'package:island/screens/creators/sites/site_edit.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:island/widgets/extended_refresh_indicator.dart';
|
import 'package:island/widgets/extended_refresh_indicator.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'site_list.g.dart';
|
final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||||
|
SiteListNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
@riverpod
|
class SiteListNotifier extends AsyncNotifier<List<SnPublicationSite>>
|
||||||
class SiteListNotifier extends _$SiteListNotifier
|
with AsyncPaginationController<SnPublicationSite> {
|
||||||
with CursorPagingNotifierMixin<SnPublicationSite> {
|
static const int pageSize = 20;
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
final String arg;
|
||||||
|
SiteListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnPublicationSite>> build(String? pubName) {
|
Future<List<SnPublicationSite>> fetch() async {
|
||||||
// immediately load first page
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnPublicationSite>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
// read the current family argument passed to provider
|
// read the current family argument passed to provider
|
||||||
final queryParams = {'offset': offset, 'take': _pageSize};
|
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/zone/sites/$pubName',
|
'/zone/sites/$arg',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final items =
|
||||||
final items = data.map((json) => SnPublicationSite.fromJson(json)).toList();
|
response.data
|
||||||
|
.map((json) => SnPublicationSite.fromJson(json))
|
||||||
|
.cast<SnPublicationSite>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + items.length < total;
|
return items;
|
||||||
final nextCursor = hasMore ? (offset + items.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,25 +75,16 @@ class CreatorSiteListScreen extends HookConsumerWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
const SliverGap(8),
|
const SliverGap(8),
|
||||||
PagingHelperSliverView(
|
PaginationList(
|
||||||
provider: siteListNotifierProvider(pubName),
|
provider: siteListNotifierProvider(pubName),
|
||||||
futureRefreshable: siteListNotifierProvider(pubName).future,
|
notifier: siteListNotifierProvider(pubName).notifier,
|
||||||
notifierRefreshable: siteListNotifierProvider(pubName).notifier,
|
itemBuilder: (context, index, site) {
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => SliverList.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
final site = data.items[index];
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 640),
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
child: _CreatorSiteItem(site: site, pubName: pubName),
|
child: _CreatorSiteItem(site: site, pubName: pubName),
|
||||||
).center();
|
).center();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'site_list.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$siteListNotifierHash() => r'1670cadcc0c7ccbd98bc33bbf5b4af21e9cb166c';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$SiteListNotifier
|
|
||||||
extends
|
|
||||||
BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnPublicationSite>> {
|
|
||||||
late final String? pubName;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnPublicationSite>> build(String? pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
@ProviderFor(SiteListNotifier)
|
|
||||||
const siteListNotifierProvider = SiteListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
class SiteListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnPublicationSite>>> {
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
const SiteListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
SiteListNotifierProvider call(String? pubName) {
|
|
||||||
return SiteListNotifierProvider(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SiteListNotifierProvider getProviderOverride(
|
|
||||||
covariant SiteListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
class SiteListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
SiteListNotifier,
|
|
||||||
CursorPagingData<SnPublicationSite>
|
|
||||||
> {
|
|
||||||
/// See also [SiteListNotifier].
|
|
||||||
SiteListNotifierProvider(String? pubName)
|
|
||||||
: this._internal(
|
|
||||||
() => SiteListNotifier()..pubName = pubName,
|
|
||||||
from: siteListNotifierProvider,
|
|
||||||
name: r'siteListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$siteListNotifierHash,
|
|
||||||
dependencies: SiteListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
SiteListNotifierFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
);
|
|
||||||
|
|
||||||
SiteListNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? pubName;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnPublicationSite>> runNotifierBuild(
|
|
||||||
covariant SiteListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(SiteListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: SiteListNotifierProvider._internal(
|
|
||||||
() => create()..pubName = pubName,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
SiteListNotifier,
|
|
||||||
CursorPagingData<SnPublicationSite>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _SiteListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is SiteListNotifierProvider && other.pubName == pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteListNotifierRef
|
|
||||||
on
|
|
||||||
AutoDisposeAsyncNotifierProviderRef<
|
|
||||||
CursorPagingData<SnPublicationSite>
|
|
||||||
> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String? get pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SiteListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
SiteListNotifier,
|
|
||||||
CursorPagingData<SnPublicationSite>
|
|
||||||
>
|
|
||||||
with SiteListNotifierRef {
|
|
||||||
_SiteListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get pubName => (origin as SiteListNotifierProvider).pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
@@ -293,7 +293,7 @@ class StickerPackActionMenu extends HookConsumerWidget {
|
|||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
client.delete('/sphere/stickers/$packId');
|
client.delete('/sphere/stickers/$packId');
|
||||||
ref.invalidate(stickerPacksNotifierProvider);
|
ref.invalidate(stickerPacksProvider);
|
||||||
if (context.mounted) context.pop(true);
|
if (context.mounted) context.pop(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -320,7 +320,6 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
final formKey = useMemoized(() => GlobalKey<FormState>(), []);
|
final formKey = useMemoized(() => GlobalKey<FormState>(), []);
|
||||||
|
|
||||||
final image = useState<String?>(id == null ? '' : sticker.value?.image.id);
|
final image = useState<String?>(id == null ? '' : sticker.value?.image.id);
|
||||||
final imageController = useTextEditingController(text: image.value);
|
|
||||||
final slugController = useTextEditingController(
|
final slugController = useTextEditingController(
|
||||||
text: id == null ? '' : sticker.value?.slug,
|
text: id == null ? '' : sticker.value?.slug,
|
||||||
);
|
);
|
||||||
@@ -328,7 +327,6 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (sticker.value != null) {
|
if (sticker.value != null) {
|
||||||
image.value = sticker.value!.image.id;
|
image.value = sticker.value!.image.id;
|
||||||
imageController.text = sticker.value!.image.id;
|
|
||||||
slugController.text = sticker.value!.slug;
|
slugController.text = sticker.value!.slug;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -344,7 +342,7 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
id == null
|
id == null
|
||||||
? '/sphere/stickers/$packId/content'
|
? '/sphere/stickers/$packId/content'
|
||||||
: '/sphere/stickers/$packId/content/$id',
|
: '/sphere/stickers/$packId/content/$id',
|
||||||
data: {'slug': slugController.text, 'image_id': imageController.text},
|
data: {'slug': slugController.text, 'image_id': image.value},
|
||||||
options: Options(method: id == null ? 'POST' : 'PATCH'),
|
options: Options(method: id == null ? 'POST' : 'PATCH'),
|
||||||
);
|
);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
@@ -392,7 +390,6 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
image.value = value[0].id;
|
image.value = value[0].id;
|
||||||
imageController.text = image.value!;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Symbols.cloud_upload),
|
icon: const Icon(Symbols.cloud_upload),
|
||||||
|
|||||||
@@ -6,272 +6,157 @@ part of 'pack_detail.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$stickerPackContentHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [stickerPackContent].
|
|
||||||
@ProviderFor(stickerPackContent)
|
@ProviderFor(stickerPackContent)
|
||||||
const stickerPackContentProvider = StickerPackContentFamily();
|
const stickerPackContentProvider = StickerPackContentFamily._();
|
||||||
|
|
||||||
/// See also [stickerPackContent].
|
final class StickerPackContentProvider
|
||||||
class StickerPackContentFamily extends Family<AsyncValue<List<SnSticker>>> {
|
extends
|
||||||
/// See also [stickerPackContent].
|
$FunctionalProvider<
|
||||||
const StickerPackContentFamily();
|
AsyncValue<List<SnSticker>>,
|
||||||
|
List<SnSticker>,
|
||||||
/// See also [stickerPackContent].
|
FutureOr<List<SnSticker>>
|
||||||
StickerPackContentProvider call(String packId) {
|
>
|
||||||
return StickerPackContentProvider(packId);
|
with $FutureModifier<List<SnSticker>>, $FutureProvider<List<SnSticker>> {
|
||||||
}
|
const StickerPackContentProvider._({
|
||||||
|
required StickerPackContentFamily super.from,
|
||||||
@override
|
required String super.argument,
|
||||||
StickerPackContentProvider getProviderOverride(
|
}) : super(
|
||||||
covariant StickerPackContentProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.packId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'stickerPackContentProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [stickerPackContent].
|
|
||||||
class StickerPackContentProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnSticker>> {
|
|
||||||
/// See also [stickerPackContent].
|
|
||||||
StickerPackContentProvider(String packId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => stickerPackContent(ref as StickerPackContentRef, packId),
|
|
||||||
from: stickerPackContentProvider,
|
|
||||||
name: r'stickerPackContentProvider',
|
name: r'stickerPackContentProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$stickerPackContentHash,
|
|
||||||
dependencies: StickerPackContentFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
StickerPackContentFamily._allTransitiveDependencies,
|
|
||||||
packId: packId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
StickerPackContentProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.packId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String packId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$stickerPackContentHash();
|
||||||
FutureOr<List<SnSticker>> Function(StickerPackContentRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'stickerPackContentProvider'
|
||||||
override: StickerPackContentProvider._internal(
|
''
|
||||||
(ref) => create(ref as StickerPackContentRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
packId: packId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnSticker>> createElement() {
|
$FutureProviderElement<List<SnSticker>> $createElement(
|
||||||
return _StickerPackContentProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnSticker>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return stickerPackContent(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is StickerPackContentProvider && other.packId == packId;
|
return other is StickerPackContentProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, packId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$stickerPackContentHash() =>
|
||||||
// ignore: unused_element
|
r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d';
|
||||||
mixin StickerPackContentRef on AutoDisposeFutureProviderRef<List<SnSticker>> {
|
|
||||||
/// The parameter `packId` of this provider.
|
|
||||||
String get packId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _StickerPackContentProviderElement
|
final class StickerPackContentFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<List<SnSticker>>
|
with $FunctionalFamilyOverride<FutureOr<List<SnSticker>>, String> {
|
||||||
with StickerPackContentRef {
|
const StickerPackContentFamily._()
|
||||||
_StickerPackContentProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'stickerPackContentProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
StickerPackContentProvider call(String packId) =>
|
||||||
|
StickerPackContentProvider._(argument: packId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get packId => (origin as StickerPackContentProvider).packId;
|
String toString() => r'stickerPackContentProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(stickerPackSticker)
|
||||||
|
const stickerPackStickerProvider = StickerPackStickerFamily._();
|
||||||
|
|
||||||
|
final class StickerPackStickerProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnSticker?>,
|
||||||
|
SnSticker?,
|
||||||
|
FutureOr<SnSticker?>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnSticker?>, $FutureProvider<SnSticker?> {
|
||||||
|
const StickerPackStickerProvider._({
|
||||||
|
required StickerPackStickerFamily super.from,
|
||||||
|
required StickerWithPackQuery? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'stickerPackStickerProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$stickerPackStickerHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'stickerPackStickerProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnSticker?> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnSticker?> create(Ref ref) {
|
||||||
|
final argument = this.argument as StickerWithPackQuery?;
|
||||||
|
return stickerPackSticker(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is StickerPackStickerProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$stickerPackStickerHash() =>
|
String _$stickerPackStickerHash() =>
|
||||||
r'5c553666b3a63530bdebae4b7cd52f303c5ab3a0';
|
r'5c553666b3a63530bdebae4b7cd52f303c5ab3a0';
|
||||||
|
|
||||||
/// See also [stickerPackSticker].
|
final class StickerPackStickerFamily extends $Family
|
||||||
@ProviderFor(stickerPackSticker)
|
with
|
||||||
const stickerPackStickerProvider = StickerPackStickerFamily();
|
$FunctionalFamilyOverride<FutureOr<SnSticker?>, StickerWithPackQuery?> {
|
||||||
|
const StickerPackStickerFamily._()
|
||||||
/// See also [stickerPackSticker].
|
: super(
|
||||||
class StickerPackStickerFamily extends Family<AsyncValue<SnSticker?>> {
|
retry: null,
|
||||||
/// See also [stickerPackSticker].
|
|
||||||
const StickerPackStickerFamily();
|
|
||||||
|
|
||||||
/// See also [stickerPackSticker].
|
|
||||||
StickerPackStickerProvider call(StickerWithPackQuery? query) {
|
|
||||||
return StickerPackStickerProvider(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
StickerPackStickerProvider getProviderOverride(
|
|
||||||
covariant StickerPackStickerProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'stickerPackStickerProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [stickerPackSticker].
|
|
||||||
class StickerPackStickerProvider extends AutoDisposeFutureProvider<SnSticker?> {
|
|
||||||
/// See also [stickerPackSticker].
|
|
||||||
StickerPackStickerProvider(StickerWithPackQuery? query)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => stickerPackSticker(ref as StickerPackStickerRef, query),
|
|
||||||
from: stickerPackStickerProvider,
|
|
||||||
name: r'stickerPackStickerProvider',
|
name: r'stickerPackStickerProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$stickerPackStickerHash,
|
|
||||||
dependencies: StickerPackStickerFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
StickerPackStickerFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
|
||||||
|
|
||||||
StickerPackStickerProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final StickerWithPackQuery? query;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnSticker?> Function(StickerPackStickerRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: StickerPackStickerProvider._internal(
|
|
||||||
(ref) => create(ref as StickerPackStickerRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
StickerPackStickerProvider call(StickerWithPackQuery? query) =>
|
||||||
|
StickerPackStickerProvider._(argument: query, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnSticker?> createElement() {
|
String toString() => r'stickerPackStickerProvider';
|
||||||
return _StickerPackStickerProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is StickerPackStickerProvider && other.query == query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin StickerPackStickerRef on AutoDisposeFutureProviderRef<SnSticker?> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
StickerWithPackQuery? get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _StickerPackStickerProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnSticker?>
|
|
||||||
with StickerPackStickerRef {
|
|
||||||
_StickerPackStickerProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
StickerWithPackQuery? get query =>
|
|
||||||
(origin as StickerPackStickerProvider).query;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -4,17 +4,21 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/file.dart';
|
||||||
import 'package:island/models/sticker.dart';
|
import 'package:island/models/sticker.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/services/responsive.dart';
|
import 'package:island/services/responsive.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/content/cloud_file_picker.dart';
|
||||||
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
import 'package:island/screens/creators/stickers/pack_detail.dart';
|
import 'package:island/screens/creators/stickers/pack_detail.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
|
|
||||||
part 'stickers.g.dart';
|
part 'stickers.g.dart';
|
||||||
|
|
||||||
@@ -44,7 +48,7 @@ class StickersScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
ref.invalidate(stickerPacksNotifierProvider(pubName));
|
ref.invalidate(stickerPacksProvider(pubName));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -78,20 +82,10 @@ class SliverStickerPacksList extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return PagingHelperView(
|
return PaginationList(
|
||||||
provider: stickerPacksNotifierProvider(pubName),
|
provider: stickerPacksProvider(pubName),
|
||||||
futureRefreshable: stickerPacksNotifierProvider(pubName).future,
|
notifier: stickerPacksProvider(pubName).notifier,
|
||||||
notifierRefreshable: stickerPacksNotifierProvider(pubName).notifier,
|
itemBuilder: (context, index, sticker) {
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => ListView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final sticker = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
@@ -121,9 +115,7 @@ class SliverStickerPacksList extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
ref.invalidate(
|
ref.invalidate(stickerPackContentProvider(id));
|
||||||
stickerPackContentProvider(id),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -143,46 +135,43 @@ class SliverStickerPacksList extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final stickerPacksProvider = AsyncNotifierProvider.family.autoDispose(
|
||||||
class StickerPacksNotifier extends _$StickerPacksNotifier
|
StickerPacksNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnStickerPack> {
|
);
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
class StickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
||||||
|
with AsyncPaginationController<SnStickerPack> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String arg;
|
||||||
|
StickerPacksNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnStickerPack>> build(String pubName) {
|
Future<List<SnStickerPack>> fetch() async {
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnStickerPack>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/stickers',
|
'/sphere/stickers',
|
||||||
queryParameters: {'offset': offset, 'take': _pageSize, 'pub': pubName},
|
queryParameters: {
|
||||||
|
'offset': fetchedCount.toString(),
|
||||||
|
'take': pageSize,
|
||||||
|
'pub': arg,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final stickers =
|
||||||
final stickers = data.map((e) => SnStickerPack.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnStickerPack.fromJson(e))
|
||||||
|
.cast<SnStickerPack>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + stickers.length < total;
|
return stickers;
|
||||||
final nextCursor = hasMore ? (offset + stickers.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: stickers,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
@@ -207,6 +196,9 @@ class StickerPackForm extends HookConsumerWidget {
|
|||||||
final formKey = useMemoized(() => GlobalKey<FormState>(), []);
|
final formKey = useMemoized(() => GlobalKey<FormState>(), []);
|
||||||
final initialPack = ref.watch(stickerPackProvider(packId));
|
final initialPack = ref.watch(stickerPackProvider(packId));
|
||||||
|
|
||||||
|
final icon = useState<String?>(
|
||||||
|
packId == null ? '' : initialPack.value?.icon?.id,
|
||||||
|
);
|
||||||
final nameController = useTextEditingController();
|
final nameController = useTextEditingController();
|
||||||
final descriptionController = useTextEditingController();
|
final descriptionController = useTextEditingController();
|
||||||
final prefixController = useTextEditingController();
|
final prefixController = useTextEditingController();
|
||||||
@@ -229,11 +221,12 @@ class StickerPackForm extends HookConsumerWidget {
|
|||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
final resp = await apiClient.request(
|
final resp = await apiClient.request(
|
||||||
'/sphere/stickers',
|
packId == null ? '/sphere/stickers' : '/sphere/stickers/$packId',
|
||||||
data: {
|
data: {
|
||||||
'name': nameController.text,
|
'name': nameController.text,
|
||||||
'description': descriptionController.text,
|
'description': descriptionController.text,
|
||||||
'prefix': prefixController.text,
|
'prefix': prefixController.text,
|
||||||
|
'icon_id': icon.value,
|
||||||
},
|
},
|
||||||
queryParameters: {'pub': pubName},
|
queryParameters: {'pub': pubName},
|
||||||
options: Options(method: packId == null ? 'POST' : 'PATCH'),
|
options: Options(method: packId == null ? 'POST' : 'PATCH'),
|
||||||
@@ -255,6 +248,44 @@ class StickerPackForm extends HookConsumerWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
|
Row(
|
||||||
|
spacing: 8,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 80,
|
||||||
|
width: 80,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
),
|
||||||
|
child:
|
||||||
|
(icon.value?.isEmpty ?? true)
|
||||||
|
? const SizedBox.shrink()
|
||||||
|
: CloudImageWidget(fileId: icon.value!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton.filledTonal(
|
||||||
|
onPressed: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder:
|
||||||
|
(context) => CloudFilePicker(
|
||||||
|
allowedTypes: {UniversalFileType.image},
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
if (value == null) return;
|
||||||
|
icon.value = value[0].id;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(Symbols.cloud_upload),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: nameController,
|
controller: nameController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
|||||||
@@ -6,295 +6,80 @@ part of 'stickers.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(stickerPack)
|
||||||
|
const stickerPackProvider = StickerPackFamily._();
|
||||||
|
|
||||||
|
final class StickerPackProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnStickerPack?>,
|
||||||
|
SnStickerPack?,
|
||||||
|
FutureOr<SnStickerPack?>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnStickerPack?>, $FutureProvider<SnStickerPack?> {
|
||||||
|
const StickerPackProvider._({
|
||||||
|
required StickerPackFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'stickerPackProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$stickerPackHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'stickerPackProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnStickerPack?> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnStickerPack?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return stickerPack(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is StickerPackProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77';
|
String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77';
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
final class StickerPackFamily extends $Family
|
||||||
class _SystemHash {
|
with $FunctionalFamilyOverride<FutureOr<SnStickerPack?>, String?> {
|
||||||
_SystemHash._();
|
const StickerPackFamily._()
|
||||||
|
: super(
|
||||||
static int combine(int hash, int value) {
|
retry: null,
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [stickerPack].
|
|
||||||
@ProviderFor(stickerPack)
|
|
||||||
const stickerPackProvider = StickerPackFamily();
|
|
||||||
|
|
||||||
/// See also [stickerPack].
|
|
||||||
class StickerPackFamily extends Family<AsyncValue<SnStickerPack?>> {
|
|
||||||
/// See also [stickerPack].
|
|
||||||
const StickerPackFamily();
|
|
||||||
|
|
||||||
/// See also [stickerPack].
|
|
||||||
StickerPackProvider call(String? packId) {
|
|
||||||
return StickerPackProvider(packId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
StickerPackProvider getProviderOverride(
|
|
||||||
covariant StickerPackProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.packId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'stickerPackProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [stickerPack].
|
|
||||||
class StickerPackProvider extends AutoDisposeFutureProvider<SnStickerPack?> {
|
|
||||||
/// See also [stickerPack].
|
|
||||||
StickerPackProvider(String? packId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => stickerPack(ref as StickerPackRef, packId),
|
|
||||||
from: stickerPackProvider,
|
|
||||||
name: r'stickerPackProvider',
|
name: r'stickerPackProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$stickerPackHash,
|
|
||||||
dependencies: StickerPackFamily._dependencies,
|
|
||||||
allTransitiveDependencies: StickerPackFamily._allTransitiveDependencies,
|
|
||||||
packId: packId,
|
|
||||||
);
|
|
||||||
|
|
||||||
StickerPackProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.packId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? packId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnStickerPack?> Function(StickerPackRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: StickerPackProvider._internal(
|
|
||||||
(ref) => create(ref as StickerPackRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
packId: packId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<SnStickerPack?> createElement() {
|
|
||||||
return _StickerPackProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is StickerPackProvider && other.packId == packId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, packId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin StickerPackRef on AutoDisposeFutureProviderRef<SnStickerPack?> {
|
|
||||||
/// The parameter `packId` of this provider.
|
|
||||||
String? get packId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _StickerPackProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnStickerPack?>
|
|
||||||
with StickerPackRef {
|
|
||||||
_StickerPackProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get packId => (origin as StickerPackProvider).packId;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$stickerPacksNotifierHash() =>
|
|
||||||
r'30024b35235f3085a5b1ec2204d0a974ee907e22';
|
|
||||||
|
|
||||||
abstract class _$StickerPacksNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnStickerPack>> {
|
|
||||||
late final String pubName;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnStickerPack>> build(String pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
@ProviderFor(StickerPacksNotifier)
|
|
||||||
const stickerPacksNotifierProvider = StickerPacksNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
class StickerPacksNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnStickerPack>>> {
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
const StickerPacksNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
StickerPacksNotifierProvider call(String pubName) {
|
|
||||||
return StickerPacksNotifierProvider(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
StickerPacksNotifierProvider getProviderOverride(
|
|
||||||
covariant StickerPacksNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'stickerPacksNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
class StickerPacksNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
StickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
> {
|
|
||||||
/// See also [StickerPacksNotifier].
|
|
||||||
StickerPacksNotifierProvider(String pubName)
|
|
||||||
: this._internal(
|
|
||||||
() => StickerPacksNotifier()..pubName = pubName,
|
|
||||||
from: stickerPacksNotifierProvider,
|
|
||||||
name: r'stickerPacksNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$stickerPacksNotifierHash,
|
|
||||||
dependencies: StickerPacksNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
StickerPacksNotifierFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
StickerPacksNotifierProvider._internal(
|
StickerPackProvider call(String? packId) =>
|
||||||
super._createNotifier, {
|
StickerPackProvider._(argument: packId, from: this);
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnStickerPack>> runNotifierBuild(
|
String toString() => r'stickerPackProvider';
|
||||||
covariant StickerPacksNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(StickerPacksNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: StickerPacksNotifierProvider._internal(
|
|
||||||
() => create()..pubName = pubName,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
StickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _StickerPacksNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is StickerPacksNotifierProvider && other.pubName == pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin StickerPacksNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnStickerPack>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _StickerPacksNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
StickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
>
|
|
||||||
with StickerPacksNotifierRef {
|
|
||||||
_StickerPacksNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get pubName => (origin as StickerPacksNotifierProvider).pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,183 +6,92 @@ part of 'app_secrets.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$customAppSecretsHash() => r'1bc62ad812487883ce739793b22a76168d656752';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customAppSecrets].
|
|
||||||
@ProviderFor(customAppSecrets)
|
@ProviderFor(customAppSecrets)
|
||||||
const customAppSecretsProvider = CustomAppSecretsFamily();
|
const customAppSecretsProvider = CustomAppSecretsFamily._();
|
||||||
|
|
||||||
/// See also [customAppSecrets].
|
final class CustomAppSecretsProvider
|
||||||
class CustomAppSecretsFamily extends Family<AsyncValue<List<CustomAppSecret>>> {
|
extends
|
||||||
/// See also [customAppSecrets].
|
$FunctionalProvider<
|
||||||
const CustomAppSecretsFamily();
|
AsyncValue<List<CustomAppSecret>>,
|
||||||
|
List<CustomAppSecret>,
|
||||||
/// See also [customAppSecrets].
|
FutureOr<List<CustomAppSecret>>
|
||||||
CustomAppSecretsProvider call(
|
>
|
||||||
String publisherName,
|
with
|
||||||
String projectId,
|
$FutureModifier<List<CustomAppSecret>>,
|
||||||
String appId,
|
$FutureProvider<List<CustomAppSecret>> {
|
||||||
) {
|
const CustomAppSecretsProvider._({
|
||||||
return CustomAppSecretsProvider(publisherName, projectId, appId);
|
required CustomAppSecretsFamily super.from,
|
||||||
}
|
required (String, String, String) super.argument,
|
||||||
|
}) : super(
|
||||||
@override
|
retry: null,
|
||||||
CustomAppSecretsProvider getProviderOverride(
|
|
||||||
covariant CustomAppSecretsProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.publisherName, provider.projectId, provider.appId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'customAppSecretsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customAppSecrets].
|
|
||||||
class CustomAppSecretsProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<CustomAppSecret>> {
|
|
||||||
/// See also [customAppSecrets].
|
|
||||||
CustomAppSecretsProvider(String publisherName, String projectId, String appId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => customAppSecrets(
|
|
||||||
ref as CustomAppSecretsRef,
|
|
||||||
publisherName,
|
|
||||||
projectId,
|
|
||||||
appId,
|
|
||||||
),
|
|
||||||
from: customAppSecretsProvider,
|
|
||||||
name: r'customAppSecretsProvider',
|
name: r'customAppSecretsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$customAppSecretsHash,
|
|
||||||
dependencies: CustomAppSecretsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
CustomAppSecretsFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
appId: appId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CustomAppSecretsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
required this.appId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
final String appId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$customAppSecretsHash();
|
||||||
FutureOr<List<CustomAppSecret>> Function(CustomAppSecretsRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'customAppSecretsProvider'
|
||||||
origin: this,
|
''
|
||||||
override: CustomAppSecretsProvider._internal(
|
'$argument';
|
||||||
(ref) => create(ref as CustomAppSecretsRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
appId: appId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<CustomAppSecret>> createElement() {
|
$FutureProviderElement<List<CustomAppSecret>> $createElement(
|
||||||
return _CustomAppSecretsProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<CustomAppSecret>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String, String);
|
||||||
|
return customAppSecrets(ref, argument.$1, argument.$2, argument.$3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is CustomAppSecretsProvider &&
|
return other is CustomAppSecretsProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId &&
|
|
||||||
other.appId == appId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, appId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$customAppSecretsHash() => r'1bc62ad812487883ce739793b22a76168d656752';
|
||||||
// ignore: unused_element
|
|
||||||
mixin CustomAppSecretsRef
|
|
||||||
on AutoDisposeFutureProviderRef<List<CustomAppSecret>> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class CustomAppSecretsFamily extends $Family
|
||||||
String get projectId;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<CustomAppSecret>>,
|
||||||
|
(String, String, String)
|
||||||
|
> {
|
||||||
|
const CustomAppSecretsFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'customAppSecretsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// The parameter `appId` of this provider.
|
CustomAppSecretsProvider call(
|
||||||
String get appId;
|
String publisherName,
|
||||||
|
String projectId,
|
||||||
|
String appId,
|
||||||
|
) => CustomAppSecretsProvider._(
|
||||||
|
argument: (publisherName, projectId, appId),
|
||||||
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'customAppSecretsProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomAppSecretsProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<List<CustomAppSecret>>
|
|
||||||
with CustomAppSecretsRef {
|
|
||||||
_CustomAppSecretsProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get publisherName =>
|
|
||||||
(origin as CustomAppSecretsProvider).publisherName;
|
|
||||||
@override
|
|
||||||
String get projectId => (origin as CustomAppSecretsProvider).projectId;
|
|
||||||
@override
|
|
||||||
String get appId => (origin as CustomAppSecretsProvider).appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,300 +6,165 @@ part of 'apps.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$customAppHash() => r'be05431ba8bf06fd20ee988a61c3663a68e15fc9';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customApp].
|
|
||||||
@ProviderFor(customApp)
|
@ProviderFor(customApp)
|
||||||
const customAppProvider = CustomAppFamily();
|
const customAppProvider = CustomAppFamily._();
|
||||||
|
|
||||||
/// See also [customApp].
|
final class CustomAppProvider
|
||||||
class CustomAppFamily extends Family<AsyncValue<CustomApp>> {
|
extends
|
||||||
/// See also [customApp].
|
$FunctionalProvider<
|
||||||
const CustomAppFamily();
|
AsyncValue<CustomApp>,
|
||||||
|
CustomApp,
|
||||||
/// See also [customApp].
|
FutureOr<CustomApp>
|
||||||
CustomAppProvider call(String publisherName, String projectId, String appId) {
|
>
|
||||||
return CustomAppProvider(publisherName, projectId, appId);
|
with $FutureModifier<CustomApp>, $FutureProvider<CustomApp> {
|
||||||
}
|
const CustomAppProvider._({
|
||||||
|
required CustomAppFamily super.from,
|
||||||
@override
|
required (String, String, String) super.argument,
|
||||||
CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) {
|
}) : super(
|
||||||
return call(provider.publisherName, provider.projectId, provider.appId);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'customAppProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customApp].
|
|
||||||
class CustomAppProvider extends AutoDisposeFutureProvider<CustomApp> {
|
|
||||||
/// See also [customApp].
|
|
||||||
CustomAppProvider(String publisherName, String projectId, String appId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) =>
|
|
||||||
customApp(ref as CustomAppRef, publisherName, projectId, appId),
|
|
||||||
from: customAppProvider,
|
|
||||||
name: r'customAppProvider',
|
name: r'customAppProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$customAppHash,
|
|
||||||
dependencies: CustomAppFamily._dependencies,
|
|
||||||
allTransitiveDependencies: CustomAppFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
appId: appId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CustomAppProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
required this.appId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
final String appId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$customAppHash();
|
||||||
FutureOr<CustomApp> Function(CustomAppRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'customAppProvider'
|
||||||
override: CustomAppProvider._internal(
|
''
|
||||||
(ref) => create(ref as CustomAppRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
appId: appId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<CustomApp> createElement() {
|
$FutureProviderElement<CustomApp> $createElement($ProviderPointer pointer) =>
|
||||||
return _CustomAppProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<CustomApp> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String, String);
|
||||||
|
return customApp(ref, argument.$1, argument.$2, argument.$3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is CustomAppProvider &&
|
return other is CustomAppProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId &&
|
|
||||||
other.appId == appId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, appId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$customAppHash() => r'be05431ba8bf06fd20ee988a61c3663a68e15fc9';
|
||||||
// ignore: unused_element
|
|
||||||
mixin CustomAppRef on AutoDisposeFutureProviderRef<CustomApp> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class CustomAppFamily extends $Family
|
||||||
String get projectId;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<CustomApp>,
|
||||||
|
(String, String, String)
|
||||||
|
> {
|
||||||
|
const CustomAppFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'customAppProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// The parameter `appId` of this provider.
|
CustomAppProvider call(
|
||||||
String get appId;
|
String publisherName,
|
||||||
|
String projectId,
|
||||||
|
String appId,
|
||||||
|
) => CustomAppProvider._(
|
||||||
|
argument: (publisherName, projectId, appId),
|
||||||
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'customAppProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomAppProviderElement
|
@ProviderFor(customApps)
|
||||||
extends AutoDisposeFutureProviderElement<CustomApp>
|
const customAppsProvider = CustomAppsFamily._();
|
||||||
with CustomAppRef {
|
|
||||||
_CustomAppProviderElement(super.provider);
|
final class CustomAppsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<CustomApp>>,
|
||||||
|
List<CustomApp>,
|
||||||
|
FutureOr<List<CustomApp>>
|
||||||
|
>
|
||||||
|
with $FutureModifier<List<CustomApp>>, $FutureProvider<List<CustomApp>> {
|
||||||
|
const CustomAppsProvider._({
|
||||||
|
required CustomAppsFamily super.from,
|
||||||
|
required (String, String) super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'customAppsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get publisherName => (origin as CustomAppProvider).publisherName;
|
String debugGetCreateSourceHash() => _$customAppsHash();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get projectId => (origin as CustomAppProvider).projectId;
|
String toString() {
|
||||||
|
return r'customAppsProvider'
|
||||||
|
''
|
||||||
|
'$argument';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
String get appId => (origin as CustomAppProvider).appId;
|
$FutureProviderElement<List<CustomApp>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<CustomApp>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return customApps(ref, argument.$1, argument.$2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is CustomAppsProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$customAppsHash() => r'450bedaf4220b8963cb44afeb14d4c0e80f01b11';
|
String _$customAppsHash() => r'450bedaf4220b8963cb44afeb14d4c0e80f01b11';
|
||||||
|
|
||||||
/// See also [customApps].
|
final class CustomAppsFamily extends $Family
|
||||||
@ProviderFor(customApps)
|
with
|
||||||
const customAppsProvider = CustomAppsFamily();
|
$FunctionalFamilyOverride<FutureOr<List<CustomApp>>, (String, String)> {
|
||||||
|
const CustomAppsFamily._()
|
||||||
/// See also [customApps].
|
: super(
|
||||||
class CustomAppsFamily extends Family<AsyncValue<List<CustomApp>>> {
|
retry: null,
|
||||||
/// See also [customApps].
|
|
||||||
const CustomAppsFamily();
|
|
||||||
|
|
||||||
/// See also [customApps].
|
|
||||||
CustomAppsProvider call(String publisherName, String projectId) {
|
|
||||||
return CustomAppsProvider(publisherName, projectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
CustomAppsProvider getProviderOverride(
|
|
||||||
covariant CustomAppsProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.publisherName, provider.projectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'customAppsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customApps].
|
|
||||||
class CustomAppsProvider extends AutoDisposeFutureProvider<List<CustomApp>> {
|
|
||||||
/// See also [customApps].
|
|
||||||
CustomAppsProvider(String publisherName, String projectId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => customApps(ref as CustomAppsRef, publisherName, projectId),
|
|
||||||
from: customAppsProvider,
|
|
||||||
name: r'customAppsProvider',
|
name: r'customAppsProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$customAppsHash,
|
|
||||||
dependencies: CustomAppsFamily._dependencies,
|
|
||||||
allTransitiveDependencies: CustomAppsFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
);
|
|
||||||
|
|
||||||
CustomAppsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<List<CustomApp>> Function(CustomAppsRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: CustomAppsProvider._internal(
|
|
||||||
(ref) => create(ref as CustomAppsRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
CustomAppsProvider call(String publisherName, String projectId) =>
|
||||||
|
CustomAppsProvider._(argument: (publisherName, projectId), from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<CustomApp>> createElement() {
|
String toString() => r'customAppsProvider';
|
||||||
return _CustomAppsProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is CustomAppsProvider &&
|
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin CustomAppsRef on AutoDisposeFutureProviderRef<List<CustomApp>> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
|
||||||
String get projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CustomAppsProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<List<CustomApp>>
|
|
||||||
with CustomAppsRef {
|
|
||||||
_CustomAppsProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get publisherName => (origin as CustomAppsProvider).publisherName;
|
|
||||||
@override
|
|
||||||
String get projectId => (origin as CustomAppsProvider).projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,167 +6,89 @@ part of 'bot_keys.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$botKeysHash() => r'f7d1121833dc3da0cbd84b6171c2b2539edeb785';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [botKeys].
|
|
||||||
@ProviderFor(botKeys)
|
@ProviderFor(botKeys)
|
||||||
const botKeysProvider = BotKeysFamily();
|
const botKeysProvider = BotKeysFamily._();
|
||||||
|
|
||||||
/// See also [botKeys].
|
final class BotKeysProvider
|
||||||
class BotKeysFamily extends Family<AsyncValue<List<SnAccountApiKey>>> {
|
extends
|
||||||
/// See also [botKeys].
|
$FunctionalProvider<
|
||||||
const BotKeysFamily();
|
AsyncValue<List<SnAccountApiKey>>,
|
||||||
|
List<SnAccountApiKey>,
|
||||||
/// See also [botKeys].
|
FutureOr<List<SnAccountApiKey>>
|
||||||
BotKeysProvider call(String publisherName, String projectId, String botId) {
|
>
|
||||||
return BotKeysProvider(publisherName, projectId, botId);
|
with
|
||||||
}
|
$FutureModifier<List<SnAccountApiKey>>,
|
||||||
|
$FutureProvider<List<SnAccountApiKey>> {
|
||||||
@override
|
const BotKeysProvider._({
|
||||||
BotKeysProvider getProviderOverride(covariant BotKeysProvider provider) {
|
required BotKeysFamily super.from,
|
||||||
return call(provider.publisherName, provider.projectId, provider.botId);
|
required (String, String, String) super.argument,
|
||||||
}
|
}) : super(
|
||||||
|
retry: null,
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'botKeysProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [botKeys].
|
|
||||||
class BotKeysProvider extends AutoDisposeFutureProvider<List<SnAccountApiKey>> {
|
|
||||||
/// See also [botKeys].
|
|
||||||
BotKeysProvider(String publisherName, String projectId, String botId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => botKeys(ref as BotKeysRef, publisherName, projectId, botId),
|
|
||||||
from: botKeysProvider,
|
|
||||||
name: r'botKeysProvider',
|
name: r'botKeysProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$botKeysHash,
|
|
||||||
dependencies: BotKeysFamily._dependencies,
|
|
||||||
allTransitiveDependencies: BotKeysFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
botId: botId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
BotKeysProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
required this.botId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
final String botId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$botKeysHash();
|
||||||
FutureOr<List<SnAccountApiKey>> Function(BotKeysRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'botKeysProvider'
|
||||||
override: BotKeysProvider._internal(
|
''
|
||||||
(ref) => create(ref as BotKeysRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
botId: botId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnAccountApiKey>> createElement() {
|
$FutureProviderElement<List<SnAccountApiKey>> $createElement(
|
||||||
return _BotKeysProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnAccountApiKey>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String, String);
|
||||||
|
return botKeys(ref, argument.$1, argument.$2, argument.$3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is BotKeysProvider &&
|
return other is BotKeysProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId &&
|
|
||||||
other.botId == botId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, botId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$botKeysHash() => r'f7d1121833dc3da0cbd84b6171c2b2539edeb785';
|
||||||
// ignore: unused_element
|
|
||||||
mixin BotKeysRef on AutoDisposeFutureProviderRef<List<SnAccountApiKey>> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class BotKeysFamily extends $Family
|
||||||
String get projectId;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnAccountApiKey>>,
|
||||||
|
(String, String, String)
|
||||||
|
> {
|
||||||
|
const BotKeysFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'botKeysProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// The parameter `botId` of this provider.
|
BotKeysProvider call(String publisherName, String projectId, String botId) =>
|
||||||
String get botId;
|
BotKeysProvider._(
|
||||||
|
argument: (publisherName, projectId, botId),
|
||||||
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'botKeysProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BotKeysProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<List<SnAccountApiKey>>
|
|
||||||
with BotKeysRef {
|
|
||||||
_BotKeysProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get publisherName => (origin as BotKeysProvider).publisherName;
|
|
||||||
@override
|
|
||||||
String get projectId => (origin as BotKeysProvider).projectId;
|
|
||||||
@override
|
|
||||||
String get botId => (origin as BotKeysProvider).botId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,151 +6,79 @@ part of 'bots.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [bots].
|
|
||||||
@ProviderFor(bots)
|
@ProviderFor(bots)
|
||||||
const botsProvider = BotsFamily();
|
const botsProvider = BotsFamily._();
|
||||||
|
|
||||||
/// See also [bots].
|
final class BotsProvider
|
||||||
class BotsFamily extends Family<AsyncValue<List<Bot>>> {
|
extends
|
||||||
/// See also [bots].
|
$FunctionalProvider<
|
||||||
const BotsFamily();
|
AsyncValue<List<Bot>>,
|
||||||
|
List<Bot>,
|
||||||
/// See also [bots].
|
FutureOr<List<Bot>>
|
||||||
BotsProvider call(String publisherName, String projectId) {
|
>
|
||||||
return BotsProvider(publisherName, projectId);
|
with $FutureModifier<List<Bot>>, $FutureProvider<List<Bot>> {
|
||||||
}
|
const BotsProvider._({
|
||||||
|
required BotsFamily super.from,
|
||||||
@override
|
required (String, String) super.argument,
|
||||||
BotsProvider getProviderOverride(covariant BotsProvider provider) {
|
}) : super(
|
||||||
return call(provider.publisherName, provider.projectId);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'botsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [bots].
|
|
||||||
class BotsProvider extends AutoDisposeFutureProvider<List<Bot>> {
|
|
||||||
/// See also [bots].
|
|
||||||
BotsProvider(String publisherName, String projectId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => bots(ref as BotsRef, publisherName, projectId),
|
|
||||||
from: botsProvider,
|
|
||||||
name: r'botsProvider',
|
name: r'botsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$botsHash,
|
dependencies: null,
|
||||||
dependencies: BotsFamily._dependencies,
|
$allTransitiveDependencies: null,
|
||||||
allTransitiveDependencies: BotsFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
BotsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(FutureOr<List<Bot>> Function(BotsRef provider) create) {
|
String debugGetCreateSourceHash() => _$botsHash();
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
@override
|
||||||
override: BotsProvider._internal(
|
String toString() {
|
||||||
(ref) => create(ref as BotsRef),
|
return r'botsProvider'
|
||||||
from: from,
|
''
|
||||||
name: null,
|
'$argument';
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<Bot>> createElement() {
|
$FutureProviderElement<List<Bot>> $createElement($ProviderPointer pointer) =>
|
||||||
return _BotsProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<Bot>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return bots(ref, argument.$1, argument.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is BotsProvider &&
|
return other is BotsProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269';
|
||||||
// ignore: unused_element
|
|
||||||
mixin BotsRef on AutoDisposeFutureProviderRef<List<Bot>> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class BotsFamily extends $Family
|
||||||
String get projectId;
|
with $FunctionalFamilyOverride<FutureOr<List<Bot>>, (String, String)> {
|
||||||
}
|
const BotsFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'botsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
class _BotsProviderElement extends AutoDisposeFutureProviderElement<List<Bot>>
|
BotsProvider call(String publisherName, String projectId) =>
|
||||||
with BotsRef {
|
BotsProvider._(argument: (publisherName, projectId), from: this);
|
||||||
_BotsProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get publisherName => (origin as BotsProvider).publisherName;
|
String toString() => r'botsProvider';
|
||||||
@override
|
|
||||||
String get projectId => (origin as BotsProvider).projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,167 +6,83 @@ part of 'edit_app.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$customAppHash() => r'8e1b38f3dc9b04fad362ee1141fcbfc53f008c09';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customApp].
|
|
||||||
@ProviderFor(customApp)
|
@ProviderFor(customApp)
|
||||||
const customAppProvider = CustomAppFamily();
|
const customAppProvider = CustomAppFamily._();
|
||||||
|
|
||||||
/// See also [customApp].
|
final class CustomAppProvider
|
||||||
class CustomAppFamily extends Family<AsyncValue<CustomApp?>> {
|
extends
|
||||||
/// See also [customApp].
|
$FunctionalProvider<
|
||||||
const CustomAppFamily();
|
AsyncValue<CustomApp?>,
|
||||||
|
CustomApp?,
|
||||||
/// See also [customApp].
|
FutureOr<CustomApp?>
|
||||||
CustomAppProvider call(String publisherName, String projectId, String id) {
|
>
|
||||||
return CustomAppProvider(publisherName, projectId, id);
|
with $FutureModifier<CustomApp?>, $FutureProvider<CustomApp?> {
|
||||||
}
|
const CustomAppProvider._({
|
||||||
|
required CustomAppFamily super.from,
|
||||||
@override
|
required (String, String, String) super.argument,
|
||||||
CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) {
|
}) : super(
|
||||||
return call(provider.publisherName, provider.projectId, provider.id);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'customAppProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [customApp].
|
|
||||||
class CustomAppProvider extends AutoDisposeFutureProvider<CustomApp?> {
|
|
||||||
/// See also [customApp].
|
|
||||||
CustomAppProvider(String publisherName, String projectId, String id)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => customApp(ref as CustomAppRef, publisherName, projectId, id),
|
|
||||||
from: customAppProvider,
|
|
||||||
name: r'customAppProvider',
|
name: r'customAppProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$customAppHash,
|
|
||||||
dependencies: CustomAppFamily._dependencies,
|
|
||||||
allTransitiveDependencies: CustomAppFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
id: id,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CustomAppProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
required this.id,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$customAppHash();
|
||||||
FutureOr<CustomApp?> Function(CustomAppRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'customAppProvider'
|
||||||
override: CustomAppProvider._internal(
|
''
|
||||||
(ref) => create(ref as CustomAppRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
id: id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<CustomApp?> createElement() {
|
$FutureProviderElement<CustomApp?> $createElement($ProviderPointer pointer) =>
|
||||||
return _CustomAppProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<CustomApp?> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String, String);
|
||||||
|
return customApp(ref, argument.$1, argument.$2, argument.$3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is CustomAppProvider &&
|
return other is CustomAppProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId &&
|
|
||||||
other.id == id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, id.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$customAppHash() => r'8e1b38f3dc9b04fad362ee1141fcbfc53f008c09';
|
||||||
// ignore: unused_element
|
|
||||||
mixin CustomAppRef on AutoDisposeFutureProviderRef<CustomApp?> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class CustomAppFamily extends $Family
|
||||||
String get projectId;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<CustomApp?>,
|
||||||
|
(String, String, String)
|
||||||
|
> {
|
||||||
|
const CustomAppFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'customAppProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// The parameter `id` of this provider.
|
CustomAppProvider call(String publisherName, String projectId, String id) =>
|
||||||
String get id;
|
CustomAppProvider._(argument: (publisherName, projectId, id), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'customAppProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomAppProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<CustomApp?>
|
|
||||||
with CustomAppRef {
|
|
||||||
_CustomAppProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get publisherName => (origin as CustomAppProvider).publisherName;
|
|
||||||
@override
|
|
||||||
String get projectId => (origin as CustomAppProvider).projectId;
|
|
||||||
@override
|
|
||||||
String get id => (origin as CustomAppProvider).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,162 +6,74 @@ part of 'edit_bot.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [bot].
|
|
||||||
@ProviderFor(bot)
|
@ProviderFor(bot)
|
||||||
const botProvider = BotFamily();
|
const botProvider = BotFamily._();
|
||||||
|
|
||||||
/// See also [bot].
|
final class BotProvider
|
||||||
class BotFamily extends Family<AsyncValue<Bot?>> {
|
extends $FunctionalProvider<AsyncValue<Bot?>, Bot?, FutureOr<Bot?>>
|
||||||
/// See also [bot].
|
with $FutureModifier<Bot?>, $FutureProvider<Bot?> {
|
||||||
const BotFamily();
|
const BotProvider._({
|
||||||
|
required BotFamily super.from,
|
||||||
/// See also [bot].
|
required (String, String, String) super.argument,
|
||||||
BotProvider call(String publisherName, String projectId, String id) {
|
}) : super(
|
||||||
return BotProvider(publisherName, projectId, id);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
BotProvider getProviderOverride(covariant BotProvider provider) {
|
|
||||||
return call(provider.publisherName, provider.projectId, provider.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'botProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [bot].
|
|
||||||
class BotProvider extends AutoDisposeFutureProvider<Bot?> {
|
|
||||||
/// See also [bot].
|
|
||||||
BotProvider(String publisherName, String projectId, String id)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => bot(ref as BotRef, publisherName, projectId, id),
|
|
||||||
from: botProvider,
|
|
||||||
name: r'botProvider',
|
name: r'botProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$botHash,
|
dependencies: null,
|
||||||
dependencies: BotFamily._dependencies,
|
$allTransitiveDependencies: null,
|
||||||
allTransitiveDependencies: BotFamily._allTransitiveDependencies,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
id: id,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
BotProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.publisherName,
|
|
||||||
required this.projectId,
|
|
||||||
required this.id,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String publisherName;
|
|
||||||
final String projectId;
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(FutureOr<Bot?> Function(BotRef provider) create) {
|
String debugGetCreateSourceHash() => _$botHash();
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
@override
|
||||||
override: BotProvider._internal(
|
String toString() {
|
||||||
(ref) => create(ref as BotRef),
|
return r'botProvider'
|
||||||
from: from,
|
''
|
||||||
name: null,
|
'$argument';
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
publisherName: publisherName,
|
|
||||||
projectId: projectId,
|
|
||||||
id: id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<Bot?> createElement() {
|
$FutureProviderElement<Bot?> $createElement($ProviderPointer pointer) =>
|
||||||
return _BotProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Bot?> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String, String);
|
||||||
|
return bot(ref, argument.$1, argument.$2, argument.$3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is BotProvider &&
|
return other is BotProvider && other.argument == argument;
|
||||||
other.publisherName == publisherName &&
|
|
||||||
other.projectId == projectId &&
|
|
||||||
other.id == id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, publisherName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, projectId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, id.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188';
|
||||||
// ignore: unused_element
|
|
||||||
mixin BotRef on AutoDisposeFutureProviderRef<Bot?> {
|
|
||||||
/// The parameter `publisherName` of this provider.
|
|
||||||
String get publisherName;
|
|
||||||
|
|
||||||
/// The parameter `projectId` of this provider.
|
final class BotFamily extends $Family
|
||||||
String get projectId;
|
with $FunctionalFamilyOverride<FutureOr<Bot?>, (String, String, String)> {
|
||||||
|
const BotFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'botProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// The parameter `id` of this provider.
|
BotProvider call(String publisherName, String projectId, String id) =>
|
||||||
String get id;
|
BotProvider._(argument: (publisherName, projectId, id), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'botProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BotProviderElement extends AutoDisposeFutureProviderElement<Bot?>
|
|
||||||
with BotRef {
|
|
||||||
_BotProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get publisherName => (origin as BotProvider).publisherName;
|
|
||||||
@override
|
|
||||||
String get projectId => (origin as BotProvider).projectId;
|
|
||||||
@override
|
|
||||||
String get id => (origin as BotProvider).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,158 +6,80 @@ part of 'edit_project.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [devProject].
|
|
||||||
@ProviderFor(devProject)
|
@ProviderFor(devProject)
|
||||||
const devProjectProvider = DevProjectFamily();
|
const devProjectProvider = DevProjectFamily._();
|
||||||
|
|
||||||
/// See also [devProject].
|
final class DevProjectProvider
|
||||||
class DevProjectFamily extends Family<AsyncValue<DevProject?>> {
|
extends
|
||||||
/// See also [devProject].
|
$FunctionalProvider<
|
||||||
const DevProjectFamily();
|
AsyncValue<DevProject?>,
|
||||||
|
DevProject?,
|
||||||
/// See also [devProject].
|
FutureOr<DevProject?>
|
||||||
DevProjectProvider call(String pubName, String id) {
|
>
|
||||||
return DevProjectProvider(pubName, id);
|
with $FutureModifier<DevProject?>, $FutureProvider<DevProject?> {
|
||||||
}
|
const DevProjectProvider._({
|
||||||
|
required DevProjectFamily super.from,
|
||||||
@override
|
required (String, String) super.argument,
|
||||||
DevProjectProvider getProviderOverride(
|
}) : super(
|
||||||
covariant DevProjectProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.pubName, provider.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'devProjectProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [devProject].
|
|
||||||
class DevProjectProvider extends AutoDisposeFutureProvider<DevProject?> {
|
|
||||||
/// See also [devProject].
|
|
||||||
DevProjectProvider(String pubName, String id)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => devProject(ref as DevProjectRef, pubName, id),
|
|
||||||
from: devProjectProvider,
|
|
||||||
name: r'devProjectProvider',
|
name: r'devProjectProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$devProjectHash,
|
|
||||||
dependencies: DevProjectFamily._dependencies,
|
|
||||||
allTransitiveDependencies: DevProjectFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
id: id,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DevProjectProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
required this.id,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$devProjectHash();
|
||||||
FutureOr<DevProject?> Function(DevProjectRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'devProjectProvider'
|
||||||
override: DevProjectProvider._internal(
|
''
|
||||||
(ref) => create(ref as DevProjectRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
id: id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<DevProject?> createElement() {
|
$FutureProviderElement<DevProject?> $createElement(
|
||||||
return _DevProjectProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<DevProject?> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return devProject(ref, argument.$1, argument.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is DevProjectProvider &&
|
return other is DevProjectProvider && other.argument == argument;
|
||||||
other.pubName == pubName &&
|
|
||||||
other.id == id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, id.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2';
|
||||||
// ignore: unused_element
|
|
||||||
mixin DevProjectRef on AutoDisposeFutureProviderRef<DevProject?> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
|
|
||||||
/// The parameter `id` of this provider.
|
final class DevProjectFamily extends $Family
|
||||||
String get id;
|
with $FunctionalFamilyOverride<FutureOr<DevProject?>, (String, String)> {
|
||||||
}
|
const DevProjectFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'devProjectProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
class _DevProjectProviderElement
|
DevProjectProvider call(String pubName, String id) =>
|
||||||
extends AutoDisposeFutureProviderElement<DevProject?>
|
DevProjectProvider._(argument: (pubName, id), from: this);
|
||||||
with DevProjectRef {
|
|
||||||
_DevProjectProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get pubName => (origin as DevProjectProvider).pubName;
|
String toString() => r'devProjectProvider';
|
||||||
@override
|
|
||||||
String get id => (origin as DevProjectProvider).id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -6,287 +6,196 @@ part of 'hub.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [developerStats].
|
|
||||||
@ProviderFor(developerStats)
|
@ProviderFor(developerStats)
|
||||||
const developerStatsProvider = DeveloperStatsFamily();
|
const developerStatsProvider = DeveloperStatsFamily._();
|
||||||
|
|
||||||
/// See also [developerStats].
|
final class DeveloperStatsProvider
|
||||||
class DeveloperStatsFamily extends Family<AsyncValue<DeveloperStats?>> {
|
extends
|
||||||
/// See also [developerStats].
|
$FunctionalProvider<
|
||||||
const DeveloperStatsFamily();
|
AsyncValue<DeveloperStats?>,
|
||||||
|
DeveloperStats?,
|
||||||
/// See also [developerStats].
|
FutureOr<DeveloperStats?>
|
||||||
DeveloperStatsProvider call(String? uname) {
|
>
|
||||||
return DeveloperStatsProvider(uname);
|
with $FutureModifier<DeveloperStats?>, $FutureProvider<DeveloperStats?> {
|
||||||
}
|
const DeveloperStatsProvider._({
|
||||||
|
required DeveloperStatsFamily super.from,
|
||||||
@override
|
required String? super.argument,
|
||||||
DeveloperStatsProvider getProviderOverride(
|
}) : super(
|
||||||
covariant DeveloperStatsProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'developerStatsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [developerStats].
|
|
||||||
class DeveloperStatsProvider
|
|
||||||
extends AutoDisposeFutureProvider<DeveloperStats?> {
|
|
||||||
/// See also [developerStats].
|
|
||||||
DeveloperStatsProvider(String? uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => developerStats(ref as DeveloperStatsRef, uname),
|
|
||||||
from: developerStatsProvider,
|
|
||||||
name: r'developerStatsProvider',
|
name: r'developerStatsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$developerStatsHash,
|
|
||||||
dependencies: DeveloperStatsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
DeveloperStatsFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DeveloperStatsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$developerStatsHash();
|
||||||
FutureOr<DeveloperStats?> Function(DeveloperStatsRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'developerStatsProvider'
|
||||||
override: DeveloperStatsProvider._internal(
|
''
|
||||||
(ref) => create(ref as DeveloperStatsRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<DeveloperStats?> createElement() {
|
$FutureProviderElement<DeveloperStats?> $createElement(
|
||||||
return _DeveloperStatsProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<DeveloperStats?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return developerStats(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is DeveloperStatsProvider && other.uname == uname;
|
return other is DeveloperStatsProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755';
|
||||||
// ignore: unused_element
|
|
||||||
mixin DeveloperStatsRef on AutoDisposeFutureProviderRef<DeveloperStats?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DeveloperStatsProviderElement
|
final class DeveloperStatsFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<DeveloperStats?>
|
with $FunctionalFamilyOverride<FutureOr<DeveloperStats?>, String?> {
|
||||||
with DeveloperStatsRef {
|
const DeveloperStatsFamily._()
|
||||||
_DeveloperStatsProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'developerStatsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
DeveloperStatsProvider call(String? uname) =>
|
||||||
|
DeveloperStatsProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get uname => (origin as DeveloperStatsProvider).uname;
|
String toString() => r'developerStatsProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(developers)
|
||||||
|
const developersProvider = DevelopersProvider._();
|
||||||
|
|
||||||
|
final class DevelopersProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnDeveloper>>,
|
||||||
|
List<SnDeveloper>,
|
||||||
|
FutureOr<List<SnDeveloper>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnDeveloper>>,
|
||||||
|
$FutureProvider<List<SnDeveloper>> {
|
||||||
|
const DevelopersProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'developersProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$developersHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnDeveloper>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnDeveloper>> create(Ref ref) {
|
||||||
|
return developers(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2';
|
String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2';
|
||||||
|
|
||||||
/// See also [developers].
|
|
||||||
@ProviderFor(developers)
|
|
||||||
final developersProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnDeveloper>>.internal(
|
|
||||||
developers,
|
|
||||||
name: r'developersProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$developersHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef DevelopersRef = AutoDisposeFutureProviderRef<List<SnDeveloper>>;
|
|
||||||
String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a';
|
|
||||||
|
|
||||||
/// See also [devProjects].
|
|
||||||
@ProviderFor(devProjects)
|
@ProviderFor(devProjects)
|
||||||
const devProjectsProvider = DevProjectsFamily();
|
const devProjectsProvider = DevProjectsFamily._();
|
||||||
|
|
||||||
/// See also [devProjects].
|
final class DevProjectsProvider
|
||||||
class DevProjectsFamily extends Family<AsyncValue<List<DevProject>>> {
|
extends
|
||||||
/// See also [devProjects].
|
$FunctionalProvider<
|
||||||
const DevProjectsFamily();
|
AsyncValue<List<DevProject>>,
|
||||||
|
List<DevProject>,
|
||||||
/// See also [devProjects].
|
FutureOr<List<DevProject>>
|
||||||
DevProjectsProvider call(String pubName) {
|
>
|
||||||
return DevProjectsProvider(pubName);
|
with $FutureModifier<List<DevProject>>, $FutureProvider<List<DevProject>> {
|
||||||
}
|
const DevProjectsProvider._({
|
||||||
|
required DevProjectsFamily super.from,
|
||||||
@override
|
required String super.argument,
|
||||||
DevProjectsProvider getProviderOverride(
|
}) : super(
|
||||||
covariant DevProjectsProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'devProjectsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [devProjects].
|
|
||||||
class DevProjectsProvider extends AutoDisposeFutureProvider<List<DevProject>> {
|
|
||||||
/// See also [devProjects].
|
|
||||||
DevProjectsProvider(String pubName)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => devProjects(ref as DevProjectsRef, pubName),
|
|
||||||
from: devProjectsProvider,
|
|
||||||
name: r'devProjectsProvider',
|
name: r'devProjectsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$devProjectsHash,
|
|
||||||
dependencies: DevProjectsFamily._dependencies,
|
|
||||||
allTransitiveDependencies: DevProjectsFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DevProjectsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$devProjectsHash();
|
||||||
FutureOr<List<DevProject>> Function(DevProjectsRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'devProjectsProvider'
|
||||||
override: DevProjectsProvider._internal(
|
''
|
||||||
(ref) => create(ref as DevProjectsRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<DevProject>> createElement() {
|
$FutureProviderElement<List<DevProject>> $createElement(
|
||||||
return _DevProjectsProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<DevProject>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return devProjects(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is DevProjectsProvider && other.pubName == pubName;
|
return other is DevProjectsProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a';
|
||||||
// ignore: unused_element
|
|
||||||
mixin DevProjectsRef on AutoDisposeFutureProviderRef<List<DevProject>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DevProjectsProviderElement
|
final class DevProjectsFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<List<DevProject>>
|
with $FunctionalFamilyOverride<FutureOr<List<DevProject>>, String> {
|
||||||
with DevProjectsRef {
|
const DevProjectsFamily._()
|
||||||
_DevProjectsProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'devProjectsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
DevProjectsProvider call(String pubName) =>
|
||||||
|
DevProjectsProvider._(argument: pubName, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get pubName => (origin as DevProjectsProvider).pubName;
|
String toString() => r'devProjectsProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -1,41 +1,39 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/webfeed.dart';
|
import 'package:island/models/webfeed.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/web_article_card.dart';
|
import 'package:island/widgets/web_article_card.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
|
|
||||||
part 'articles.g.dart';
|
part 'articles.g.dart';
|
||||||
|
part 'articles.freezed.dart';
|
||||||
|
|
||||||
@riverpod
|
@freezed
|
||||||
class ArticlesListNotifier extends _$ArticlesListNotifier
|
sealed class ArticleListQuery with _$ArticleListQuery {
|
||||||
with CursorPagingNotifierMixin<SnWebArticle> {
|
const factory ArticleListQuery({String? feedId, String? publisherId}) =
|
||||||
static const int _pageSize = 20;
|
_ArticleListQuery;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> _params = {};
|
final articlesListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||||
|
ArticlesListNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
|
||||||
|
with AsyncPaginationController<SnWebArticle> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final ArticleListQuery arg;
|
||||||
|
ArticlesListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnWebArticle>> build({
|
Future<List<SnWebArticle>> fetch() async {
|
||||||
String? feedId,
|
|
||||||
String? publisherId,
|
|
||||||
}) async {
|
|
||||||
_params = {
|
|
||||||
if (feedId != null) 'feedId': feedId,
|
|
||||||
if (publisherId != null) 'publisherId': publisherId,
|
|
||||||
};
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnWebArticle>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final queryParams = {'limit': _pageSize, 'offset': offset, ..._params};
|
final queryParams = {'limit': pageSize, 'offset': fetchedCount.toString()};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
@@ -43,23 +41,17 @@ class ArticlesListNotifier extends _$ArticlesListNotifier
|
|||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final articles =
|
final articles =
|
||||||
data
|
response.data
|
||||||
.map(
|
.map(
|
||||||
(json) => SnWebArticle.fromJson(json as Map<String, dynamic>),
|
(json) => SnWebArticle.fromJson(json as Map<String, dynamic>),
|
||||||
)
|
)
|
||||||
|
.cast<SnWebArticle>()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final total = int.tryParse(response.headers.value('X-Total') ?? '0') ?? 0;
|
totalCount = int.tryParse(response.headers.value('X-Total') ?? '0') ?? 0;
|
||||||
final hasMore = offset + articles.length < total;
|
|
||||||
final nextCursor = hasMore ? (offset + articles.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
return articles;
|
||||||
items: articles,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Error fetching articles: $e');
|
debugPrint('Error fetching articles: $e');
|
||||||
rethrow;
|
rethrow;
|
||||||
@@ -85,34 +77,17 @@ class SliverArticlesList extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return PagingHelperSliverView(
|
final provider = articlesListNotifierProvider(
|
||||||
provider: articlesListNotifierProvider(
|
ArticleListQuery(feedId: feedId, publisherId: publisherId),
|
||||||
feedId: feedId,
|
);
|
||||||
publisherId: publisherId,
|
return PaginationList(
|
||||||
),
|
provider: provider,
|
||||||
futureRefreshable:
|
notifier: provider.notifier,
|
||||||
articlesListNotifierProvider(
|
isRefreshable: false,
|
||||||
feedId: feedId,
|
isSliver: true,
|
||||||
publisherId: publisherId,
|
itemBuilder: (context, index, article) {
|
||||||
).future,
|
|
||||||
notifierRefreshable:
|
|
||||||
articlesListNotifierProvider(
|
|
||||||
feedId: feedId,
|
|
||||||
publisherId: publisherId,
|
|
||||||
).notifier,
|
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => SliverList.separated(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final article = data.items[index];
|
|
||||||
return WebArticleCard(article: article, showDetails: true);
|
return WebArticleCard(article: article, showDetails: true);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
268
lib/screens/discovery/articles.freezed.dart
Normal file
268
lib/screens/discovery/articles.freezed.dart
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// 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 'articles.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ArticleListQuery {
|
||||||
|
|
||||||
|
String? get feedId; String? get publisherId;
|
||||||
|
/// Create a copy of ArticleListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ArticleListQueryCopyWith<ArticleListQuery> get copyWith => _$ArticleListQueryCopyWithImpl<ArticleListQuery>(this as ArticleListQuery, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ArticleListQuery&&(identical(other.feedId, feedId) || other.feedId == feedId)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,feedId,publisherId);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ArticleListQuery(feedId: $feedId, publisherId: $publisherId)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ArticleListQueryCopyWith<$Res> {
|
||||||
|
factory $ArticleListQueryCopyWith(ArticleListQuery value, $Res Function(ArticleListQuery) _then) = _$ArticleListQueryCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? feedId, String? publisherId
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ArticleListQueryCopyWithImpl<$Res>
|
||||||
|
implements $ArticleListQueryCopyWith<$Res> {
|
||||||
|
_$ArticleListQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ArticleListQuery _self;
|
||||||
|
final $Res Function(ArticleListQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ArticleListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? feedId = freezed,Object? publisherId = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
feedId: freezed == feedId ? _self.feedId : feedId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,publisherId: freezed == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ArticleListQuery].
|
||||||
|
extension ArticleListQueryPatterns on ArticleListQuery {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ArticleListQuery value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ArticleListQuery value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ArticleListQuery value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? feedId, String? publisherId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery() when $default != null:
|
||||||
|
return $default(_that.feedId,_that.publisherId);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? feedId, String? publisherId) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery():
|
||||||
|
return $default(_that.feedId,_that.publisherId);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? feedId, String? publisherId)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ArticleListQuery() when $default != null:
|
||||||
|
return $default(_that.feedId,_that.publisherId);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _ArticleListQuery implements ArticleListQuery {
|
||||||
|
const _ArticleListQuery({this.feedId, this.publisherId});
|
||||||
|
|
||||||
|
|
||||||
|
@override final String? feedId;
|
||||||
|
@override final String? publisherId;
|
||||||
|
|
||||||
|
/// Create a copy of ArticleListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ArticleListQueryCopyWith<_ArticleListQuery> get copyWith => __$ArticleListQueryCopyWithImpl<_ArticleListQuery>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ArticleListQuery&&(identical(other.feedId, feedId) || other.feedId == feedId)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,feedId,publisherId);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ArticleListQuery(feedId: $feedId, publisherId: $publisherId)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ArticleListQueryCopyWith<$Res> implements $ArticleListQueryCopyWith<$Res> {
|
||||||
|
factory _$ArticleListQueryCopyWith(_ArticleListQuery value, $Res Function(_ArticleListQuery) _then) = __$ArticleListQueryCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? feedId, String? publisherId
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ArticleListQueryCopyWithImpl<$Res>
|
||||||
|
implements _$ArticleListQueryCopyWith<$Res> {
|
||||||
|
__$ArticleListQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ArticleListQuery _self;
|
||||||
|
final $Res Function(_ArticleListQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ArticleListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? feedId = freezed,Object? publisherId = freezed,}) {
|
||||||
|
return _then(_ArticleListQuery(
|
||||||
|
feedId: freezed == feedId ? _self.feedId : feedId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,publisherId: freezed == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -6,220 +6,44 @@ part of 'articles.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [subscribedFeeds].
|
|
||||||
@ProviderFor(subscribedFeeds)
|
@ProviderFor(subscribedFeeds)
|
||||||
final subscribedFeedsProvider =
|
const subscribedFeedsProvider = SubscribedFeedsProvider._();
|
||||||
AutoDisposeFutureProvider<List<SnWebFeed>>.internal(
|
|
||||||
subscribedFeeds,
|
final class SubscribedFeedsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnWebFeed>>,
|
||||||
|
List<SnWebFeed>,
|
||||||
|
FutureOr<List<SnWebFeed>>
|
||||||
|
>
|
||||||
|
with $FutureModifier<List<SnWebFeed>>, $FutureProvider<List<SnWebFeed>> {
|
||||||
|
const SubscribedFeedsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'subscribedFeedsProvider',
|
name: r'subscribedFeedsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$subscribedFeedsHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$subscribedFeedsHash();
|
||||||
typedef SubscribedFeedsRef = AutoDisposeFutureProviderRef<List<SnWebFeed>>;
|
|
||||||
String _$articlesListNotifierHash() =>
|
|
||||||
r'579741af4d90c7c81f2e2697e57c4895b7a9dabc';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
@$internal
|
||||||
class _SystemHash {
|
@override
|
||||||
_SystemHash._();
|
$FutureProviderElement<List<SnWebFeed>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
@override
|
||||||
// ignore: parameter_assignments
|
FutureOr<List<SnWebFeed>> create(Ref ref) {
|
||||||
hash = 0x1fffffff & (hash + value);
|
return subscribedFeeds(ref);
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$ArticlesListNotifier
|
String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df';
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebArticle>> {
|
|
||||||
late final String? feedId;
|
|
||||||
late final String? publisherId;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnWebArticle>> build({
|
|
||||||
String? feedId,
|
|
||||||
String? publisherId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
@ProviderFor(ArticlesListNotifier)
|
|
||||||
const articlesListNotifierProvider = ArticlesListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
class ArticlesListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnWebArticle>>> {
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
const ArticlesListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
ArticlesListNotifierProvider call({String? feedId, String? publisherId}) {
|
|
||||||
return ArticlesListNotifierProvider(
|
|
||||||
feedId: feedId,
|
|
||||||
publisherId: publisherId,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ArticlesListNotifierProvider getProviderOverride(
|
|
||||||
covariant ArticlesListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(feedId: provider.feedId, publisherId: provider.publisherId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'articlesListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
class ArticlesListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
ArticlesListNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
> {
|
|
||||||
/// See also [ArticlesListNotifier].
|
|
||||||
ArticlesListNotifierProvider({String? feedId, String? publisherId})
|
|
||||||
: this._internal(
|
|
||||||
() =>
|
|
||||||
ArticlesListNotifier()
|
|
||||||
..feedId = feedId
|
|
||||||
..publisherId = publisherId,
|
|
||||||
from: articlesListNotifierProvider,
|
|
||||||
name: r'articlesListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$articlesListNotifierHash,
|
|
||||||
dependencies: ArticlesListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ArticlesListNotifierFamily._allTransitiveDependencies,
|
|
||||||
feedId: feedId,
|
|
||||||
publisherId: publisherId,
|
|
||||||
);
|
|
||||||
|
|
||||||
ArticlesListNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.feedId,
|
|
||||||
required this.publisherId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? feedId;
|
|
||||||
final String? publisherId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnWebArticle>> runNotifierBuild(
|
|
||||||
covariant ArticlesListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(feedId: feedId, publisherId: publisherId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ArticlesListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ArticlesListNotifierProvider._internal(
|
|
||||||
() =>
|
|
||||||
create()
|
|
||||||
..feedId = feedId
|
|
||||||
..publisherId = publisherId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
feedId: feedId,
|
|
||||||
publisherId: publisherId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ArticlesListNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _ArticlesListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is ArticlesListNotifierProvider &&
|
|
||||||
other.feedId == feedId &&
|
|
||||||
other.publisherId == publisherId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, feedId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, publisherId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin ArticlesListNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnWebArticle>> {
|
|
||||||
/// The parameter `feedId` of this provider.
|
|
||||||
String? get feedId;
|
|
||||||
|
|
||||||
/// The parameter `publisherId` of this provider.
|
|
||||||
String? get publisherId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ArticlesListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ArticlesListNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
>
|
|
||||||
with ArticlesListNotifierRef {
|
|
||||||
_ArticlesListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get feedId => (origin as ArticlesListNotifierProvider).feedId;
|
|
||||||
@override
|
|
||||||
String? get publisherId =>
|
|
||||||
(origin as ArticlesListNotifierProvider).publisherId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/webfeed.dart';
|
import 'package:island/models/webfeed.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/web_article_card.dart';
|
import 'package:island/widgets/web_article_card.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'feed_detail.g.dart';
|
part 'feed_detail.g.dart';
|
||||||
@@ -23,52 +22,35 @@ Future<SnWebFeed> marketplaceWebFeed(Ref ref, String feedId) async {
|
|||||||
return SnWebFeed.fromJson(resp.data);
|
return SnWebFeed.fromJson(resp.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provider for web feed articles content
|
final marketplaceWebFeedContentNotifierProvider = AsyncNotifierProvider.family
|
||||||
@riverpod
|
.autoDispose(MarketplaceWebFeedContentNotifier.new);
|
||||||
|
|
||||||
class MarketplaceWebFeedContentNotifier
|
class MarketplaceWebFeedContentNotifier
|
||||||
extends _$MarketplaceWebFeedContentNotifier
|
extends AsyncNotifier<List<SnWebArticle>>
|
||||||
with CursorPagingNotifierMixin<SnWebArticle> {
|
with AsyncPaginationController<SnWebArticle> {
|
||||||
static const int _pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String arg;
|
||||||
|
MarketplaceWebFeedContentNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnWebArticle>> build(String feedId) async {
|
Future<List<SnWebArticle>> fetch() async {
|
||||||
_feedId = feedId;
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final String _feedId;
|
|
||||||
ValueNotifier<int> totalCount = ValueNotifier(0);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnWebArticle>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final queryParams = {'offset': offset, 'take': _pageSize};
|
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/feeds/$_feedId/articles',
|
'/sphere/feeds/$arg/articles',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
totalCount.value = total;
|
final articles =
|
||||||
final List<dynamic> data = response.data;
|
response.data
|
||||||
final articles = data.map((json) => SnWebArticle.fromJson(json)).toList();
|
.map((json) => SnWebArticle.fromJson(json))
|
||||||
|
.cast<SnWebArticle>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + articles.length < total;
|
return articles;
|
||||||
final nextCursor = hasMore ? (offset + articles.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: articles,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispose() {
|
|
||||||
totalCount.dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,10 +108,6 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
|||||||
marketplaceWebFeedContentNotifierProvider(id).notifier,
|
marketplaceWebFeedContentNotifierProvider(id).notifier,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
return feedNotifier.dispose;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBar: AppBar(title: Text(feed.value?.title ?? 'loading'.tr())),
|
appBar: AppBar(title: Text(feed.value?.title ?? 'loading'.tr())),
|
||||||
body: Column(
|
body: Column(
|
||||||
@@ -147,13 +125,9 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
|||||||
spacing: 4,
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Symbols.rss_feed, size: 16),
|
const Icon(Symbols.rss_feed, size: 16),
|
||||||
ListenableBuilder(
|
Text(
|
||||||
listenable: feedNotifier.totalCount,
|
|
||||||
builder:
|
|
||||||
(context, _) => Text(
|
|
||||||
'webFeedArticleCount'.plural(
|
'webFeedArticleCount'.plural(
|
||||||
feedNotifier.totalCount.value,
|
feedNotifier.totalCount ?? 0,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -174,29 +148,12 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
|||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
// Articles list
|
// Articles list
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: marketplaceWebFeedContentNotifierProvider(id),
|
provider: marketplaceWebFeedContentNotifierProvider(id),
|
||||||
futureRefreshable:
|
notifier: marketplaceWebFeedContentNotifierProvider(id).notifier,
|
||||||
marketplaceWebFeedContentNotifierProvider(id).future,
|
itemBuilder: (context, index, article) {
|
||||||
notifierRefreshable:
|
|
||||||
marketplaceWebFeedContentNotifierProvider(id).notifier,
|
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => ListView.separated(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 24,
|
|
||||||
vertical: 20,
|
|
||||||
),
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final article = data.items[index];
|
|
||||||
return WebArticleCard(article: article);
|
return WebArticleCard(article: article);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) => const Gap(12),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|||||||
@@ -6,453 +6,161 @@ part of 'feed_detail.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$marketplaceWebFeedHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'8383f94f1bc272b903c341b8d95000313b69d14c';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [marketplaceWebFeed].
|
|
||||||
@ProviderFor(marketplaceWebFeed)
|
@ProviderFor(marketplaceWebFeed)
|
||||||
const marketplaceWebFeedProvider = MarketplaceWebFeedFamily();
|
const marketplaceWebFeedProvider = MarketplaceWebFeedFamily._();
|
||||||
|
|
||||||
/// See also [marketplaceWebFeed].
|
final class MarketplaceWebFeedProvider
|
||||||
class MarketplaceWebFeedFamily extends Family<AsyncValue<SnWebFeed>> {
|
extends
|
||||||
/// See also [marketplaceWebFeed].
|
$FunctionalProvider<
|
||||||
const MarketplaceWebFeedFamily();
|
AsyncValue<SnWebFeed>,
|
||||||
|
SnWebFeed,
|
||||||
/// See also [marketplaceWebFeed].
|
FutureOr<SnWebFeed>
|
||||||
MarketplaceWebFeedProvider call(String feedId) {
|
>
|
||||||
return MarketplaceWebFeedProvider(feedId);
|
with $FutureModifier<SnWebFeed>, $FutureProvider<SnWebFeed> {
|
||||||
}
|
const MarketplaceWebFeedProvider._({
|
||||||
|
required MarketplaceWebFeedFamily super.from,
|
||||||
@override
|
required String super.argument,
|
||||||
MarketplaceWebFeedProvider getProviderOverride(
|
}) : super(
|
||||||
covariant MarketplaceWebFeedProvider provider,
|
retry: null,
|
||||||
) {
|
|
||||||
return call(provider.feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'marketplaceWebFeedProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [marketplaceWebFeed].
|
|
||||||
class MarketplaceWebFeedProvider extends AutoDisposeFutureProvider<SnWebFeed> {
|
|
||||||
/// See also [marketplaceWebFeed].
|
|
||||||
MarketplaceWebFeedProvider(String feedId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => marketplaceWebFeed(ref as MarketplaceWebFeedRef, feedId),
|
|
||||||
from: marketplaceWebFeedProvider,
|
|
||||||
name: r'marketplaceWebFeedProvider',
|
name: r'marketplaceWebFeedProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$marketplaceWebFeedHash,
|
|
||||||
dependencies: MarketplaceWebFeedFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MarketplaceWebFeedFamily._allTransitiveDependencies,
|
|
||||||
feedId: feedId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
MarketplaceWebFeedProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.feedId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String feedId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$marketplaceWebFeedHash();
|
||||||
FutureOr<SnWebFeed> Function(MarketplaceWebFeedRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'marketplaceWebFeedProvider'
|
||||||
override: MarketplaceWebFeedProvider._internal(
|
''
|
||||||
(ref) => create(ref as MarketplaceWebFeedRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
feedId: feedId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnWebFeed> createElement() {
|
$FutureProviderElement<SnWebFeed> $createElement($ProviderPointer pointer) =>
|
||||||
return _MarketplaceWebFeedProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnWebFeed> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return marketplaceWebFeed(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is MarketplaceWebFeedProvider && other.feedId == feedId;
|
return other is MarketplaceWebFeedProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, feedId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$marketplaceWebFeedHash() =>
|
||||||
// ignore: unused_element
|
r'8383f94f1bc272b903c341b8d95000313b69d14c';
|
||||||
mixin MarketplaceWebFeedRef on AutoDisposeFutureProviderRef<SnWebFeed> {
|
|
||||||
/// The parameter `feedId` of this provider.
|
|
||||||
String get feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MarketplaceWebFeedProviderElement
|
final class MarketplaceWebFeedFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<SnWebFeed>
|
with $FunctionalFamilyOverride<FutureOr<SnWebFeed>, String> {
|
||||||
with MarketplaceWebFeedRef {
|
const MarketplaceWebFeedFamily._()
|
||||||
_MarketplaceWebFeedProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'marketplaceWebFeedProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
MarketplaceWebFeedProvider call(String feedId) =>
|
||||||
|
MarketplaceWebFeedProvider._(argument: feedId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get feedId => (origin as MarketplaceWebFeedProvider).feedId;
|
String toString() => r'marketplaceWebFeedProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provider for web feed subscription status
|
||||||
|
|
||||||
|
@ProviderFor(marketplaceWebFeedSubscription)
|
||||||
|
const marketplaceWebFeedSubscriptionProvider =
|
||||||
|
MarketplaceWebFeedSubscriptionFamily._();
|
||||||
|
|
||||||
|
/// Provider for web feed subscription status
|
||||||
|
|
||||||
|
final class MarketplaceWebFeedSubscriptionProvider
|
||||||
|
extends $FunctionalProvider<AsyncValue<bool>, bool, FutureOr<bool>>
|
||||||
|
with $FutureModifier<bool>, $FutureProvider<bool> {
|
||||||
|
/// Provider for web feed subscription status
|
||||||
|
const MarketplaceWebFeedSubscriptionProvider._({
|
||||||
|
required MarketplaceWebFeedSubscriptionFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'marketplaceWebFeedSubscriptionProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$marketplaceWebFeedSubscriptionHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'marketplaceWebFeedSubscriptionProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<bool> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<bool> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return marketplaceWebFeedSubscription(ref, feedId: argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is MarketplaceWebFeedSubscriptionProvider &&
|
||||||
|
other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$marketplaceWebFeedSubscriptionHash() =>
|
String _$marketplaceWebFeedSubscriptionHash() =>
|
||||||
r'2ff06a48ed7d4236b57412ecca55e94c0a0b6330';
|
r'2ff06a48ed7d4236b57412ecca55e94c0a0b6330';
|
||||||
|
|
||||||
/// Provider for web feed subscription status
|
/// Provider for web feed subscription status
|
||||||
///
|
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
|
||||||
@ProviderFor(marketplaceWebFeedSubscription)
|
|
||||||
const marketplaceWebFeedSubscriptionProvider =
|
|
||||||
MarketplaceWebFeedSubscriptionFamily();
|
|
||||||
|
|
||||||
/// Provider for web feed subscription status
|
final class MarketplaceWebFeedSubscriptionFamily extends $Family
|
||||||
///
|
with $FunctionalFamilyOverride<FutureOr<bool>, String> {
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
const MarketplaceWebFeedSubscriptionFamily._()
|
||||||
class MarketplaceWebFeedSubscriptionFamily extends Family<AsyncValue<bool>> {
|
: super(
|
||||||
/// Provider for web feed subscription status
|
retry: null,
|
||||||
///
|
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
|
||||||
const MarketplaceWebFeedSubscriptionFamily();
|
|
||||||
|
|
||||||
/// Provider for web feed subscription status
|
|
||||||
///
|
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
|
||||||
MarketplaceWebFeedSubscriptionProvider call({required String feedId}) {
|
|
||||||
return MarketplaceWebFeedSubscriptionProvider(feedId: feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MarketplaceWebFeedSubscriptionProvider getProviderOverride(
|
|
||||||
covariant MarketplaceWebFeedSubscriptionProvider provider,
|
|
||||||
) {
|
|
||||||
return call(feedId: provider.feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'marketplaceWebFeedSubscriptionProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for web feed subscription status
|
|
||||||
///
|
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
|
||||||
class MarketplaceWebFeedSubscriptionProvider
|
|
||||||
extends AutoDisposeFutureProvider<bool> {
|
|
||||||
/// Provider for web feed subscription status
|
|
||||||
///
|
|
||||||
/// Copied from [marketplaceWebFeedSubscription].
|
|
||||||
MarketplaceWebFeedSubscriptionProvider({required String feedId})
|
|
||||||
: this._internal(
|
|
||||||
(ref) => marketplaceWebFeedSubscription(
|
|
||||||
ref as MarketplaceWebFeedSubscriptionRef,
|
|
||||||
feedId: feedId,
|
|
||||||
),
|
|
||||||
from: marketplaceWebFeedSubscriptionProvider,
|
|
||||||
name: r'marketplaceWebFeedSubscriptionProvider',
|
name: r'marketplaceWebFeedSubscriptionProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$marketplaceWebFeedSubscriptionHash,
|
|
||||||
dependencies: MarketplaceWebFeedSubscriptionFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MarketplaceWebFeedSubscriptionFamily._allTransitiveDependencies,
|
|
||||||
feedId: feedId,
|
|
||||||
);
|
|
||||||
|
|
||||||
MarketplaceWebFeedSubscriptionProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.feedId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String feedId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<bool> Function(MarketplaceWebFeedSubscriptionRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MarketplaceWebFeedSubscriptionProvider._internal(
|
|
||||||
(ref) => create(ref as MarketplaceWebFeedSubscriptionRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
feedId: feedId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<bool> createElement() {
|
|
||||||
return _MarketplaceWebFeedSubscriptionProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is MarketplaceWebFeedSubscriptionProvider &&
|
|
||||||
other.feedId == feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, feedId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin MarketplaceWebFeedSubscriptionRef on AutoDisposeFutureProviderRef<bool> {
|
|
||||||
/// The parameter `feedId` of this provider.
|
|
||||||
String get feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MarketplaceWebFeedSubscriptionProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<bool>
|
|
||||||
with MarketplaceWebFeedSubscriptionRef {
|
|
||||||
_MarketplaceWebFeedSubscriptionProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get feedId =>
|
|
||||||
(origin as MarketplaceWebFeedSubscriptionProvider).feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$marketplaceWebFeedContentNotifierHash() =>
|
|
||||||
r'25688082884cb824eeff300888ba38c9748295dc';
|
|
||||||
|
|
||||||
abstract class _$MarketplaceWebFeedContentNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebArticle>> {
|
|
||||||
late final String feedId;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnWebArticle>> build(String feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
@ProviderFor(MarketplaceWebFeedContentNotifier)
|
|
||||||
const marketplaceWebFeedContentNotifierProvider =
|
|
||||||
MarketplaceWebFeedContentNotifierFamily();
|
|
||||||
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
class MarketplaceWebFeedContentNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnWebArticle>>> {
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
const MarketplaceWebFeedContentNotifierFamily();
|
|
||||||
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
MarketplaceWebFeedContentNotifierProvider call(String feedId) {
|
|
||||||
return MarketplaceWebFeedContentNotifierProvider(feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MarketplaceWebFeedContentNotifierProvider getProviderOverride(
|
|
||||||
covariant MarketplaceWebFeedContentNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'marketplaceWebFeedContentNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
class MarketplaceWebFeedContentNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
MarketplaceWebFeedContentNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
> {
|
|
||||||
/// Provider for web feed articles content
|
|
||||||
///
|
|
||||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
|
||||||
MarketplaceWebFeedContentNotifierProvider(String feedId)
|
|
||||||
: this._internal(
|
|
||||||
() => MarketplaceWebFeedContentNotifier()..feedId = feedId,
|
|
||||||
from: marketplaceWebFeedContentNotifierProvider,
|
|
||||||
name: r'marketplaceWebFeedContentNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$marketplaceWebFeedContentNotifierHash,
|
|
||||||
dependencies: MarketplaceWebFeedContentNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MarketplaceWebFeedContentNotifierFamily._allTransitiveDependencies,
|
|
||||||
feedId: feedId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
MarketplaceWebFeedContentNotifierProvider._internal(
|
/// Provider for web feed subscription status
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.feedId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String feedId;
|
MarketplaceWebFeedSubscriptionProvider call({required String feedId}) =>
|
||||||
|
MarketplaceWebFeedSubscriptionProvider._(argument: feedId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnWebArticle>> runNotifierBuild(
|
String toString() => r'marketplaceWebFeedSubscriptionProvider';
|
||||||
covariant MarketplaceWebFeedContentNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(feedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(MarketplaceWebFeedContentNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MarketplaceWebFeedContentNotifierProvider._internal(
|
|
||||||
() => create()..feedId = feedId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
feedId: feedId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceWebFeedContentNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _MarketplaceWebFeedContentNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is MarketplaceWebFeedContentNotifierProvider &&
|
|
||||||
other.feedId == feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, feedId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin MarketplaceWebFeedContentNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnWebArticle>> {
|
|
||||||
/// The parameter `feedId` of this provider.
|
|
||||||
String get feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MarketplaceWebFeedContentNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceWebFeedContentNotifier,
|
|
||||||
CursorPagingData<SnWebArticle>
|
|
||||||
>
|
|
||||||
with MarketplaceWebFeedContentNotifierRef {
|
|
||||||
_MarketplaceWebFeedContentNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get feedId =>
|
|
||||||
(origin as MarketplaceWebFeedContentNotifierProvider).feedId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
@@ -6,52 +7,44 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/webfeed.dart';
|
import 'package:island/models/webfeed.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
final marketplaceWebFeedsNotifierProvider = AsyncNotifierProvider(
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
MarketplaceWebFeedsNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
part 'feed_marketplace.g.dart';
|
class MarketplaceWebFeedsNotifier extends AsyncNotifier<List<SnWebFeed>>
|
||||||
|
with
|
||||||
@riverpod
|
AsyncPaginationController<SnWebFeed>,
|
||||||
class MarketplaceWebFeedsNotifier extends _$MarketplaceWebFeedsNotifier
|
AsyncPaginationFilter<String?, SnWebFeed> {
|
||||||
with CursorPagingNotifierMixin<SnWebFeed> {
|
@override
|
||||||
String? _query;
|
String? currentFilter;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnWebFeed>> build({required String? query}) {
|
Future<List<SnWebFeed>> fetch() async {
|
||||||
_query = query;
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnWebFeed>> fetch({required String? cursor}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/feeds/explore',
|
'/sphere/feeds/explore',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'offset': offset,
|
'offset': fetchedCount.toString(),
|
||||||
'take': 20,
|
'take': 20,
|
||||||
if (_query != null && _query!.isNotEmpty) 'query': _query,
|
if (currentFilter != null && currentFilter!.isNotEmpty)
|
||||||
|
'query': currentFilter,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final feeds =
|
||||||
final feeds = data.map((e) => SnWebFeed.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnWebFeed.fromJson(e))
|
||||||
|
.cast<SnWebFeed>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + feeds.length < total;
|
return feeds;
|
||||||
final nextCursor = hasMore ? (offset + feeds.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: feeds,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,16 +79,8 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
|
|||||||
title: const Text('webFeeds').tr(),
|
title: const Text('webFeeds').tr(),
|
||||||
actions: const [Gap(8)],
|
actions: const [Gap(8)],
|
||||||
),
|
),
|
||||||
body: PagingHelperView(
|
body: Column(
|
||||||
provider: marketplaceWebFeedsNotifierProvider(query: query.value),
|
|
||||||
futureRefreshable:
|
|
||||||
marketplaceWebFeedsNotifierProvider(query: query.value).future,
|
|
||||||
notifierRefreshable:
|
|
||||||
marketplaceWebFeedsNotifierProvider(query: query.value).notifier,
|
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => Column(
|
|
||||||
children: [
|
children: [
|
||||||
// Search bar above the list
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
@@ -137,15 +122,11 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: PaginationList(
|
||||||
|
provider: marketplaceWebFeedsNotifierProvider,
|
||||||
|
notifier: marketplaceWebFeedsNotifierProvider.notifier,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: widgetCount,
|
itemBuilder: (context, index, feed) {
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final feed = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(feed.title),
|
title: Text(feed.title),
|
||||||
subtitle: Text(feed.description ?? ''),
|
subtitle: Text(feed.description ?? ''),
|
||||||
@@ -163,7 +144,6 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,180 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'feed_marketplace.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$marketplaceWebFeedsNotifierHash() =>
|
|
||||||
r'774b2985f2f7d61fe958f534f84e39f814327c4e';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$MarketplaceWebFeedsNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebFeed>> {
|
|
||||||
late final String? query;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnWebFeed>> build({required String? query});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
@ProviderFor(MarketplaceWebFeedsNotifier)
|
|
||||||
const marketplaceWebFeedsNotifierProvider = MarketplaceWebFeedsNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
class MarketplaceWebFeedsNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnWebFeed>>> {
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
const MarketplaceWebFeedsNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
MarketplaceWebFeedsNotifierProvider call({required String? query}) {
|
|
||||||
return MarketplaceWebFeedsNotifierProvider(query: query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MarketplaceWebFeedsNotifierProvider getProviderOverride(
|
|
||||||
covariant MarketplaceWebFeedsNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(query: provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'marketplaceWebFeedsNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
class MarketplaceWebFeedsNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
MarketplaceWebFeedsNotifier,
|
|
||||||
CursorPagingData<SnWebFeed>
|
|
||||||
> {
|
|
||||||
/// See also [MarketplaceWebFeedsNotifier].
|
|
||||||
MarketplaceWebFeedsNotifierProvider({required String? query})
|
|
||||||
: this._internal(
|
|
||||||
() => MarketplaceWebFeedsNotifier()..query = query,
|
|
||||||
from: marketplaceWebFeedsNotifierProvider,
|
|
||||||
name: r'marketplaceWebFeedsNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$marketplaceWebFeedsNotifierHash,
|
|
||||||
dependencies: MarketplaceWebFeedsNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MarketplaceWebFeedsNotifierFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
|
||||||
|
|
||||||
MarketplaceWebFeedsNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? query;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnWebFeed>> runNotifierBuild(
|
|
||||||
covariant MarketplaceWebFeedsNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(query: query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(MarketplaceWebFeedsNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MarketplaceWebFeedsNotifierProvider._internal(
|
|
||||||
() => create()..query = query,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceWebFeedsNotifier,
|
|
||||||
CursorPagingData<SnWebFeed>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _MarketplaceWebFeedsNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is MarketplaceWebFeedsNotifierProvider && other.query == query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin MarketplaceWebFeedsNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnWebFeed>> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
String? get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MarketplaceWebFeedsNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceWebFeedsNotifier,
|
|
||||||
CursorPagingData<SnWebFeed>
|
|
||||||
>
|
|
||||||
with MarketplaceWebFeedsNotifierRef {
|
|
||||||
_MarketplaceWebFeedsNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get query => (origin as MarketplaceWebFeedsNotifierProvider).query;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user