👽 Update API to microservices

♻️ Refactor router pushes
This commit is contained in:
2025-07-17 14:35:09 +08:00
parent a7454edec0
commit e6c58b7b63
109 changed files with 9156 additions and 344 deletions

View File

@@ -16,7 +16,7 @@ Future<SnRealtimeCall?> ongoingCall(Ref ref, String roomId) async {
if (roomId.isEmpty) return null;
try {
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get('/chat/realtime/$roomId');
final resp = await apiClient.get('/sphere/chat/realtime/$roomId');
return SnRealtimeCall.fromJson(resp.data);
} catch (e) {
if (e is DioException && e.response?.statusCode == 404) {
@@ -42,9 +42,9 @@ class AudioCallButton extends HookConsumerWidget {
Future<void> handleJoin() async {
isLoading.value = true;
try {
await apiClient.post('/chat/realtime/$roomId');
await apiClient.post('/sphere/chat/realtime/$roomId');
if (context.mounted) {
context.push('/chat/$roomId/call');
context.pushNamed('chatCall', pathParameters: {'id': roomId});
}
} catch (e) {
showErrorAlert(e);
@@ -56,7 +56,7 @@ class AudioCallButton extends HookConsumerWidget {
Future<void> handleEnd() async {
isLoading.value = true;
try {
await apiClient.delete('/chat/realtime/$roomId');
await apiClient.delete('/sphere/chat/realtime/$roomId');
callNotifier.dispose(); // Clean up call resources
} catch (e) {
showErrorAlert(e);
@@ -96,7 +96,7 @@ class AudioCallButton extends HookConsumerWidget {
tooltip: 'Join Ongoing Call',
onPressed: () {
if (context.mounted) {
context.push('/chat/$roomId/call');
context.pushNamed('chatCall', pathParameters: {'id': roomId});
}
},
);

View File

@@ -6,7 +6,7 @@ part of 'call_button.dart';
// RiverpodGenerator
// **************************************************************************
String _$ongoingCallHash() => r'ab7337bcd4d766897bd6d6a38f418c6bdd15eb94';
String _$ongoingCallHash() => r'48031badb79efa07aefb3a4fc51635be457bd3f9';
/// Copied from Dart SDK
class _SystemHash {

View File

@@ -360,7 +360,7 @@ class CallOverlayBar extends HookConsumerWidget {
).padding(all: 16),
),
onTap: () {
context.push('/chat/${callNotifier.roomId!}/call');
context.pushNamed('chatCall', pathParameters: {'id': callNotifier.roomId!});
},
);
}