Skip to content

Commit

Permalink
cast subscription duration as enum value
Browse files Browse the repository at this point in the history
  • Loading branch information
ggurdin committed Nov 4, 2024
1 parent b1524bc commit 542958d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/pangea/repo/subscription_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ class SubscriptionRepo {
final RCProductsResponseModel resp =
RCProductsResponseModel.fromJson(json);
return resp.allProducts;
} catch (err) {
ErrorHandler.logError(
m: "Failed to fetch entitlement information for revenuecat API",
s: StackTrace.current,
);
} catch (err, s) {
ErrorHandler.logError(e: err, s: s);
return null;
}
}
Expand Down Expand Up @@ -97,7 +94,9 @@ class RCProductsResponseModel {
.map(
(offering) => SubscriptionDetails(
price: offering['price'],
duration: offering['duration'],
duration: SubscriptionDuration.values.firstWhereOrNull(
(duration) => duration.value == offering['duration'],
),
id: offering['id'],
appId: offering['appId'],
),
Expand Down

0 comments on commit 542958d

Please sign in to comment.