Skip to content

Commit

Permalink
support retry custom confirm functions (#484)
Browse files Browse the repository at this point in the history
* support retry custom confirm functions
* use persistent handle
* fix syntax in credentials.dart

Co-authored-by: Kasper Overgård Nielsen <kasper.nielsen@mongodb.com>
Co-authored-by: Desislava Stefanova <dst.stefanova@gmail.com>
Co-authored-by: Kasper Overgård Nielsen <kasper@byolimit.com>
Co-authored-by: Desislava Stefanova <95419820+desistefanova@users.noreply.github.com>
  • Loading branch information
5 people authored Apr 22, 2022
1 parent 816a74d commit 1a63d39
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ x.x.x Release notes (yyyy-MM-dd)
* Support EmailPassword complete reset password. ([#480](https://github.com/realm/realm-dart/pull/480))
* Support EmailPassword reset password. ([#481](https://github.com/realm/realm-dart/pull/481))
* Support EmailPassword calling custom reset password functions. ([#482](https://github.com/realm/realm-dart/pull/482))
* Support EmailPassword retry custom user confirmation functions. ([#484](https://github.com/realm/realm-dart/pull/484))

### Fixed
* Fixed an issue that would result in the wrong transaction being rolled back if you start a write transaction inside a write transaction. ([#442](https://github.com/realm/realm-dart/issues/442))
Expand Down
5 changes: 5 additions & 0 deletions lib/src/credentials.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,9 @@ class EmailPasswordAuthProvider {
Future<void> callResetPasswordFunction(String email, String password, Map<String, dynamic> functionArgs) {
return realmCore.emailPasswordCallResetPasswordFunction(application, email, password, jsonEncode(functionArgs));
}

/// Retries the custom confirmation function on a user for a given email.
Future<void> retryCustomConfirmationFunction(String email) {
return realmCore.emailPasswordRetryCustomConfirmationFunction(application, email);
}
}
14 changes: 14 additions & 0 deletions lib/src/native/realm_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,20 @@ class _RealmCore {
});
return completer.future;
}

Future<void> emailPasswordRetryCustomConfirmationFunction(Application application, String email) {
final completer = Completer<void>();
using((arena) {
_realmLib.invokeGetBool(() => _realmLib.realm_app_email_password_provider_client_retry_custom_confirmation(
application.handle._pointer,
email.toUtf8Ptr(arena),
Pointer.fromFunction(void_completion_callback),
completer.toPersistentHandle(),
_deletePersistentHandleFuncPtr,
));
});
return completer.future;
}
}

class LastError {
Expand Down

0 comments on commit 1a63d39

Please sign in to comment.