Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33093446
D6675.1768464857.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6675.1768464857.diff
View Options
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -39,6 +39,7 @@
...LogInExtraInfo,
+username: string,
+password: string,
+ +primaryIdentityPublicKey?: string,
};
type DeviceTokenUpdateRequest = {
diff --git a/native/account/register-panel.react.js b/native/account/register-panel.react.js
--- a/native/account/register-panel.react.js
+++ b/native/account/register-panel.react.js
@@ -33,6 +33,7 @@
import { setNativeCredentials } from './native-credentials.js';
import { PanelButton, Panel } from './panel-components.react.js';
import SWMansionIcon from '../components/swmansion-icon.react.js';
+import { commCoreModule } from '../native-modules.js';
import { NavContext } from '../navigation/navigation-context.js';
import { useSelector } from '../redux/redux-utils.js';
import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
@@ -51,13 +52,11 @@
};
type Props = {
...BaseProps,
- // Redux state
+loadingStatus: LoadingStatus,
+logInExtraInfo: () => LogInExtraInfo,
- // Redux dispatch functions
+dispatchActionPromise: DispatchActionPromise,
- // async functions that hit server APIs
+register: (registerInfo: RegisterInfo) => Promise<RegisterResult>,
+ +primaryIdentityPublicKey: ?string,
};
type State = {
+confirmPasswordFocused: boolean,
@@ -329,11 +328,18 @@
};
async registerAction(extraInfo: LogInExtraInfo) {
+ const { primaryIdentityPublicKey } = this.props;
try {
+ invariant(
+ primaryIdentityPublicKey !== null &&
+ primaryIdentityPublicKey !== undefined,
+ 'primaryIdentityPublicKey must exist in logInAction',
+ );
const result = await this.props.register({
+ ...extraInfo,
username: this.props.registerState.state.usernameInputText,
password: this.props.registerState.state.passwordInputText,
- ...extraInfo,
+ primaryIdentityPublicKey: primaryIdentityPublicKey,
});
this.props.setActiveAlert(false);
await setNativeCredentials({
@@ -461,13 +467,26 @@
const dispatchActionPromise = useDispatchActionPromise();
const callRegister = useServerCall(register);
+ const [
+ primaryIdentityPublicKey,
+ setPrimaryIdentityPublicKey,
+ ] = React.useState<?string>(null);
+ React.useEffect(() => {
+ (async () => {
+ await commCoreModule.initializeCryptoAccount('PLACEHOLDER');
+ const { ed25519 } = await commCoreModule.getUserPublicKey();
+ setPrimaryIdentityPublicKey(ed25519);
+ })();
+ }, []);
+
return (
<RegisterPanel
{...props}
- loadingStatus={loadingStatus}
+ loadingStatus={!primaryIdentityPublicKey ? 'loading' : loadingStatus}
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
register={callRegister}
+ primaryIdentityPublicKey={primaryIdentityPublicKey}
/>
);
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 8:14 AM (35 m, 15 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5936876
Default Alt Text
D6675.1768464857.diff (2 KB)
Attached To
Mode
D6675: [native] Include `primaryIdentityPublicKey` in `register` request
Attached
Detach File
Event Timeline
Log In to Comment