bug fixed
This commit is contained in:
parent
40f2587b3a
commit
2435cd88c8
53
package-lock.json
generated
53
package-lock.json
generated
|
@ -1846,9 +1846,9 @@
|
|||
"integrity": "sha512-bMHXrXFI2+cKjEwUs7GMSZwM2OZoA/PSavlzAx5NhzvN1Cg7Mz4mspjky++/7eRnYeqRUm7UmdOKAhdRdHprPQ=="
|
||||
},
|
||||
"@ucap/ng-protocol": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-protocol/-/ng-protocol-0.0.2.tgz",
|
||||
"integrity": "sha512-fNbmiIrXECeKowvjGflx2lOcOCykH42QKSZzciOeoSxHF8HiFT8ORN5BlR6GOknUCXvGwVPDccNwUs0t1QCnjg=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-protocol/-/ng-protocol-0.0.3.tgz",
|
||||
"integrity": "sha512-9aGv4bDKfOjDXWD56THW/KPDdAp2ytaWZSFnbw3PMy8bKiyfRQH/UXrj9c9jrf2aNhnSVvYjh1ol4oXNL8EYMg=="
|
||||
},
|
||||
"@ucap/ng-protocol-authentication": {
|
||||
"version": "0.0.3",
|
||||
|
@ -1926,24 +1926,24 @@
|
|||
"integrity": "sha512-cMfKYv56L7KQ8D9LRxFeE/fY2bl6Vw1WwH8FQKjI6ntD+pr7LgVQZzMMDjN0xfMW0rCS+MhmTU+WAcHgkLlqRA=="
|
||||
},
|
||||
"@ucap/ng-store-authentication": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-authentication/-/ng-store-authentication-0.0.7.tgz",
|
||||
"integrity": "sha512-6IxxjFYpmN3xC2zIix9BfXbHHKpZeeS09SlT7RujMGt58CPyLnWkCFa/a4NILYQpUaXwQn+CmB1o8nhaZvwMNw=="
|
||||
"version": "0.0.10",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-authentication/-/ng-store-authentication-0.0.10.tgz",
|
||||
"integrity": "sha512-eGdxf9VXmwLlhwpMndnAQUaKV/JaMmtxebSN+kiez8czQiqVKFXSjdVyA92/3AscMf5GvdwKMMh553IT7EhpqA=="
|
||||
},
|
||||
"@ucap/ng-store-chat": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-chat/-/ng-store-chat-0.0.4.tgz",
|
||||
"integrity": "sha512-rSZirwFUMv9zXllqBWpdSUbUuRz9j1O8BVIfselp9sZHdKl7Xcx9irqNnHHkF2bJpxeWzugGrgG02tdt/xrIuQ=="
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-chat/-/ng-store-chat-0.0.5.tgz",
|
||||
"integrity": "sha512-FlvWI52w58jq/ZO8b8sk/MonY+TYKiEYlkyIfZWfFYOxlnKG0MkbpL0R+tiOFO9GLbBGEsXrzYtaDazrLk55ZQ=="
|
||||
},
|
||||
"@ucap/ng-store-group": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-group/-/ng-store-group-0.0.5.tgz",
|
||||
"integrity": "sha512-NNqnSiyQWbBIWLjXsBBxkdCHlRkMPRF8+IXq7scUgG7aNlUA0SGuntUbghRPxAJLQNuMe/csQziOlqHn98sJfw=="
|
||||
"version": "0.0.6",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-group/-/ng-store-group-0.0.6.tgz",
|
||||
"integrity": "sha512-WShenZp/RP+cgiswvM12HPWOeSFuhNYkCUY6fxEAg58unxUZhBskVhefSq+OgD3dX/OaAPo2eQkwvXVANnyiZw=="
|
||||
},
|
||||
"@ucap/ng-store-organization": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-organization/-/ng-store-organization-0.0.3.tgz",
|
||||
"integrity": "sha512-qakDmEzWloikSk/Sczs2i/dL54ZAIEqkjx2x4jcn0dMKkCF2KseCphNXTfaLpAcMuGVR5ZAy2bQjy90NbbHeOg=="
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-organization/-/ng-store-organization-0.0.4.tgz",
|
||||
"integrity": "sha512-gVGOTfGmp58U0nHEn0UkjMc9AWQEmopNXDbyIrltMwR5XCKweC9AWXAiQzDxCb3sN07cSozEseFBJzJ7XO+dwg=="
|
||||
},
|
||||
"@ucap/ng-ui": {
|
||||
"version": "0.0.3",
|
||||
|
@ -1965,6 +1965,11 @@
|
|||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-skin-default/-/ng-ui-skin-default-0.0.1.tgz",
|
||||
"integrity": "sha512-vtgJBOsJj/S2GjP02PpBz9ebGikNtzdsC7JQc5HKkCZRC6JKkzZmWzcaFGlLPsh9dcWEeZuNhwnAZfmPXgz6Aw=="
|
||||
},
|
||||
"@ucap/ng-web-socket": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-web-socket/-/ng-web-socket-0.0.2.tgz",
|
||||
"integrity": "sha512-hMn8niCiRfR3ZUzE0oqspJGlGl0DKvLizkVMphF+JenqwARQcBYR+G7e+4HPEGyRbu0LtimkhMfExzJFTHky3A=="
|
||||
},
|
||||
"@ucap/ng-web-storage": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-web-storage/-/ng-web-storage-0.0.3.tgz",
|
||||
|
@ -1976,9 +1981,9 @@
|
|||
"integrity": "sha512-nWev387pHxeBHtOu0EvRTVQ0/JeJL44Ew0PzQaiqHsC5mghkJ6ok7z22nk9nmuZ7lONxGJmW7CHT8X8lyviZJg=="
|
||||
},
|
||||
"@ucap/protocol": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol/-/protocol-0.0.8.tgz",
|
||||
"integrity": "sha512-cLFryVjd3VLAEJScJiZ2Dm+Uuo5uqX0BHE9ZIdu99BSoDMyODOuBxPFBXAWaxiqX0H5jJHAU3m6leGVv1P2alg=="
|
||||
"version": "0.0.11",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol/-/protocol-0.0.11.tgz",
|
||||
"integrity": "sha512-nmwejglPVtC7elUn8x05ENFyqFz0z2pFibpblqAUW3m8HQHBSIKLqfctVsHzk5iP9/JyCDCTDuJ2DjMhMVJB8g=="
|
||||
},
|
||||
"@ucap/protocol-authentication": {
|
||||
"version": "0.0.5",
|
||||
|
@ -2026,9 +2031,9 @@
|
|||
"integrity": "sha512-w6jLCCVew66WrDbN/SkC3ND1Rj7u22wkbDCQxuW87hJt/PdfGPu4fnep6OL8GCo4CtLCgUEt7iOWNAxMv8ipUg=="
|
||||
},
|
||||
"@ucap/protocol-query": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-query/-/protocol-query-0.0.4.tgz",
|
||||
"integrity": "sha512-cRMZgrOfKFPJKz+bPTxYOAhTQfgYvAjGvAXgcK8FzQ51R3jwmVTXsHi8FBBfqOeI2bDw1/KkPBfhChHRF2h+kg=="
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-query/-/protocol-query-0.0.5.tgz",
|
||||
"integrity": "sha512-z8NGdXxw1C3FplynHbglO3Vk9vEIimu9pYWxXNtT9pEErcei4fyosV9DO+7UMPmBfXa47WlyKjLQlKQuPjcyMg=="
|
||||
},
|
||||
"@ucap/protocol-room": {
|
||||
"version": "0.0.5",
|
||||
|
@ -2056,9 +2061,9 @@
|
|||
"integrity": "sha512-PVrQJC5g+eywOPQ8BATnlr3UDLXW7HDZpNuBCablvtEcylIIIbP0czsZsEWGuLCJqSQ9pZy/sEQDbGiM7yTpmQ=="
|
||||
},
|
||||
"@ucap/web-socket": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/web-socket/-/web-socket-0.0.2.tgz",
|
||||
"integrity": "sha512-hKAEsIzMhUuR8u26ENkuIAh4Xp8ltzBlZggxhqtLifP8KbgQdWD3w3+1M1697MPni8q42+Q/ZH/1IHLdi8KB7w=="
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/web-socket/-/web-socket-0.0.5.tgz",
|
||||
"integrity": "sha512-BsdH5llLxlFGPjER3rvSLaNKtdQyXhhVyAbPStYJPstBNfcyq0Al8/C97aXFWlpLrmvib+s3AT7o1OmPhv8ZWw=="
|
||||
},
|
||||
"@ucap/web-storage": {
|
||||
"version": "0.0.5",
|
||||
|
|
17
package.json
17
package.json
|
@ -52,7 +52,7 @@
|
|||
"@ucap/ng-native": "~0.0.1",
|
||||
"@ucap/ng-native-browser": "~0.0.1",
|
||||
"@ucap/ng-pi": "~0.0.1",
|
||||
"@ucap/ng-protocol": "~0.0.2",
|
||||
"@ucap/ng-protocol": "~0.0.3",
|
||||
"@ucap/ng-protocol-authentication": "~0.0.3",
|
||||
"@ucap/ng-protocol-buddy": "~0.0.3",
|
||||
"@ucap/ng-protocol-event": "~0.0.3",
|
||||
|
@ -68,17 +68,18 @@
|
|||
"@ucap/ng-protocol-status": "~0.0.3",
|
||||
"@ucap/ng-protocol-sync": "~0.0.3",
|
||||
"@ucap/ng-protocol-umg": "~0.0.3",
|
||||
"@ucap/ng-store-authentication": "~0.0.7",
|
||||
"@ucap/ng-store-chat": "~0.0.4",
|
||||
"@ucap/ng-store-group": "~0.0.5",
|
||||
"@ucap/ng-store-organization": "~0.0.3",
|
||||
"@ucap/ng-store-authentication": "~0.0.10",
|
||||
"@ucap/ng-store-chat": "~0.0.5",
|
||||
"@ucap/ng-store-group": "~0.0.6",
|
||||
"@ucap/ng-store-organization": "~0.0.4",
|
||||
"@ucap/ng-web-socket": "~0.0.2",
|
||||
"@ucap/ng-web-storage": "~0.0.3",
|
||||
"@ucap/ng-ui": "~0.0.3",
|
||||
"@ucap/ng-ui-organization": "~0.0.2",
|
||||
"@ucap/ng-ui-authentication": "~0.0.15",
|
||||
"@ucap/ng-ui-skin-default": "~0.0.1",
|
||||
"@ucap/pi": "~0.0.5",
|
||||
"@ucap/protocol": "~0.0.8",
|
||||
"@ucap/protocol": "~0.0.11",
|
||||
"@ucap/protocol-authentication": "~0.0.5",
|
||||
"@ucap/protocol-buddy": "~0.0.5",
|
||||
"@ucap/protocol-event": "~0.0.5",
|
||||
|
@ -88,13 +89,13 @@
|
|||
"@ucap/protocol-inner": "~0.0.4",
|
||||
"@ucap/protocol-option": "~0.0.7",
|
||||
"@ucap/protocol-ping": "~0.0.4",
|
||||
"@ucap/protocol-query": "~0.0.4",
|
||||
"@ucap/protocol-query": "~0.0.5",
|
||||
"@ucap/protocol-room": "~0.0.5",
|
||||
"@ucap/protocol-service": "~0.0.4",
|
||||
"@ucap/protocol-status": "~0.0.5",
|
||||
"@ucap/protocol-sync": "~0.0.4",
|
||||
"@ucap/protocol-umg": "~0.0.5",
|
||||
"@ucap/web-socket": "~0.0.2",
|
||||
"@ucap/web-socket": "~0.0.5",
|
||||
"@ucap/web-storage": "~0.0.5",
|
||||
"autolinker": "^3.13.0",
|
||||
"axios": "^0.19.2",
|
||||
|
|
|
@ -9,14 +9,14 @@ import { environment } from '@environments';
|
|||
|
||||
import { AppAuthenticationGuard } from './guards/app-authentication.guard';
|
||||
|
||||
import { AppAuthenticationResolver } from './resolvers/app-authentication.resolver';
|
||||
import { AppSessionResolver } from './resolvers/app-session.resolver';
|
||||
|
||||
import { AppAuthenticationService } from './services/app-authentication.service';
|
||||
import { AppNativeService } from './services/app-native.service';
|
||||
import { AppService } from './services/app.service';
|
||||
|
||||
const GUARDS = [AppAuthenticationGuard];
|
||||
const RESOLVERS = [AppAuthenticationResolver];
|
||||
const RESOLVERS = [AppSessionResolver];
|
||||
const SERVICES = [AppService, AppAuthenticationService, AppNativeService];
|
||||
|
||||
const axiosFactory = () => {
|
||||
|
|
|
@ -5,13 +5,13 @@ import { DefaultLayoutComponent } from '@app/layouts/components/default.layout.c
|
|||
import { NoNaviLayoutComponent } from '@app/layouts/components/no-navi.layout.component';
|
||||
|
||||
import { AppAuthenticationGuard } from '@app/guards/app-authentication.guard';
|
||||
import { AppAuthenticationResolver } from './resolvers/app-authentication.resolver';
|
||||
import { AppSessionResolver } from './resolvers/app-session.resolver';
|
||||
|
||||
export function appMatcher(url: UrlSegment[]) {
|
||||
if (1 === url.length) {
|
||||
if (
|
||||
['organization', 'group', 'chat', 'message'].some(
|
||||
(p) => p === url[0].path
|
||||
['organization', 'group', 'chat', 'message'].some((p) =>
|
||||
url[0].path.startsWith(p)
|
||||
)
|
||||
) {
|
||||
return { consumed: url };
|
||||
|
@ -21,6 +21,7 @@ export function appMatcher(url: UrlSegment[]) {
|
|||
}
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/organization', pathMatch: 'full' },
|
||||
{
|
||||
path: 'account',
|
||||
component: NoNaviLayoutComponent,
|
||||
|
@ -42,7 +43,7 @@ const routes: Routes = [
|
|||
component: DefaultLayoutComponent,
|
||||
canActivate: [AppAuthenticationGuard],
|
||||
resolve: {
|
||||
authentication: AppAuthenticationResolver
|
||||
session: AppSessionResolver
|
||||
}
|
||||
},
|
||||
// {
|
||||
|
|
|
@ -35,6 +35,7 @@ import { StatusProtocolModule } from '@ucap/ng-protocol-status';
|
|||
import { SyncProtocolModule } from '@ucap/ng-protocol-sync';
|
||||
import { UmgProtocolModule } from '@ucap/ng-protocol-umg';
|
||||
|
||||
import { WebSocketModule } from '@ucap/ng-web-socket';
|
||||
import { WebStorageModule } from '@ucap/ng-web-storage';
|
||||
|
||||
import { I18nModule } from '@ucap/ng-i18n';
|
||||
|
@ -91,6 +92,7 @@ import { environment } from '@environments';
|
|||
SyncProtocolModule.forRoot({}),
|
||||
UmgProtocolModule.forRoot({}),
|
||||
|
||||
WebSocketModule.forRoot(environment.webSocketModuleConfig),
|
||||
WebStorageModule.forRoot({}),
|
||||
|
||||
I18nModule.forRoot({}),
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Component, ViewChild, OnDestroy, OnInit, Type } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { MatTabChangeEvent } from '@angular/material/tabs';
|
||||
import { MatSidenav } from '@angular/material/sidenav';
|
||||
|
||||
import { Store, select } from '@ngrx/store';
|
||||
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
|
||||
import { AppSelector } from '@app/store/state';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layouts-default',
|
||||
|
@ -22,8 +25,18 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
|||
contentSectionComponent: Type<any>;
|
||||
|
||||
private windowSizeSubscription: Subscription;
|
||||
private routerEventSubscription: Subscription;
|
||||
|
||||
constructor(private router: Router, private store: Store<any>) {}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private store: Store<any>,
|
||||
private logService: LogService
|
||||
) {
|
||||
this.routerEventSubscription = this.router.events.subscribe((event) => {
|
||||
this.logService.debug('DefaultLayoutComponent', event);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.windowSizeSubscription = this.store
|
||||
|
@ -45,14 +58,32 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
|||
if (!this.windowSizeSubscription) {
|
||||
this.windowSizeSubscription.unsubscribe();
|
||||
}
|
||||
if (!!this.routerEventSubscription) {
|
||||
this.routerEventSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
onSelectedTabChange(event: MatTabChangeEvent) {
|
||||
switch (event.index) {
|
||||
case 1:
|
||||
// this.router.navigate(['/chat']);
|
||||
this.router.navigate(['/chat']);
|
||||
break;
|
||||
case 2:
|
||||
this.router.navigate(['/organization']);
|
||||
break;
|
||||
case 3:
|
||||
this.router.navigate(['/message']);
|
||||
break;
|
||||
default:
|
||||
this.router.navigate(['/group']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onRoute(url: string) {
|
||||
this.logService.debug('onRoute', url);
|
||||
switch (url) {
|
||||
case '/organization':
|
||||
import('@app/sections/organization/organization.section.module').then(
|
||||
(m) => {
|
||||
this.leftSectionComponent = m.TreeListSectionComponent;
|
||||
|
@ -64,11 +95,18 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
// this.router.navigate(['/message']);
|
||||
case '/group':
|
||||
break;
|
||||
case '/chat':
|
||||
import('@app/pages/chat/chat.page.module').then((m) => {
|
||||
this.leftSectionComponent = m.RoomListPageComponent;
|
||||
this.contentSectionComponent = m.IndexPageComponent;
|
||||
});
|
||||
break;
|
||||
case '/message':
|
||||
break;
|
||||
|
||||
default:
|
||||
// this.router.navigate(['/group']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,5 @@ export interface LoginSession extends UCAPLoginSession {
|
|||
loginPw?: string;
|
||||
initPw?: boolean;
|
||||
encData?: string;
|
||||
alive?: boolean;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { IndexPageComponent } from './components/index.page.component';
|
||||
import { RoomListPageComponent } from './components/room-list.page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'index',
|
||||
component: IndexPageComponent
|
||||
},
|
||||
{
|
||||
path: 'room-list',
|
||||
component: RoomListPageComponent,
|
||||
outlet: 'outlet-content'
|
||||
}
|
||||
];
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
|
|
|
@ -5,7 +5,12 @@ import { FlexLayoutModule } from '@angular/flex-layout';
|
|||
|
||||
import { AppChatRoutingPageModule } from './chat-routing.page.module';
|
||||
|
||||
import { COMPONENTS } from './components';
|
||||
import { IndexPageComponent } from './components/index.page.component';
|
||||
import { RoomListPageComponent } from './components/room-list.page.component';
|
||||
|
||||
export const COMPONENTS = [IndexPageComponent, RoomListPageComponent];
|
||||
|
||||
export { IndexPageComponent, RoomListPageComponent };
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, FlexLayoutModule, AppChatRoutingPageModule],
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
import { IndexPageComponent } from './index.page.component';
|
||||
import { RoomListPageComponent } from './room-list.page.component';
|
||||
|
||||
export const COMPONENTS = [IndexPageComponent, RoomListPageComponent];
|
|
@ -1 +1,3 @@
|
|||
Room list page of chat is works!
|
||||
<div fxFlexFill>
|
||||
Room list page of chat is works!
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pages-chat-room-list',
|
||||
|
@ -6,5 +7,7 @@ import { Component } from '@angular/core';
|
|||
styleUrls: ['./room-list.page.component.scss']
|
||||
})
|
||||
export class RoomListPageComponent {
|
||||
constructor() {}
|
||||
constructor(private router: Router) {
|
||||
console.log('RoomListPageComponent', this.router.url, this.router);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Observable, forkJoin } from 'rxjs';
|
||||
import { take, concatMap } from 'rxjs/operators';
|
||||
import { Observable, forkJoin, Subject } from 'rxjs';
|
||||
import { take, filter, map, takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import {
|
||||
|
@ -12,9 +12,9 @@ import { Store } from '@ngrx/store';
|
|||
|
||||
import { StatusCode } from '@ucap/api';
|
||||
import { NativeService } from '@ucap/native';
|
||||
import { SSOMode } from '@ucap/protocol-authentication';
|
||||
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
import { SessionStorageService } from '@ucap/ng-web-storage';
|
||||
import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native';
|
||||
import { PublicApiService } from '@ucap/ng-api-public';
|
||||
import { ExternalApiService } from '@ucap/ng-api-external';
|
||||
|
@ -23,25 +23,22 @@ import { InnerProtocolService } from '@ucap/ng-protocol-inner';
|
|||
import { AuthenticationProtocolService } from '@ucap/ng-protocol-authentication';
|
||||
|
||||
import { CompanyActions } from '@ucap/ng-store-organization';
|
||||
import {
|
||||
ConfigurationActions,
|
||||
LoginActions
|
||||
} from '@ucap/ng-store-authentication';
|
||||
import { ConfigurationActions } from '@ucap/ng-store-authentication';
|
||||
|
||||
import { AppAuthenticationService } from '@app/services/app-authentication.service';
|
||||
import { AppKey } from '@app/types/app-key.type';
|
||||
import { LoginSession } from '@app/models/login-session';
|
||||
|
||||
@Injectable()
|
||||
export class AppAuthenticationResolver implements Resolve<void> {
|
||||
export class AppSessionResolver implements Resolve<void> {
|
||||
constructor(
|
||||
private publicApiService: PublicApiService,
|
||||
private externalApiService: ExternalApiService,
|
||||
private protocolService: ProtocolService,
|
||||
private innerProtocolService: InnerProtocolService,
|
||||
private authenticationProtocolService: AuthenticationProtocolService,
|
||||
private store: Store<any>,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private appAuthenticationService: AppAuthenticationService,
|
||||
private logService: LogService,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
|
||||
private logService: LogService
|
||||
) {}
|
||||
|
||||
resolve(
|
||||
|
@ -51,15 +48,11 @@ export class AppAuthenticationResolver implements Resolve<void> {
|
|||
return new Promise<void>(async (resolve, reject) => {
|
||||
try {
|
||||
const loginSession = this.appAuthenticationService.getLoginSession();
|
||||
const networkInfo = await this.nativeService.getNetworkInfo();
|
||||
const localIp =
|
||||
!!networkInfo && 0 < networkInfo.length && !!networkInfo[0].ip
|
||||
? networkInfo[0].ip
|
||||
: '';
|
||||
const localMac =
|
||||
!!networkInfo && 0 < networkInfo.length && !!networkInfo[0].mac
|
||||
? networkInfo[0].mac
|
||||
: '';
|
||||
|
||||
if (loginSession.alive) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
this.store.dispatch(
|
||||
CompanyActions.companies({
|
||||
|
@ -128,46 +121,28 @@ export class AppAuthenticationResolver implements Resolve<void> {
|
|||
|
||||
this.protocolService
|
||||
.connect(versionInfo2Res.serverIp)
|
||||
.pipe(
|
||||
take(1),
|
||||
concatMap(() => {
|
||||
return this.innerProtocolService.conn({}).pipe(
|
||||
take(1),
|
||||
concatMap((connRes) => {
|
||||
return this.authenticationProtocolService
|
||||
.login({
|
||||
loginId: loginSession.loginId,
|
||||
loginPw: loginSession.loginPw,
|
||||
deviceType: loginSession.deviceType,
|
||||
deviceId: ' ',
|
||||
token: '',
|
||||
localeCode: loginSession.localeCode,
|
||||
pushId: ' ',
|
||||
companyCode: loginSession.companyCode,
|
||||
passwordEncodingType: 1,
|
||||
clientVersion: '',
|
||||
reconnect: false,
|
||||
ip: localIp,
|
||||
hostName: localMac,
|
||||
ssoMode: SSOMode.AUTH,
|
||||
userSpecificInformation: 'PRO_000482',
|
||||
andId: '',
|
||||
andPushRefreshYn: ''
|
||||
})
|
||||
.pipe(take(1));
|
||||
})
|
||||
);
|
||||
})
|
||||
)
|
||||
.pipe(take(1))
|
||||
.subscribe(
|
||||
(loginRes) => {
|
||||
this.store.dispatch(
|
||||
LoginActions.loginSuccess({
|
||||
res: loginRes,
|
||||
loginSession
|
||||
})
|
||||
);
|
||||
resolve();
|
||||
() => {
|
||||
const destroy$ = new Subject<boolean>();
|
||||
this.sessionStorageService.changed$
|
||||
.pipe(
|
||||
takeUntil(destroy$),
|
||||
filter((param) => AppKey.LoginSession === param.key),
|
||||
map((param) => param.value)
|
||||
)
|
||||
.subscribe(
|
||||
(v) => {
|
||||
if ((v as LoginSession).alive) {
|
||||
destroy$.next(true);
|
||||
destroy$.unsubscribe();
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
reject(error);
|
||||
}
|
||||
);
|
||||
},
|
||||
(error) => {
|
||||
reject(error);
|
|
@ -1,16 +1,21 @@
|
|||
import { Observable } from 'rxjs';
|
||||
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
|
||||
import { LocaleCode } from '@ucap/core';
|
||||
|
||||
import { PasswordUtil } from '@ucap/pi';
|
||||
import { LoginResponse, SSOMode } from '@ucap/protocol-authentication';
|
||||
import { NativeService } from '@ucap/native';
|
||||
|
||||
import {
|
||||
SessionStorageService,
|
||||
LocalStorageService
|
||||
} from '@ucap/ng-web-storage';
|
||||
import { NativeService } from '@ucap/native';
|
||||
|
||||
import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native';
|
||||
import { InnerProtocolService } from '@ucap/ng-protocol-inner';
|
||||
import { AuthenticationProtocolService } from '@ucap/ng-protocol-authentication';
|
||||
import { LoginActions } from '@ucap/ng-store-authentication';
|
||||
|
||||
import { LoginSession } from '@app/models/login-session';
|
||||
import { UserStore } from '@app/models/user-store';
|
||||
|
@ -18,14 +23,19 @@ import { UserStore } from '@app/models/user-store';
|
|||
import { AppKey } from '@app/types/app-key.type';
|
||||
|
||||
import { environment } from '@environments';
|
||||
import { take, concatMap } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppAuthenticationService {
|
||||
constructor(
|
||||
private innerProtocolService: InnerProtocolService,
|
||||
private authenticationProtocolService: AuthenticationProtocolService,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private localStorageService: LocalStorageService,
|
||||
private store: Store<any>,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
|
||||
) {}
|
||||
|
||||
|
@ -147,6 +157,73 @@ export class AppAuthenticationService {
|
|||
this.sessionStorageService.remove(AppKey.LogoutSession);
|
||||
}
|
||||
|
||||
createSession(): Promise<{
|
||||
loginRes: LoginResponse;
|
||||
loginSession: LoginSession;
|
||||
}> {
|
||||
return new Promise<{
|
||||
loginRes: LoginResponse;
|
||||
loginSession: LoginSession;
|
||||
}>(async (resolve, reject) => {
|
||||
const loginSession = this.getLoginSession();
|
||||
const networkInfo = await this.nativeService.getNetworkInfo();
|
||||
const localIp =
|
||||
!!networkInfo && 0 < networkInfo.length && !!networkInfo[0].ip
|
||||
? networkInfo[0].ip
|
||||
: '';
|
||||
const localMac =
|
||||
!!networkInfo && 0 < networkInfo.length && !!networkInfo[0].mac
|
||||
? networkInfo[0].mac
|
||||
: '';
|
||||
|
||||
this.innerProtocolService
|
||||
.conn({})
|
||||
.pipe(
|
||||
take(1),
|
||||
concatMap((connRes) => {
|
||||
return this.authenticationProtocolService
|
||||
.login({
|
||||
loginId: loginSession.loginId,
|
||||
loginPw: loginSession.loginPw,
|
||||
deviceType: loginSession.deviceType,
|
||||
deviceId: ' ',
|
||||
token: '',
|
||||
localeCode: loginSession.localeCode,
|
||||
pushId: ' ',
|
||||
companyCode: loginSession.companyCode,
|
||||
passwordEncodingType: 1,
|
||||
clientVersion: '',
|
||||
reconnect: false,
|
||||
ip: localIp,
|
||||
hostName: localMac,
|
||||
ssoMode: SSOMode.AUTH,
|
||||
userSpecificInformation: 'PRO_000482',
|
||||
andId: '',
|
||||
andPushRefreshYn: ''
|
||||
})
|
||||
.pipe(take(1));
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
(loginRes) => {
|
||||
this.store.dispatch(
|
||||
LoginActions.loginSuccess({
|
||||
res: loginRes,
|
||||
loginSession
|
||||
})
|
||||
);
|
||||
resolve({
|
||||
loginSession,
|
||||
loginRes
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
reject(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.sessionStorageService.remove(AppKey.LoginResponse);
|
||||
this.sessionStorageService.remove(AppKey.VerInfoResponse);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { Injectable, Inject } from '@angular/core';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { DeviceType, DesktopType } from '@ucap/core';
|
||||
import { NativeService, NativeType, OsType } from '@ucap/native';
|
||||
|
||||
|
@ -10,7 +12,10 @@ import { SessionStorageService } from '@ucap/ng-web-storage';
|
|||
import { PingProtocolService } from '@ucap/ng-protocol-ping';
|
||||
import { DateService } from '@ucap/ng-ui';
|
||||
import { TranslateService } from '@ucap/ng-ui-organization';
|
||||
import { ProtocolService } from '@ucap/ng-protocol';
|
||||
import { LoginActions } from '@ucap/ng-store-authentication';
|
||||
|
||||
import { AppActions } from '@app/store/actions';
|
||||
import { environment } from '@environments';
|
||||
|
||||
import { AppAuthenticationService } from './app-authentication.service';
|
||||
|
@ -23,9 +28,11 @@ export class AppService {
|
|||
private i18nService: I18nService,
|
||||
private translateService: TranslateService,
|
||||
private dateService: DateService,
|
||||
private protocolService: ProtocolService,
|
||||
private pingProtocolService: PingProtocolService,
|
||||
private appAuthenticationService: AppAuthenticationService,
|
||||
private logService: LogService,
|
||||
private store: Store<any>,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
|
||||
) {}
|
||||
|
||||
|
@ -68,7 +75,8 @@ export class AppService {
|
|||
...loginSession,
|
||||
deviceType,
|
||||
desktopType,
|
||||
companyGroupCode: this.companyGroupCode
|
||||
companyGroupCode: this.companyGroupCode,
|
||||
alive: false
|
||||
});
|
||||
|
||||
this.dateService.setDefaultTimezone('Asia/Seoul');
|
||||
|
@ -138,6 +146,35 @@ export class AppService {
|
|||
}
|
||||
});
|
||||
|
||||
return Promise.all([initSession, initI18n, initOrganization]);
|
||||
const initProtocol = new Promise<void>(async (resolve, reject) => {
|
||||
try {
|
||||
this.protocolService.connection$.subscribe((connected) => {
|
||||
if (connected) {
|
||||
this.appAuthenticationService
|
||||
.createSession()
|
||||
.then((result) => {
|
||||
this.store.dispatch(
|
||||
LoginActions.sessionCreated({
|
||||
res: result.loginRes,
|
||||
loginSession: result.loginSession
|
||||
})
|
||||
);
|
||||
})
|
||||
.catch((reason) => {
|
||||
this.logService.error('createSession failed', reason);
|
||||
});
|
||||
} else {
|
||||
this.store.dispatch(
|
||||
LoginActions.sessionDestroyed({ error: 'disconnected' })
|
||||
);
|
||||
}
|
||||
});
|
||||
resolve();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all([initSession, initI18n, initOrganization, initProtocol]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import { LoginActions } from '@ucap/ng-store-authentication';
|
|||
|
||||
import { AppKey } from '@app/types/app-key.type';
|
||||
import { AppAuthenticationService } from '@app/services/app-authentication.service';
|
||||
import { AppActions } from '@app/store/actions';
|
||||
|
||||
import { environment } from '@environments';
|
||||
|
||||
|
@ -119,6 +120,28 @@ export class Effects {
|
|||
{ dispatch: false }
|
||||
);
|
||||
|
||||
sessionCreated$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(LoginActions.sessionCreated),
|
||||
tap((params) => {
|
||||
this.appAuthenticationService.setLoginSession({ alive: true });
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
sessionDestroyed$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(LoginActions.sessionDestroyed),
|
||||
tap((params) => {
|
||||
this.appAuthenticationService.setLoginSession({ alive: false });
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
|
|
|
@ -154,6 +154,12 @@ export const environment: Environment = {
|
|||
urls: piUrls
|
||||
},
|
||||
|
||||
webSocketModuleConfig: {
|
||||
reconnect: {
|
||||
delay: 1000 * 3
|
||||
}
|
||||
},
|
||||
|
||||
protocolModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'ws',
|
||||
|
@ -161,9 +167,6 @@ export const environment: Environment = {
|
|||
port: 8080
|
||||
},
|
||||
urls: protocolUrls,
|
||||
reconnect: {
|
||||
delay: 1000
|
||||
},
|
||||
requestId: {
|
||||
min: 1,
|
||||
max: 59999
|
||||
|
@ -175,6 +178,6 @@ export const environment: Environment = {
|
|||
},
|
||||
pingProtocolModuleConfig: {
|
||||
statusCode: 'O',
|
||||
interval: 5 * 60
|
||||
interval: 5
|
||||
}
|
||||
};
|
||||
|
|
|
@ -154,6 +154,12 @@ export const environment: Environment = {
|
|||
urls: piUrls
|
||||
},
|
||||
|
||||
webSocketModuleConfig: {
|
||||
reconnect: {
|
||||
delay: 1000 * 3
|
||||
}
|
||||
},
|
||||
|
||||
protocolModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'ws',
|
||||
|
@ -161,9 +167,6 @@ export const environment: Environment = {
|
|||
port: 8080
|
||||
},
|
||||
urls: protocolUrls,
|
||||
reconnect: {
|
||||
delay: 1000
|
||||
},
|
||||
requestId: {
|
||||
min: 1,
|
||||
max: 59999
|
||||
|
|
|
@ -157,6 +157,12 @@ export const environment: Environment = {
|
|||
urls: piUrls
|
||||
},
|
||||
|
||||
webSocketModuleConfig: {
|
||||
reconnect: {
|
||||
delay: 1000 * 3
|
||||
}
|
||||
},
|
||||
|
||||
protocolModuleConfig: {
|
||||
hostConfig: {
|
||||
protocol: 'ws',
|
||||
|
@ -164,9 +170,6 @@ export const environment: Environment = {
|
|||
port: 8080
|
||||
},
|
||||
urls: protocolUrls,
|
||||
reconnect: {
|
||||
delay: 1000
|
||||
},
|
||||
requestId: {
|
||||
min: 1,
|
||||
max: 59999
|
||||
|
|
|
@ -2,6 +2,8 @@ import { Type } from '@angular/core';
|
|||
|
||||
import { DeviceType, DesktopType } from '@ucap/core';
|
||||
|
||||
import { ModuleConfig as WebSocketModuleConfig } from '@ucap/web-socket';
|
||||
|
||||
import {
|
||||
ModuleConfig as CommonApiModuleConfig,
|
||||
Urls as CommonApiUrls
|
||||
|
@ -114,6 +116,7 @@ export interface Environment {
|
|||
messageApiModuleConfig: MessageApiModuleConfig;
|
||||
promptApiModuleConfig: PromptApiModuleConfig;
|
||||
piModuleConfig: PiModuleConfig;
|
||||
webSocketModuleConfig: WebSocketModuleConfig;
|
||||
protocolModuleConfig: ProtocolModuleConfig;
|
||||
pingProtocolModuleConfig: PingProtocolModuleConfig;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user