@lvce-editor/activity-bar-worker 5.7.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1118,7 +1118,6 @@ const create$2 = rpcId => {
1118
1118
  };
1119
1119
 
1120
1120
  const {
1121
- invoke: invoke$1,
1122
1121
  set: set$2
1123
1122
  } = create$2(6010);
1124
1123
 
@@ -1455,6 +1454,7 @@ const getKeyBindings = () => {
1455
1454
  };
1456
1455
 
1457
1456
  const getMenuEntriesAccount = state => {
1457
+ // TODO maybe query it now from layout?
1458
1458
  const {
1459
1459
  userLoginState
1460
1460
  } = state;
@@ -1970,18 +1970,12 @@ const handleClick = async (state, button, eventX, eventY) => {
1970
1970
  };
1971
1971
 
1972
1972
  const handleClickSignIn = async state => {
1973
- const {
1974
- platform
1975
- } = state;
1976
- const backendUrl = await invoke('Layout.getBackendUrl');
1977
- await invoke$1('Auth.login', {
1978
- backendUrl,
1979
- platform
1980
- });
1973
+ await invoke('Layout.signIn');
1981
1974
  return state;
1982
1975
  };
1983
1976
 
1984
1977
  const handleClickSignOut = async state => {
1978
+ await invoke('Layout.signOut');
1985
1979
  return state;
1986
1980
  };
1987
1981
 
@@ -2221,16 +2215,48 @@ const getActiveView = async () => {
2221
2215
  }
2222
2216
  };
2223
2217
 
2218
+ const getUserInfo = async () => {
2219
+ try {
2220
+ return await invoke('Layout.getUserInfo');
2221
+ } catch {
2222
+ return undefined;
2223
+ }
2224
+ };
2225
+
2226
+ const getUserState = userInfo => {
2227
+ if (!userInfo || typeof userInfo !== 'object') {
2228
+ return undefined;
2229
+ }
2230
+ if (!('userState' in userInfo)) {
2231
+ return undefined;
2232
+ }
2233
+ return userInfo.userState;
2234
+ };
2235
+
2236
+ const toUserLoginState = userState => {
2237
+ switch (userState) {
2238
+ case 'loggedIn':
2239
+ return 'logged in';
2240
+ case 'loggingIn':
2241
+ return 'logging in';
2242
+ case 'loggingOut':
2243
+ return 'logging out';
2244
+ default:
2245
+ return 'logged out';
2246
+ }
2247
+ };
2248
+
2224
2249
  const loadContent = async state => {
2225
2250
  const {
2226
2251
  accountEnabled,
2227
2252
  height,
2228
2253
  itemHeight
2229
2254
  } = state;
2230
- const [accountEnabledNew, activeView, sideBarVisible, sidebarLocation] = await Promise.all([getAccountEnabled(accountEnabled), getActiveView(), getSideBarVisible(), getSideBarPosition()]);
2255
+ const [accountEnabledNew, activeView, sideBarVisible, sidebarLocation, userInfo] = await Promise.all([getAccountEnabled(accountEnabled), getActiveView(), getSideBarVisible(), getSideBarPosition(), getUserInfo()]);
2231
2256
  const newState = {
2232
2257
  ...state,
2233
- accountEnabled: accountEnabledNew
2258
+ accountEnabled: accountEnabledNew,
2259
+ userLoginState: toUserLoginState(getUserState(userInfo))
2234
2260
  };
2235
2261
  const items = getActivityBarItems(newState);
2236
2262
  const index = items.findIndex(item => item.id === activeView);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/activity-bar-worker",
3
- "version": "5.7.0",
3
+ "version": "6.0.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",