Skip to content

Commit 1652564

Browse files
authored
Merge branch 'main' into feature/app-updates
2 parents cbd0e44 + 440cd53 commit 1652564

File tree

5 files changed

+138
-13
lines changed

5 files changed

+138
-13
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ The app combines a variety of different Google technologies, such as:
3131
Place the file in the app folder: `app/google-services.json`. Be sure to enable [Vertex AI API](https://console.cloud.google.com/apis/library/aiplatform.googleapis.com).
3232
Ensure to also enable [AppCheck](https://console.firebase.google.com/project/_/appcheck) on your Firebase project to prevent API abuse.
3333
3. This project makes use of remote config on Firebase. In [`remote_config_defaults.xml`](core/network/src/main/res/xml/remote_config_defaults.xml), update the value of [`use_imagen`](core/network/src/main/res/xml/remote_config_defaults.xml#L40) to `true`, then import the [Firebase Remote config](https://firebase.google.com/docs/remote-config) settings from
34-
[`remote_config_defaults.xml`](core/network/src/main/res/xml/remote_config_defaults.xml)
34+
[`remote_config_defaults.xml`](core/network/src/main/res/xml/remote_config_defaults.xml).
35+
- Navigate to your Firebase project console.
36+
- In the left-hand menu, under the "Run" section, select "Remote Config".
37+
- Click on the "Upload template" button.
38+
- Browse and select the `[setup/remote_config_defaults.json](setup/remote_config_defaults.json)` file from your local repository.
39+
- Click "Publish" to apply the settings.
3540
4. If you'd like to change the font that the app renders with, an optional spec can be placed in
3641
`~/.gradle/gradle.properties` file:
3742

feature/creation/src/main/java/com/android/developers/androidify/creation/CreationScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fun CreationScreen(
8989
onUndoPressed = creationViewModel::onUndoPressed,
9090
onPromptGenerationPressed = creationViewModel::onPromptGenerationClicked,
9191
onBotColorSelected = creationViewModel::onBotColorChanged,
92-
onStartClicked = creationViewModel::startClicked,
92+
onStartClicked = creationViewModel::onStartClicked,
9393
onDropCallback = creationViewModel::onImageSelected,
9494
)
9595
}

feature/creation/src/main/java/com/android/developers/androidify/creation/CreationViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class CreationViewModel @AssistedInject constructor(
132132
}
133133
}
134134

135-
fun startClicked() {
135+
fun onStartClicked() {
136136
imageGenerationJob?.cancel()
137137
imageGenerationJob = viewModelScope.launch {
138138
if (internetConnectivityManager.isInternetAvailable()) {

feature/creation/src/test/kotlin/com/android/developers/androidify/creation/CreationViewModelTest.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class CreationViewModelTest {
130130
}
131131

132132
@Test
133-
fun startClicked_GenerateBotFromPhoto() = runTest {
133+
fun onStartClicked_GenerateBotFromPhoto() = runTest {
134134
val screenStateValues = mutableListOf<ScreenState>()
135135
backgroundScope.launch(UnconfinedTestDispatcher()) {
136136
viewModel.uiState.collect {
@@ -140,13 +140,13 @@ class CreationViewModelTest {
140140

141141
viewModel.onImageSelected(Uri.parse("content://test/image.jpg"))
142142
viewModel.onSelectedPromptOptionChanged(PromptType.PHOTO)
143-
viewModel.startClicked()
143+
viewModel.onStartClicked()
144144
assertEquals(ScreenState.EDIT, viewModel.uiState.value.screenState)
145145
assertNotNull(viewModel.uiState.value.resultBitmapUri)
146146
}
147147

148148
@Test
149-
fun startClicked_GenerateBotFromPhoto_NoPhotoSelected() = runTest {
149+
fun onStartClicked_GenerateBotFromPhoto_NoPhotoSelected() = runTest {
150150
val values = mutableListOf<SnackbarHostState>()
151151

152152
backgroundScope.launch(UnconfinedTestDispatcher()) {
@@ -156,7 +156,7 @@ class CreationViewModelTest {
156156
}
157157

158158
viewModel.onSelectedPromptOptionChanged(PromptType.PHOTO)
159-
viewModel.startClicked()
159+
viewModel.onStartClicked()
160160
assertEquals(ScreenState.EDIT, viewModel.uiState.value.screenState)
161161
assertNotNull(
162162
"Choose an image or use a prompt instead.",
@@ -165,7 +165,7 @@ class CreationViewModelTest {
165165
}
166166

167167
@Test
168-
fun startClicked_GenerateBotFromPrompt_TextEmpty() = runTest {
168+
fun onStartClicked_GenerateBotFromPrompt_TextEmpty() = runTest {
169169
val values = mutableListOf<SnackbarHostState>()
170170

171171
backgroundScope.launch(UnconfinedTestDispatcher()) {
@@ -182,7 +182,7 @@ class CreationViewModelTest {
182182
imageGenerationRepository.exceptionToThrow = InsufficientInformationException()
183183

184184
viewModel.onSelectedPromptOptionChanged(PromptType.TEXT)
185-
viewModel.startClicked()
185+
viewModel.onStartClicked()
186186

187187
assertEquals(ScreenState.EDIT, screenStateValues[1])
188188
assertEquals(
@@ -193,7 +193,7 @@ class CreationViewModelTest {
193193
}
194194

195195
@Test
196-
fun startClicked_GenerateBotFromPrompt() = runTest {
196+
fun onStartClicked_GenerateBotFromPrompt() = runTest {
197197
val screenStateValues = mutableListOf<ScreenState>()
198198
backgroundScope.launch(UnconfinedTestDispatcher()) {
199199
viewModel.uiState.collect {
@@ -204,21 +204,21 @@ class CreationViewModelTest {
204204
viewModel.uiState.value.descriptionText.edit {
205205
"testing input description"
206206
}
207-
viewModel.startClicked()
207+
viewModel.onStartClicked()
208208
assertEquals(ScreenState.EDIT, viewModel.uiState.value.screenState)
209209
assertNotNull(viewModel.uiState.value.resultBitmapUri)
210210
}
211211

212212
@Test
213-
fun startClicked_NoInternet_DisplaysError() = runTest {
213+
fun onStartClicked_NoInternet_DisplaysError() = runTest {
214214
val values = mutableListOf<SnackbarHostState>()
215215
backgroundScope.launch(UnconfinedTestDispatcher()) {
216216
viewModel.snackbarHostState.collect {
217217
values.add(it)
218218
}
219219
}
220220
internetConnectivityManager.internetAvailable = false
221-
viewModel.startClicked()
221+
viewModel.onStartClicked()
222222
advanceUntilIdle()
223223
assertEquals(ScreenState.EDIT, viewModel.uiState.value.screenState)
224224
assertEquals(

0 commit comments

Comments
 (0)