Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/WidgetAppsPanel/WidgetAppPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
RcListItemText,
RcListItemSecondaryAction,
RcListItemAvatar,
RcTypography,
} from '@ringcentral/juno';
import { ArrowLeft2, Refresh } from '@ringcentral/juno-icon';
import { Container, PageHeader, Content, AppIcon } from './styled';
Expand Down Expand Up @@ -36,6 +37,10 @@ const StyledContent = styled(Content)`
padding-top: 0;
`;

const LoadingText = styled(RcTypography)`
padding-top: 16px;
`;

type App = {
id: string;
name: string;
Expand Down Expand Up @@ -185,7 +190,7 @@ export function WidgetAppPanel({
}
}}
/>
) : 'Loading...'
) : (<LoadingText>Loading...</LoadingText>)
}
</StyledContent>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Adapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Adapter extends AdapterCore {
console.log(data.calls);
break;
case 'rc-login-status-notify':
console.log('rc-login-status-notify:', data.loggedIn, data.loginNumber, data.contractedCountryCode, data.admin, data.features);
console.log('rc-login-status-notify:', data.loggedIn, data.loginNumber, data.contractedCountryCode, data.admin, data.features, data.isFreshLogin);
break;
case 'rc-calling-settings-notify':
console.log('rc-calling-settings-notify:', data.callWith, data.callingMode);
Expand Down
1 change: 1 addition & 0 deletions src/modules/Adapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ export default class Adapter extends AdapterModuleCore {
contractedCountryCode,
admin: isAdmin,
features,
isFreshLogin: this._auth.isFreshLogin,
});
}

Expand Down
31 changes: 31 additions & 0 deletions src/modules/Auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Auth as AuthBase } from '@ringcentral-integration/commons/modules/Auth';
import { Module } from '@ringcentral-integration/commons/lib/di';
import { loginStatus } from '@ringcentral-integration/commons/modules/Auth/loginStatus';
import { watch } from '@ringcentral-integration/core';

export const LoginStatusChangeEvent = 'loginStatusChange';
export const TriggerSyncTokenEvent = 'triggerSyncTokenEvent';

@Module({
name: 'NewAuth',
Expand Down Expand Up @@ -47,6 +51,33 @@ export class Auth extends AuthBase {
}
}

override async onInit() {
const platform = this._deps.client.service.platform();
this._loggedIn = await platform.loggedIn();
this._bindEvents();
watch(
this,
() => [this.token, this._triggerSyncToken],
() => {
if (this._triggerSyncToken) {
this._deps.tabManager?.send(TriggerSyncTokenEvent);
}
},
{
multiple: true, // Add this to fix for multiple watch
}
);
watch(
this,
() => this._deps.tabManager?.event,
() => {
if (this._deps.tabManager?.event?.name === TriggerSyncTokenEvent) {
this.fetchToken();
}
},
);
}

async fetchToken() {
const token = await this._getTokenFromSDK();
this.setInitLogin({
Expand Down