Skip to content

Compose sample app#1056

Merged
tonidero merged 12 commits into
mainfrom
compose-sample-app
Jun 22, 2023
Merged

Compose sample app#1056
tonidero merged 12 commits into
mainfrom
compose-sample-app

Conversation

@tonidero

@tonidero tonidero commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

Description

This PR adds a new sample app MagicWeatherCompose, very similar to the existing MagicWeather but using Jetpack Compose. Many things are copied over from MagicWeather including the actual weather change logic and the purchase SDK setup. It does change how we interact with the SDK from there.

To better understand the code, this app has 2 main screens:

  • Main
  • Paywall

The Main screen has a bottom navigation view and has 2 subscreens, Weather and User.

This can be a better sample for more modern android development. Things remaining:

  • Build app on every PR, to make sure it compiles.
  • Improve UI
  • Use coroutines
  • Add some global state instead of always performing getCustomerInfo, so we can use it to listen to the customer info listener.
device-2023-06-07-170206.mp4

@tonidero tonidero added the test label Jun 7, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I copied this from the existing MagicWeather to be able to run it with both Google and Amazon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried to do this in a way that it could be extracted to a library in the future if needed 😏 . Made an assumption by using architecture component view models, which we could potentially remove, but this is how I imagine a view that can just be used by anyone using jetpack compose. cc @RevenueCat/coresdk

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

asks ChatGPT what "architecture component view models" means

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment thread config/detekt/detekt.yml Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All this is mostly copied from the existing MagicWeather

@codecov

codecov Bot commented Jun 7, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1056 (8ceb316) into main (9f617e1) will not change coverage.
The diff coverage is n/a.

❗ Current head 8ceb316 differs from pull request most recent head 5ab1901. Consider uploading reports for the commit 5ab1901 to get more accurate results

@@           Coverage Diff           @@
##             main    #1056   +/-   ##
=======================================
  Coverage   85.86%   85.86%           
=======================================
  Files         179      179           
  Lines        6362     6362           
  Branches      876      876           
=======================================
  Hits         5463     5463           
  Misses        557      557           
  Partials      342      342           

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally we would improve the UI to also display free trials and what not. But as a sample app it's functional for now.,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can always iterate as we feel the need

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This are the default app icons for a template app. Could customize them but don't want to dedicate more time to a sample app

@tonidero tonidero marked this pull request as ready for review June 15, 2023 09:31
@tonidero tonidero requested a review from a team June 15, 2023 09:31
Comment on lines 94 to 111

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so clean

Comment on lines 28 to 34

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is pretty much exactly like SwiftUI, love it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

honestly kinda better syntax

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

asks ChatGPT what "architecture component view models" means

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment on lines 59 to 71

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hard for me to convey how much I love this ❤️

Comment on lines 23 to 80

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can always iterate as we feel the need

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a blocker, but do you think there's a way we can remove the number of parameters of this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, thinking about it, we definitely should add a listener of some sort, instead of adding all those callbacks. Might do that in a different PR. That would join 4 parameters into 1. As for the others, I think they need to be there, but we can think of ways to refactor.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could add another one here that gets the active entitlements by doing active.keys

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, I think that makes sense, but we are currently not displaying the active entitlements anywhere, only whether a user has any active entitlements or not.

We could add a place where it displays the active entitlements, and checks that it has the correct one instead, as we do in the current magic weather, this just seemed a simpler approach, but I'm ok changing it. Thoughts? @vegaro

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Talked with @vegaro. Done in 5ab1901

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can use the gradle library catalogs, but we can do it in another PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I thought about that. Going to make that change in another PR, so we are using catalogs everywhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in #1081

@tonidero tonidero enabled auto-merge (squash) June 22, 2023 12:07
@tonidero tonidero merged commit 6b2581a into main Jun 22, 2023
@tonidero tonidero deleted the compose-sample-app branch June 22, 2023 12:15
@tonidero tonidero restored the compose-sample-app branch June 22, 2023 12:21
@tonidero tonidero deleted the compose-sample-app branch June 22, 2023 12:25
tonidero added a commit that referenced this pull request Jun 22, 2023
### Description
This PR moves the new jetpack compose sample app added in #1056 to use
gradle catalogs as added in #1059.
tonidero pushed a commit that referenced this pull request Jun 23, 2023
**This is an automatic release.**

### Bugfixes
* Default customer info schema version to latest known by SDK (#1080)
via Toni Rico (@tonidero)
* Handle other diagnostics-related exceptions (#1076) via Toni Rico
(@tonidero)
* Return error in queryPurchases if error connecting to billing client
(#1072) via Toni Rico (@tonidero)
### Other Changes
* Fix offline entitlements integration tests (#1085) via Toni Rico
(@tonidero)
* Add defaultsRelease variant tests run configuration (#1074) via Toni
Rico (@tonidero)
* Compose sample app: move to gradle catalog (#1081) via Toni Rico
(@tonidero)
* Compose sample app: automate builds (#1082) via Toni Rico (@tonidero)
* Compose sample app (#1056) via Toni Rico (@tonidero)
* Migrate to Gradle version catalog (#1059) via Cesar de la Vega
(@vegaro)
* Trusted entitlements: Add logs with verification mode (#1067) via Toni
Rico (@tonidero)
* Sync pending purchases before getting customer info (#1073) via Toni
Rico (@tonidero)
* Refactor syncing pending transactions logic out of `Purchases` (#1058)
via Toni Rico (@tonidero)
* Refactor CustomerInfo listener and cache logic into
CustomerInfoUpdater (#1052) via Toni Rico (@tonidero)
* Trusted entitlements: Add integration tests (#1071) via Toni Rico
(@tonidero)
* Trusted entitlements: Add internal mechanism to force signing errors
for tests (#1070) via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants