💥 Switch all id to uuid
This commit is contained in:
@ -232,7 +232,7 @@ class _LoginPickerScreen extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final isBusy = useState(false);
|
||||
final factorPicked = useState<int?>(null);
|
||||
final factorPicked = useState<String?>(null);
|
||||
|
||||
final unfocusColor = Theme.of(
|
||||
context,
|
||||
|
@ -191,7 +191,7 @@ class ChatListScreen extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Future<SnChatRoom?> chatroom(Ref ref, int? identifier) async {
|
||||
Future<SnChatRoom?> chatroom(Ref ref, String? identifier) async {
|
||||
if (identifier == null) return null;
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/chat/$identifier');
|
||||
@ -199,7 +199,7 @@ Future<SnChatRoom?> chatroom(Ref ref, int? identifier) async {
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Future<SnChatMember?> chatroomIdentity(Ref ref, int? identifier) async {
|
||||
Future<SnChatMember?> chatroomIdentity(Ref ref, String? identifier) async {
|
||||
if (identifier == null) return null;
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/chat/$identifier/members/me');
|
||||
@ -218,7 +218,7 @@ class NewChatScreen extends StatelessWidget {
|
||||
|
||||
@RoutePage()
|
||||
class EditChatScreen extends HookConsumerWidget {
|
||||
final int? id;
|
||||
final String? id;
|
||||
const EditChatScreen({super.key, @PathParam("id") this.id});
|
||||
|
||||
@override
|
||||
|
@ -25,7 +25,7 @@ final chatroomsJoinedProvider =
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ChatroomsJoinedRef = AutoDisposeFutureProviderRef<List<SnChatRoom>>;
|
||||
String _$chatroomHash() => r'3a945a61ea434f860fbeae9d40778fbfceddc5db';
|
||||
String _$chatroomHash() => r'dce3c0fc407f178bb7c306a08b9fa545795a9205';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
@ -58,7 +58,7 @@ class ChatroomFamily extends Family<AsyncValue<SnChatRoom?>> {
|
||||
const ChatroomFamily();
|
||||
|
||||
/// See also [chatroom].
|
||||
ChatroomProvider call(int? identifier) {
|
||||
ChatroomProvider call(String? identifier) {
|
||||
return ChatroomProvider(identifier);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ class ChatroomFamily extends Family<AsyncValue<SnChatRoom?>> {
|
||||
/// See also [chatroom].
|
||||
class ChatroomProvider extends AutoDisposeFutureProvider<SnChatRoom?> {
|
||||
/// See also [chatroom].
|
||||
ChatroomProvider(int? identifier)
|
||||
ChatroomProvider(String? identifier)
|
||||
: this._internal(
|
||||
(ref) => chatroom(ref as ChatroomRef, identifier),
|
||||
from: chatroomProvider,
|
||||
@ -109,7 +109,7 @@ class ChatroomProvider extends AutoDisposeFutureProvider<SnChatRoom?> {
|
||||
required this.identifier,
|
||||
}) : super.internal();
|
||||
|
||||
final int? identifier;
|
||||
final String? identifier;
|
||||
|
||||
@override
|
||||
Override overrideWith(
|
||||
@ -152,7 +152,7 @@ class ChatroomProvider extends AutoDisposeFutureProvider<SnChatRoom?> {
|
||||
// ignore: unused_element
|
||||
mixin ChatroomRef on AutoDisposeFutureProviderRef<SnChatRoom?> {
|
||||
/// The parameter `identifier` of this provider.
|
||||
int? get identifier;
|
||||
String? get identifier;
|
||||
}
|
||||
|
||||
class _ChatroomProviderElement
|
||||
@ -161,10 +161,10 @@ class _ChatroomProviderElement
|
||||
_ChatroomProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
int? get identifier => (origin as ChatroomProvider).identifier;
|
||||
String? get identifier => (origin as ChatroomProvider).identifier;
|
||||
}
|
||||
|
||||
String _$chatroomIdentityHash() => r'b20322591279d0336f2f309729e7e0cb9809063f';
|
||||
String _$chatroomIdentityHash() => r'4c349ea4265df7b0498cf26c82dbaabe3d868727';
|
||||
|
||||
/// See also [chatroomIdentity].
|
||||
@ProviderFor(chatroomIdentity)
|
||||
@ -176,7 +176,7 @@ class ChatroomIdentityFamily extends Family<AsyncValue<SnChatMember?>> {
|
||||
const ChatroomIdentityFamily();
|
||||
|
||||
/// See also [chatroomIdentity].
|
||||
ChatroomIdentityProvider call(int? identifier) {
|
||||
ChatroomIdentityProvider call(String? identifier) {
|
||||
return ChatroomIdentityProvider(identifier);
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ class ChatroomIdentityFamily extends Family<AsyncValue<SnChatMember?>> {
|
||||
class ChatroomIdentityProvider
|
||||
extends AutoDisposeFutureProvider<SnChatMember?> {
|
||||
/// See also [chatroomIdentity].
|
||||
ChatroomIdentityProvider(int? identifier)
|
||||
ChatroomIdentityProvider(String? identifier)
|
||||
: this._internal(
|
||||
(ref) => chatroomIdentity(ref as ChatroomIdentityRef, identifier),
|
||||
from: chatroomIdentityProvider,
|
||||
@ -231,7 +231,7 @@ class ChatroomIdentityProvider
|
||||
required this.identifier,
|
||||
}) : super.internal();
|
||||
|
||||
final int? identifier;
|
||||
final String? identifier;
|
||||
|
||||
@override
|
||||
Override overrideWith(
|
||||
@ -274,7 +274,7 @@ class ChatroomIdentityProvider
|
||||
// ignore: unused_element
|
||||
mixin ChatroomIdentityRef on AutoDisposeFutureProviderRef<SnChatMember?> {
|
||||
/// The parameter `identifier` of this provider.
|
||||
int? get identifier;
|
||||
String? get identifier;
|
||||
}
|
||||
|
||||
class _ChatroomIdentityProviderElement
|
||||
@ -283,7 +283,7 @@ class _ChatroomIdentityProviderElement
|
||||
_ChatroomIdentityProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
int? get identifier => (origin as ChatroomIdentityProvider).identifier;
|
||||
String? get identifier => (origin as ChatroomIdentityProvider).identifier;
|
||||
}
|
||||
|
||||
String _$chatroomInvitesHash() => r'c15f06c1e9c6074e6159d9d1f4404f31250ce523';
|
||||
|
@ -24,27 +24,26 @@ import 'package:super_context_menu/super_context_menu.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'chat.dart';
|
||||
|
||||
final messageRepositoryProvider = FutureProvider.family<MessageRepository, int>(
|
||||
(ref, roomId) async {
|
||||
final room = await ref.watch(chatroomProvider(roomId).future);
|
||||
final identity = await ref.watch(chatroomIdentityProvider(roomId).future);
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
final database = ref.watch(databaseProvider);
|
||||
return MessageRepository(room!, identity!, apiClient, database);
|
||||
},
|
||||
);
|
||||
final messageRepositoryProvider =
|
||||
FutureProvider.family<MessageRepository, String>((ref, roomId) async {
|
||||
final room = await ref.watch(chatroomProvider(roomId).future);
|
||||
final identity = await ref.watch(chatroomIdentityProvider(roomId).future);
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
final database = ref.watch(databaseProvider);
|
||||
return MessageRepository(room!, identity!, apiClient, database);
|
||||
});
|
||||
|
||||
// Provider for messages with pagination
|
||||
final messagesProvider = StateNotifierProvider.family<
|
||||
MessagesNotifier,
|
||||
AsyncValue<List<LocalChatMessage>>,
|
||||
int
|
||||
String
|
||||
>((ref, roomId) => MessagesNotifier(ref, roomId));
|
||||
|
||||
class MessagesNotifier
|
||||
extends StateNotifier<AsyncValue<List<LocalChatMessage>>> {
|
||||
final Ref _ref;
|
||||
final int _roomId;
|
||||
final String _roomId;
|
||||
int _currentPage = 0;
|
||||
static const int _pageSize = 20;
|
||||
bool _hasMore = true;
|
||||
@ -334,7 +333,7 @@ class MessagesNotifier
|
||||
|
||||
@RoutePage()
|
||||
class ChatRoomScreen extends HookConsumerWidget {
|
||||
final int id;
|
||||
final String id;
|
||||
const ChatRoomScreen({super.key, @PathParam("id") required this.id});
|
||||
|
||||
@override
|
||||
|
@ -21,7 +21,7 @@ part 'room_detail.freezed.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ChatDetailScreen extends HookConsumerWidget {
|
||||
final int id;
|
||||
final String id;
|
||||
const ChatDetailScreen({super.key, @PathParam("id") required this.id});
|
||||
|
||||
@override
|
||||
@ -129,7 +129,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
class _ChatRoomActionMenu extends HookConsumerWidget {
|
||||
final int id;
|
||||
final String id;
|
||||
final Shadow iconShadow;
|
||||
|
||||
const _ChatRoomActionMenu({required this.id, required this.iconShadow});
|
||||
@ -199,17 +199,17 @@ abstract class ChatRoomMemberState with _$ChatRoomMemberState {
|
||||
}) = _ChatRoomMemberState;
|
||||
}
|
||||
|
||||
final chatMemberStateProvider =
|
||||
StateNotifierProvider.family<ChatMemberNotifier, ChatRoomMemberState, int>((
|
||||
ref,
|
||||
roomId,
|
||||
) {
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
return ChatMemberNotifier(apiClient, roomId);
|
||||
});
|
||||
final chatMemberStateProvider = StateNotifierProvider.family<
|
||||
ChatMemberNotifier,
|
||||
ChatRoomMemberState,
|
||||
String
|
||||
>((ref, roomId) {
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
return ChatMemberNotifier(apiClient, roomId);
|
||||
});
|
||||
|
||||
class ChatMemberNotifier extends StateNotifier<ChatRoomMemberState> {
|
||||
final int roomId;
|
||||
final String roomId;
|
||||
final Dio _apiClient;
|
||||
|
||||
ChatMemberNotifier(this._apiClient, this.roomId)
|
||||
@ -247,7 +247,7 @@ class ChatMemberNotifier extends StateNotifier<ChatRoomMemberState> {
|
||||
}
|
||||
|
||||
class _ChatMemberListSheet extends HookConsumerWidget {
|
||||
final int roomId;
|
||||
final String roomId;
|
||||
const _ChatMemberListSheet({required this.roomId});
|
||||
|
||||
@override
|
||||
|
@ -27,7 +27,7 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
@RoutePage()
|
||||
class PostEditScreen extends HookConsumerWidget {
|
||||
final int id;
|
||||
final String id;
|
||||
const PostEditScreen({super.key, @PathParam('id') required this.id});
|
||||
|
||||
@override
|
||||
|
@ -14,7 +14,7 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
part 'detail.g.dart';
|
||||
|
||||
@riverpod
|
||||
Future<SnPost?> post(Ref ref, int id) async {
|
||||
Future<SnPost?> post(Ref ref, String id) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/posts/$id');
|
||||
return SnPost.fromJson(resp.data);
|
||||
@ -22,7 +22,7 @@ Future<SnPost?> post(Ref ref, int id) async {
|
||||
|
||||
@RoutePage()
|
||||
class PostDetailScreen extends HookConsumerWidget {
|
||||
final int id;
|
||||
final String id;
|
||||
const PostDetailScreen({super.key, @PathParam('id') required this.id});
|
||||
|
||||
@override
|
||||
|
@ -6,7 +6,7 @@ part of 'detail.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$postHash() => r'58de03954e284b5c04544b61ccb9cadfc45e9422';
|
||||
String _$postHash() => r'a5f66f47ed0eaef57e49518f6b764cdbfa725ad8';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
@ -39,7 +39,7 @@ class PostFamily extends Family<AsyncValue<SnPost?>> {
|
||||
const PostFamily();
|
||||
|
||||
/// See also [post].
|
||||
PostProvider call(int id) {
|
||||
PostProvider call(String id) {
|
||||
return PostProvider(id);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class PostFamily extends Family<AsyncValue<SnPost?>> {
|
||||
/// See also [post].
|
||||
class PostProvider extends AutoDisposeFutureProvider<SnPost?> {
|
||||
/// See also [post].
|
||||
PostProvider(int id)
|
||||
PostProvider(String id)
|
||||
: this._internal(
|
||||
(ref) => post(ref as PostRef, id),
|
||||
from: postProvider,
|
||||
@ -88,7 +88,7 @@ class PostProvider extends AutoDisposeFutureProvider<SnPost?> {
|
||||
required this.id,
|
||||
}) : super.internal();
|
||||
|
||||
final int id;
|
||||
final String id;
|
||||
|
||||
@override
|
||||
Override overrideWith(FutureOr<SnPost?> Function(PostRef provider) create) {
|
||||
@ -129,7 +129,7 @@ class PostProvider extends AutoDisposeFutureProvider<SnPost?> {
|
||||
// ignore: unused_element
|
||||
mixin PostRef on AutoDisposeFutureProviderRef<SnPost?> {
|
||||
/// The parameter `id` of this provider.
|
||||
int get id;
|
||||
String get id;
|
||||
}
|
||||
|
||||
class _PostProviderElement extends AutoDisposeFutureProviderElement<SnPost?>
|
||||
@ -137,7 +137,7 @@ class _PostProviderElement extends AutoDisposeFutureProviderElement<SnPost?>
|
||||
_PostProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
int get id => (origin as PostProvider).id;
|
||||
String get id => (origin as PostProvider).id;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
Reference in New Issue
Block a user