Page MenuHomePhabricator

D6751.id22732.diff
No OneTemporary

D6751.id22732.diff

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
@@ -111,7 +111,6 @@
+username: string,
+password: string,
+logInActionSource: LogInActionSource,
- +primaryIdentityPublicKey?: string,
};
export type LogInRequest = {
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
@@ -33,7 +33,6 @@
import { PanelButton, Panel } from './panel-components.react.js';
import PasswordInput from './password-input.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';
@@ -55,7 +54,6 @@
+logInExtraInfo: () => Promise<LogInExtraInfo>,
+dispatchActionPromise: DispatchActionPromise,
+logIn: (logInInfo: LogInInfo) => Promise<LogInResult>,
- +primaryIdentityPublicKey: ?string,
};
class LogInPanel extends React.PureComponent<Props> {
usernameInput: ?TextInput;
@@ -152,10 +150,6 @@
text="LOG IN"
loadingStatus={this.props.loadingStatus}
onSubmit={this.onSubmit}
- disabled={
- this.props.primaryIdentityPublicKey === undefined ||
- this.props.primaryIdentityPublicKey === null
- }
/>
</View>
</Panel>
@@ -242,19 +236,12 @@
};
async logInAction(extraInfo: LogInExtraInfo): Promise<LogInResult> {
- const { primaryIdentityPublicKey } = this.props;
try {
- invariant(
- primaryIdentityPublicKey !== null &&
- primaryIdentityPublicKey !== undefined,
- 'primaryIdentityPublicKey must exist in logInAction',
- );
const result = await this.props.logIn({
...extraInfo,
username: this.usernameInputText,
password: this.passwordInputText,
logInActionSource: logInActionSources.logInFromNativeForm,
- primaryIdentityPublicKey: primaryIdentityPublicKey,
});
this.props.setActiveAlert(false);
await setNativeCredentials({
@@ -378,18 +365,6 @@
const dispatchActionPromise = useDispatchActionPromise();
const callLogIn = useServerCall(logIn);
- const [
- primaryIdentityPublicKey,
- setPrimaryIdentityPublicKey,
- ] = React.useState<?string>(null);
- React.useEffect(() => {
- (async () => {
- await commCoreModule.initializeCryptoAccount('PLACEHOLDER');
- const { ed25519 } = await commCoreModule.getUserPublicKey();
- setPrimaryIdentityPublicKey(ed25519);
- })();
- }, []);
-
return (
<LogInPanel
{...props}
@@ -397,7 +372,6 @@
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
logIn={callLogIn}
- primaryIdentityPublicKey={primaryIdentityPublicKey}
/>
);
},
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,7 +33,6 @@
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';
@@ -56,7 +55,6 @@
+logInExtraInfo: () => Promise<LogInExtraInfo>,
+dispatchActionPromise: DispatchActionPromise,
+register: (registerInfo: RegisterInfo) => Promise<RegisterResult>,
- +primaryIdentityPublicKey: ?string,
};
type State = {
+confirmPasswordFocused: boolean,
@@ -181,10 +179,6 @@
text="SIGN UP"
loadingStatus={this.props.loadingStatus}
onSubmit={this.onSubmit}
- disabled={
- this.props.primaryIdentityPublicKey === undefined ||
- this.props.primaryIdentityPublicKey === null
- }
/>
</View>
</Panel>
@@ -332,18 +326,11 @@
};
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,
- primaryIdentityPublicKey: primaryIdentityPublicKey,
});
this.props.setActiveAlert(false);
await setNativeCredentials({
@@ -471,18 +458,6 @@
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}
@@ -490,7 +465,6 @@
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
register={callRegister}
- primaryIdentityPublicKey={primaryIdentityPublicKey}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 8:09 AM (20 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2519617
Default Alt Text
D6751.id22732.diff (5 KB)

Event Timeline