fluffychat/lib/pangea/subscription/models/web_subscriptions.dart
Brord van Wierst c0680b5294
feat: trial using choreo (#2435)
* RC trial

* generated

* fixed mobile

* reverted to resetSubscription

* generated

* fix for unloaded state

* generated

* chore: clean up some unused variables

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
Co-authored-by: ggurdin <ggurdin@gmail.com>
2025-04-25 12:45:56 -04:00

35 lines
1.1 KiB
Dart

import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/subscription/models/base_subscription_info.dart';
import 'package:fluffychat/pangea/subscription/repo/subscription_repo.dart';
class WebSubscriptionInfo extends CurrentSubscriptionInfo {
WebSubscriptionInfo({
required super.userID,
required super.availableSubscriptionInfo,
required super.history,
});
@override
Future<void> setCurrentSubscription() async {
if (currentSubscriptionId != null) return;
try {
final rcResponse = await SubscriptionRepo.getCurrentSubscriptionInfo(
userID,
availableSubscriptionInfo.allProducts,
);
currentSubscriptionId = rcResponse.currentSubscriptionId;
expirationDate = rcResponse.expirationDate;
} catch (err) {
currentSubscriptionId = AppConfig.errorSubscriptionId;
}
if (currentSubscriptionId != null && currentSubscription == null) {
Sentry.addBreadcrumb(
Breadcrumb(message: "mismatch of productIds and currentSubscriptionID"),
);
}
}
}