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

Improve tracking Tile installation #2066

Open
luizgrp opened this issue Feb 26, 2024 · 2 comments
Open

Improve tracking Tile installation #2066

luizgrp opened this issue Feb 26, 2024 · 2 comments
Labels
datalayer Related to datalayer modules

Comments

@luizgrp
Copy link
Member

luizgrp commented Feb 26, 2024

Since getActiveTilesAsync became available, our guidance should be updated to use it, instead of using the information provided by onTileAddEvent and onTileRemoveEvent.


Suggestion:

  1. Remove markTileAsInstalled and markTileAsRemoved functions;
  2. Add function to update the tracking of installed tiles:
    public suspend fun updateInstalledTiles() {
        val activeTiles = TileService.getActiveTilesAsync(context, executor).await()

        surfacesInfoDataStore.updateData { info ->
            info.copy {
                tiles.clear()
                for (activeTileIdentifier in activeTiles) {
                    tiles.add(tileInfo {
                        timestamp = System.currentTimeMillis().toProtoTimestamp()
                        name = activeTileIdentifier.componentName.className
                    })
                }
            }
        }
    }
  1. Update guidance in https://google.github.io/horologist/datalayer-helpers-guide/ to call updateInstalledTiles in onTileAddEvent and onTileRemoveEvent.
@luizgrp luizgrp added the datalayer Related to datalayer modules label Feb 26, 2024
@luizgrp
Copy link
Member Author

luizgrp commented Feb 26, 2024

@yschimke @garanj please review.

@garanj
Copy link
Collaborator

garanj commented Feb 27, 2024

Looks good!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datalayer Related to datalayer modules
Projects
None yet
Development

No branches or pull requests

2 participants