Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Customer Center] Slight improvement to the Customer Center Promotional Offer view #4554

Merged
merged 5 commits into from
Dec 6, 2024

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Dec 5, 2024

The promo offer view felt pretty barren. This is a very small update, but I feel like it looks significantly better this way.

All I'm doing is reading the icon from the bundle if available. If the image cannot be loaded, it looks exactly the same as it used to.

Before After
Screenshot 2024-12-05 at 6 18 10 PM Screenshot 2024-12-05 at 6 17 30 PM
Screenshot 2024-12-05 at 6 22 21 PM image

@aboedo aboedo requested review from fire-at-will and a team December 5, 2024 21:30
@aboedo aboedo self-assigned this Dec 5, 2024
@aboedo
Copy link
Member Author

aboedo commented Dec 5, 2024

@vegaro genuinely not sure what the labels should be - it's customer center but not really a feature, went with "other"

@@ -110,7 +143,6 @@ struct PromotionalOfferHeaderView: View {
private(set) var viewModel: PromotionalOfferViewModel

private let spacing: CGFloat = 30
private let topPadding: CGFloat = 150
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the padding from here to the icon view so it can be controlled from there

Comment on lines 119 to 127
private enum AppIconHelper {
static func getAppIcon() -> UIImage? {
guard let iconsDictionary = Bundle.main.infoDictionary?["CFBundleIcons"] as? [String: Any],
let primaryIcons = iconsDictionary["CFBundlePrimaryIcon"] as? [String: Any],
let iconFiles = primaryIcons["CFBundleIconFiles"] as? [String],
let lastIcon = iconFiles.last else {
return nil
}
return UIImage(named: lastIcon)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just fetch the app icon, seems to work well in my testing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 looks a bit blurry actually, maybe I can do something to ensure we're always getting the highest-res version

@@ -62,6 +62,12 @@ struct PromotionalOfferView: View {

VStack {
if self.viewModel.error == nil {

AppIconView()
.padding(.top, 100)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this padding is always applied, the padding will still be present even if the AppIconView() is just an EmptyView(), which could make the layout look off if the app icon can't be found for some reason. I'd consider making a static property on AppIconView called canDisplay and then conditionally setting the top padding based on that value, like:

.padding(.top, AppIconView.canDisplay ? 100 : 0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think you switched the missing case from being an EmptyView() to a Color.clear while I was reviewing. Ignore this comment since we want to preserve the space!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sorry for the switcheroo, I had uncommitted code. I guess I'm starting to forget how to do PRs properly

@aboedo
Copy link
Member Author

aboedo commented Dec 5, 2024

🤔 actually I think we might not wanna merge this and instead have the image in the backend unfortunately.

The image is blurred, since the only icon that is actually embedded in the app is the size that the app would need. So I just get a 60x60 icon, doesn't look great

@aboedo
Copy link
Member Author

aboedo commented Dec 5, 2024

Taking it down to 60 px and updating the corner radius does give a pretty reasonable result
simulator_screenshot_A11866A3-5FC8-42D2-B657-CD60BC5F8484

@aboedo
Copy link
Member Author

aboedo commented Dec 5, 2024

it's similar to what StoreKit Views do by default
Screenshot 2024-12-05 at 7 05 25 PM

Copy link
Contributor

@vegaro vegaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it. It takes de screen to the next level

@aboedo
Copy link
Member Author

aboedo commented Dec 6, 2024

ok, final version.
I updated the size to 70x70, which seems to roughly match StoreKit's SubscriptionStoreView sizing for their equivalent. The icon is technically 60x60, but at that size it doesn't look blurry or stretched to my eye

Here's what it looks like, when the icon can be picked up and when it can't

Screenshot 2024-12-06 at 5 53 22 PM Screenshot 2024-12-06 at 5 53 12 PM
Screenshot 2024-12-06 at 5 55 57 PM Screenshot 2024-12-06 at 5 56 08 PM

@aboedo aboedo enabled auto-merge (squash) December 6, 2024 21:04
@aboedo aboedo merged commit f1e4ca5 into main Dec 6, 2024
9 of 10 checks passed
@aboedo aboedo deleted the andy/promotional_offer_view_improvements branch December 6, 2024 21:08
@vegaro vegaro added pr:feat A new feature pr:RevenueCatUI and removed pr:other labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants