Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3248907
D6675.id22509.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6675.id22509.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/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -152,6 +152,10 @@
text="LOG IN"
loadingStatus={this.props.loadingStatus}
onSubmit={this.onSubmit}
+ disabled={
+ this.props.primaryIdentityPublicKey === undefined ||
+ this.props.primaryIdentityPublicKey === null
+ }
/>
</View>
</Panel>
@@ -389,7 +393,7 @@
return (
<LogInPanel
{...props}
- loadingStatus={!primaryIdentityPublicKey ? 'loading' : loadingStatus}
+ loadingStatus={loadingStatus}
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
logIn={callLogIn}
diff --git a/native/account/panel-components.react.js b/native/account/panel-components.react.js
--- a/native/account/panel-components.react.js
+++ b/native/account/panel-components.react.js
@@ -21,6 +21,7 @@
+text: string,
+loadingStatus: LoadingStatus,
+onSubmit: () => void,
+ +disabled?: boolean,
};
function PanelButton(props: ButtonProps): React.Node {
let buttonIcon;
@@ -42,7 +43,7 @@
<View style={styles.submitButtonVerticalContainer}>
<Button
onPress={props.onSubmit}
- disabled={props.loadingStatus === 'loading'}
+ disabled={props.disabled || props.loadingStatus === 'loading'}
topStyle={styles.submitButton}
style={styles.innerSubmitButton}
iosFormat="highlight"
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,
@@ -182,6 +181,10 @@
text="SIGN UP"
loadingStatus={this.props.loadingStatus}
onSubmit={this.onSubmit}
+ disabled={
+ this.props.primaryIdentityPublicKey === undefined ||
+ this.props.primaryIdentityPublicKey === null
+ }
/>
</View>
</Panel>
@@ -329,11 +332,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,6 +471,18 @@
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}
@@ -468,6 +490,7 @@
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
register={callRegister}
+ primaryIdentityPublicKey={primaryIdentityPublicKey}
/>
);
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 11:20 AM (21 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497136
Default Alt Text
D6675.id22509.diff (4 KB)
Attached To
Mode
D6675: [native] Include `primaryIdentityPublicKey` in `register` request
Attached
Detach File
Event Timeline
Log In to Comment