🐛 Dozens of bug fixes

This commit is contained in:
2025-07-20 02:31:50 +08:00
parent 903008d397
commit 18db50d80c
33 changed files with 359 additions and 318 deletions

View File

@@ -106,7 +106,7 @@ class AuthFactorSheet extends HookConsumerWidget {
showLoadingModal(context);
final client = ref.read(apiClientProvider);
await client.post(
'/accounts/me/factors/${factor.id}/enable',
'/id/accounts/me/factors/${factor.id}/enable',
data: jsonEncode(password),
);
if (context.mounted) Navigator.pop(context, true);
@@ -193,7 +193,7 @@ class AuthFactorNewSheet extends HookConsumerWidget {
showLoadingModal(context);
final apiClient = ref.read(apiClientProvider);
final resp = await apiClient.post(
'/accounts/me/factors',
'/id/accounts/me/factors',
data: {'type': factorType.value, 'secret': secretController.text},
);
final factor = SnAuthFactor.fromJson(resp.data);

View File

@@ -174,7 +174,7 @@ class AccountConnectionNewSheet extends HookConsumerWidget {
if (context.mounted) showLoadingModal(context);
await client.post(
'/auth/connect/apple/mobile',
'/id/auth/connect/apple/mobile',
data: {
'identity_token': credential.identityToken!,
'authorization_code': credential.authorizationCode,
@@ -336,7 +336,7 @@ class AccountConnectionsSheet extends HookConsumerWidget {
try {
final client = ref.read(apiClientProvider);
await client.delete(
'/accounts/me/connections/${connection.id}',
'/id/accounts/me/connections/${connection.id}',
);
ref.invalidate(accountConnectionsProvider);
return true;

View File

@@ -160,7 +160,7 @@ class ContactMethodNewSheet extends HookConsumerWidget {
showLoadingModal(context);
final apiClient = ref.read(apiClientProvider);
await apiClient.post(
'/accounts/me/contacts',
'/id/accounts/me/contacts',
data: {'type': contactType.value, 'content': contentController.text},
);
if (context.mounted) {

View File

@@ -39,14 +39,14 @@ Future<SnAccount> account(Ref ref, String uname) async {
}
}
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get("/accounts/$uname");
final resp = await apiClient.get("/id/accounts/$uname");
return SnAccount.fromJson(resp.data);
}
@riverpod
Future<List<SnAccountBadge>> accountBadges(Ref ref, String uname) async {
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get("/accounts/$uname/badges");
final resp = await apiClient.get("/id/accounts/$uname/badges");
return List<SnAccountBadge>.from(
resp.data.map((x) => SnAccountBadge.fromJson(x)),
);
@@ -78,7 +78,7 @@ Future<SnChatRoom?> accountDirectChat(Ref ref, String uname) async {
final account = await ref.watch(accountProvider(uname).future);
final apiClient = ref.watch(apiClientProvider);
try {
final resp = await apiClient.get("/chat/direct/${account.id}");
final resp = await apiClient.get("/sphere/chat/direct/${account.id}");
return SnChatRoom.fromJson(resp.data);
} catch (err) {
if (err is DioException && err.response?.statusCode == 404) {
@@ -95,7 +95,7 @@ Future<SnRelationship?> accountRelationship(Ref ref, String uname) async {
final account = await ref.watch(accountProvider(uname).future);
final apiClient = ref.watch(apiClientProvider);
try {
final resp = await apiClient.get("/relationships/${account.id}");
final resp = await apiClient.get("/id/relationships/${account.id}");
return SnRelationship.fromJson(resp.data);
} catch (err) {
if (err is DioException && err.response?.statusCode == 404) {
@@ -174,7 +174,7 @@ class AccountProfileScreen extends HookConsumerWidget {
try {
final client = ref.watch(apiClientProvider);
final resp = await client.post(
'/chat/direct',
'/sphere/chat/direct',
data: {'related_user_id': account.value!.id},
);
final chat = SnChatRoom.fromJson(resp.data);

View File

@@ -6,7 +6,7 @@ part of 'profile.dart';
// RiverpodGenerator
// **************************************************************************
String _$accountHash() => r'd2b0579617e6264452d98f47f695a9cdf45b24ec';
String _$accountHash() => r'ce7264a04f69e32a5cb07bc10ca5fa47ae1fddaa';
/// Copied from Dart SDK
class _SystemHash {
@@ -145,7 +145,7 @@ class _AccountProviderElement
String get uname => (origin as AccountProvider).uname;
}
String _$accountBadgesHash() => r'4bfe5fb0d6ac0d4cde4563460bde289289188f6d';
String _$accountBadgesHash() => r'1de05e122c23ff2c6ac6d318977165761e2ad177';
/// See also [accountBadges].
@ProviderFor(accountBadges)
@@ -395,7 +395,7 @@ class _AccountAppbarForcegroundColorProviderElement
String get uname => (origin as AccountAppbarForcegroundColorProvider).uname;
}
String _$accountDirectChatHash() => r'3d28c8ba8079159f724fe3cd47bbe00db55cedcc';
String _$accountDirectChatHash() => r'149ea3a3730672cfbbb8c16fe1f2caa0bb9f0e17';
/// See also [accountDirectChat].
@ProviderFor(accountDirectChat)
@@ -517,7 +517,7 @@ class _AccountDirectChatProviderElement
}
String _$accountRelationshipHash() =>
r'0be2420e1f6a65b8dcead9617191471924aaf232';
r'9a3a4e8c6c6706f73df95feccb86736fcad33f30';
/// See also [accountRelationship].
@ProviderFor(accountRelationship)

View File

@@ -42,7 +42,7 @@ class RelationshipListNotifier extends _$RelationshipListNotifier
final take = 20;
final response = await client.get(
'/relationships',
'/id/relationships',
queryParameters: {'offset': offset, 'take': take},
);
@@ -235,7 +235,7 @@ class RelationshipScreen extends HookConsumerWidget {
submitting.value = true;
final client = ref.read(apiClientProvider);
await client.post(
'/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
'/id/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
);
relationshipNotifier.forceRefresh();
if (!context.mounted) return;
@@ -262,7 +262,7 @@ class RelationshipScreen extends HookConsumerWidget {
) async {
final client = ref.read(apiClientProvider);
await client.patch(
'/relationships/${relationship.accountId}',
'/id/relationships/${relationship.accountId}',
data: {'status': newStatus},
);
relationshipNotifier.forceRefresh();

View File

@@ -27,7 +27,7 @@ final sentFriendRequestProvider =
typedef SentFriendRequestRef =
AutoDisposeFutureProviderRef<List<SnRelationship>>;
String _$relationshipListNotifierHash() =>
r'560410cba6e4c26affd91aa86b3666319bd31f24';
r'0a134ce69489a4f2002d2223853855b6f22e4e9f';
/// See also [RelationshipListNotifier].
@ProviderFor(RelationshipListNotifier)