💥 Updated API routes
This commit is contained in:
@@ -22,7 +22,7 @@ part 'account_devices.g.dart';
|
||||
Future<List<SnAuthDeviceWithChallenge>> authDevices(Ref ref) async {
|
||||
final resp = await ref
|
||||
.watch(apiClientProvider)
|
||||
.get('/id/accounts/me/devices');
|
||||
.get('/pass/accounts/me/devices');
|
||||
final currentId = await getUdid();
|
||||
final data =
|
||||
resp.data.map<SnAuthDeviceWithChallenge>((e) {
|
||||
@@ -154,7 +154,7 @@ class AccountSessionSheet extends HookConsumerWidget {
|
||||
if (!confirm || !context.mounted) return;
|
||||
try {
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
await apiClient.delete('/id/accounts/me/devices/$sessionId');
|
||||
await apiClient.delete('/pass/accounts/me/devices/$sessionId');
|
||||
ref.invalidate(authDevicesProvider);
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
@@ -193,7 +193,7 @@ class AccountSessionSheet extends HookConsumerWidget {
|
||||
try {
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
await apiClient.patch(
|
||||
'/id/accounts/me/devices/$sessionId/label',
|
||||
'/pass/accounts/me/devices/$sessionId/label',
|
||||
data: jsonEncode(label),
|
||||
);
|
||||
ref.invalidate(authDevicesProvider);
|
||||
@@ -284,7 +284,7 @@ class AccountSessionSheet extends HookConsumerWidget {
|
||||
apiClientProvider,
|
||||
);
|
||||
await apiClient.delete(
|
||||
'/id/accounts/me/devices/${device.deviceId}',
|
||||
'/pass/accounts/me/devices/${device.deviceId}',
|
||||
);
|
||||
ref.invalidate(authDevicesProvider);
|
||||
} catch (err) {
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'account_devices.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$authDevicesHash() => r'feb19238f759921e51c888f8b443a3d7761e68da';
|
||||
String _$authDevicesHash() => r'35735af4ed75b73fe80c8942e53b3bc26a569c01';
|
||||
|
||||
/// See also [authDevices].
|
||||
@ProviderFor(authDevices)
|
||||
|
||||
@@ -19,7 +19,7 @@ Future<List<SnAccount>> searchAccounts(Ref ref, {required String query}) async {
|
||||
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
final response = await apiClient.get(
|
||||
'/id/accounts/search',
|
||||
'/pass/accounts/search',
|
||||
queryParameters: {'query': query},
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'account_picker.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$searchAccountsHash() => r'fa3b8b7d51e14cf40d4116ba0ff0b6955fa0ff54';
|
||||
String _$searchAccountsHash() => r'3b4aa4d7970a1e406c1a0a1dfac2c686e05bc533';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
||||
@@ -31,7 +31,7 @@ class RestorePurchaseSheet extends HookConsumerWidget {
|
||||
try {
|
||||
final client = ref.read(apiClientProvider);
|
||||
await client.post(
|
||||
'/id/subscriptions/order/restore/${selectedProvider.value!}',
|
||||
'/pass/subscriptions/order/restore/${selectedProvider.value!}',
|
||||
data: {'order_id': orderIdController.text.trim()},
|
||||
);
|
||||
|
||||
|
||||
@@ -27,14 +27,18 @@ class CurrentAccountStatusNotifier extends StateNotifier<SnAccountStatus?> {
|
||||
}
|
||||
}
|
||||
|
||||
final currentAccountStatusProvider = StateNotifierProvider<CurrentAccountStatusNotifier, SnAccountStatus?>((ref) {
|
||||
return CurrentAccountStatusNotifier();
|
||||
});
|
||||
final currentAccountStatusProvider =
|
||||
StateNotifierProvider<CurrentAccountStatusNotifier, SnAccountStatus?>((
|
||||
ref,
|
||||
) {
|
||||
return CurrentAccountStatusNotifier();
|
||||
});
|
||||
|
||||
@riverpod
|
||||
Future<SnAccountStatus?> accountStatus(Ref ref, String uname) async {
|
||||
final userInfo = ref.watch(userInfoProvider);
|
||||
if (uname == 'me' || (userInfo.value != null && uname == userInfo.value!.name)) {
|
||||
if (uname == 'me' ||
|
||||
(userInfo.value != null && uname == userInfo.value!.name)) {
|
||||
final local = ref.watch(currentAccountStatusProvider);
|
||||
if (local != null) {
|
||||
return local;
|
||||
@@ -42,7 +46,7 @@ Future<SnAccountStatus?> accountStatus(Ref ref, String uname) async {
|
||||
}
|
||||
final apiClient = ref.watch(apiClientProvider);
|
||||
try {
|
||||
final resp = await apiClient.get('/id/accounts/$uname/statuses');
|
||||
final resp = await apiClient.get('/pass/accounts/$uname/statuses');
|
||||
return SnAccountStatus.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (err is DioException) {
|
||||
@@ -137,9 +141,13 @@ class AccountStatusWidget extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final userInfo = ref.watch(userInfoProvider);
|
||||
final localStatus = ref.watch(currentAccountStatusProvider);
|
||||
final status = (uname == 'me' || (userInfo.value != null && uname == userInfo.value!.name && localStatus != null))
|
||||
? AsyncValue.data(localStatus)
|
||||
: ref.watch(accountStatusProvider(uname));
|
||||
final status =
|
||||
(uname == 'me' ||
|
||||
(userInfo.value != null &&
|
||||
uname == userInfo.value!.name &&
|
||||
localStatus != null))
|
||||
? AsyncValue.data(localStatus)
|
||||
: ref.watch(accountStatusProvider(uname));
|
||||
final account = ref.watch(accountProvider(uname));
|
||||
|
||||
return Padding(
|
||||
@@ -166,16 +174,17 @@ class AccountStatusWidget extends HookConsumerWidget {
|
||||
onLongPress: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Activity Details'),
|
||||
content: buildActivityDetails(status.value),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Close'),
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
title: Text('Activity Details'),
|
||||
content: buildActivityDetails(status.value),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Tooltip(
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'status.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$accountStatusHash() => r'abc2f11f0fbaf637efc182cf85ab838936c4d875';
|
||||
String _$accountStatusHash() => r'4cac809808e6f1345dab06dc32d759cfcea13315';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
||||
@@ -33,7 +33,7 @@ class AccountStatusCreationSheet extends HookConsumerWidget {
|
||||
submitting.value = true;
|
||||
final user = ref.watch(userInfoProvider);
|
||||
final apiClient = ref.read(apiClientProvider);
|
||||
await apiClient.delete('/id/accounts/me/statuses');
|
||||
await apiClient.delete('/pass/accounts/me/statuses');
|
||||
if (!context.mounted) return;
|
||||
ref.invalidate(accountStatusProvider(user.value!.name));
|
||||
Navigator.pop(context);
|
||||
@@ -50,7 +50,7 @@ class AccountStatusCreationSheet extends HookConsumerWidget {
|
||||
final user = ref.watch(userInfoProvider);
|
||||
final apiClient = ref.read(apiClientProvider);
|
||||
await apiClient.request(
|
||||
'/id/accounts/me/statuses',
|
||||
'/pass/accounts/me/statuses',
|
||||
data: {
|
||||
'attitude': attitude.value,
|
||||
'is_invisible': isInvisible.value,
|
||||
|
||||
@@ -30,7 +30,7 @@ part 'stellar_program_tab.g.dart';
|
||||
Future<SnWalletSubscription?> accountStellarSubscription(Ref ref) async {
|
||||
try {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/id/subscriptions/fuzzy/solian.stellar');
|
||||
final resp = await client.get('/pass/subscriptions/fuzzy/solian.stellar');
|
||||
return SnWalletSubscription.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (err is DioException && err.response?.statusCode == 404) return null;
|
||||
@@ -46,7 +46,7 @@ Future<List<SnWalletGift>> accountSentGifts(
|
||||
}) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get(
|
||||
'/id/subscriptions/gifts/sent?offset=$offset&take=$take',
|
||||
'/pass/subscriptions/gifts/sent?offset=$offset&take=$take',
|
||||
);
|
||||
return (resp.data as List).map((e) => SnWalletGift.fromJson(e)).toList();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ Future<List<SnWalletGift>> accountReceivedGifts(
|
||||
}) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get(
|
||||
'/id/subscriptions/gifts/received?offset=$offset&take=$take',
|
||||
'/pass/subscriptions/gifts/received?offset=$offset&take=$take',
|
||||
);
|
||||
return (resp.data as List).map((e) => SnWalletGift.fromJson(e)).toList();
|
||||
}
|
||||
@@ -67,7 +67,7 @@ Future<List<SnWalletGift>> accountReceivedGifts(
|
||||
@riverpod
|
||||
Future<SnWalletGift> accountGift(Ref ref, String giftId) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/id/subscriptions/gifts/$giftId');
|
||||
final resp = await client.get('/pass/subscriptions/gifts/$giftId');
|
||||
return SnWalletGift.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,9 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final client = ref.watch(apiClientProvider);
|
||||
await client.post('/id/subscriptions/${membership.identifier}/cancel');
|
||||
await client.post(
|
||||
'/pass/subscriptions/${membership.identifier}/cancel',
|
||||
);
|
||||
ref.invalidate(accountStellarSubscriptionProvider);
|
||||
ref.read(userInfoProvider.notifier).fetchUser();
|
||||
if (context.mounted) {
|
||||
@@ -698,7 +700,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final resp = await client.post(
|
||||
'/id/subscriptions',
|
||||
'/pass/subscriptions',
|
||||
data: {
|
||||
'identifier': tierId,
|
||||
'payment_method': 'solian.wallet',
|
||||
@@ -710,7 +712,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
final subscription = SnWalletSubscription.fromJson(resp.data);
|
||||
if (subscription.status == 1) return;
|
||||
final orderResp = await client.post(
|
||||
'/id/subscriptions/${subscription.identifier}/order',
|
||||
'/pass/subscriptions/${subscription.identifier}/order',
|
||||
);
|
||||
final order = SnWalletOrder.fromJson(orderResp.data);
|
||||
|
||||
@@ -1221,7 +1223,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final resp = await client.post(
|
||||
'/id/subscriptions/gifts/purchase',
|
||||
'/pass/subscriptions/gifts/purchase',
|
||||
data: {
|
||||
'subscription_identifier': subscriptionId,
|
||||
if (recipientId != null) 'recipient_id': recipientId,
|
||||
@@ -1237,7 +1239,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
if (gift.status == 1) return; // Already paid
|
||||
|
||||
final orderResp = await client.post(
|
||||
'/id/subscriptions/gifts/${gift.id}/order',
|
||||
'/pass/subscriptions/gifts/${gift.id}/order',
|
||||
);
|
||||
final order = SnWalletOrder.fromJson(orderResp.data);
|
||||
|
||||
@@ -1258,7 +1260,9 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
// Get the updated gift
|
||||
final giftResp = await client.get('/id/subscriptions/gifts/${gift.id}');
|
||||
final giftResp = await client.get(
|
||||
'/pass/subscriptions/gifts/${gift.id}',
|
||||
);
|
||||
final updatedGift = SnWalletGift.fromJson(giftResp.data);
|
||||
|
||||
if (context.mounted) hideLoadingModal(context);
|
||||
@@ -1367,7 +1371,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
|
||||
// First check if gift can be redeemed
|
||||
final checkResp = await client.get(
|
||||
'/id/subscriptions/gifts/check/$giftCode',
|
||||
'/pass/subscriptions/gifts/check/$giftCode',
|
||||
);
|
||||
final checkData = checkResp.data as Map<String, dynamic>;
|
||||
|
||||
@@ -1379,7 +1383,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
|
||||
// Redeem the gift
|
||||
await client.post(
|
||||
'/id/subscriptions/gifts/redeem',
|
||||
'/pass/subscriptions/gifts/redeem',
|
||||
data: {'gift_code': giftCode},
|
||||
);
|
||||
|
||||
@@ -1424,7 +1428,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
await client.post('/id/subscriptions/gifts/${gift.id}/cancel');
|
||||
await client.post('/pass/subscriptions/gifts/${gift.id}/cancel');
|
||||
ref.invalidate(accountSentGiftsProvider);
|
||||
if (context.mounted) {
|
||||
hideLoadingModal(context);
|
||||
|
||||
@@ -7,7 +7,7 @@ part of 'stellar_program_tab.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$accountStellarSubscriptionHash() =>
|
||||
r'80abcdefb3868775fd8fe3c980215713efff5948';
|
||||
r'7cdfc7ca29aac240fc8704f4493498d87f307400';
|
||||
|
||||
/// See also [accountStellarSubscription].
|
||||
@ProviderFor(accountStellarSubscription)
|
||||
@@ -27,7 +27,7 @@ final accountStellarSubscriptionProvider =
|
||||
// ignore: unused_element
|
||||
typedef AccountStellarSubscriptionRef =
|
||||
AutoDisposeFutureProviderRef<SnWalletSubscription?>;
|
||||
String _$accountSentGiftsHash() => r'36fdf4e2be3805e8501cca1657d8be27aa891ef4';
|
||||
String _$accountSentGiftsHash() => r'460af8d22e16dc402848cb94e9b8a8a26d023c41';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
@@ -187,7 +187,7 @@ class _AccountSentGiftsProviderElement
|
||||
}
|
||||
|
||||
String _$accountReceivedGiftsHash() =>
|
||||
r'15f6f7e27aa0277b67b02dd72875ba3efd147dfd';
|
||||
r'1208c27cca49e154af073071a197b37a2703f56d';
|
||||
|
||||
/// See also [accountReceivedGifts].
|
||||
@ProviderFor(accountReceivedGifts)
|
||||
@@ -328,7 +328,7 @@ class _AccountReceivedGiftsProviderElement
|
||||
int get take => (origin as AccountReceivedGiftsProvider).take;
|
||||
}
|
||||
|
||||
String _$accountGiftHash() => r'598c5071fff3cc1dd7eb867df48d69fef04543db';
|
||||
String _$accountGiftHash() => r'70ca553e0b84cba9dfbee428f9bf44207138713a';
|
||||
|
||||
/// See also [accountGift].
|
||||
@ProviderFor(accountGift)
|
||||
|
||||
@@ -26,7 +26,7 @@ part 'check_in.g.dart';
|
||||
Future<SnCheckInResult?> checkInResultToday(Ref ref) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
try {
|
||||
final resp = await client.get('/id/accounts/me/check-in');
|
||||
final resp = await client.get('/pass/accounts/me/check-in');
|
||||
return SnCheckInResult.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (err is DioException) {
|
||||
@@ -42,7 +42,7 @@ Future<SnCheckInResult?> checkInResultToday(Ref ref) async {
|
||||
Future<SnNotableDay?> nextNotableDay(Ref ref) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
try {
|
||||
final resp = await client.get('/id/notable/me/next');
|
||||
final resp = await client.get('/pass/notable/me/next');
|
||||
return SnNotableDay.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
return null;
|
||||
@@ -94,7 +94,7 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
final client = ref.read(apiClientProvider);
|
||||
try {
|
||||
await client.post(
|
||||
'/id/accounts/me/check-in',
|
||||
'/pass/accounts/me/check-in',
|
||||
data: captchatTk == null ? null : jsonEncode(captchatTk),
|
||||
);
|
||||
ref.invalidate(checkInResultTodayProvider);
|
||||
|
||||
@@ -7,7 +7,7 @@ part of 'check_in.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$checkInResultTodayHash() =>
|
||||
r'402e3a3be0d441ae12b2370d19d09bf81326933f';
|
||||
r'b4dc97b2243f542b36c295dc5cce3fe6097cb308';
|
||||
|
||||
/// See also [checkInResultToday].
|
||||
@ProviderFor(checkInResultToday)
|
||||
@@ -26,7 +26,7 @@ final checkInResultTodayProvider =
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef CheckInResultTodayRef = AutoDisposeFutureProviderRef<SnCheckInResult?>;
|
||||
String _$nextNotableDayHash() => r'698370bec4be28774d332412c5a701f914064c90';
|
||||
String _$nextNotableDayHash() => r'c8404308f6b0f581cc7df251bce8f3c5ac130245';
|
||||
|
||||
/// See also [nextNotableDay].
|
||||
@ProviderFor(nextNotableDay)
|
||||
|
||||
@@ -241,7 +241,7 @@ class _PaymentContentState extends ConsumerState<_PaymentContent> {
|
||||
try {
|
||||
final client = ref.read(apiClientProvider);
|
||||
final response = await client.post(
|
||||
'/id/orders/${widget.order.id}/pay',
|
||||
'/pass/orders/${widget.order.id}/pay',
|
||||
data: {'pin_code': pin},
|
||||
);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ class PostAwardSheet extends HookConsumerWidget {
|
||||
final orderId = awardResponse.data['order_id'] as String;
|
||||
|
||||
// Fetch order details
|
||||
final orderResponse = await client.get('/id/orders/$orderId');
|
||||
final orderResponse = await client.get('/pass/orders/$orderId');
|
||||
final order = SnWalletOrder.fromJson(orderResponse.data);
|
||||
|
||||
if (context.mounted) {
|
||||
|
||||
@@ -43,7 +43,7 @@ class AbuseReportSheet extends HookConsumerWidget {
|
||||
try {
|
||||
final client = ref.read(apiClientProvider);
|
||||
await client.post(
|
||||
'/id/safety/reports',
|
||||
'/pass/safety/reports',
|
||||
data: {
|
||||
'resource_identifier': resourceIdentifier,
|
||||
'type': selectedType.value,
|
||||
|
||||
Reference in New Issue
Block a user