Skip to content

Conversation

@ncooke3
Copy link
Member

@ncooke3 ncooke3 commented Aug 29, 2025

OK if I merge main into mc/spm?

dpebot and others added 30 commits January 27, 2025 19:09
* Improve the styling of the view

- use the re-usable InputField component
- layout the images in a 2x2 grid
- add rounded corners
- add a progress overlay

* Allow user to cancel the image generation process

---------

Signed-off-by: Peter Friese <[email protected]>
Bumps [json](https://github.com/ruby/json) from 2.10.1 to 2.10.2.
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](ruby/json@v2.10.1...v2.10.2)

---
updated-dependencies:
- dependency-name: json
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
[Infra] Update build-for-testing.sh
* Update vertexai's README.md

* Update vertexai's README to not mention the mock GoogleService-Info.plist

Because there is not such file. Also, changes to them are ignored by git anyways (see [.gitignore](.gitignore#L5)).
* Copy vertexai directory to firebaseai

* Rename directories, files, and scheme and build/run again

* Run on firebase-ai branch

* to import FirebaseAI

* Update to googleAI and comment vertexAI configures

* readme updates

* firebaseai.yml

* style

* Apply suggestions from code review

Co-authored-by: Andrew Heard <[email protected]>

* Update package dependency to FirebaseAI

* Fix scheme name

* Fix SAMPLE env

---------

Co-authored-by: Andrew Heard <[email protected]>
* feat: Add backend toggle for Google AI/Vertex AI in FirebaseAISample

Adds a picker UI to the main `FirebaseAISample` screen allowing users to select between Google AI and Vertex AI backends.

- Introduced an `AIBackend` enum to represent the choices.
- Added a `@State` variable in `FirebaseAISampleApp` to manage the selection.
- Added a `Picker` in `ContentView` bound to the state variable.
- Passed the selected backend down to each sample view (`Summarize`, `PhotoReasoning`, `Chat`, `FunctionCalling`, `Imagen`).
- Updated the ViewModels for each sample to accept the backend choice and initialize `FirebaseAI.firebaseAI(backend:)` accordingly.
- Refactored the `AIBackend` enum to a common location.

* feat: Add backend toggle for Google AI / Vertex AI

Adds a Picker UI to the main ContentView allowing users to select between
Google AI and Vertex AI as the backend for the Generative AI samples.

- Introduced a `BackendOption` enum.
- Added a Picker in `ContentView` bound to a state variable holding the selected backend.
- Modified sample Screens (`SummarizeScreen`, `PhotoReasoningScreen`, `ConversationScreen`, `FunctionCallingScreen`, `ImagenScreen`) to accept the chosen `FirebaseAIBackend` in their initializers.
- Updated corresponding ViewModels (`SummarizeViewModel`, `PhotoReasoningViewModel`, `ConversationViewModel`, `FunctionCallingViewModel`, `ImagenViewModel`) to receive the backend instance via their initializers and use it when initializing the Firebase AI service, removing the previously hardcoded `.googleAI()` backend.

* refactor: Centralize FirebaseAI service initialization

Refactors the codebase based on feedback to initialize the FirebaseAI
service instance once in ContentView and pass it down the hierarchy,
instead of passing the backend option and initializing the service
in each ViewModel.

- ContentView now manages a @State variable `firebaseService: FirebaseAI`
  which is updated when the backend Picker selection changes.
- Sample Screens now receive the `firebaseService` instance in their
  initializers.
- ViewModels now receive the `firebaseService` instance from their
  respective Screens and use it directly to obtain generative/Imagen
  models, removing the internal service initialization call.

* Build fixes

* Fix previews and cleanup jules verbosity

* review and more cleanup

* Cleanup explanatory Jules comments

* One more extraneous comment

* Update firebaseai/ChatSample/Screens/ConversationScreen.swift

Co-authored-by: Andrew Heard <[email protected]>

* Update firebaseai/ChatSample/Screens/ConversationScreen.swift

Co-authored-by: Andrew Heard <[email protected]>

* Update firebaseai/FunctionCallingSample/Screens/FunctionCallingScreen.swift

Co-authored-by: Andrew Heard <[email protected]>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Andrew Heard <[email protected]>
pcfba and others added 24 commits June 27, 2025 15:54
[Infra] Upgrade to FirebaseUI v15
#1719)

* change ImagenScreen UI from ZStack to ScrollView

* change fix size of images to flexible

* center the progressoverlay in firebase Imagen

* remove unrelated comments in imagen
@ncooke3 ncooke3 requested a review from morganchen12 August 29, 2025 15:41
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @ncooke3, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request performs a significant update and restructuring of the project's quickstart examples and underlying dependencies. It removes outdated quickstarts, introduces new ones for emerging Firebase features, and ensures compatibility with newer iOS versions and development tools.

Highlights

  • Quickstart Restructuring: The AdMob and Dynamic Links quickstarts have been completely removed from the project, while new Firebase AI and Firebase Data Connect quickstarts have been introduced.
  • Minimum Deployment Target Update: The minimum iOS deployment target across most quickstarts has been consistently raised from iOS 13.0/14.0 to iOS 15.0. Corresponding tvOS deployment targets were also updated to 15.0 where applicable.
  • Dependency Version Bumps: Numerous third-party dependencies, including core RubyGems (e.g., activesupport, json) and various Firebase SDKs (e.g., Analytics, Authentication, Crashlytics, Functions, Storage, FirebaseUI), have been updated to their latest versions. This includes a change in Firebase Analytics subspec from AdIdSupport to Default and the addition of GoogleAdsOnDeviceConversion.
  • Build System Enhancements: The build environment has been updated to use Xcode 16.4, and a new build flag (ENABLE_DEBUG_DYLIB=NO) was added to prevent potential signing issues with preview dylibs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request appears to merge changes from the main branch, including the removal of deprecated AdMob and Dynamic Links examples and the introduction of a comprehensive new Firebase AI example. The changes also involve updating deployment targets, dependencies, and build scripts across various projects. The new Firebase AI code is well-structured. My review includes a high-severity comment to prevent a potential crash in the function calling example by handling empty API responses more gracefully, and a couple of medium-severity suggestions to improve error feedback to the user in the Imagen example.

Comment on lines +141 to +143
guard let candidate = content.candidates.first else {
fatalError("No candidate.")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The use of fatalError here can cause the app to crash if the model returns a response with no candidates, for example, due to safety settings. It's better to handle this case gracefully by setting an error state and displaying a message to the user.

    guard let candidate = content.candidates.first else {
      if let promptFeedback = content.promptFeedback {
        self.error = GenerateContentError.promptBlocked(response: content)
      } else {
        self.error = NSError(domain: "com.google.firebase.quickstart", code: -1, userInfo: [NSLocalizedDescriptionKey: "No candidate in response."])
      }
      messages.removeLast()
      return
    }

Comment on lines +70 to +72
if let filteredReason = response.filteredReason {
print("Image(s) Blocked: \(filteredReason)")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The reason for images being filtered is only printed to the console. It would be a better user experience to display this information in the UI, for example, by setting the errorMessage property.

Suggested change
if let filteredReason = response.filteredReason {
print("Image(s) Blocked: \(filteredReason)")
}
if let filteredReason = response.filteredReason {
errorMessage = "Image(s) Blocked: \(filteredReason)"
print("Image(s) Blocked: \(filteredReason)")
}

Comment on lines +79 to +81
if !Task.isCancelled {
logger.error("Error generating images: \(error)")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Errors during image generation are logged to the console but not shown to the user. Consider setting the errorMessage property to provide feedback in the UI when an error occurs.

        if !Task.isCancelled {
          logger.error("Error generating images: \(error)")
          errorMessage = error.localizedDescription
        }

@ncooke3 ncooke3 merged commit 5c1c372 into mc/spm Aug 29, 2025
3 checks passed
@ncooke3 ncooke3 deleted the nc/spm branch August 29, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.