├── README.md ├── chat-demo ├── .env ├── NgxChatClient │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── .vscode │ │ ├── extensions.json │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── angular.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── chat.service.ts │ │ │ ├── chat │ │ │ │ └── chatbox │ │ │ │ │ ├── chatbox.component.css │ │ │ │ │ ├── chatbox.component.html │ │ │ │ │ └── chatbox.component.ts │ │ │ ├── friend-list │ │ │ │ ├── friend-list.component.css │ │ │ │ ├── friend-list.component.html │ │ │ │ └── friend-list.component.ts │ │ │ ├── home │ │ │ │ ├── home.component.css │ │ │ │ ├── home.component.html │ │ │ │ └── home.component.ts │ │ │ ├── login │ │ │ │ ├── login.component.css │ │ │ │ ├── login.component.html │ │ │ │ └── login.component.ts │ │ │ ├── models │ │ │ │ ├── user.ts │ │ │ │ └── userchatbox.ts │ │ │ ├── nav │ │ │ │ ├── nav.component.css │ │ │ │ ├── nav.component.html │ │ │ │ └── nav.component.ts │ │ │ └── services │ │ │ │ ├── account.service.ts │ │ │ │ ├── message-hub.service.ts │ │ │ │ └── presence.service.ts │ │ ├── assets │ │ │ ├── .gitkeep │ │ │ ├── bootstrap-logo.svg │ │ │ └── user.png │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json ├── helpers │ ├── jwt.js │ └── utility.js ├── models │ └── user.js ├── package-lock.json ├── package.json ├── router │ └── user.js └── server.js ├── chatSocketIOFlutter.png ├── chatnodeangular.png └── socketchat ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── socketchat │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets └── images │ ├── netcore.png │ └── user.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── chatPage.dart ├── const.dart ├── contronllers │ └── ketNoiHubChat.dart ├── detailChatPage.dart ├── main.dart ├── models │ ├── message.dart │ └── user.dart └── widgetUseritem.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /README.md: -------------------------------------------------------------------------------- 1 | # chat-basic-node-angular-socketIO 2 | Chat basic NodeJS, SocketIO and Angular 3 | 4 | tài khoản: 5 | hoainam10th - 123456 6 | ubuntu - 123456 7 | datnguyen - 123456 8 | 9 | Lưu ý: flutter khi chạy lên gán cứng user là hoainam10th. nên đăng nhập 2 user còn lại để test 10 | 11 | ![alt text for screen readers](/chatnodeangular.png "Text to show on mouseover") 12 | 13 | ![alt text for screen readers](/chatSocketIOFlutter.png "Text to show on mouseover") 14 | -------------------------------------------------------------------------------- /chat-demo/.env: -------------------------------------------------------------------------------- 1 | API_URL = /api/v1 2 | secret = super-hoainam10th 3 | CONNECTION_STRING = mongodb+srv://hoainam10th:UzH90C1X90Aq255c@cluster0.uijfwkt.mongodb.net/chat?retryWrites=true&w=majority -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 3 | "recommendations": ["angular.ng-template"] 4 | } 5 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "pwa-chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "type": "npm", 7 | "script": "start", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "typescript", 11 | "pattern": "$tsc", 12 | "background": { 13 | "activeOnStart": true, 14 | "beginsPattern": { 15 | "regexp": "(.*?)" 16 | }, 17 | "endsPattern": { 18 | "regexp": "bundle generation complete" 19 | } 20 | } 21 | } 22 | }, 23 | { 24 | "type": "npm", 25 | "script": "test", 26 | "isBackground": true, 27 | "problemMatcher": { 28 | "owner": "typescript", 29 | "pattern": "$tsc", 30 | "background": { 31 | "activeOnStart": true, 32 | "beginsPattern": { 33 | "regexp": "(.*?)" 34 | }, 35 | "endsPattern": { 36 | "regexp": "bundle generation complete" 37 | } 38 | } 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/README.md: -------------------------------------------------------------------------------- 1 | # NgxChatClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.8. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "NgxChatClient": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/ngx-chat-client", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets" 24 | ], 25 | "styles": [ 26 | "src/styles.css", 27 | "./node_modules/ngx-toastr/toastr.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "budgets": [ 34 | { 35 | "type": "initial", 36 | "maximumWarning": "2mb", 37 | "maximumError": "5mb" 38 | }, 39 | { 40 | "type": "anyComponentStyle", 41 | "maximumWarning": "6kb", 42 | "maximumError": "10kb" 43 | } 44 | ], 45 | "fileReplacements": [ 46 | { 47 | "replace": "src/environments/environment.ts", 48 | "with": "src/environments/environment.prod.ts" 49 | } 50 | ], 51 | "outputHashing": "all" 52 | }, 53 | "development": { 54 | "buildOptimizer": false, 55 | "optimization": false, 56 | "vendorChunk": true, 57 | "extractLicenses": false, 58 | "sourceMap": true, 59 | "namedChunks": true 60 | } 61 | }, 62 | "defaultConfiguration": "production" 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "configurations": { 67 | "production": { 68 | "browserTarget": "NgxChatClient:build:production" 69 | }, 70 | "development": { 71 | "browserTarget": "NgxChatClient:build:development" 72 | } 73 | }, 74 | "defaultConfiguration": "development" 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n", 78 | "options": { 79 | "browserTarget": "NgxChatClient:build" 80 | } 81 | }, 82 | "test": { 83 | "builder": "@angular-devkit/build-angular:karma", 84 | "options": { 85 | "main": "src/test.ts", 86 | "polyfills": "src/polyfills.ts", 87 | "tsConfig": "tsconfig.spec.json", 88 | "karmaConfig": "karma.conf.js", 89 | "assets": [ 90 | "src/favicon.ico", 91 | "src/assets" 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [] 97 | } 98 | } 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/ngx-chat-client'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngx-chat-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^14.2.0", 14 | "@angular/common": "^14.2.0", 15 | "@angular/compiler": "^14.2.0", 16 | "@angular/core": "^14.2.0", 17 | "@angular/forms": "^14.2.0", 18 | "@angular/platform-browser": "^14.2.0", 19 | "@angular/platform-browser-dynamic": "^14.2.0", 20 | "@angular/router": "^14.2.0", 21 | "@fortawesome/angular-fontawesome": "^0.11.0", 22 | "@fortawesome/fontawesome-svg-core": "^6.2.1", 23 | "@fortawesome/free-solid-svg-icons": "^6.2.1", 24 | "ngx-bootstrap": "^9.0.0", 25 | "ngx-toastr": "^15.2.0", 26 | "rxjs": "~7.5.0", 27 | "socket.io-client": "^4.5.4", 28 | "tslib": "^2.3.0", 29 | "zone.js": "~0.11.4" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/build-angular": "^14.2.8", 33 | "@angular/cli": "~14.2.8", 34 | "@angular/compiler-cli": "^14.2.0", 35 | "@types/jasmine": "~4.0.0", 36 | "jasmine-core": "~4.3.0", 37 | "karma": "~6.4.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage": "~2.2.0", 40 | "karma-jasmine": "~5.1.0", 41 | "karma-jasmine-html-reporter": "~2.0.0", 42 | "typescript": "~4.7.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { HomeComponent } from './home/home.component'; 4 | import { LoginComponent } from './login/login.component'; 5 | 6 | const routes: Routes = [ 7 | {path: '', component: HomeComponent}, 8 | {path: 'login', component: LoginComponent}, 9 | ]; 10 | 11 | @NgModule({ 12 | imports: [RouterModule.forRoot(routes)], 13 | exports: [RouterModule] 14 | }) 15 | export class AppRoutingModule { } 16 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chat-demo/NgxChatClient/src/app/app.component.css -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'NgxChatClient'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('NgxChatClient'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('NgxChatClient app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { IUser } from './models/user'; 3 | import { AccountService } from './services/account.service'; 4 | import { PresenceService } from './services/presence.service'; 5 | 6 | @Component({ 7 | selector: 'app-root', 8 | templateUrl: './app.component.html', 9 | styleUrls: ['./app.component.css'] 10 | }) 11 | export class AppComponent implements OnInit{ 12 | title = 'NgxChatClient'; 13 | 14 | constructor(private presence: PresenceService, private accountService: AccountService){} 15 | 16 | ngOnInit(): void { 17 | this.setCurrentUser(); 18 | } 19 | 20 | private setCurrentUser() { 21 | const user: IUser = JSON.parse(localStorage.getItem('user')); 22 | if (user) { 23 | this.accountService.setCurrentUser(user); 24 | this.presence.createConnection(user); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { AppRoutingModule } from './app-routing.module'; 4 | import { AppComponent } from './app.component'; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 7 | import { HttpClientModule } from '@angular/common/http'; 8 | import { NavComponent } from './nav/nav.component'; 9 | 10 | import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; 11 | import { ToastrModule } from 'ngx-toastr'; 12 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 13 | import { LoginComponent } from './login/login.component'; 14 | import { HomeComponent } from './home/home.component'; 15 | import { AlertModule } from 'ngx-bootstrap/alert'; 16 | import { FriendListComponent } from './friend-list/friend-list.component'; 17 | import { ChatboxComponent } from './chat/chatbox/chatbox.component'; 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | NavComponent, 23 | LoginComponent, 24 | HomeComponent, 25 | FriendListComponent, 26 | ChatboxComponent 27 | ], 28 | imports: [ 29 | BrowserModule, 30 | BrowserAnimationsModule, 31 | AppRoutingModule, 32 | FormsModule, 33 | ReactiveFormsModule, 34 | HttpClientModule, 35 | FontAwesomeModule, 36 | BsDropdownModule.forRoot(), 37 | AlertModule.forRoot(), 38 | ToastrModule.forRoot({ 39 | positionClass: 'toast-bottom-left' 40 | }) 41 | ], 42 | providers: [], 43 | bootstrap: [AppComponent] 44 | }) 45 | export class AppModule { } 46 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/chat.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject } from 'rxjs'; 3 | import { io } from 'socket.io-client'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class ChatService { 9 | 10 | public message$: BehaviorSubject = new BehaviorSubject(''); 11 | constructor() {} 12 | 13 | socket = io('http://localhost:7000'); 14 | 15 | public sendMessage(message: string) { 16 | this.socket.emit('message', message); 17 | } 18 | 19 | public getNewMessage = () => { 20 | this.socket.on('message', (message) =>{ 21 | this.message$.next(message); 22 | }); 23 | 24 | return this.message$.asObservable(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/chat/chatbox/chatbox.component.css: -------------------------------------------------------------------------------- 1 | .child-right{ 2 | margin-left: auto; 3 | order: 2; 4 | } 5 | 6 | .message-body{ 7 | background-color: rgba(230, 225, 225, 0.603); 8 | border-radius: 10px; 9 | padding: 5px; 10 | max-width: 80%; 11 | } 12 | 13 | .message-send{ 14 | background-color: rgba(73, 73, 250, 0.972); 15 | color: white; 16 | } 17 | 18 | .parent-sent{ 19 | display: flex; 20 | flex-direction:row; 21 | justify-content: flex-end; 22 | } 23 | 24 | img{ 25 | max-height: 50px; 26 | } 27 | 28 | .chat{ 29 | list-style: none; 30 | margin: 0; 31 | padding: 0; 32 | } 33 | 34 | .chat-box{ 35 | position: fixed; 36 | max-width: 320px; 37 | z-index: 999; 38 | right: 250px; 39 | bottom: 1px; 40 | } 41 | 42 | .small-img{ 43 | max-height: 25px; 44 | } 45 | 46 | .pd-5{ 47 | padding: 2px; 48 | } 49 | 50 | .chat-frame{ 51 | max-height: 350px; 52 | overflow-y: scroll; 53 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/chat/chatbox/chatbox.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | {{username}} 7 |
1 minute ago
8 |
9 |
10 | 11 | 12 |
13 |
14 |
15 |
16 |
    17 |
  • 18 |
    19 |
    20 | 21 |
    22 |
    23 |
    {{message.content}}
    24 |
    25 |
    26 |
  • 27 |
