ApparenceKit CLI 3.0.0 release note: RevenueCat, Anonymous authentication and more

Gautier SiclonGautier Siclon
4 min read

ApparenceKit has now been updated to version 3.0.0. This update brings a lot of new features and improvements.
It's been 6 months since ApparenceKit was released. It's been a great success and I am very proud of it.
With this new version, I hope to make it even better and more useful for you.
A lot of improvements have been suggested by the community and I am very grateful for that.
Let's see what's new.

Anonymous signup mode

On setup you will be prompted to activate anonymous signup. This allows a user to access your app without login. An id and security token will be generated without any email, social auth or phone number. Currently this only work with firebase. (Supabase is currently working on it See https://github.com/supabase/gotrue/issues/68#issuecomment-1836671954) For rest API you can still activate it by changing the current mode in environment: But you will have to implements the auth api signupAnonymously.

authenticationMode: AuthenticationMode.authRequired, // change it to anonymous

Changes

User anonymous state has now an optionnal ID

const factory User.anonymous({String? id}) = AnonymousUserData;
  • Getting the id from the user now correctly return an ID if logged in anonymously
String get idOrThrow => map(
        authenticated: (value) => value.id!,
        anonymous: (value) {
          if (value.id != null) {
            return value.id!;
          }
          throw "user is not connected";
        } 
        loading: (_) => throw "user is not connected",
      );

Firebase authentication new methods

  • signupFromAnonymousWithGoogle

  • signupFromAnonymousWithApple

Sign up with Google or Apple and link the account to the current anonymous user. The anonymous account will now be linked to the Apple account. The user can now sign in with his Apple account on another device. His data will be preserved.

If you want to sign in to a previous account call signinWithApple or signinWithGoogle.

  • onLinkedAccount

As Firebase does not have any trigger for when a user links an account, you might want to call this function after it. So you can for example add the user email to your email marketing list


Rating popup pre-request

Apple store and Play Store limit the number of time you can ask a user for a rating. (nearly 3 times a year only) As you may know, Rating is one of the most important things to grow an app. A pre-request popup asking the user if he has 10 seconds to give your app a rating before showing the real rating popup from the system.

showRatingPopup(WidgetRef ref) {...}

You can call it from any widget using riverpod. You won't have to bother about spaming the user. The method will check if it should show the popup or not.

  • it will save the last request time and user answer

  • Won't show again if user has recently see the request (delay param can be changed)

  • Won't show again if user said once "Yes"

See lib/core/rating/models/rating.dart for more details.


Current theme is now saved in user preferences

ApparenceKit provides a complete theme enhancement. Simplifiying text theme, colors, and more. (See this article about our theme system)

It also provides a way to switch between light and dark mode easily, but this wasn't saved in the user preferences. This is now done.
The current theme is now saved in SharedPreferences without anything to do.
Meaning that if the user switches to dark mode, the app will open in dark mode the next time he opens it.


Migrating in-app payment to RevenueCat

Motivation RevenueCat is the most popular by far for handling in-app payments. It's also now the most reliable option and so we are migrating to this solution completely. (I could have maintained both solutions but this would require too much effort).

The module still includes a template of a paywall that you can customize to fit your needs. If the subscription is active the active subscription content page will be automatically shown.

As revenuecat allows you to tweak the shown subscriptions you can easily test your subscription prices.


BugFixes

  • Android notification deserialization should be made from RemoteMessage.notification property

  • Purchase now correctly update state after payment


Conclusion

I hope you will enjoy this new version.
I also use it to create apps with it and includes the best practices I learn from my experience. The documentation has also been updated to reflect these changes.
Don't hesitate to give me feedback or ask for new features.

0
Subscribe to my newsletter

Read articles from Gautier Siclon directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Gautier Siclon
Gautier Siclon