From dedc955891ecb58a342eb2df5ea8e3e1c9ae4a79 Mon Sep 17 00:00:00 2001 From: Charlotte Liang Date: Tue, 2 Jul 2024 15:56:55 -0700 Subject: [PATCH 1/3] remove the coresdkpath as it is no longer needed --- FirebaseDataConnect/README.md | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/FirebaseDataConnect/README.md b/FirebaseDataConnect/README.md index 1cc23db4b71..c14ab4c8c3d 100644 --- a/FirebaseDataConnect/README.md +++ b/FirebaseDataConnect/README.md @@ -10,21 +10,24 @@ Here's a quick rundown of steps to get you started. Learn more about details at ### 1. Create a new Data Connect service and Cloud SQL instance. * Go to Firebase Console and select Firebase Data Connect from the Left Navigation bar to create a new Data Connect service and a Cloud SQL instance. You have to be in Blaze plan and you can view the details of pricing at https://firebase.google.com/pricing. * Select us-central1 region if you want to try out vector search with Data Connect later. -* Wait for the Cloud SQL instance to be provisioned, you can view and manage the instance at the [Cloud console](https://pantheon.corp.google.com/sql). +* Your Cloud SQL instance is now to be provisioned, you can view and manage the instance at the [Cloud console](https://pantheon.corp.google.com/sql). +### 2. Setup your iOS app and [initialize Firebase](https://firebase.google.com/docs/ios/setup) +The following steps will guide you to setup your schema and create query operation that you need for your app. The toolings below will help you to test out your query with dummy data and once you are happy with your query, the tools will help generate client code for that query so you can call directly from your app. -### 2. Set up [Firebase CLI](https://firebase.devsite.corp.google.com/docs/cli) + +### 3. Set up [Firebase CLI](https://firebase.devsite.corp.google.com/docs/cli) * If you already have CLI, make sure you always update to the latest version ``` npm install -g firebase-tools ``` -### 3. Set up VSCode +### 4. Set up VSCode You will need VS Code and its Firebase extension (VS Code extension) to automatically generate Swift code for your queries. * Install VS Code * Download the [extension](https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/vsix%2Ffirebase-vscode-latest.vsix?alt=media) and drag it into the "Extensions" in the Left Navigation bar for installation. Keep in mind double clicking the file won't install. -* Create a fdc folder where you like to have firebase configuration. +* Create a fdc folder where you like to have firebase data connect configuration. ``` mkdir fdc ``` @@ -36,7 +39,17 @@ mkdir fdc * Enter/Select the project, service and database ID you setup on the console * Enter to select the default connector ID and complete the rest of the process -### 4. Create a schema and generate some dummy data +### 5. Set up generated SDK location +In the connector.yaml file, add the following code to enable swift code to be generated. + +``` + swiftSdk: + outputDir: "../swift-generated/" + package: "User" +``` +* You should see swift code is generated inside the ../swift-generated/User/ folder + +### 6. Create a schema and generate some dummy data * In the schema.gql file, uncomment the schema ``` type User @table(key: "uid") { @@ -48,11 +61,12 @@ type User @table(key: "uid") { * On top of the schema User, an "Add data" button start showing up, click on it to generate a User_insert.gql file * Fill out the fields and click on Run button to run the query to add a user dummy data for testing -### 5. Deploy your schema +### 7. Deploy your schema +* To deploy your schema, you will need your Cloud SQL instance to be ready. You can view the instance at the [Cloud console](https://pantheon.corp.google.com/sql). * Select the Firebase icon on the left and Click on the "Deploy all" button to deploy all the schema and operations to backend. * You can now see your schemas on the Firebase Console. -### 6. Set up a mutation +### 8. Set up a mutation In the mutations.gql file, uncomment the "CreateUser" query. * In the CONFIGURATION -> VARIABLES, enter ``` @@ -66,23 +80,9 @@ In the mutations.gql file, uncomment the "CreateUser" query. * You should see your dummy data is added. * Select the Firebase icon on the left and Click on the "Deploy all" button to deplouy all the schema and operations to backend. -### 7. Set up generated SDK location -In the connector.yaml file, add the following code to enable swift code to be generated. - -``` - swiftSdk: - outputDir: "../swift-generated/" - package: "User" - coreSdkPackageLocation: "file:///Users/[YOURUSERID]/github/firebase-ios-sdk" -``` -* You should see swift code is generated inside the ../swift-generated/User/ folder -* The coreSdkPackageLocation should be where you check out the firebase-ios-sdk repo and make sure you check out the "dataconnect" branch because Firebase Data Connect is currently under "dataconnect" branch during Private Preview. - ### At this point, you have the code generated for the queries you need for your app Now let's see how you can use the generated query code in your iOS app: -### 8. Setup your iOS app and [initialize Firebase](https://firebase.google.com/docs/ios/setup) - ### 9. Adding the generated package to your app project * Go to File -> Add Package Dependencies -> Add Local * Navigate to the generated folder and select it From cbf7e24ffc4e6702d42686e594e73c3295ccda8f Mon Sep 17 00:00:00 2001 From: Charlotte Liang Date: Tue, 2 Jul 2024 16:07:40 -0700 Subject: [PATCH 2/3] clarify on the authentication --- FirebaseDataConnect/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FirebaseDataConnect/README.md b/FirebaseDataConnect/README.md index c14ab4c8c3d..9609c52a2e0 100644 --- a/FirebaseDataConnect/README.md +++ b/FirebaseDataConnect/README.md @@ -13,7 +13,8 @@ Here's a quick rundown of steps to get you started. Learn more about details at * Your Cloud SQL instance is now to be provisioned, you can view and manage the instance at the [Cloud console](https://pantheon.corp.google.com/sql). ### 2. Setup your iOS app and [initialize Firebase](https://firebase.google.com/docs/ios/setup) -The following steps will guide you to setup your schema and create query operation that you need for your app. The toolings below will help you to test out your query with dummy data and once you are happy with your query, the tools will help generate client code for that query so you can call directly from your app. + +#### The following steps will guide you to setup your schema and create query operation that you need for your app. The toolings below will help you to test out your query with dummy data and once you are happy with your query, the tools will help generate client code for that query so you can call directly from your app. ### 3. Set up [Firebase CLI](https://firebase.devsite.corp.google.com/docs/cli) @@ -79,6 +80,7 @@ In the mutations.gql file, uncomment the "CreateUser" query. * Click on the "Run" button above the query. * You should see your dummy data is added. * Select the Firebase icon on the left and Click on the "Deploy all" button to deplouy all the schema and operations to backend. +* As you see this operation needs authentication, so you will need to be authenticated with Firebase Authentication in your client app when you call this operation in iOS app. ### At this point, you have the code generated for the queries you need for your app Now let's see how you can use the generated query code in your iOS app: From d7b456e1d1575d6a913f5cc9b09b5b6a7171cb63 Mon Sep 17 00:00:00 2001 From: Charlotte Liang Date: Tue, 2 Jul 2024 16:13:58 -0700 Subject: [PATCH 3/3] polish --- FirebaseDataConnect/README.md | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/FirebaseDataConnect/README.md b/FirebaseDataConnect/README.md index 9609c52a2e0..9b28b70e6ab 100644 --- a/FirebaseDataConnect/README.md +++ b/FirebaseDataConnect/README.md @@ -79,16 +79,14 @@ In the mutations.gql file, uncomment the "CreateUser" query. * In the CONFIGURATION -> AUTHENTICATION, select Run as "Authenticated". * Click on the "Run" button above the query. * You should see your dummy data is added. -* Select the Firebase icon on the left and Click on the "Deploy all" button to deplouy all the schema and operations to backend. +* Select the Firebase icon on the left and Click on the "Deploy all" button to deploy all the schema and operations to backend. * As you see this operation needs authentication, so you will need to be authenticated with Firebase Authentication in your client app when you call this operation in iOS app. -### At this point, you have the code generated for the queries you need for your app -Now let's see how you can use the generated query code in your iOS app: +#### At this point, you have the code generated for the queries you need for your app. Now let's see how you can use the generated query code in your iOS app: ### 9. Adding the generated package to your app project * Go to File -> Add Package Dependencies -> Add Local -* Navigate to the generated folder and select it - +* Navigate to the generated folder and select the "swift-generated/User" folder (You should see a Package.swift file in it). ### 10. Calling the generated code from your app ``` @@ -106,23 +104,3 @@ func executeFDCCreateUserQuery() { ``` - - - - - - - - - - - - - - - - - - - -