Move sign-in sheet under fb folder

Summary: SignInSheet and "dispatcher/user" are not used in public build, so it doesn't make sense to keep them on github.

Reviewed By: passy

Differential Revision: D28789384

fbshipit-source-id: aa1ab0fc70f2211260017be42762714b753ea877
This commit is contained in:
Anton Nikolaev
2021-06-02 11:29:11 -07:00
committed by Facebook GitHub Bot
parent 178d76bc84
commit c1f161045c
7 changed files with 33 additions and 239 deletions

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export default () => {
// no public implementation
};

View File

@@ -17,7 +17,7 @@ import tracking from './tracking';
import server from './server';
import notifications from './notifications';
import plugins from './plugins';
import user from './user';
import user from './fb-stubs/user';
import pluginManager from './pluginManager';
import reactNative from './reactNative';
import pluginMarketplace from './fb-stubs/pluginMarketplace';

View File

@@ -1,47 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {Store} from '../reducers/index';
import {Logger} from '../fb-interfaces/Logger';
import {login, logout} from '../reducers/user';
import {getUser, logoutUser} from '../fb-stubs/user';
import {sideEffect} from '../utils/sideEffect';
import config from '../fb-stubs/config';
export default (store: Store, _logger: Logger) => {
if (!config.isFBBuild) {
return;
}
getUser()
.then((user) => {
if (user) {
store.dispatch(login(user));
} else {
store.dispatch(logout());
}
})
.catch((e) => {
store.dispatch(logout());
console.warn('Failed to load user:', e);
});
let prevUserName = store.getState().user.name;
sideEffect(
store,
{name: 'logout', throttleMs: 500},
(state) => state.user.name,
(userName) => {
if (prevUserName && !userName) {
logoutUser();
}
prevUserName = userName;
},
);
};