diff --git a/datalayer/watch/api/current.api b/datalayer/watch/api/current.api index 56e7154b2e..9f19b3d55a 100644 --- a/datalayer/watch/api/current.api +++ b/datalayer/watch/api/current.api @@ -11,8 +11,6 @@ package com.google.android.horologist.datalayer.watch { method public suspend Object? markComplicationAsDeactivated(int complicationInstanceId, kotlin.coroutines.Continuation); method public suspend Object? markSetupComplete(kotlin.coroutines.Continuation); method public suspend Object? markSetupNoLongerComplete(kotlin.coroutines.Continuation); - method @Deprecated public suspend Object? markTileAsInstalled(String tileName, kotlin.coroutines.Continuation); - method @Deprecated public suspend Object? markTileAsRemoved(String tileName, kotlin.coroutines.Continuation); method @CheckResult public suspend Object? startCompanion(String nodeId, kotlin.coroutines.Continuation); method public suspend Object? updateInstalledTiles(kotlin.coroutines.Continuation); property public kotlinx.coroutines.flow.Flow> connectedAndInstalledNodes; diff --git a/datalayer/watch/src/main/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelper.kt b/datalayer/watch/src/main/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelper.kt index c317577e3a..bf193d18c9 100644 --- a/datalayer/watch/src/main/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelper.kt +++ b/datalayer/watch/src/main/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelper.kt @@ -151,28 +151,6 @@ public class WearDataLayerAppHelper internal constructor( return sendRequestWithTimeout(nodeId, LAUNCH_APP, request.toByteArray()) } - /** - * Marks a tile as installed. Call this in [TileService#onTileAddEvent]. Supplying a name is - * mandatory to disambiguate from the installation or removal of other tiles your app may have. - * - * @param tileName The name of the tile. - */ - @Deprecated("Please use updateInstalledTiles instead") - public suspend fun markTileAsInstalled(tileName: String) { - surfacesInfoDataStore.updateData { info -> - val tile = tileInfo { - timestamp = System.currentTimeMillis().toProtoTimestamp() - name = tileName - } - info.copy { - val exists = tiles.find { it.equalWithoutTimestamp(tile) } != null - if (!exists) { - tiles.add(tile) - } - } - } - } - /** * Updates the list of currently installed tiles on this watch. * @@ -269,29 +247,6 @@ public class WearDataLayerAppHelper internal constructor( } } - /** - * Marks a tile as removed. Call this in [TileService#onTileRemoveEvent]. Supplying a name is - * mandatory to disambiguate from the installation or removal of other tiles your app may have. - * - * @param tileName The name of the tile. - */ - @Deprecated("Please use updateInstalledTiles instead") - public suspend fun markTileAsRemoved(tileName: String) { - surfacesInfoDataStore.updateData { info -> - val tile = tileInfo { - timestamp = System.currentTimeMillis().toProtoTimestamp() - name = tileName - } - info.copy { - val filtered = tiles.filter { !tile.equalWithoutTimestamp(it) } - if (filtered.size != tiles.size) { - tiles.clear() - tiles.addAll(filtered) - } - } - } - } - /** * Marks a complication as activated. Call this in * [ComplicationDataSourceService.onComplicationActivated]. diff --git a/datalayer/watch/src/test/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelperTest.kt b/datalayer/watch/src/test/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelperTest.kt index 66532912dd..258d0a1e3b 100644 --- a/datalayer/watch/src/test/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelperTest.kt +++ b/datalayer/watch/src/test/java/com/google/android/horologist/datalayer/watch/WearDataLayerAppHelperTest.kt @@ -77,43 +77,6 @@ class WearDataLayerAppHelperTest { coroutineContext.cancelChildren() } - @Test - fun testTiles() = runTest { - val context = ApplicationProvider.getApplicationContext() - val registry = WearDataLayerRegistry.fromContext(context, this) - - val testDataStore: DataStore = - DataStoreFactory.create( - scope = this, - produceFile = { context.dataStoreFile("testTiles") }, - serializer = SurfacesInfoSerializer, - ) - - val helper = WearDataLayerAppHelper( - context = context, - registry = registry, - appStoreUri = null, - scope = this, - surfacesInfoDataStoreFn = { testDataStore }, - ) - - val infoInitial = testDataStore.data.first() - assertThat(infoInitial.tilesList).isEmpty() - - helper.markTileAsInstalled("my.SampleTileService") - - val infoUpdated = testDataStore.data.first() - assertThat(infoUpdated.tilesList).hasSize(1) - assertThat(infoUpdated.tilesList.first().name).isEqualTo("my.SampleTileService") - - helper.markTileAsRemoved("my.SampleTileService") - - val infoReverted = testDataStore.data.first() - assertThat(infoReverted.tilesList).isEmpty() - - coroutineContext.cancelChildren() - } - @Test fun testComplications() = runTest { val context = ApplicationProvider.getApplicationContext()