Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-497

Specific callback for ClientReset

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      While ClientResync can be handled automatically by Realm now, it is still possible to enable an automatic mode where the user has to handle it automatically. In that case, it results in the user having to write a bunch of annoying code.

      We should consider exposing a specific callback explicitly for that, which will also make it much easier to expose the correct information and types to users.

      ```
      // Current API
      SyncConfiguration config = user.createConfiguration(url)
      .errorHandler((session, error) -> {
      if (error.getErrorCode() == ErrorCode.CLIENT_RESET)

      { ClientResetRequiredError clientResetRequiredError = (ClientResetRequiredError) error; // Handle client reset }

      else

      { // Handle other errors }

      .build()

      // Suggest API
      SyncConfiguration config = user.createConfiguration(url)
      .clientResyncMode(ClientResyncMode.MANUAL)
      .errorHandler((session, error) ->

      { // Handle other errors }

      )
      .clientResyncHandler((session, error) ->

      { // Setting this will fail unless the mode is MANUAL // error is already of type ClientResetRequeriedError }

      )
      .build()

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: