Skip to content

Commit

Permalink
This mostly works
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdholtz committed Jan 6, 2025
1 parent f7b6a15 commit a5afdae
Show file tree
Hide file tree
Showing 7 changed files with 1,014 additions and 0 deletions.
24 changes: 24 additions & 0 deletions RevenueCat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
030890812D2B764D0069677B /* VariableHandlerV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030890802D2B76450069677B /* VariableHandlerV2.swift */; };
030890842D2B77E70069677B /* VariableHandlerV2Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030890832D2B77E20069677B /* VariableHandlerV2Tests.swift */; };
0313FD41268A506400168386 /* DateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313FD40268A506400168386 /* DateProvider.swift */; };
03A98CEF2D1EE048009BCA61 /* FallbackComponentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A98CEE2D1EE040009BCA61 /* FallbackComponentTests.swift */; };
03A98CF12D222F5F009BCA61 /* FallbackComponentPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A98CF02D222F53009BCA61 /* FallbackComponentPreview.swift */; };
Expand Down Expand Up @@ -1236,6 +1238,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
030890802D2B76450069677B /* VariableHandlerV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VariableHandlerV2.swift; sourceTree = "<group>"; };
030890832D2B77E20069677B /* VariableHandlerV2Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VariableHandlerV2Tests.swift; sourceTree = "<group>"; };
0313FD40268A506400168386 /* DateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateProvider.swift; sourceTree = "<group>"; };
03A98CEE2D1EE040009BCA61 /* FallbackComponentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FallbackComponentTests.swift; sourceTree = "<group>"; };
03A98CF02D222F53009BCA61 /* FallbackComponentPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FallbackComponentPreview.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2440,6 +2444,22 @@
path = StoreKit2;
sourceTree = "<group>";
};
0308907F2D2B76340069677B /* Variables */ = {
isa = PBXGroup;
children = (
030890802D2B76450069677B /* VariableHandlerV2.swift */,
);
path = Variables;
sourceTree = "<group>";
};
030890822D2B77DD0069677B /* PaywallsV2 */ = {
isa = PBXGroup;
children = (
030890832D2B77E20069677B /* VariableHandlerV2Tests.swift */,
);
path = PaywallsV2;
sourceTree = "<group>";
};
03A98D2E2D240C2D009BCA61 /* RevenueCatUI */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4711,6 +4731,7 @@
887A62242C1D168B00E1A461 /* RevenueCatUITests */ = {
isa = PBXGroup;
children = (
030890822D2B77DD0069677B /* PaywallsV2 */,
3544DA6B2C2C848E00704E9D /* CustomerCenter */,
887A612D2C1D168B00E1A461 /* Data */,
887A61362C1D168B00E1A461 /* Helpers */,
Expand Down Expand Up @@ -4752,6 +4773,7 @@
children = (
88B1BAE32C813A3C001B7EE5 /* PaywallsV2View.swift */,
2C7457492CEA6B06004ACE52 /* EnvironmentObjects */,
0308907F2D2B76340069677B /* Variables */,
2C7457442CEA652B004ACE52 /* ViewHelpers */,
2C7457452CEA653A004ACE52 /* ViewModelHelpers */,
2C7457432CEA6470004ACE52 /* Components */,
Expand Down Expand Up @@ -6647,6 +6669,7 @@
887A60842C1D037000E1A461 /* ConsistentPackageContentView.swift in Sources */,
887A60C42C1D037000E1A461 /* IconView.swift in Sources */,
887A60732C1D037000E1A461 /* ProcessedLocalizedConfiguration.swift in Sources */,
030890812D2B764D0069677B /* VariableHandlerV2.swift in Sources */,
887A606F2C1D037000E1A461 /* PaywallData+Validation.swift in Sources */,
88A543DF2C37A45B0039C6A5 /* TemplatePackageSetting.swift in Sources */,
3546355D2C391F38001D7E85 /* PromotionalOfferViewModel.swift in Sources */,
Expand Down Expand Up @@ -6694,6 +6717,7 @@
887A63412C1D177800E1A461 /* BaseSnapshotTest.swift in Sources */,
887A63422C1D177800E1A461 /* ImageLoaderTests.swift in Sources */,
887A63432C1D177800E1A461 /* LocalizationTests.swift in Sources */,
030890842D2B77E70069677B /* VariableHandlerV2Tests.swift in Sources */,
FD6186542D1393FA007843DA /* MockCustomerCenterStoreKitUtilities.swift in Sources */,
887A63442C1D177800E1A461 /* PaywallFooterTests.swift in Sources */,
887A63452C1D177800E1A461 /* PaywallViewEventsTests.swift in Sources */,
Expand Down
14 changes: 14 additions & 0 deletions RevenueCatUI/Helpers/Package+VariableDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ extension Package: VariableDataProvider {
return self.storeProduct.localizedPriceString
}
}

func localizedPricePerDay(showZeroDecimalPlacePrices: Bool = false) -> String {
guard let price = self.storeProduct.localizedPricePerDay else {
Logger.warning(Strings.package_not_subscription(self))
return self.storeProduct.localizedPriceString
}

if showZeroDecimalPlacePrices && isPriceEndingIn00Cents(price) {
return formatAsZeroDecimalPlaces(price)
} else {
return price
}

}

func localizedPricePerWeek(showZeroDecimalPlacePrices: Bool = false) -> String {
guard let price = self.storeProduct.localizedPricePerWeek else {
Expand Down
Loading

0 comments on commit a5afdae

Please sign in to comment.