u/Western_Office3092

Clean package structure

Hi Android devs!

My biggest concern right now about code structure of my app is the package tree: it is really a mess! Right now I follow this structure:

- root
    - feature 1
      - ui
      - data
      - domain
      - di
        - Feature1HiltModule
    - feature 2
    - feature 3
    - library
    - ui (reusable composable that aren't bound with any feature)
    - data (app database)
    - di (global module for global usecases)
    - domain (utilites usecases)

But slowly it is becoming a mess: recently I added a force update feature, which have its own package, for that I added a Firebase library in its own package. Two packages for one simple feature, two di modules.

Even tho I have few features, it is becoming awkward and I need extra time to search for the package I want.

How do you organize your packages? Let me know down in the comments!

reddit.com
u/Western_Office3092 — 4 days ago

Force users to update their version of my app using Firebase Remote Config

Hi Firebase users! I wanted to force my users to update their version of the app using Firebase Remote Config that every version would fetch and decides if it should update itself. But I don't know what strategy to use: according to this article there are 3 strategies available to me:

  • The first strategy is excluded because showing a blocking screen after the user has already start using the app is a big UI/UX impact
  • The second strategy consists of basically waiting to show the app UI and hiding the loading behind a loading screen, which might be the best strategy if the user has a good internet
  • The third strategy consists of downloading the data for the next startup and ignoring them for the current session, this strategy is also excluded because if the user didn't open the app for a big time like a month, it would not show the blocking screen if needed.

I then thought of a hybrid strategy between 2 and 3:

  • I first check the cache, if that says that I have an obsolete version I immediately block the user,
  • If the cache let me pass, I fetch and I block the user if needed in a 5 seconds window after the internet request.
  • After that 5 seconds window I let the user pass, but I continue to fetch in background for the next startup.

What do you think of my hybrid strategy? Should I use it or do you suggest me another approach? How did you do in your app? Let me know down the comments!

EDIT: I'm asking about loading strategies to use in an android app

Note: if you want to give code samples I would like them in Kotlin, using compose for the UI. Thanks!

reddit.com
u/Western_Office3092 — 7 days ago