Skip to content

Commit

Permalink
apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cbullinger committed May 6, 2024
1 parent ae472be commit 64319c4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Expand Up @@ -79,7 +79,7 @@ class AppClientTest : RealmTest() {
val customBaseUrl = "http://localhost:80"
// :snippet-start: change-base-url
// Specify a custom baseUrl to connect to.
// In this case, an Edge Server instance running on the device.
// In this case, an Edge Server instance running on the device:
val config = AppConfiguration.Builder(EDGE_SERVER_APP_ID)
.baseUrl("http://localhost:80")
.build()
Expand All @@ -92,7 +92,8 @@ class AppClientTest : RealmTest() {
assertNotNull(app.currentUser)
// :remove-end:

// Later, change the baseUrl to the default:
// Later, change the baseUrl.
// In this case, pass `null` to reset to default:
// https://services.cloud.mongodb.com
app.updateBaseUrl(null)
// :snippet-end:
Expand Down
Expand Up @@ -471,9 +471,9 @@ class AuthenticationTest: RealmTest() {
app.close()
}

/*
** Tests for Multi-User Applications page **
*/
/*
** Tests for Multi-User Applications page **
*/

private val app = App.create(YOUR_APP_ID)
val joeEmail = getRandomEmail()
Expand Down
@@ -1,12 +1,13 @@
// Specify a custom baseUrl to connect to.
// In this case, an Edge Server instance running on the device.
// In this case, an Edge Server instance running on the device:
val config = AppConfiguration.Builder(EDGE_SERVER_APP_ID)
.baseUrl("http://localhost:80")
.build()
val app = App.create(config)

// ... log in a user and use the app ...

// Later, change the baseUrl to the default:
// Later, change the baseUrl.
// In this case, pass `null` to reset to default:
// https://services.cloud.mongodb.com
app.updateBaseUrl(null)
Expand Up @@ -300,16 +300,13 @@ annotation:
.. literalinclude:: /examples/generated/kotlin/AppClientTest.snippet.experimental-opt-in.kt
:language: kotlin

Change Server with Logged-In User
`````````````````````````````````

If you want to change the ``baseUrl`` after you have logged in a user and
If you change the ``baseUrl`` *after* you have logged in a user and
have opened a synced database, the app must perform a client reset. For more
information, refer to :ref:`flutter-client-reset`.
information, refer to :ref:`kotlin-client-reset`.

Perform the following in your code:

1. :ref:`Pause the Sync session <flutter-pause-resume-sync>`
1. :ref:`Pause the Sync session <kotlin-pause-resume-sync>`
2. Update the ``baseUrl`` using the ``app.updateBaseUrl`` method
3. Re-authenticate the user to log in using the new ``baseUrl``
4. Open a synced database pulling data from the new server
Expand Down

0 comments on commit 64319c4

Please sign in to comment.