28 |
29 | 40 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/chat/chatbox/chatbox.component.ts: -------------------------------------------------------------------------------- 1 | import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; 2 | import { NgForm } from '@angular/forms'; 3 | import { faMinus, faClose } from '@fortawesome/free-solid-svg-icons'; 4 | import { IUser } from 'src/app/models/user'; 5 | import { AccountService } from 'src/app/services/account.service'; 6 | import { MessageHubService } from 'src/app/services/message-hub.service'; 7 | 8 | @Component({ 9 | selector: 'app-chatbox', 10 | templateUrl: './chatbox.component.html', 11 | styleUrls: ['./chatbox.component.css'], 12 | providers: [MessageHubService]//separate services independently for every component 13 | }) 14 | export class ChatboxComponent implements OnInit, AfterViewInit { 15 | 16 | faMinus = faMinus 17 | faClose = faClose 18 | 19 | messageContent: string = '' 20 | 21 | @Input() username: string; 22 | @Input() right: number; 23 | 24 | @Output() removeChatBox = new EventEmitter(); 25 | @ViewChild('messageForm') messageForm: NgForm; 26 | 27 | currentUser: IUser; 28 | 29 | constructor(public messageService: MessageHubService, public account: AccountService) { 30 | this.account.currentUser$.subscribe(user=>{ 31 | this.currentUser = user 32 | }) 33 | } 34 | 35 | ngOnInit(): void { 36 | this.messageService.createConnection(this.currentUser.username, this.username) 37 | } 38 | 39 | ngAfterViewInit() { 40 | var chatBox = document.getElementById(this.username); 41 | chatBox.style.right = this.right + "px"; 42 | } 43 | 44 | minimumBoxChat(){} 45 | 46 | closeBoxChat(){ 47 | this.removeChatBox.emit(this.username); 48 | } 49 | 50 | sendMessage(){ 51 | this.messageService.sendMessage(this.username, this.messageContent) 52 | this.messageContent = '' 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/friend-list/friend-list.component.css: -------------------------------------------------------------------------------- 1 | .friend-list{ 2 | position: fixed; 3 | width: 18rem; 4 | right: 25px; 5 | bottom: 1px; 6 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/friend-list/friend-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Online: {{usersOnline.length}} 4 |
5 |
6 |
    7 |
  • 8 | {{item}} 9 |
  • 10 |
11 |
12 |
13 | 14 |
15 | 18 | 19 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/friend-list/friend-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { UserChatBox } from '../models/userchatbox'; 3 | import { PresenceService } from '../services/presence.service'; 4 | 5 | @Component({ 6 | selector: 'app-friend-list', 7 | templateUrl: './friend-list.component.html', 8 | styleUrls: ['./friend-list.component.css'] 9 | }) 10 | export class FriendListComponent implements OnInit { 11 | 12 | friendList: string [] 13 | usersOnline: UserChatBox[] = [] 14 | 15 | constructor(private presence: PresenceService) { 16 | this.presence.onlineUsers$.subscribe(users=>{ 17 | this.friendList = users 18 | }) 19 | } 20 | 21 | ngOnInit(): void { 22 | 23 | } 24 | 25 | selectUser(user: string) { 26 | switch (( this.usersOnline.length + 1 ) % 2 ) { 27 | case 1: { 28 | var u = this.usersOnline.find(x => x.username === user); 29 | if (u) { 30 | this.usersOnline = this.usersOnline.filter(x => x.username !== user); 31 | this.usersOnline.push(u); 32 | } else { 33 | this.usersOnline.push(new UserChatBox(user, 250)); 34 | } 35 | break; 36 | } 37 | case 0: { 38 | var u = this.usersOnline.find(x => x.username === user); 39 | if (u) { 40 | this.usersOnline = this.usersOnline.filter(x => x.username !== user); 41 | this.usersOnline.push(u); 42 | } else { 43 | this.usersOnline.push(new UserChatBox(user, 250 + 325)); 44 | } 45 | break; 46 | } 47 | default: { 48 | alert('No chat box') 49 | break; 50 | } 51 | } 52 | } 53 | 54 | removeChatBox(event: string) { 55 | this.usersOnline = this.usersOnline.filter(x => x.username !== event); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chat-demo/NgxChatClient/src/app/home/home.component.css -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 | 2 | WeChat web Chat app with NodeJS and Angular. 3 | 4 | 5 |
6 | 7 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.css'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/login/login.component.css: -------------------------------------------------------------------------------- 1 | .form-signin { 2 | width: 100%; 3 | max-width: 330px; 4 | padding: 15px; 5 | margin: auto; 6 | } 7 | 8 | .form-signin .checkbox { 9 | font-weight: 400; 10 | } 11 | 12 | .form-signin .form-floating:focus-within { 13 | z-index: 2; 14 | } 15 | 16 | .form-signin input[type="email"] { 17 | margin-bottom: -1px; 18 | border-bottom-right-radius: 0; 19 | border-bottom-left-radius: 0; 20 | } 21 | 22 | .form-signin input[type="password"] { 23 | margin-bottom: 10px; 24 | border-top-left-radius: 0; 25 | border-top-right-radius: 0; 26 | } 27 | 28 | button{ 29 | margin: 2px; 30 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |

Please sign in

6 |
7 | 8 |
9 | 12 | 13 |
Required UserName!
14 |
15 | 16 |
17 | 20 | 21 |
Required 22 | Password!
23 |
Password min is: 6
24 |
25 | 26 | 27 | 28 |
29 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormControl, FormGroup, Validators } from '@angular/forms'; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { IUser } from '../models/user'; 6 | import { AccountService } from '../services/account.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-login', 11 | templateUrl: './login.component.html', 12 | styleUrls: ['./login.component.css'] 13 | }) 14 | export class LoginComponent implements OnInit { 15 | loginForm: FormGroup; 16 | user: IUser; 17 | 18 | constructor(public accountService: AccountService, 19 | private router: Router, 20 | private toastr: ToastrService) { } 21 | 22 | ngOnInit(): void { 23 | this.khoiTaoForm(); 24 | } 25 | 26 | private khoiTaoForm() { 27 | this.loginForm = new FormGroup({ 28 | username: new FormControl('', [Validators.required]), 29 | password: new FormControl('', [Validators.required, Validators.minLength(6)]) 30 | }) 31 | } 32 | 33 | login() { 34 | this.accountService.login(this.loginForm.value).subscribe({ 35 | next: () => { 36 | this.toastr.success('Đăng nhập thành công!'); 37 | this.router.navigateByUrl('/'); 38 | }, 39 | error: (e) => { 40 | console.error(e) 41 | this.toastr.error('loi khi dang nhap'); 42 | } 43 | }) 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/models/user.ts: -------------------------------------------------------------------------------- 1 | export interface IUser{ 2 | username: string; 3 | token: string; 4 | photoUrl: string; 5 | displayName: string; 6 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/models/userchatbox.ts: -------------------------------------------------------------------------------- 1 | export class UserChatBox{ 2 | username: string; 3 | right: number;//position 4 | 5 | constructor(_user: string, _right: number){ 6 | this.username = _user; 7 | this.right = _right; 8 | } 9 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/nav/nav.component.css: -------------------------------------------------------------------------------- 1 | .img-persion{ 2 | max-height: 40px; 3 | } -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/nav/nav.component.html: -------------------------------------------------------------------------------- 1 |
2 |
4 | 5 |

WeChat

6 |
7 | 8 | 19 | 20 |
21 | 26 | 34 |
35 |
36 |
-------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/nav/nav.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { AccountService } from '../services/account.service'; 4 | 5 | @Component({ 6 | selector: 'app-nav', 7 | templateUrl: './nav.component.html', 8 | styleUrls: ['./nav.component.css'] 9 | }) 10 | export class NavComponent implements OnInit { 11 | 12 | constructor(public accountService: AccountService, private router: Router) { } 13 | 14 | ngOnInit(): void { 15 | } 16 | 17 | logout(){ 18 | this.accountService.logout(); 19 | this.router.navigateByUrl('/login'); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/services/account.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { map, ReplaySubject } from 'rxjs'; 4 | import { environment } from 'src/environments/environment'; 5 | import { IUser } from '../models/user'; 6 | import { PresenceService } from './presence.service'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class AccountService { 12 | baseUrl = environment.apiUrl; 13 | private currentUserSource = new ReplaySubject(1); 14 | currentUser$ = this.currentUserSource.asObservable(); 15 | 16 | constructor(private http: HttpClient, private presence: PresenceService) { } 17 | 18 | login(model: any){ 19 | return this.http.post(this.baseUrl+'/users/login', model).pipe( 20 | map((res:IUser)=>{ 21 | const user = res; 22 | if(user){ 23 | this.setCurrentUser(user); 24 | this.presence.createConnection(user); 25 | } 26 | }) 27 | ) 28 | } 29 | 30 | setCurrentUser(user: IUser){ 31 | if(user){ 32 | localStorage.setItem('user', JSON.stringify(user)); 33 | this.currentUserSource.next(user); 34 | } 35 | } 36 | 37 | logout(){ 38 | localStorage.removeItem('user'); 39 | this.currentUserSource.next(null); 40 | this.presence.stopConnection(); 41 | } 42 | 43 | register(model:any){ 44 | return this.http.post(this.baseUrl+'/users/register', model).pipe( 45 | map((res:IUser)=>{ 46 | if(res){ 47 | this.setCurrentUser(res); 48 | this.presence.createConnection(res); 49 | } 50 | return res; 51 | }) 52 | ) 53 | } 54 | 55 | getDecodedToken(token: string) { 56 | return JSON.parse(atob(token.split('.')[1])); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/services/message-hub.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject, take } from 'rxjs'; 3 | import { io } from 'socket.io-client'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class MessageHubService { 9 | 10 | private messageThreadSource = new BehaviorSubject([]); 11 | messageThread$ = this.messageThreadSource.asObservable(); 12 | 13 | socket = io('http://localhost:7000') 14 | groupName = '' 15 | 16 | constructor() { } 17 | 18 | createConnection(user: string, otherUsername: string){ 19 | this.socket = io('http://localhost:7000') 20 | this.groupName = this.getGroupName(user, otherUsername) 21 | this.socket.emit('OnConnectedRoom', {username: user, groupName:this.groupName}) 22 | 23 | this.socket.on('NewMessage', (message)=>{ 24 | console.log(message) 25 | this.messageThread$.pipe(take(1)).subscribe(messages => { 26 | this.messageThreadSource.next([...messages, message]) 27 | }) 28 | }) 29 | } 30 | 31 | private getGroupName(text1: string, text2: string){ 32 | const stringCompare = text1.localeCompare(text2) < 0 33 | return stringCompare ? `${text1}-${text2}` : `${text2}-${text1}` 34 | } 35 | 36 | sendMessage(recipientUsername: string, content: string){ 37 | this.socket.emit('SendMessage', {recipientUsername, content, groupName: this.groupName}) 38 | } 39 | 40 | disconnectedRoom(){ 41 | this.socket.emit('OnDisConnectedRoom', this.groupName) 42 | this.socket.disconnect() 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/app/services/presence.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject, take } from 'rxjs'; 3 | import { io } from 'socket.io-client'; 4 | import { IUser } from '../models/user'; 5 | 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class PresenceService { 11 | 12 | socket = io('http://localhost:7000') 13 | 14 | private onlineUsersSource = new BehaviorSubject([]) 15 | onlineUsers$ = this.onlineUsersSource.asObservable() 16 | 17 | constructor() { } 18 | 19 | createConnection(user:IUser){ 20 | this.socket = io('http://localhost:7000') 21 | this.socket.emit('OnConnected', user.username) 22 | 23 | this.socket.on('GetOnlineUsers', (userOnline)=>{ 24 | console.log('GetOnlineUsers') 25 | console.log(userOnline) 26 | this.onlineUsersSource.next(userOnline); 27 | }) 28 | 29 | this.socket.on('UserIsOnline', (user)=>{ 30 | console.log(user + ' online') 31 | this.onlineUsers$.pipe(take(1)).subscribe(usernames => { 32 | this.onlineUsersSource.next([...usernames, user]) 33 | }) 34 | }) 35 | 36 | this.socket.on('UserIsOffline', (username: string)=>{ 37 | console.log(username + ' Offline') 38 | this.onlineUsers$.pipe(take(1)).subscribe(usernames => { 39 | this.onlineUsersSource.next([...usernames.filter(x => x !== username)]) 40 | }) 41 | }) 42 | } 43 | 44 | stopConnection(){ 45 | this.socket.disconnect() 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chat-demo/NgxChatClient/src/assets/.gitkeep -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/assets/bootstrap-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/assets/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chat-demo/NgxChatClient/src/assets/user.png -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | apiUrl: 'http://localhost:7000/api/v1', 8 | }; 9 | 10 | /* 11 | * For easier debugging in development mode, you can import the following file 12 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 13 | * 14 | * This import should be commented out in production mode because it will have a negative impact 15 | * on performance if an error is thrown. 16 | */ 17 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 18 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chat-demo/NgxChatClient/src/favicon.ico -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NgxChatClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes recent versions of Safari, Chrome (including 12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * By default, zone.js will patch all possible macroTask and DomEvents 23 | * user can disable parts of macroTask/DomEvents patch by setting following flags 24 | * because those flags need to be set before `zone.js` being loaded, and webpack 25 | * will put import in the top of bundle, so user need to create a separate file 26 | * in this directory (for example: zone-flags.ts), and put the following flags 27 | * into that file, and then add the following code before importing zone.js. 28 | * import './zone-flags'; 29 | * 30 | * The flags allowed in zone-flags.ts are listed here. 31 | * 32 | * The following flags will work for all browsers. 33 | * 34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 37 | * 38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 40 | * 41 | * (window as any).__Zone_enable_cross_context_check = true; 42 | * 43 | */ 44 | 45 | /*************************************************************************************************** 46 | * Zone JS is required by default for Angular itself. 47 | */ 48 | import 'zone.js'; // Included with Angular CLI. 49 | 50 | 51 | /*************************************************************************************************** 52 | * APPLICATION IMPORTS 53 | */ 54 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | (id: string): T; 13 | keys(): string[]; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | ); 22 | 23 | // Then we find all the tests. 24 | const context = require.context('./', true, /\.spec\.ts$/); 25 | // And load the modules. 26 | context.keys().forEach(context); 27 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2020", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2020", 17 | "dom" 18 | ] 19 | }, 20 | "angularCompilerOptions": { 21 | "enableI18nLegacyMessageIdFormat": false 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chat-demo/NgxChatClient/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /chat-demo/helpers/jwt.js: -------------------------------------------------------------------------------- 1 | const { expressjwt: jwt } = require("express-jwt"); 2 | 3 | function authJwt() { 4 | const secret = process.env.secret; 5 | const api = process.env.API_URL; 6 | return jwt({ 7 | secret, 8 | algorithms: ['HS256'], 9 | }).unless({ 10 | path: [ 11 | {url: /\/api\/v1\/products(.*)/ , methods: ['GET', 'OPTIONS'] }, 12 | {url: /\/api\/v1\/categories(.*)/ , methods: ['GET', 'OPTIONS'] }, 13 | {url: /\/api\/v1\/errors(.*)/ , methods: ['GET', 'OPTIONS'] }, 14 | `${api}/users/login`, 15 | `${api}/users/register`, 16 | ] 17 | }) 18 | } 19 | 20 | 21 | module.exports = authJwt -------------------------------------------------------------------------------- /chat-demo/helpers/utility.js: -------------------------------------------------------------------------------- 1 | export function checkIsExist(object1, username) { 2 | let isExist = false 3 | 4 | for (const [key, value] of Object.entries(object1)) { 5 | console.log(`${key}: ${value}`); 6 | if(key === username){ 7 | isExist = true 8 | break 9 | } 10 | } 11 | return isExist 12 | } 13 | 14 | export function getValue(arr, username){ 15 | for(var i in arr){ 16 | if(checkIsExist(i, username)){ 17 | return i // { ubuntu: [ 'pN2Xb8H0q_QqsV52AAAL' ] } 18 | } 19 | } 20 | return null 21 | } 22 | -------------------------------------------------------------------------------- /chat-demo/models/user.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | 3 | const userSchema = mongoose.Schema({ 4 | username: { 5 | type: String, 6 | required: true 7 | }, 8 | passwordHash: { 9 | type: String, 10 | required: true, 11 | }, 12 | photoUrl: { 13 | type: String, 14 | }, 15 | displayName: { 16 | type: String, 17 | } 18 | }) 19 | 20 | 21 | userSchema.virtual('id').get(function () { 22 | return this._id.toHexString(); 23 | }); 24 | 25 | userSchema.set('toJSON', { 26 | virtuals: true, 27 | }); 28 | 29 | exports.User = mongoose.model('User', userSchema); 30 | exports.userSchema = userSchema; -------------------------------------------------------------------------------- /chat-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chat-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "nodemon server.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "bcryptjs": "^2.4.3", 14 | "cors": "^2.8.5", 15 | "dotenv": "^16.0.3", 16 | "express": "^4.18.2", 17 | "express-jwt": "^7.7.7", 18 | "jsonwebtoken": "^8.5.1", 19 | "mongoose": "^6.8.0", 20 | "morgan": "^1.10.0", 21 | "nodemon": "^2.0.20", 22 | "socket.io": "^4.5.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chat-demo/router/user.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const {User} = require('../models/user') 3 | const router = express.Router() 4 | const bcrypt = require('bcryptjs'); 5 | const jwt = require('jsonwebtoken'); 6 | 7 | router.get('/', async (req, res) =>{ 8 | const userList = await User.find().select('-passwordHash') 9 | if(!userList){ 10 | res.status(500).json({success: false}) 11 | } 12 | res.send(userList) 13 | }) 14 | 15 | router.get('/:id', async(req,res)=>{ 16 | const user = await User.findById(req.params.id).select('-passwordHash') 17 | 18 | if(!user) { 19 | res.status(404).json({message: 'The user with the given ID was not found.'}) 20 | } 21 | res.status(200).send(user); 22 | }) 23 | 24 | router.post('/register', async (req, res) =>{ 25 | 26 | let user = new User({ 27 | username: req.body.username, 28 | passwordHash: bcrypt.hashSync(req.body.password, 10), 29 | photoUrl: req.body.photoUrl, 30 | displayName: req.body.displayName, 31 | }) 32 | user = await user.save(); 33 | 34 | if(!user) 35 | return res.status(400).send('the user cannot be created!') 36 | 37 | res.send(user); 38 | }) 39 | 40 | router.post('/login', async (req,res) => { 41 | // tim user co email = body truyen vao 42 | const user = await User.findOne({username: req.body.username}) 43 | const secret = process.env.secret; 44 | if(!user) { 45 | return res.status(400).send('The user not found'); 46 | } 47 | 48 | if(user && bcrypt.compareSync(req.body.password, user.passwordHash)) { 49 | const token = jwt.sign( 50 | { 51 | userId: user.id, 52 | }, 53 | secret, 54 | {expiresIn : '1d'} 55 | ) 56 | 57 | res.status(200).send( 58 | { 59 | username: user.username, 60 | displayName: user.displayName, 61 | photoUrl: user.photoUrl, 62 | token: token 63 | }) 64 | } else { 65 | res.status(400).send('password is wrong!'); 66 | } 67 | }) 68 | 69 | module.exports = router -------------------------------------------------------------------------------- /chat-demo/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const app = express() 3 | const bodyParser = require('body-parser') 4 | const morgan = require('morgan') 5 | const mongoose = require('mongoose') 6 | const cors = require('cors') 7 | require('dotenv/config') 8 | const authJwt = require('./helpers/jwt') 9 | 10 | 11 | app.use(cors()) 12 | app.options('*', cors()) 13 | 14 | const api = process.env.API_URL 15 | 16 | const usersRouter = require('./router/user') 17 | 18 | // middleware 19 | app.use(bodyParser.json()) 20 | app.use(morgan('tiny')) 21 | app.use(authJwt()) 22 | app.use((err, req, res, next) => { 23 | console.log(err) 24 | 25 | if (err.name === 'ValidationError') { 26 | // validation error 27 | return res.status(400).json({ message: err }) 28 | } 29 | 30 | if (err.name === 'UnauthorizedError') { 31 | return res.status(401).json({ message: "The user is not authorized" }) 32 | } 33 | 34 | // default to 500 server error 35 | return res.status(500).json(err); 36 | }); 37 | 38 | // Routes 39 | app.use(`${api}/users`, usersRouter) 40 | 41 | mongoose.connect(process.env.CONNECTION_STRING).then(() => { 42 | console.log('Database is ready') 43 | }).catch((err) => { 44 | console.log(err) 45 | }) 46 | 47 | 48 | const usersOnline = new Map() 49 | const socketToRoom = {}// lu tru connectionid va username tuong ung 50 | 51 | // socketIO 52 | const httpServer = require('http').createServer(app); 53 | const io = require('socket.io')(httpServer, { 54 | cors: { origin: '*' } 55 | }); 56 | 57 | const port = process.env.PORT || 7000; 58 | 59 | io.on('connection', (socket) => { 60 | socket.on("OnConnected", async (username) => { 61 | // moi user co the truy cap nhieu trinh duyet 62 | let obTemp = usersOnline.get(username) 63 | if (obTemp) { 64 | obTemp.push(socket.id) 65 | } else { 66 | usersOnline.set(username, [socket.id]); 67 | } 68 | socketToRoom[socket.id] = username; 69 | 70 | const keys = Array.from(usersOnline.keys()); 71 | let onlineUserTemp = keys.filter(x=> x !== username) 72 | //basic emit back to sender 73 | socket.emit("GetOnlineUsers", onlineUserTemp); 74 | //to all clients in the current namespace except the sender 75 | socket.broadcast.emit("UserIsOnline", username) 76 | }) 77 | 78 | socket.on('OnConnectedRoom', ({username, groupName}) =>{ 79 | socket.join(groupName) 80 | // nen luu socket.id vao 1 Map rieng, do demo chạy nên làm như thế này 81 | let obTemp = usersOnline.get(username) 82 | if (obTemp) { 83 | obTemp.push(socket.id) 84 | } else { 85 | usersOnline.set(username, [socket.id]); 86 | } 87 | socketToRoom[socket.id] = username; 88 | }) 89 | 90 | socket.on('OnDisConnectedRoom', (room) =>{ 91 | socket.leave(room); 92 | }) 93 | 94 | socket.on('SendMessage', ({recipientUsername, content, groupName}) =>{ 95 | const username = socketToRoom[socket.id] 96 | 97 | const message = { 98 | senderUsername: username, 99 | recipientUsername: recipientUsername, 100 | content: content 101 | } 102 | 103 | console.log(message) 104 | 105 | io.to(groupName).emit("NewMessage", message) 106 | }) 107 | 108 | socket.on('disconnect', () => { 109 | const username = socketToRoom[socket.id]; 110 | let connectionIds = usersOnline.get(username) 111 | 112 | if (connectionIds && connectionIds.length > 1) { 113 | connectionIds = connectionIds.filter(id => id !== socket.id) 114 | usersOnline.set(username, connectionIds) 115 | }else{ 116 | usersOnline.delete(username) 117 | } 118 | delete socketToRoom[socket.id] 119 | //to all clients in the current namespace except the sender 120 | socket.broadcast.emit("UserIsOffline", username) 121 | }); 122 | }); 123 | 124 | httpServer.listen(port, () => console.log(`listening on port ${port}`)); -------------------------------------------------------------------------------- /chatSocketIOFlutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chatSocketIOFlutter.png -------------------------------------------------------------------------------- /chatnodeangular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/chatnodeangular.png -------------------------------------------------------------------------------- /socketchat/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /socketchat/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 17 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 18 | - platform: android 19 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 20 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 21 | - platform: ios 22 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 23 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /socketchat/README.md: -------------------------------------------------------------------------------- 1 | # socketchat 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /socketchat/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /socketchat/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /socketchat/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.socketchat" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /socketchat/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/kotlin/com/example/socketchat/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.socketchat 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /socketchat/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /socketchat/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /socketchat/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /socketchat/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /socketchat/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /socketchat/assets/images/netcore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/assets/images/netcore.png -------------------------------------------------------------------------------- /socketchat/assets/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/assets/images/user.png -------------------------------------------------------------------------------- /socketchat/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /socketchat/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /socketchat/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /socketchat/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "@executable_path/Frameworks", 296 | ); 297 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socketchat; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 300 | SWIFT_VERSION = 5.0; 301 | VERSIONING_SYSTEM = "apple-generic"; 302 | }; 303 | name = Profile; 304 | }; 305 | 97C147031CF9000F007C117D /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_ANALYZER_NONNULL = YES; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_COMMA = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INFINITE_RECURSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 326 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = dwarf; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | ENABLE_TESTABILITY = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_DYNAMIC_NO_PIC = NO; 340 | GCC_NO_COMMON_BLOCKS = YES; 341 | GCC_OPTIMIZATION_LEVEL = 0; 342 | GCC_PREPROCESSOR_DEFINITIONS = ( 343 | "DEBUG=1", 344 | "$(inherited)", 345 | ); 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 97C147041CF9000F007C117D /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_ANALYZER_NONNULL = YES; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_COMMA = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 374 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 384 | CLANG_WARN_STRICT_PROTOTYPES = YES; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 391 | ENABLE_NS_ASSERTIONS = NO; 392 | ENABLE_STRICT_OBJC_MSGSEND = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu99; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 402 | MTL_ENABLE_DEBUG_INFO = NO; 403 | SDKROOT = iphoneos; 404 | SUPPORTED_PLATFORMS = iphoneos; 405 | SWIFT_COMPILATION_MODE = wholemodule; 406 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 407 | TARGETED_DEVICE_FAMILY = "1,2"; 408 | VALIDATE_PRODUCT = YES; 409 | }; 410 | name = Release; 411 | }; 412 | 97C147061CF9000F007C117D /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | CLANG_ENABLE_MODULES = YES; 418 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 419 | ENABLE_BITCODE = NO; 420 | INFOPLIST_FILE = Runner/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socketchat; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 5.0; 430 | VERSIONING_SYSTEM = "apple-generic"; 431 | }; 432 | name = Debug; 433 | }; 434 | 97C147071CF9000F007C117D /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 441 | ENABLE_BITCODE = NO; 442 | INFOPLIST_FILE = Runner/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "@executable_path/Frameworks", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socketchat; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 450 | SWIFT_VERSION = 5.0; 451 | VERSIONING_SYSTEM = "apple-generic"; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147031CF9000F007C117D /* Debug */, 462 | 97C147041CF9000F007C117D /* Release */, 463 | 249021D3217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 97C147061CF9000F007C117D /* Debug */, 472 | 97C147071CF9000F007C117D /* Release */, 473 | 249021D4217E4FDB00AE95B9 /* Profile */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | }; 480 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 481 | } 482 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoainam10th123/chat-basic-node-angular/fb69ae292c68c7e498a52282417593dab1c2e048/socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /socketchat/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /socketchat/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Socketchat 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | socketchat 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /socketchat/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /socketchat/lib/chatPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:socketchat/widgetUseritem.dart'; 3 | import 'package:get/get.dart'; 4 | import 'contronllers/ketNoiHubChat.dart'; 5 | import 'detailChatPage.dart'; 6 | 7 | class ChatPage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return ChatScreenState(); 11 | } 12 | } 13 | 14 | class ChatScreenState extends State { 15 | final KetNoiHubController ketNoiHubCtr = Get.find(); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: AppBar( 21 | title: Text('Login as hoainam10th'), 22 | ), 23 | body: Obx(()=>ListView.builder( 24 | itemCount: ketNoiHubCtr.onlineUsers.length, 25 | itemBuilder: (context, index) => GestureDetector( 26 | onTap: () { 27 | Navigator.push( 28 | context, 29 | MaterialPageRoute( 30 | builder: (context) => DetailChatPage(userName: ketNoiHubCtr.onlineUsers[index],) 31 | ), 32 | ); 33 | }, 34 | child: UserItem(username: ketNoiHubCtr.onlineUsers[index],) 35 | ))), 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /socketchat/lib/const.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'chatPage.dart'; 3 | 4 | List pages = [ChatPage()]; 5 | 6 | const serverName = "10.0.2.2"; //10.0.2.2 for mobile or localhost for desktop app 7 | const urlBase = "http://$serverName:5291"; 8 | const hubUrl = "http://$serverName:5291/hubs/"; -------------------------------------------------------------------------------- /socketchat/lib/contronllers/ketNoiHubChat.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:socket_io_client/socket_io_client.dart' as IO; 3 | import 'package:socket_io_client/socket_io_client.dart'; 4 | import 'package:socketchat/models/message.dart'; 5 | 6 | class KetNoiHubController extends GetxController { 7 | var onlineUsers = [].obs; 8 | late IO.Socket socket; 9 | var groupName = ''.obs; 10 | var messages = [].obs; 11 | 12 | createConnection(String user){ 13 | socket = IO.io('http://10.0.2.2:7000', 14 | OptionBuilder() 15 | .setTransports(['websocket']) // for Flutter or Dart VM 16 | .disableAutoConnect() // disable auto-connection 17 | .setExtraHeaders({'foo': 'bar'}) // optional 18 | .build() 19 | ); 20 | socket.connect(); 21 | 22 | socket.onConnect((_) { 23 | print('connect'); 24 | socket.emit('OnConnected', user); 25 | }); 26 | 27 | socket.on('GetOnlineUsers', GetOnlineUsers); 28 | 29 | socket.on('UserIsOnline', UserIsOnline); 30 | 31 | socket.on('UserIsOffline', UserIsOffline); 32 | 33 | socket.on('NewMessage', NewMessage); 34 | 35 | socket.onDisconnect((_) => print('disconnect')); 36 | } 37 | 38 | void GetOnlineUsers(dynamic data){ 39 | print('Users online'); 40 | final memberServer = data as List; 41 | memberServer.forEach((element) { 42 | onlineUsers.add(element); 43 | }); 44 | } 45 | 46 | void UserIsOnline(dynamic data){ 47 | onlineUsers.add(data); 48 | } 49 | 50 | void UserIsOffline(dynamic data){ 51 | onlineUsers.remove(data); 52 | } 53 | 54 | void NewMessage(dynamic data){ 55 | final memberServer = data as Map; 56 | final mess = Message.fromJson(memberServer); 57 | messages.add(mess); 58 | } 59 | 60 | void clearMessages(){ 61 | messages.clear(); 62 | } 63 | 64 | ketNoiToiRoom(String user, String otherUser){ 65 | final group = getGroupName(user, otherUser); 66 | groupName.value = group; 67 | Map params = {}; 68 | params['username'] = user; 69 | params['groupName'] = group; 70 | socket.emit('OnConnectedRoom', params); 71 | } 72 | 73 | void stopGroupConnection(){ 74 | socket.emit('OnDisConnectedRoom', groupName.value); 75 | } 76 | 77 | String getGroupName(String user, String otherUser){ 78 | var result = user.compareTo(otherUser) < 0; 79 | return result ? '$user-$otherUser' : '$otherUser-$user'; 80 | } 81 | 82 | sendPrivateMessage(String content, String otherUser){ 83 | Map params = {}; 84 | params['recipientUsername'] = otherUser; 85 | params['content'] = content; 86 | params['groupName'] = getGroupName('hoainam10th', otherUser); 87 | socket.emit('SendMessage', params); 88 | } 89 | } -------------------------------------------------------------------------------- /socketchat/lib/detailChatPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | import 'contronllers/ketNoiHubChat.dart'; 4 | 5 | class DetailChatPage extends StatefulWidget { 6 | final String userName; 7 | 8 | DetailChatPage({Key? key, required this.userName}); 9 | 10 | @override 11 | State createState() { 12 | return DetailChatScreenState(); 13 | } 14 | } 15 | 16 | class DetailChatScreenState extends State { 17 | final TextEditingController contentController = TextEditingController(); 18 | final KetNoiHubController ketNoiHubCtrl = Get.find(); 19 | 20 | @override 21 | void initState() { 22 | // TODO: implement initState 23 | super.initState(); 24 | ketNoiHubCtrl.ketNoiToiRoom('hoainam10th', widget.userName); 25 | } 26 | 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | elevation: 0, 33 | automaticallyImplyLeading: false, 34 | backgroundColor: Colors.white, 35 | flexibleSpace: SafeArea( 36 | child: Container( 37 | padding: const EdgeInsets.only(right: 16), 38 | child: Row( 39 | children: [ 40 | IconButton( 41 | onPressed: () { 42 | // event exit chat screen with people, back button on app bar 43 | ketNoiHubCtrl.stopGroupConnection(); 44 | ketNoiHubCtrl.clearMessages(); 45 | Navigator.pop(context); 46 | }, 47 | icon: const Icon( 48 | Icons.arrow_back, 49 | color: Colors.black, 50 | ), 51 | ), 52 | const SizedBox( 53 | width: 2, 54 | ), 55 | const CircleAvatar( 56 | backgroundImage: AssetImage('assets/images/user.png'), 57 | maxRadius: 25, 58 | ), 59 | const SizedBox( 60 | width: 12, 61 | ), 62 | Expanded( 63 | child: Column( 64 | crossAxisAlignment: CrossAxisAlignment.start, 65 | mainAxisAlignment: MainAxisAlignment.center, 66 | children: [ 67 | Text( 68 | widget.userName, 69 | style: const TextStyle(fontWeight: FontWeight.bold), 70 | ), 71 | const SizedBox( 72 | height: 6, 73 | ), 74 | Text( 75 | 'vừa mới truy cập', 76 | style: TextStyle( 77 | color: Colors.grey.shade600, fontSize: 13), 78 | ), 79 | ], 80 | ), 81 | ), 82 | ], 83 | ), 84 | ), 85 | ), 86 | ), 87 | bottomSheet: Container( 88 | padding: const EdgeInsets.all(5), 89 | height: 80, 90 | width: double.infinity, 91 | color: Colors.white, 92 | child: Row( 93 | children: [ 94 | Expanded( 95 | child: TextField( 96 | controller: contentController, 97 | decoration: InputDecoration( 98 | hintText: "Write message...", 99 | hintStyle: const TextStyle(color: Colors.black), 100 | filled: true, 101 | fillColor: Colors.grey.withOpacity(0.2), 102 | border: OutlineInputBorder( 103 | borderSide: BorderSide.none, 104 | borderRadius: BorderRadius.circular(30), 105 | )), 106 | ), 107 | ), 108 | const SizedBox( 109 | width: 5, 110 | ), 111 | FloatingActionButton( 112 | onPressed: () async { 113 | if (contentController.text.isNotEmpty) { 114 | ketNoiHubCtrl.sendPrivateMessage(contentController.text, widget.userName); 115 | contentController.clear(); 116 | } 117 | }, 118 | child: Icon( 119 | Icons.send, 120 | color: Colors.white, 121 | size: 20, 122 | ), 123 | backgroundColor: Colors.blue, 124 | elevation: 0, 125 | ), 126 | ], 127 | ), 128 | ), 129 | body: SizedBox( 130 | height: MediaQuery.of(context).size.height, 131 | child: Obx(()=>ListView.builder( 132 | itemCount: ketNoiHubCtrl.messages.length, 133 | shrinkWrap: true, 134 | physics: const BouncingScrollPhysics(), 135 | padding: const EdgeInsets.only(top: 10, bottom: 10), 136 | itemBuilder: (context, index) { 137 | final leftOrRight = ketNoiHubCtrl.messages[index].senderUsername == 'hoainam10th'; 138 | return Container( 139 | padding: 140 | const EdgeInsets.symmetric(horizontal: 14, vertical: 10), 141 | child: Row( 142 | mainAxisAlignment: leftOrRight 143 | ? MainAxisAlignment.end 144 | : MainAxisAlignment.start, 145 | crossAxisAlignment: CrossAxisAlignment.start, 146 | children: [ 147 | leftOrRight 148 | ? Text('') 149 | : CircleAvatar( 150 | backgroundImage: 151 | AssetImage('assets/images/user.png'), 152 | radius: 15, 153 | ), 154 | const SizedBox( 155 | width: 5, 156 | ), 157 | Container( 158 | width: 250, 159 | decoration: BoxDecoration( 160 | borderRadius: BorderRadius.circular(20), 161 | color: Colors.blue[200], 162 | ), 163 | padding: const EdgeInsets.all(16), 164 | child: Text( 165 | ketNoiHubCtrl.messages[index].content!, 166 | style: const TextStyle(fontSize: 15), 167 | ), 168 | ), 169 | ], 170 | )); 171 | })), 172 | ), 173 | ); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /socketchat/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:get/get.dart'; 4 | import 'const.dart'; 5 | import 'contronllers/ketNoiHubChat.dart'; 6 | 7 | void main() { 8 | runApp(const MyApp()); 9 | // vì mục đích demo, nên khi app chạy lên mặc định đăng nhập user là hoainam10th gán cứng 10 | } 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({super.key}); 14 | 15 | // This widget is the root of your application. 16 | @override 17 | Widget build(BuildContext context) { 18 | return MaterialApp( 19 | title: 'Flutter Demo', 20 | theme: ThemeData( 21 | primarySwatch: Colors.blue, 22 | ), 23 | home: const MyHomePage(title: 'Flutter Demo Home Page'), 24 | ); 25 | } 26 | } 27 | 28 | class MyHomePage extends StatefulWidget { 29 | const MyHomePage({super.key, required this.title}); 30 | 31 | final String title; 32 | 33 | @override 34 | State createState() => _MyHomePageState(); 35 | } 36 | 37 | class _MyHomePageState extends State { 38 | 39 | final KetNoiHubController ketNoiHubCtr = Get.put(KetNoiHubController()); 40 | 41 | int pageIndex = 0; 42 | 43 | @override 44 | void initState() { 45 | // TODO: implement initState 46 | super.initState(); 47 | ketNoiHubCtr.createConnection('hoainam10th'); 48 | } 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | return Scaffold( 53 | body: pages[pageIndex], 54 | bottomNavigationBar: CupertinoTabBar( 55 | onTap: (index){ 56 | setState(() { 57 | //pageIndex = index; 58 | }); 59 | }, 60 | currentIndex: pageIndex, 61 | items: const [ 62 | BottomNavigationBarItem(icon: Icon(Icons.chat, size: 35,), label: 'Chat'), 63 | BottomNavigationBarItem(icon: Icon(Icons.group, size: 35,), label: 'Group'), 64 | BottomNavigationBarItem(icon: Icon(Icons.rss_feed, size: 35,), label: 'Feed'), 65 | BottomNavigationBarItem(icon: Icon(Icons.account_box, size: 35,), label: 'Profile'), 66 | ],), 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /socketchat/lib/models/message.dart: -------------------------------------------------------------------------------- 1 | class Message{ 2 | String? senderUsername; 3 | String? recipientUsername; 4 | String? content; 5 | 6 | 7 | Message( 8 | {this.senderUsername, 9 | this.recipientUsername, 10 | this.content, 11 | }); 12 | 13 | factory Message.fromJson(Map json) { 14 | return Message( 15 | senderUsername: json['senderUsername'], 16 | recipientUsername: json['recipientUsername'], 17 | content: json['content'], 18 | ); 19 | } 20 | } -------------------------------------------------------------------------------- /socketchat/lib/models/user.dart: -------------------------------------------------------------------------------- 1 | class User { 2 | String username; 3 | String token; 4 | String displayName; 5 | 6 | User( 7 | {required this.username, required this.token, required this.displayName}); 8 | 9 | factory User.fromJson(Map json) { 10 | return User( 11 | username: json['username'], 12 | token: json['token'], 13 | displayName: json['displayName'], 14 | ); 15 | } 16 | 17 | Map toJson() => 18 | { 19 | 'username': username, 20 | 'token': token, 21 | 'displayName': displayName, 22 | }; 23 | } -------------------------------------------------------------------------------- /socketchat/lib/widgetUseritem.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class UserItem extends StatelessWidget { 4 | final String username; 5 | 6 | const UserItem({super.key, required this.username}); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | padding: const EdgeInsets.all(5), 12 | child: Row( 13 | crossAxisAlignment: CrossAxisAlignment.start, 14 | children: [ 15 | Expanded( 16 | child: Row( 17 | crossAxisAlignment: CrossAxisAlignment.start, 18 | children: [ 19 | Stack( 20 | children: [ 21 | CircleAvatar( 22 | backgroundImage: 23 | AssetImage('assets/images/netcore.png'), 24 | maxRadius: 30, 25 | ), 26 | ], 27 | ), 28 | Expanded( 29 | child: Container( 30 | padding: const EdgeInsets.all(5), 31 | child: Column( 32 | crossAxisAlignment: CrossAxisAlignment.start, 33 | children: [ 34 | Text( 35 | username, 36 | style: const TextStyle(fontSize: 18), 37 | ), 38 | Text( 39 | 'content', 40 | overflow: TextOverflow.ellipsis, 41 | ) 42 | ], 43 | ), 44 | ), 45 | ), 46 | ], 47 | ), 48 | ), 49 | ], 50 | )); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /socketchat/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.9.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.1" 25 | clock: 26 | dependency: transitive 27 | description: 28 | name: clock 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.1" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.16.0" 39 | cupertino_icons: 40 | dependency: "direct main" 41 | description: 42 | name: cupertino_icons 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.0.5" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.3.1" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_lints: 59 | dependency: "direct dev" 60 | description: 61 | name: flutter_lints 62 | url: "https://pub.dartlang.org" 63 | source: hosted 64 | version: "2.0.1" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | get: 71 | dependency: "direct main" 72 | description: 73 | name: get 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "4.6.5" 77 | js: 78 | dependency: transitive 79 | description: 80 | name: js 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.6.5" 84 | lints: 85 | dependency: transitive 86 | description: 87 | name: lints 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "2.0.1" 91 | logging: 92 | dependency: transitive 93 | description: 94 | name: logging 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.1.0" 98 | matcher: 99 | dependency: transitive 100 | description: 101 | name: matcher 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.12.12" 105 | material_color_utilities: 106 | dependency: transitive 107 | description: 108 | name: material_color_utilities 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.1.5" 112 | meta: 113 | dependency: transitive 114 | description: 115 | name: meta 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.8.0" 119 | path: 120 | dependency: transitive 121 | description: 122 | name: path 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.8.2" 126 | sky_engine: 127 | dependency: transitive 128 | description: flutter 129 | source: sdk 130 | version: "0.0.99" 131 | socket_io_client: 132 | dependency: "direct main" 133 | description: 134 | name: socket_io_client 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.0.0" 138 | socket_io_common: 139 | dependency: transitive 140 | description: 141 | name: socket_io_common 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.2" 145 | source_span: 146 | dependency: transitive 147 | description: 148 | name: source_span 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.9.0" 152 | stack_trace: 153 | dependency: transitive 154 | description: 155 | name: stack_trace 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.10.0" 159 | stream_channel: 160 | dependency: transitive 161 | description: 162 | name: stream_channel 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.1.0" 166 | string_scanner: 167 | dependency: transitive 168 | description: 169 | name: string_scanner 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.1" 173 | term_glyph: 174 | dependency: transitive 175 | description: 176 | name: term_glyph 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.2.1" 180 | test_api: 181 | dependency: transitive 182 | description: 183 | name: test_api 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "0.4.12" 187 | vector_math: 188 | dependency: transitive 189 | description: 190 | name: vector_math 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "2.1.2" 194 | sdks: 195 | dart: ">=2.18.4 <3.0.0" 196 | -------------------------------------------------------------------------------- /socketchat/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: socketchat 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.18.4 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | 36 | # The following adds the Cupertino Icons font to your application. 37 | # Use with the CupertinoIcons class for iOS style icons. 38 | cupertino_icons: ^1.0.2 39 | socket_io_client: ^2.0.0 40 | get: ^4.6.5 41 | 42 | dev_dependencies: 43 | flutter_test: 44 | sdk: flutter 45 | 46 | # The "flutter_lints" package below contains a set of recommended lints to 47 | # encourage good coding practices. The lint set provided by the package is 48 | # activated in the `analysis_options.yaml` file located at the root of your 49 | # package. See that file for information about deactivating specific lint 50 | # rules and activating additional ones. 51 | flutter_lints: ^2.0.0 52 | 53 | # For information on the generic Dart part of this file, see the 54 | # following page: https://dart.dev/tools/pub/pubspec 55 | 56 | # The following section is specific to Flutter packages. 57 | flutter: 58 | 59 | # The following line ensures that the Material Icons font is 60 | # included with your application, so that you can use the icons in 61 | # the material Icons class. 62 | uses-material-design: true 63 | 64 | # To add assets to your application, add an assets section, like this: 65 | assets: 66 | - assets/images/ 67 | # - images/a_dot_ham.jpeg 68 | 69 | # An image asset can refer to one or more resolution-specific "variants", see 70 | # https://flutter.dev/assets-and-images/#resolution-aware 71 | 72 | # For details regarding adding assets from package dependencies, see 73 | # https://flutter.dev/assets-and-images/#from-packages 74 | 75 | # To add custom fonts to your application, add a fonts section here, 76 | # in this "flutter" section. Each entry in this list should have a 77 | # "family" key with the font family name, and a "fonts" key with a 78 | # list giving the asset and other descriptors for the font. For 79 | # example: 80 | # fonts: 81 | # - family: Schyler 82 | # fonts: 83 | # - asset: fonts/Schyler-Regular.ttf 84 | # - asset: fonts/Schyler-Italic.ttf 85 | # style: italic 86 | # - family: Trajan Pro 87 | # fonts: 88 | # - asset: fonts/TrajanPro.ttf 89 | # - asset: fonts/TrajanPro_Bold.ttf 90 | # weight: 700 91 | # 92 | # For details regarding fonts from package dependencies, 93 | # see https://flutter.dev/custom-fonts/#from-packages 94 | -------------------------------------------------------------------------------- /socketchat/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:socketchat/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------