-
-
Save Ashoat/123765219189cd738d353e156b9ca493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js | |
index 4f75f64c88..83ca1375eb 100644 | |
--- a/lib/actions/user-actions.js | |
+++ b/lib/actions/user-actions.js | |
@@ -233,6 +233,7 @@ const identityRegisterActionTypes = Object.freeze({ | |
failed: 'IDENTITY_REGISTER_FAILED', | |
}); | |
function useIdentityRegister( | |
+): ( | |
client: IdentityServiceNativeClient, | |
username: string, | |
password: string, | |
@@ -244,8 +245,20 @@ function useIdentityRegister( | |
notifPrekeySignature: string, | |
contentOneTimeKeys: $ReadOnlyArray<string>, | |
notifOneTimeKeys: $ReadOnlyArray<string>, | |
-): () => Promise<UserLoginResponse> { | |
- const identityRegister = React.useCallback(async () => { | |
+) => Promise<UserLoginResponse> { | |
+ const identityRegister = React.useCallback(async ( | |
+ client: IdentityServiceNativeClient, | |
+ username: string, | |
+ password: string, | |
+ keyPayload: string, | |
+ keyPayloadSignature: string, | |
+ contentPrekey: string, | |
+ contentPrekeySignature: string, | |
+ notifPrekey: string, | |
+ notifPrekeySignature: string, | |
+ contentOneTimeKeys: $ReadOnlyArray<string>, | |
+ notifOneTimeKeys: $ReadOnlyArray<string>, | |
+ ) => { | |
const registrationResult = await client.registerUser( | |
username, | |
password, | |
@@ -260,19 +273,7 @@ function useIdentityRegister( | |
); | |
const { userID, accessToken } = JSON.parse(registrationResult); | |
return { accessToken, userId: userID }; | |
- }, [ | |
- client, | |
- contentOneTimeKeys, | |
- contentPrekey, | |
- contentPrekeySignature, | |
- keyPayload, | |
- keyPayloadSignature, | |
- notifOneTimeKeys, | |
- notifPrekey, | |
- notifPrekeySignature, | |
- password, | |
- username, | |
- ]); | |
+ }, []); | |
return identityRegister; | |
} | |
diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js | |
index 369b3cbd09..d4ffc6e077 100644 | |
--- a/native/account/registration/registration-server-call.js | |
+++ b/native/account/registration/registration-server-call.js | |
@@ -75,7 +75,7 @@ function useRegistrationServerCall(): RegistrationServerCallInput => Promise<voi | |
const dispatchActionPromise = useDispatchActionPromise(); | |
const callKeyserverRegister = useServerCall(keyserverRegister); | |
- const callIdentityRegister = useIdentityRegister; | |
+ const callIdentityRegister = useIdentityRegister(); | |
const identityRegisterUsernameAccount = React.useCallback( | |
async (accountSelection: UsernameAccountSelection) => { | |
@@ -100,7 +100,7 @@ function useRegistrationServerCall(): RegistrationServerCallInput => Promise<voi | |
}); | |
const identityRegisterPromise = (async () => { | |
try { | |
- await callIdentityRegister( | |
+ const response = await callIdentityRegister( | |
commRustModule, | |
accountSelection.username, | |
accountSelection.password, | |
@@ -117,6 +117,7 @@ function useRegistrationServerCall(): RegistrationServerCallInput => Promise<voi | |
username: accountSelection.username, | |
password: accountSelection.password, | |
}); | |
+ return response; | |
} catch (e) { | |
if (e.message === 'username reserved') { | |
Alert.alert( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment