diff --git a/angular.json b/angular.json index 37ed647d..79569837 100644 --- a/angular.json +++ b/angular.json @@ -82,7 +82,7 @@ "budgets": [ { "type": "initial", - "maximumWarning": "2mb", + "maximumWarning": "4mb", "maximumError": "5mb" }, { @@ -140,7 +140,7 @@ "budgets": [ { "type": "initial", - "maximumWarning": "2mb", + "maximumWarning": "4mb", "maximumError": "5mb" }, { diff --git a/config/angular.webpack.config.js b/config/angular.webpack.config.js index c7013ead..1e970c61 100644 --- a/config/angular.webpack.config.js +++ b/config/angular.webpack.config.js @@ -4,14 +4,12 @@ module.exports = (config, options) => { const PRODUCTION = process.env.NODE_ENV === 'production'; const BROWSER = process.env.UCAP_ENV_RUNTIME === 'BROWSER'; - console.log('BROWSER', BROWSER, config.target); - if (!BROWSER) { config.target = 'electron-renderer'; } else { config.target = 'web'; config.node = { - fs: 'empty' + fs: 'empty', }; } @@ -21,7 +19,7 @@ module.exports = (config, options) => { __dirname, '..', 'projects/ucap-webmessenger-ui/src/assets/scss' - ) + ), }; return config; diff --git a/config/main.webpack.config.ts b/config/main.webpack.config.ts index 961a2542..5759bf65 100644 --- a/config/main.webpack.config.ts +++ b/config/main.webpack.config.ts @@ -20,18 +20,18 @@ const mainConfig: webpack.Configuration = { __dirname, '..', 'electron-projects/ucap-webmessenger-electron/src/index' - ) + ), }, target: 'electron-main', mode: enviroments.__DEV__ ? 'development' : 'production', devtool: 'source-map', optimization: { - noEmitOnErrors: true + noEmitOnErrors: true, }, externals, output: { filename: '[name].js', - path: path.resolve(__dirname, '..', outputDir) + path: path.resolve(__dirname, '..', outputDir), }, module: { rules: [ @@ -44,7 +44,7 @@ const mainConfig: webpack.Configuration = { 'electron-projects/ucap-webmessenger-electron/src' ), path.resolve(__dirname, '..', 'electron-projects'), - path.resolve(__dirname, '..', 'projects') + path.resolve(__dirname, '..', 'projects'), ], use: [ { @@ -55,20 +55,20 @@ const mainConfig: webpack.Configuration = { __dirname, '..', 'electron-projects/ucap-webmessenger-electron/tsconfig.electron.json' - ) - } - } + ), + }, + }, ], - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /\.node$/, loader: 'awesome-node-loader', options: { - name: '[name].[ext]' - } - } - ] + name: '[name].[ext]', + }, + }, + ], }, plugins: [ new CleanWebpackPlugin({ verbose: false }), @@ -77,16 +77,16 @@ const mainConfig: webpack.Configuration = { new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.DefinePlugin( Object.assign({}, enviroments, { - __PROCESS_KIND__: JSON.stringify('main') + __PROCESS_KIND__: JSON.stringify('main'), }) ), new CopyWebpackPlugin([ { from: 'ucap-webmessenger-electron/resources/**/*', to: path.resolve(__dirname, '..', 'dist'), - context: 'electron-projects' - } - ]) + context: 'electron-projects', + }, + ]), ], resolve: { extensions: ['.js', '.ts'], @@ -101,6 +101,11 @@ const mainConfig: webpack.Configuration = { '..', 'electron-projects/ucap-webmessenger-electron-notification/src/public-api' ), + '@ucap-webmessenger/core': path.resolve( + __dirname, + '..', + 'projects/ucap-webmessenger-core/src/public-api' + ), '@ucap-webmessenger/native': path.resolve( __dirname, '..', @@ -115,14 +120,14 @@ const mainConfig: webpack.Configuration = { __dirname, '..', 'electron-projects/ucap-webmessenger-electron/src/public-api' - ) + ), }, - modules: [path.resolve(__dirname, '..', 'node_modules/')] + modules: [path.resolve(__dirname, '..', 'node_modules/')], }, node: { __dirname: false, - __filename: false - } + __filename: false, + }, }; export default [mainConfig]; diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..29789cd5 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.1' + +services: + nginx: + image: nginx:1.17.5-alpine + volumes: + - ../dist/ucap-webmessenger-app:/usr/share/nginx/html:ro + ports: + - 8099:80 diff --git a/electron-projects/ucap-webmessenger-electron/tsconfig.electron.json b/electron-projects/ucap-webmessenger-electron/tsconfig.electron.json index 0eec2f0f..d01f9dcd 100644 --- a/electron-projects/ucap-webmessenger-electron/tsconfig.electron.json +++ b/electron-projects/ucap-webmessenger-electron/tsconfig.electron.json @@ -19,6 +19,9 @@ "@ucap-webmessenger/electron-notification": [ "../ucap-webmessenger-electron-notification/src/public-api" ], + "@ucap-webmessenger/core": [ + "../../projects/ucap-webmessenger-core/src/public-api" + ], "@ucap-webmessenger/native": [ "../../projects/ucap-webmessenger-native/src/public-api" ], diff --git a/package.json b/package.json index e1df8b40..e6c3d28d 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "start:renderer": "cross-env UCAP_ENV_RUNTIME=ELECTRON ng serve -c renderer-development", "start:browser": "cross-env UCAP_ENV_RUNTIME=BROWSER ng serve -c browser-development -o", "build:renderer": "cross-env NODE_ENV=production ng build --base-href ./", + "build:browser": "cross-env UCAP_ENV_RUNTIME=BROWSER ng build -c browser-development", "build:main:development": "cross-env NODE_ENV=development TS_NODE_PROJECT='./config/tsconfig.webpack.json' parallel-webpack --config=config/main.webpack.config.ts", "build:main:production": "cross-env NODE_ENV=production TS_NODE_PROJECT='./config/tsconfig.webpack.json' NODE_OPTIONS='--max_old_space_size=4096' parallel-webpack --config=config/main.webpack.config.ts", "test": "ng test", diff --git a/projects/ucap-webmessenger-api-common/src/lib/config/module-config.ts b/projects/ucap-webmessenger-api-common/src/lib/config/module-config.ts new file mode 100644 index 00000000..c51a89c0 --- /dev/null +++ b/projects/ucap-webmessenger-api-common/src/lib/config/module-config.ts @@ -0,0 +1,7 @@ +import { ModuleConfig as CoreModuleConfig } from '@ucap-webmessenger/core'; + +import { Urls } from './urls'; + +export interface ModuleConfig extends CoreModuleConfig { + acceptableFileExtensions: string[]; +} diff --git a/projects/ucap-webmessenger-api-common/src/lib/types/token.ts b/projects/ucap-webmessenger-api-common/src/lib/config/token.ts similarity index 100% rename from projects/ucap-webmessenger-api-common/src/lib/types/token.ts rename to projects/ucap-webmessenger-api-common/src/lib/config/token.ts diff --git a/projects/ucap-webmessenger-api-common/src/lib/config/urls.ts b/projects/ucap-webmessenger-api-common/src/lib/config/urls.ts new file mode 100644 index 00000000..2fc7cb2f --- /dev/null +++ b/projects/ucap-webmessenger-api-common/src/lib/config/urls.ts @@ -0,0 +1,12 @@ +export interface Urls { + fileProfileSave: string; + fileTalkDownload: string; + fileTalkSave: string; + fileTalkShare: string; + massTalkDownload: string; + massTalkSave: string; + transMassTalkDownload: string; + transMassTalkSave: string; + translationReq: string; + translationSave: string; +} diff --git a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts index 4ec66383..ba8e48b6 100644 --- a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts +++ b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts @@ -3,82 +3,92 @@ import { HttpClient, HttpEventType, HttpResponse, - HttpRequest + HttpRequest, } from '@angular/common/http'; import { Observable, Subject } from 'rxjs'; import { map, filter } from 'rxjs/operators'; -import { _MODULE_CONFIG } from '../types/token'; -import { ModuleConfig } from '../types/module-config'; import { FileProfileSaveRequest, FileProfileSaveResponse, encodeFileProfileSave, - decodeFileProfileSave + decodeFileProfileSave, } from '../apis/file-profile-save'; import { FileTalkDownloadRequest, encodeFileTalkDownload, - encodeFormDataFileTalkDownload + encodeFormDataFileTalkDownload, } from '../apis/file-talk-download'; import { FileTalkSaveRequest, FileTalkSaveResponse, encodeFileTalkSave, - decodeFileTalkSave + decodeFileTalkSave, } from '../apis/file-talk-save'; import { FileTalkShareRequest, FileTalkShareResponse, encodeFileTalkShare, - decodeFileTalkShare + decodeFileTalkShare, } from '../apis/file-talk-share'; import { MassTalkDownloadRequest, MassTalkDownloadResponse, encodeMassTalkDownload, - decodeMassTalkDownload + decodeMassTalkDownload, } from '../apis/mass-talk-download'; import { MassTalkSaveRequest, MassTalkSaveResponse, encodeMassTalkSave, - decodeMassTalkSave + decodeMassTalkSave, } from '../apis/mass-talk-save'; import { TransMassTalkDownloadRequest, TransMassTalkDownloadResponse, encodeTransMassTalkDownload, - decodeTransMassTalkDownload + decodeTransMassTalkDownload, } from '../apis/trans-mass-talk-download'; import { TransMassTalkSaveRequest, TransMassTalkSaveResponse, encodeTransMassTalkSave, - decodeTransMassTalkSave + decodeTransMassTalkSave, } from '../apis/trans-mass-talk-save'; import { TranslationReqRequest, TranslationReqResponse, encodeTranslationReq, - decodeTranslationReq + decodeTranslationReq, } from '../apis/translation-req'; import { TranslationSaveRequest, TranslationSaveResponse, encodeTranslationSave, - decodeTranslationSave + decodeTranslationSave, } from '../apis/translation-save'; +import { _MODULE_CONFIG } from '../config/token'; +import { ModuleConfig } from '../config/module-config'; +import { Urls } from '../config/urls'; +import { UrlConfig } from '@ucap-webmessenger/core'; + @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CommonApiService { + readonly urls: Urls; + constructor( @Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig, private httpClient: HttpClient - ) {} + ) { + this.urls = UrlConfig.getUrls( + this.moduleConfig.hostConfig, + this.moduleConfig.urls + ); + } public fileProfileSave( req: FileProfileSaveRequest, @@ -86,12 +96,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - !!fileProfileSaveUrl - ? fileProfileSaveUrl - : this.moduleConfig.urls.fileProfileSave, + !!fileProfileSaveUrl ? fileProfileSaveUrl : this.urls.fileProfileSave, {}, { - params: encodeFileProfileSave(req) + params: encodeFileProfileSave(req), } ) .pipe(map(res => decodeFileProfileSave(res))); @@ -103,12 +111,10 @@ export class CommonApiService { ): string { const httpReq = new HttpRequest( 'GET', - !!fileTalkDownloadUrl - ? fileTalkDownloadUrl - : this.moduleConfig.urls.fileTalkDownload, + !!fileTalkDownloadUrl ? fileTalkDownloadUrl : this.urls.fileTalkDownload, {}, { - params: encodeFileTalkDownload(req) + params: encodeFileTalkDownload(req), } ); @@ -121,9 +127,7 @@ export class CommonApiService { ): Observable { const httpReq = new HttpRequest( 'POST', - !!fileTalkDownloadUrl - ? fileTalkDownloadUrl - : this.moduleConfig.urls.fileTalkDownload, + !!fileTalkDownloadUrl ? fileTalkDownloadUrl : this.urls.fileTalkDownload, encodeFormDataFileTalkDownload(req), { reportProgress: true, responseType: 'blob' } ); @@ -159,7 +163,7 @@ export class CommonApiService { ): Observable { const httpReq = new HttpRequest( 'POST', - !!fileTalkSaveUrl ? fileTalkSaveUrl : this.moduleConfig.urls.fileTalkSave, + !!fileTalkSaveUrl ? fileTalkSaveUrl : this.urls.fileTalkSave, encodeFileTalkSave(req), { reportProgress: true, responseType: 'text' as 'json' } ); @@ -185,7 +189,10 @@ export class CommonApiService { public acceptableExtensionForFileTalk(extensions: string[]): boolean { for (const extension of extensions) { if ( - -1 === this.moduleConfig.acceptableFileExtensions.indexOf(extension.toLowerCase()) + -1 === + this.moduleConfig.acceptableFileExtensions.indexOf( + extension.toLowerCase() + ) ) { return false; } @@ -198,10 +205,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.fileTalkShare, + this.urls.fileTalkShare, {}, { - params: encodeFileTalkShare(req) + params: encodeFileTalkShare(req), } ) .pipe(map(res => decodeFileTalkShare(res))); @@ -212,11 +219,11 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.massTalkDownload, + this.urls.massTalkDownload, {}, { params: encodeMassTalkDownload(req), - responseType: 'text' as 'json' + responseType: 'text' as 'json', } ) .pipe(map(res => decodeMassTalkDownload(res))); @@ -227,11 +234,11 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.massTalkSave, + this.urls.massTalkSave, {}, { params: encodeMassTalkSave(req), - responseType: 'text' as 'json' + responseType: 'text' as 'json', } ) .pipe(map(res => decodeMassTalkSave(res))); @@ -242,10 +249,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.transMassTalkDownload, + this.urls.transMassTalkDownload, {}, { - params: encodeTransMassTalkDownload(req) + params: encodeTransMassTalkDownload(req), } ) .pipe(map(res => decodeTransMassTalkDownload(res))); @@ -256,10 +263,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.transMassTalkSave, + this.urls.transMassTalkSave, {}, { - params: encodeTransMassTalkSave(req) + params: encodeTransMassTalkSave(req), } ) .pipe(map(res => decodeTransMassTalkSave(res))); @@ -270,10 +277,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.translationReq, + this.urls.translationReq, {}, { - params: encodeTranslationReq(req) + params: encodeTranslationReq(req), } ) .pipe(map(res => decodeTranslationReq(res))); @@ -284,10 +291,10 @@ export class CommonApiService { ): Observable { return this.httpClient .post( - this.moduleConfig.urls.translationSave, + this.urls.translationSave, {}, { - params: encodeTranslationSave(req) + params: encodeTranslationSave(req), } ) .pipe(map(res => decodeTranslationSave(res))); diff --git a/projects/ucap-webmessenger-api-common/src/lib/types/module-config.ts b/projects/ucap-webmessenger-api-common/src/lib/types/module-config.ts deleted file mode 100644 index 8799fa4f..00000000 --- a/projects/ucap-webmessenger-api-common/src/lib/types/module-config.ts +++ /dev/null @@ -1,15 +0,0 @@ -export interface ModuleConfig { - urls: { - fileProfileSave: string; - fileTalkDownload: string; - fileTalkSave: string; - fileTalkShare: string; - massTalkDownload: string; - massTalkSave: string; - transMassTalkDownload: string; - transMassTalkSave: string; - translationReq: string; - translationSave: string; - }; - acceptableFileExtensions: string[]; -} diff --git a/projects/ucap-webmessenger-api-common/src/lib/ucap-common-api.module.ts b/projects/ucap-webmessenger-api-common/src/lib/ucap-common-api.module.ts index 3e3baffb..2292850f 100644 --- a/projects/ucap-webmessenger-api-common/src/lib/ucap-common-api.module.ts +++ b/projects/ucap-webmessenger-api-common/src/lib/ucap-common-api.module.ts @@ -1,15 +1,16 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; -import { _MODULE_CONFIG } from './types/token'; import { CommonApiService } from './services/common-api.service'; -import { ModuleConfig } from './types/module-config'; + +import { _MODULE_CONFIG } from './config/token'; +import { ModuleConfig } from './config/module-config'; const SERVICES = [CommonApiService]; @NgModule({ declarations: [], imports: [], - exports: [] + exports: [], }) export class UCapCommonApiModule { public static forRoot( @@ -17,7 +18,7 @@ export class UCapCommonApiModule { ): ModuleWithProviders { return { ngModule: UCapCommonApiModule, - providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES] + providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES], }; } } diff --git a/projects/ucap-webmessenger-api-common/src/public-api.ts b/projects/ucap-webmessenger-api-common/src/public-api.ts index 0a47d28d..82e0038c 100644 --- a/projects/ucap-webmessenger-api-common/src/public-api.ts +++ b/projects/ucap-webmessenger-api-common/src/public-api.ts @@ -2,8 +2,6 @@ * Public API Surface of ucap-webmessenger-api-common */ -export * from './lib/types/module-config'; - export * from './lib/apis/file-profile-save'; export * from './lib/apis/file-talk-download'; export * from './lib/apis/file-talk-save'; @@ -21,3 +19,6 @@ export * from './lib/models/file-upload-item'; export * from './lib/services/common-api.service'; export * from './lib/ucap-common-api.module'; + +export * from './lib/config/urls'; +export * from './lib/config/module-config'; diff --git a/projects/ucap-webmessenger-api-external/src/lib/config/module-config.ts b/projects/ucap-webmessenger-api-external/src/lib/config/module-config.ts new file mode 100644 index 00000000..8e49cd75 --- /dev/null +++ b/projects/ucap-webmessenger-api-external/src/lib/config/module-config.ts @@ -0,0 +1,5 @@ +import { ModuleConfig as CoreModuleConfig } from '@ucap-webmessenger/core'; + +import { Urls } from './urls'; + +export interface ModuleConfig extends CoreModuleConfig {} diff --git a/projects/ucap-webmessenger-api-external/src/lib/types/token.ts b/projects/ucap-webmessenger-api-external/src/lib/config/token.ts similarity index 100% rename from projects/ucap-webmessenger-api-external/src/lib/types/token.ts rename to projects/ucap-webmessenger-api-external/src/lib/config/token.ts diff --git a/projects/ucap-webmessenger-api-external/src/lib/config/urls.ts b/projects/ucap-webmessenger-api-external/src/lib/config/urls.ts new file mode 100644 index 00000000..1912b8cb --- /dev/null +++ b/projects/ucap-webmessenger-api-external/src/lib/config/urls.ts @@ -0,0 +1,6 @@ +export interface Urls { + checkUserInfoEx: string; + companyList: string; + tokenUpdate: string; + urlInfo: string; +} diff --git a/projects/ucap-webmessenger-api-external/src/lib/services/external-api.service.ts b/projects/ucap-webmessenger-api-external/src/lib/services/external-api.service.ts index a4730adf..5da6b027 100644 --- a/projects/ucap-webmessenger-api-external/src/lib/services/external-api.service.ts +++ b/projects/ucap-webmessenger-api-external/src/lib/services/external-api.service.ts @@ -4,51 +4,61 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { _MODULE_CONFIG } from '../types/token'; -import { ModuleConfig } from '../types/module-config'; import { CheckUserInfoExRequest, CheckUserInfoExResponse, encodeCheckUserInfoEx, - decodeCheckUserInfoEx + decodeCheckUserInfoEx, } from '../apis/check-user-info-ex'; import { CompanyListRequest, CompanyListResponse, encodeCompanyList, - decodeCompanyList + decodeCompanyList, } from '../apis/company-list'; import { TokenUpdateRequest, TokenUpdateResponse, encodeTokenUpdate, - decodeTokenUpdate + decodeTokenUpdate, } from '../apis/token-update'; import { UrlInfoResponse, UrlInfoRequest, encodeUrlInfo, - decodeUrlInfo + decodeUrlInfo, } from '../apis/url-info'; +import { _MODULE_CONFIG } from '../config/token'; +import { ModuleConfig } from '../config/module-config'; +import { Urls } from '../config/urls'; +import { UrlConfig } from '@ucap-webmessenger/core'; + @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ExternalApiService { + readonly urls: Urls; + constructor( @Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig, private httpClient: HttpClient - ) {} + ) { + this.urls = UrlConfig.getUrls( + this.moduleConfig.hostConfig, + this.moduleConfig.urls + ); + } public checkUserInfoEx( req: CheckUserInfoExRequest ): Observable { return this.httpClient .post( - this.moduleConfig.urls.checkUserInfoEx, + this.urls.checkUserInfoEx, {}, { - params: encodeCheckUserInfoEx(req) + params: encodeCheckUserInfoEx(req), } ) .pipe(map(res => decodeCheckUserInfoEx(res))); @@ -57,10 +67,10 @@ export class ExternalApiService { public companyList(req: CompanyListRequest): Observable { return this.httpClient .post( - this.moduleConfig.urls.companyList, + this.urls.companyList, {}, { - params: encodeCompanyList(req) + params: encodeCompanyList(req), } ) .pipe(map(res => decodeCompanyList(res))); @@ -69,10 +79,10 @@ export class ExternalApiService { public tokenUpdate(req: TokenUpdateRequest): Observable { return this.httpClient .post( - this.moduleConfig.urls.tokenUpdate, + this.urls.tokenUpdate, {}, { - params: encodeTokenUpdate(req) + params: encodeTokenUpdate(req), } ) .pipe(map(res => decodeTokenUpdate(res))); @@ -81,10 +91,10 @@ export class ExternalApiService { public urlInfo(req: UrlInfoRequest): Observable { return this.httpClient .post( - this.moduleConfig.urls.urlInfo, + this.urls.urlInfo, {}, { - params: encodeUrlInfo(req) + params: encodeUrlInfo(req), } ) .pipe(map(res => decodeUrlInfo(res))); diff --git a/projects/ucap-webmessenger-api-external/src/lib/types/module-config.ts b/projects/ucap-webmessenger-api-external/src/lib/types/module-config.ts deleted file mode 100644 index 91a494d8..00000000 --- a/projects/ucap-webmessenger-api-external/src/lib/types/module-config.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface ModuleConfig { - urls: { - checkUserInfoEx: string; - companyList: string; - tokenUpdate: string; - urlInfo: string; - }; -} diff --git a/projects/ucap-webmessenger-api-external/src/lib/ucap-external-api.module.ts b/projects/ucap-webmessenger-api-external/src/lib/ucap-external-api.module.ts index c21dada5..c6283c72 100644 --- a/projects/ucap-webmessenger-api-external/src/lib/ucap-external-api.module.ts +++ b/projects/ucap-webmessenger-api-external/src/lib/ucap-external-api.module.ts @@ -1,15 +1,16 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; -import { _MODULE_CONFIG } from './types/token'; import { ExternalApiService } from './services/external-api.service'; -import { ModuleConfig } from './types/module-config'; + +import { _MODULE_CONFIG } from './config/token'; +import { ModuleConfig } from './config/module-config'; const SERVICES = [ExternalApiService]; @NgModule({ declarations: [], imports: [], - exports: [] + exports: [], }) export class UCapExternalApiModule { public static forRoot( @@ -17,7 +18,7 @@ export class UCapExternalApiModule { ): ModuleWithProviders { return { ngModule: UCapExternalApiModule, - providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES] + providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES], }; } } diff --git a/projects/ucap-webmessenger-api-external/src/public-api.ts b/projects/ucap-webmessenger-api-external/src/public-api.ts index b9a5d5ab..375f6493 100644 --- a/projects/ucap-webmessenger-api-external/src/public-api.ts +++ b/projects/ucap-webmessenger-api-external/src/public-api.ts @@ -2,8 +2,6 @@ * Public API Surface of ucap-webmessenger-api-public */ -export * from './lib/types/module-config'; - export * from './lib/models/company'; export * from './lib/apis/check-user-info-ex'; @@ -14,3 +12,6 @@ export * from './lib/apis/url-info'; export * from './lib/services/external-api.service'; export * from './lib/ucap-external-api.module'; + +export * from './lib/config/urls'; +export * from './lib/config/module-config'; diff --git a/projects/ucap-webmessenger-api-public/src/lib/apis/update-info.ts b/projects/ucap-webmessenger-api-public/src/lib/apis/update-info.ts index a4d08e08..4a1cfea9 100644 --- a/projects/ucap-webmessenger-api-public/src/lib/apis/update-info.ts +++ b/projects/ucap-webmessenger-api-public/src/lib/apis/update-info.ts @@ -4,7 +4,7 @@ import { APIResponse, APIEncoder, APIDecoder, - ParameterUtil + ParameterUtil, } from '@ucap-webmessenger/api'; export interface UpdateInfoRequest extends APIRequest { @@ -19,7 +19,7 @@ export interface UpdateInfoResponse extends APIResponse { } const updateInfoEncodeMap = { - deviceType: 'p_device_type' + deviceType: 'p_device_type', }; export const encodeUpdateInfo: APIEncoder = ( @@ -35,6 +35,6 @@ export const decodeUpdateInfo: APIDecoder = (res: any) => { appVersion: res.AppVer, installUrl: res.InstallURL, launcherAppVersion: res.LauncherAppVer, - launcherInstallUrl: res.LauncherInstallURL + launcherInstallUrl: res.LauncherInstallURL, } as UpdateInfoResponse; }; diff --git a/projects/ucap-webmessenger-api-public/src/lib/config/module-config.ts b/projects/ucap-webmessenger-api-public/src/lib/config/module-config.ts new file mode 100644 index 00000000..8e49cd75 --- /dev/null +++ b/projects/ucap-webmessenger-api-public/src/lib/config/module-config.ts @@ -0,0 +1,5 @@ +import { ModuleConfig as CoreModuleConfig } from '@ucap-webmessenger/core'; + +import { Urls } from './urls'; + +export interface ModuleConfig extends CoreModuleConfig {} diff --git a/projects/ucap-webmessenger-api-public/src/lib/types/token.ts b/projects/ucap-webmessenger-api-public/src/lib/config/token.ts similarity index 100% rename from projects/ucap-webmessenger-api-public/src/lib/types/token.ts rename to projects/ucap-webmessenger-api-public/src/lib/config/token.ts diff --git a/projects/ucap-webmessenger-api-public/src/lib/config/urls.ts b/projects/ucap-webmessenger-api-public/src/lib/config/urls.ts new file mode 100644 index 00000000..6a9da63f --- /dev/null +++ b/projects/ucap-webmessenger-api-public/src/lib/config/urls.ts @@ -0,0 +1,4 @@ +export interface Urls { + versionInfo2: string; + updateInfo: string; +} diff --git a/projects/ucap-webmessenger-api-public/src/lib/services/public-api.service.ts b/projects/ucap-webmessenger-api-public/src/lib/services/public-api.service.ts index d3dd1f98..739fdb6b 100644 --- a/projects/ucap-webmessenger-api-public/src/lib/services/public-api.service.ts +++ b/projects/ucap-webmessenger-api-public/src/lib/services/public-api.service.ts @@ -4,39 +4,49 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { _MODULE_CONFIG } from '../types/token'; import { VersionInfo2Request, VersionInfo2Response, encodeVersionInfo2, - decodeVersionInfo2 + decodeVersionInfo2, } from '../apis/version-info2'; import { UpdateInfoRequest, UpdateInfoResponse, encodeUpdateInfo, - decodeUpdateInfo + decodeUpdateInfo, } from '../apis/update-info'; -import { ModuleConfig } from '../types/module-config'; + +import { _MODULE_CONFIG } from '../config/token'; +import { ModuleConfig } from '../config/module-config'; +import { UrlConfig } from '@ucap-webmessenger/core'; +import { Urls } from '../config/urls'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class PublicApiService { + readonly urls: Urls; + constructor( @Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig, private httpClient: HttpClient - ) {} + ) { + this.urls = UrlConfig.getUrls( + this.moduleConfig.hostConfig, + this.moduleConfig.urls + ); + } public versionInfo2( req: VersionInfo2Request ): Observable { return this.httpClient .post( - this.moduleConfig.urls.versionInfo2, + this.urls.versionInfo2, {}, { - params: encodeVersionInfo2(req) + params: encodeVersionInfo2(req), } ) .pipe(map((res: any) => decodeVersionInfo2(res))); @@ -45,10 +55,10 @@ export class PublicApiService { public updateInfo(req: UpdateInfoRequest): Observable { return this.httpClient .post( - this.moduleConfig.urls.updateInfo, + this.urls.updateInfo, {}, { - params: encodeUpdateInfo(req) + params: encodeUpdateInfo(req), } ) .pipe(map(res => decodeUpdateInfo(res))); diff --git a/projects/ucap-webmessenger-api-public/src/lib/types/module-config.ts b/projects/ucap-webmessenger-api-public/src/lib/types/module-config.ts deleted file mode 100644 index 3d90c146..00000000 --- a/projects/ucap-webmessenger-api-public/src/lib/types/module-config.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface ModuleConfig { - urls: { - versionInfo2: string; - updateInfo: string; - }; -} diff --git a/projects/ucap-webmessenger-api-public/src/lib/ucap-public-api.module.ts b/projects/ucap-webmessenger-api-public/src/lib/ucap-public-api.module.ts index 3424d78f..cc929036 100644 --- a/projects/ucap-webmessenger-api-public/src/lib/ucap-public-api.module.ts +++ b/projects/ucap-webmessenger-api-public/src/lib/ucap-public-api.module.ts @@ -1,15 +1,16 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; -import { _MODULE_CONFIG } from './types/token'; import { PublicApiService } from './services/public-api.service'; -import { ModuleConfig } from './types/module-config'; + +import { _MODULE_CONFIG } from './config/token'; +import { ModuleConfig } from './config/module-config'; const SERVICES = [PublicApiService]; @NgModule({ declarations: [], imports: [], - exports: [] + exports: [], }) export class UCapPublicApiModule { public static forRoot( @@ -17,7 +18,7 @@ export class UCapPublicApiModule { ): ModuleWithProviders { return { ngModule: UCapPublicApiModule, - providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES] + providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES], }; } } diff --git a/projects/ucap-webmessenger-api-public/src/public-api.ts b/projects/ucap-webmessenger-api-public/src/public-api.ts index eb7db5ee..41cd5c4d 100644 --- a/projects/ucap-webmessenger-api-public/src/public-api.ts +++ b/projects/ucap-webmessenger-api-public/src/public-api.ts @@ -7,7 +7,9 @@ export * from './lib/apis/version-info2'; export * from './lib/services/public-api.service'; -export * from './lib/types/module-config'; export * from './lib/types/sync-mode.type'; export * from './lib/ucap-public-api.module'; + +export * from './lib/config/urls'; +export * from './lib/config/module-config'; diff --git a/projects/ucap-webmessenger-api/src/lib/types/status-code.type.ts b/projects/ucap-webmessenger-api/src/lib/types/status-code.type.ts index ec9005b5..e3db8044 100644 --- a/projects/ucap-webmessenger-api/src/lib/types/status-code.type.ts +++ b/projects/ucap-webmessenger-api/src/lib/types/status-code.type.ts @@ -1,4 +1,4 @@ export enum StatusCode { Success = '200', - Fail = '500' + Fail = '500', } diff --git a/projects/ucap-webmessenger-app/src/app/app-provider.module.ts b/projects/ucap-webmessenger-app/src/app/app-provider.module.ts index 5dfda4ed..9fea381a 100644 --- a/projects/ucap-webmessenger-app/src/app/app-provider.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-provider.module.ts @@ -1,35 +1,59 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; +import { NgModule, APP_INITIALIZER, Type } from '@angular/core'; + +import { HttpClient } from '@angular/common/http'; + +import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native'; import { RESOLVERS } from './resolvers'; import { SERVICES } from './services'; import { AppService } from './services/app.service'; -import { HttpClient } from '@angular/common/http'; -import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; -import { environment } from '../environments/environment'; -export function initializeApp(appService: AppService) { +import { environment } from '../environments/environment'; +import { BrowserNativeService } from '@ucap-webmessenger/native-browser'; +import { ElectronNativeService } from '@ucap-webmessenger/native-electron'; + +export function initializeApp( + appService: AppService, + nativeService: NativeService +) { return (): Promise => { return appService.postInit(); }; } +// export function nativeServiceFactory(httpClient: HttpClient) { +// if ('browser' === environment.runtime) { +// return import('@ucap-webmessenger/native-browser').then( +// m => new m.BrowserNativeService(httpClient) +// ); +// } else { +// return import('@ucap-webmessenger/native-electron').then( +// m => new m.ElectronNativeService() +// ); +// } +// } + @NgModule({ imports: [], exports: [], providers: [ - ...SERVICES, - ...RESOLVERS, { provide: UCAP_NATIVE_SERVICE, - useClass: environment.modules.native.serviceClass, - deps: [HttpClient] + // useFactory: nativeServiceFactory, + useClass: + 'browser' === environment.runtime + ? BrowserNativeService + : ElectronNativeService, + deps: [HttpClient], }, + ...SERVICES, + ...RESOLVERS, { provide: APP_INITIALIZER, useFactory: initializeApp, deps: [AppService, UCAP_NATIVE_SERVICE], - multi: true - } - ] + multi: true, + }, + ], }) export class AppProviderModule {} diff --git a/projects/ucap-webmessenger-app/src/app/app-routing.module.ts b/projects/ucap-webmessenger-app/src/app/app-routing.module.ts index e27fc322..99fef86b 100644 --- a/projects/ucap-webmessenger-app/src/app/app-routing.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-routing.module.ts @@ -10,26 +10,26 @@ const routes: Routes = [ import('./pages/messenger/messenger.page.module').then( m => m.AppMessengerPageModule ), - canActivate: [AppAuthGuard] + canActivate: [AppAuthGuard], }, { path: 'account', loadChildren: () => import('./pages/account/account.page.module').then( m => m.AppAccountPageModule - ) + ), }, { path: 'template', loadChildren: () => import('./pages/template/template.page.module').then( m => m.AppTemplatePageModule - ) - } + ), + }, ]; @NgModule({ imports: [RouterModule.forRoot(routes, { enableTracing: false })], - exports: [RouterModule] + exports: [RouterModule], }) export class AppRoutingModule {} diff --git a/projects/ucap-webmessenger-app/src/app/app.module.ts b/projects/ucap-webmessenger-app/src/app/app.module.ts index 2e3bc2e2..2476fe74 100644 --- a/projects/ucap-webmessenger-app/src/app/app.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app.module.ts @@ -7,6 +7,13 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; +import { UCapUiModule } from '@ucap-webmessenger/ui'; +import { UCapUiAccountModule } from '@ucap-webmessenger/ui-account'; + +import { UCapWebStorageModule } from '@ucap-webmessenger/web-storage'; + +import { UCapUtilModule } from '@ucap-webmessenger/util'; + import { UCapCommonApiModule } from '@ucap-webmessenger/api-common'; import { UCapExternalApiModule } from '@ucap-webmessenger/api-external'; import { UCapPublicApiModule } from '@ucap-webmessenger/api-public'; @@ -25,17 +32,8 @@ import { UCapServiceProtocolModule } from '@ucap-webmessenger/protocol-service'; import { UCapStatusProtocolModule } from '@ucap-webmessenger/protocol-status'; import { UCapSyncProtocolModule } from '@ucap-webmessenger/protocol-sync'; -import { UCapUiModule } from '@ucap-webmessenger/ui'; -import { UCapUiAccountModule } from '@ucap-webmessenger/ui-account'; - -import { UCapWebStorageModule } from '@ucap-webmessenger/web-storage'; - -import { UCapUtilModule } from '@ucap-webmessenger/util'; - import { LoggerModule, NgxLoggerLevel } from 'ngx-logger'; -import { environment } from '../environments/environment'; - import { AppProviderModule } from './app-provider.module'; import { AppRoutingModule } from './app-routing.module'; import { AppStoreModule } from './app-store.module'; @@ -47,6 +45,8 @@ import { GUARDS } from './guards'; import { AppMessengerLayoutModule } from './layouts/messenger/messenger.layout.module'; import { AppNativeLayoutModule } from './layouts/native/native.layout.module'; +import { environment } from '../environments/environment'; + @NgModule({ imports: [ BrowserModule, @@ -58,28 +58,14 @@ import { AppNativeLayoutModule } from './layouts/native/native.layout.module'; PerfectScrollbarModule, - UCapCommonApiModule.forRoot({ - urls: environment.urls.apiCommon, - acceptableFileExtensions: - environment.modules.event.acceptableFileExtensions - }), + UCapCommonApiModule.forRoot(environment.commonApiModuleConfig), - UCapPublicApiModule.forRoot({ - urls: environment.urls.apiPublic - }), - UCapExternalApiModule.forRoot({ - urls: environment.urls.apiExternal - }), + UCapPublicApiModule.forRoot(environment.publicApiModuleConfig), + UCapExternalApiModule.forRoot(environment.externalApiModuleConfig), - UCapPiModule.forRoot({ - urls: environment.urls.pi - }), + UCapPiModule.forRoot(environment.piModuleConfig), - UCapProtocolModule.forRoot({ - urls: environment.urls.protocol, - reconnect: environment.protocol.reconnect, - requestId: environment.protocol.requestId - }), + UCapProtocolModule.forRoot(environment.protocolModuleConfig), UCapAuthenticationProtocolModule.forRoot(), UCapEventProtocolModule.forRoot(), UCapGroupProtocolModule.forRoot(), @@ -107,12 +93,12 @@ import { AppNativeLayoutModule } from './layouts/native/native.layout.module'; AppNativeLayoutModule, LoggerModule.forRoot({ - level: NgxLoggerLevel.DEBUG - }) + level: NgxLoggerLevel.DEBUG, + }), ], providers: [...GUARDS], declarations: [AppComponent], bootstrap: [AppComponent], - entryComponents: [] + entryComponents: [], }) export class AppModule {} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index 71099332..28ec68e9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -9,8 +9,17 @@
- + @@ -18,7 +27,7 @@ @@ -32,16 +41,28 @@ matBadgePosition="above after" >chat--> -
- + matBadgePosition="above after" + > + - + d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" + >
@@ -51,8 +72,17 @@
- + @@ -73,16 +103,27 @@
- - + - + c-0.1,0-0.2,0-0.2,0c-1.5-0.1-2.9-0.7-4-1.2c-2.9-1.4-5.4-3.4-7.5-5.9C4.5,13,3.3,11.1,2.6,9C2.1,7.7,1.9,6.7,2,5.8z" + >
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index 7edc38e5..19570fd5 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -17,7 +17,7 @@ [companyList]="companyList$ | async" [companyCode]="companyCode" (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)" - (cancel)="onClickCancel($event)" + (cancel)="onClickCancel()" >
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 9a1f51b2..cfce4f1d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -66,7 +66,7 @@
diff --git a/projects/ucap-webmessenger-app/src/app/services/app.service.ts b/projects/ucap-webmessenger-app/src/app/services/app.service.ts index 2a2c16d5..d52cdadf 100644 --- a/projects/ucap-webmessenger-app/src/app/services/app.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/app.service.ts @@ -32,7 +32,7 @@ export class AppService { this.sessionStorageService.set( KEY_ENVIRONMENTS_INFO, { - deviceType + deviceType, } ); diff --git a/projects/ucap-webmessenger-app/src/app/store/account/authentication/actions.ts b/projects/ucap-webmessenger-app/src/app/store/account/authentication/actions.ts index c87419be..4ad59d61 100644 --- a/projects/ucap-webmessenger-app/src/app/store/account/authentication/actions.ts +++ b/projects/ucap-webmessenger-app/src/app/store/account/authentication/actions.ts @@ -6,7 +6,7 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginInfo } from '@app/types'; import { UserPasswordSetRequest, - UserPasswordSetResponse + UserPasswordSetResponse, } from '@ucap-webmessenger/protocol-service'; export const webLogin = createAction( diff --git a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts index c0253fd8..d7a9eb0b 100644 --- a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts @@ -9,14 +9,14 @@ import { Actions, ofType, createEffect } from '@ngrx/effects'; import { PiService, Login2Response, - UserTermsActionResponse + UserTermsActionResponse, } from '@ucap-webmessenger/pi'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { DialogService, ConfirmDialogComponent, ConfirmDialogData, - ConfirmDialogResult + ConfirmDialogResult, } from '@ucap-webmessenger/ui'; import { @@ -34,13 +34,13 @@ import { privacyAgreeSuccess, changePassword, changePasswordFailure, - changePasswordSuccess + changePasswordSuccess, } from './actions'; import { LoginInfo, KEY_LOGIN_INFO, EnvironmentsInfo, - KEY_ENVIRONMENTS_INFO + KEY_ENVIRONMENTS_INFO, } from '@app/types'; import { AppAuthenticationService } from '@app/services/authentication.service'; import { NGXLogger } from 'ngx-logger'; @@ -48,7 +48,7 @@ import { Store } from '@ngrx/store'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { ServiceProtocolService, - UserPasswordSetResponse + UserPasswordSetResponse, } from '@ucap-webmessenger/protocol-service'; @Injectable() @@ -62,7 +62,7 @@ export class Effects { .login2({ loginId: params.loginInfo.loginId, loginPw: params.loginInfo.loginPw, - companyCode: params.loginInfo.companyCode + companyCode: params.loginInfo.companyCode, }) .pipe( map((res: Login2Response) => { @@ -72,7 +72,7 @@ export class Effects { return webLoginSuccess({ loginInfo: params.loginInfo, rememberMe: params.rememberMe, - login2Response: res + login2Response: res, }); } }), @@ -138,8 +138,8 @@ export class Effects { width: '220px', data: { title: 'Logout', - message: 'Logout ?' - } + message: 'Logout ?', + }, }); return result.choice; @@ -168,7 +168,7 @@ export class Effects { token: loginRes.tokenString, deviceType: environmentsInfo.deviceType, localeCode: loginInfo.localeCode, - textOnly: 'true' + textOnly: 'true', }); const result = await this.dialogService.open< @@ -180,9 +180,9 @@ export class Effects { height: '500px', disableClose: true, data: { - title: '개인정보 동의' + title: '개인정보 동의', // html: `