Skip to content

Commit

Permalink
Stateobject instantiation fix (#4271)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrb1 authored Sep 13, 2024
1 parent 38688f7 commit af1e39f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions RevenueCatUI/CustomerCenter/Views/FeedbackSurveyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ struct FeedbackSurveyView: View {

init(feedbackSurveyData: FeedbackSurveyData,
customerCenterActionHandler: CustomerCenterActionHandler?) {
let viewModel = FeedbackSurveyViewModel(feedbackSurveyData: feedbackSurveyData,
customerCenterActionHandler: customerCenterActionHandler)
self._viewModel = StateObject(wrappedValue: viewModel)
self._viewModel = StateObject(wrappedValue: FeedbackSurveyViewModel(
feedbackSurveyData: feedbackSurveyData,
customerCenterActionHandler: customerCenterActionHandler
))
}

var body: some View {
Expand Down
12 changes: 7 additions & 5 deletions RevenueCatUI/CustomerCenter/Views/PromotionalOfferView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ struct PromotionalOfferView: View {
init(promotionalOffer: PromotionalOffer,
product: StoreProduct,
promoOfferDetails: CustomerCenterConfigData.HelpPath.PromotionalOffer) {
let promotionalOfferData = PromotionalOfferData(promotionalOffer: promotionalOffer,
product: product,
promoOfferDetails: promoOfferDetails)
let viewModel = PromotionalOfferViewModel(promotionalOfferData: promotionalOfferData)
self._viewModel = StateObject(wrappedValue: viewModel)
_viewModel = StateObject(wrappedValue: PromotionalOfferViewModel(
promotionalOfferData: PromotionalOfferData(
promotionalOffer: promotionalOffer,
product: product,
promoOfferDetails: promoOfferDetails
)
))
}

var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ extension SamplePaywallsList {
print("CustomerCenter: refundRequestStarted. ProductId: \(productId)")
case .refundRequestCompleted(let status):
print("CustomerCenter: refundRequestCompleted. Result: \(status)")
case .feedbackSurveyCompleted(let surveyOptionID):
print("CustomerCenter: feedbackSurveyCompleted. Result: \(surveyOptionID)")
}
}
}
Expand Down

0 comments on commit af1e39f

Please sign in to comment.