├── .gitignore ├── README.md ├── config.xml ├── errors.pages ├── ionic.config.json ├── keyboard.gif ├── package.json ├── resources ├── android │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── ios │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ └── Default~iphone.png └── splash.png ├── src ├── app │ ├── app.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── components │ ├── chat-bubble │ │ ├── chat-bubble.html │ │ ├── chat-bubble.scss │ │ └── chat-bubble.ts │ └── keyboard-fix │ │ └── keyboard-fix.ts ├── index.html ├── manifest.json ├── pages │ ├── chats │ │ ├── chats.html │ │ ├── chats.module.ts │ │ ├── chats.scss │ │ └── chats.ts │ ├── hello-ionic │ │ ├── hello-ionic.html │ │ ├── hello-ionic.scss │ │ └── hello-ionic.ts │ └── home │ │ ├── home.html │ │ ├── home.module.ts │ │ ├── home.scss │ │ └── home.ts ├── pipes │ └── chat-date.ts ├── service-worker.js └── theme │ └── variables.scss ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | *.log 7 | *.tmp 8 | *.tmp.* 9 | log.txt 10 | *.sublime-project 11 | *.sublime-workspace 12 | .vscode/ 13 | npm-debug.log* 14 | 15 | .idea/ 16 | .sass-cache/ 17 | .tmp/ 18 | .versions/ 19 | coverage/ 20 | dist/ 21 | node_modules/ 22 | tmp/ 23 | temp/ 24 | hooks/ 25 | platforms/ 26 | plugins/ 27 | plugins/android.json 28 | plugins/ios.json 29 | www/ 30 | $RECYCLE.BIN/ 31 | 32 | .DS_Store 33 | Thumbs.db 34 | UserInterfaceState.xcuserstate 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ionic 3 Elastic Textarea Chat Example App 2 | 3 | 4 | See the demo here: 5 | 6 | https://youtu.be/vR0XrD5F7zw -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | KeyboardTest 4 | An awesome Ionic/Cordova app. 5 | Ionic Framework Team 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /errors.pages: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/errors.pages -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MyIonic2Project", 3 | "app_id": "", 4 | "type": "ionic-angular" 5 | } 6 | -------------------------------------------------------------------------------- /keyboard.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/keyboard.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | "name": "ionic-hello-world", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "private": true, 7 | "scripts": { 8 | "ionic:build": "ionic-app-scripts build", 9 | "ionic:serve": "ionic-app-scripts serve" 10 | }, 11 | "dependencies": { 12 | "@angular/common": "4.1.3", 13 | "@angular/compiler": "4.1.3", 14 | "@angular/compiler-cli": "4.1.3", 15 | "@angular/core": "4.1.3", 16 | "@angular/forms": "4.1.3", 17 | "@angular/http": "4.1.3", 18 | "@angular/platform-browser": "4.1.3", 19 | "@angular/platform-browser-dynamic": "4.1.3", 20 | "@ionic-native/camera": "3.12.1", 21 | "@ionic-native/core": "3.12.1", 22 | "@ionic-native/image-picker": "3.12.1", 23 | "@ionic-native/keyboard": "3.12.1", 24 | "@ionic-native/splash-screen": "3.12.1", 25 | "@ionic-native/status-bar": "3.12.1", 26 | "@ionic/storage": "2.0.1", 27 | "angular2-elastic": "^0.13.0", 28 | "cordova-android": "^6.2.3", 29 | "cordova-ios": "^4.4.0", 30 | "cordova-plugin-camera": "^2.4.1", 31 | "cordova-plugin-compat": "^1.1.0", 32 | "cordova-plugin-console": "^1.0.7", 33 | "cordova-plugin-device": "^1.1.6", 34 | "cordova-plugin-image-picker": "^1.1.3", 35 | "cordova-plugin-splashscreen": "^4.0.3", 36 | "cordova-plugin-statusbar": "^2.2.3", 37 | "cordova-plugin-whitelist": "^1.3.2", 38 | "cordova-plugin-wkwebview-engine": "^1.1.3", 39 | "ionic-angular": "^3.6.0", 40 | "ionic-plugin-keyboard": "^2.2.1", 41 | "ionicons": "3.0.0", 42 | "ios": "0.0.1", 43 | "moment": "^2.18.1", 44 | "rxjs": "5.4.0", 45 | "sw-toolbox": "3.6.0", 46 | "zone.js": "0.8.12" 47 | }, 48 | "devDependencies": { 49 | "@ionic/app-scripts": "^2.1.3", 50 | "@ionic/cli-plugin-cordova": "1.6.2", 51 | "@ionic/cli-plugin-ionic-angular": "1.4.1", 52 | "ionic": "3.7.0", 53 | "typescript": "2.3.4" 54 | }, 55 | "description": "Keyboard Test Project", 56 | "cordova": { 57 | "platforms": [ 58 | "android", 59 | "ios" 60 | ], 61 | "plugins": { 62 | "cordova-plugin-console": {}, 63 | "cordova-plugin-device": {}, 64 | "cordova-plugin-splashscreen": {}, 65 | "cordova-plugin-statusbar": {}, 66 | "cordova-plugin-whitelist": {}, 67 | "ionic-plugin-keyboard": {}, 68 | "cordova-plugin-wkwebview-engine": {}, 69 | "cordova-plugin-image-picker": { 70 | "PHOTO_LIBRARY_USAGE_DESCRIPTION": " " 71 | }, 72 | "cordova-plugin-camera": { 73 | "CAMERA_USAGE_DESCRIPTION": " ", 74 | "PHOTOLIBRARY_USAGE_DESCRIPTION": " " 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/icon.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmady/KeyboardTest/019f735c84558175489b5688c300a22f490ac002/resources/splash.png -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { Platform, MenuController, Nav } from 'ionic-angular'; 3 | import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic'; 4 | import { ChatsPage } from '../pages/chats/chats'; 5 | import { Keyboard } from '@ionic-native/keyboard'; 6 | 7 | @Component({ 8 | templateUrl: 'app.html', 9 | providers: [Keyboard] 10 | }) 11 | export class MyApp { 12 | @ViewChild(Nav) nav: Nav; 13 | rootPage: any = ChatsPage; 14 | pages: Array<{title: string, component: any}>; 15 | 16 | constructor( 17 | public platform: Platform, 18 | public menu: MenuController, 19 | private keybaord: Keyboard 20 | ) { 21 | this.initializeApp(); 22 | this.pages = [ 23 | { title: 'Hello Ionic', component: HelloIonicPage } 24 | ]; 25 | } 26 | 27 | initializeApp() { 28 | this.platform.ready().then(() => { 29 | this.keybaord.disableScroll(true); 30 | }); 31 | } 32 | 33 | openPage(page) { 34 | this.menu.close(); 35 | this.nav.setRoot(page.component); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Pages 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicApp, IonicModule } from 'ionic-angular'; 3 | import { MyApp } from './app.component'; 4 | import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic'; 5 | import { ChatsPage } from '../pages/chats/chats'; 6 | import { ChatBubble} from '../components/chat-bubble/chat-bubble'; 7 | import { keyboardFix } from '../components/keyboard-fix/keyboard-fix' 8 | import { BrowserModule } from '@angular/platform-browser'; 9 | import { HttpModule } from '@angular/http'; 10 | import { ElasticModule } from 'angular2-elastic'; 11 | import { ChatDate } from '../pipes/chat-date'; 12 | 13 | 14 | @NgModule({ 15 | declarations: [ 16 | MyApp, 17 | ChatsPage, 18 | HelloIonicPage, 19 | ChatBubble, 20 | keyboardFix, 21 | ChatDate 22 | 23 | ], 24 | imports: [ 25 | BrowserModule, 26 | HttpModule, 27 | ElasticModule, 28 | IonicModule.forRoot(MyApp, { 29 | ios: { 30 | scrollAssist: false, 31 | autoFocusAssist: false, 32 | inputBlurring: false 33 | } 34 | } 35 | ) 36 | ], 37 | bootstrap: [IonicApp], 38 | entryComponents: [ 39 | // MyApp, 40 | HelloIonicPage, 41 | // Home, 42 | // ChatBubble, 43 | ChatsPage 44 | ], 45 | providers: [ChatDate] 46 | }) 47 | export class AppModule {} 48 | -------------------------------------------------------------------------------- /src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | -------------------------------------------------------------------------------- /src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /src/components/chat-bubble/chat-bubble.html: -------------------------------------------------------------------------------- 1 |
2 |

{{msg.timestamp | chatDate }}

3 |
4 | 5 |
6 | 7 | 8 |
9 |
{{msg.body}}
10 |
11 | {{msg.timestamp | date: "HH:mm"}} 12 |
13 |
14 |
15 | 16 |
17 | {{msg.timestamp| date: "HH:mm"}} 18 |
19 |
20 |
-------------------------------------------------------------------------------- /src/components/chat-bubble/chat-bubble.scss: -------------------------------------------------------------------------------- 1 | .chatBubble{ 2 | 3 | //position: relative; 4 | 5 | // :last-child { 6 | // margin-bottom: 10px; 7 | // } 8 | 9 | .profile-pic { 10 | width: 40px; 11 | height: 40px; 12 | border-radius: 50%; 13 | position: absolute; 14 | bottom: 10px; 15 | background-position: center center; 16 | background-size: cover; 17 | background-repeat: no-repeat; 18 | } 19 | 20 | .profile-pic.left { 21 | left: 10px; 22 | } 23 | 24 | .profile-pic.right { 25 | right: 10px; 26 | } 27 | 28 | .message { 29 | font-size: small; 30 | word-wrap: break-word; 31 | white-space: pre-wrap; 32 | } 33 | 34 | .message-detail { 35 | white-space: nowrap; 36 | font-size: 12px; 37 | text-align: right; 38 | } 39 | 40 | .message-detail-img { 41 | white-space: nowrap; 42 | font-size: 12px; 43 | text-align: right; 44 | position: absolute; 45 | right: 7.5px; 46 | bottom: 10px; 47 | } 48 | 49 | .chat-bubble { 50 | border-radius: 10px; 51 | display: inline-block; 52 | padding: 5px 10px; 53 | position: relative; 54 | margin: 10px; 55 | // box-shadow: 1px 1px 5px #000; 56 | max-width: 80%; 57 | } 58 | 59 | 60 | .chat-bubble-img { 61 | background: transparent; 62 | position: relative; 63 | max-width: 80%; 64 | } 65 | 66 | .chat-bubble:before { 67 | content: "\00a0"; 68 | display: block; 69 | height: 16px; 70 | width: 9px; 71 | position: absolute; 72 | bottom: -7.5px; 73 | } 74 | 75 | .chat-bubble.left { 76 | background-color: map-get($chat-bubble, background-left); 77 | float: left; 78 | text-align: left; 79 | //margin-left: 45px; 80 | } 81 | 82 | .chat-bubble-img.left { 83 | float: left; 84 | margin-left: 7.5px; 85 | } 86 | 87 | .chat-bubble.left:before { 88 | left: -15px; 89 | top: -5px; 90 | content: ""; 91 | text-align: left; 92 | position: absolute; 93 | border: 0 solid transparent; 94 | border-top: 9px solid map-get($chat-bubble, background-left); 95 | border-radius: 0 20px 0; 96 | width: 15px; 97 | height: 30px; 98 | transform: rotate(145deg); 99 | -webkit-transform: rotate(145deg); 100 | } 101 | 102 | .chat-bubble.right { 103 | background-color: map-get($chat-bubble, background-right); 104 | color: white; 105 | float: right; 106 | text-align: right; 107 | //margin-right: 45px; 108 | } 109 | 110 | .chat-bubble-img.right { 111 | color: white; 112 | float: right; 113 | padding: 5px; 114 | margin-right: 7.5px; 115 | } 116 | 117 | .chat-bubble-img.left { 118 | color: white; 119 | float: left; 120 | padding-top: 5px; 121 | margin-right: 7.5px; 122 | } 123 | 124 | .chat-bubble.right:before { 125 | right: -15px; 126 | top: -5px; 127 | content: ""; 128 | position: absolute; 129 | border: 0 solid transparent; 130 | border-top: 9px solid map-get($chat-bubble, background-right); 131 | border-radius: 20px 0px 20px; 132 | width: 15px; 133 | height: 30px; 134 | -webkit-transform: rotate(220deg); 135 | transform: rotate(220deg); 136 | 137 | } 138 | 139 | .chat-bubble.right a.autolinker { 140 | color: #000; 141 | font-weight: bold; 142 | } 143 | 144 | img { 145 | border-radius: 10px; 146 | } 147 | 148 | 149 | 150 | 151 | } 152 | 153 | 154 | 155 | .date { 156 | background: antiquewhite; 157 | margin: 0 auto; 158 | display: inline-block; 159 | border-radius: 5px; 160 | padding: 1px 5px 1px 5px; 161 | font-size: small; 162 | margin: 2px; 163 | } 164 | 165 | .date-container { 166 | text-align: center; 167 | // display: inline-block; 168 | 169 | // background-color: green; 170 | // border-radius: 5px; 171 | // width: 100px; 172 | } -------------------------------------------------------------------------------- /src/components/chat-bubble/chat-bubble.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'chat-bubble', 5 | templateUrl: 'chat-bubble.html', 6 | inputs: ['msg: message'], 7 | }) 8 | export class ChatBubble { 9 | public msg: any; 10 | constructor() { 11 | this.msg = { 12 | content: 'Am I dreaming?', 13 | position: 'left', 14 | time: '12/3/2016', 15 | senderName: 'Gregory' 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/components/keyboard-fix/keyboard-fix.ts: -------------------------------------------------------------------------------- 1 | import {Directive, ElementRef, Renderer, AfterViewInit} from "@angular/core"; 2 | 3 | @Directive({ 4 | selector: '[keyboardFix]' 5 | }) 6 | 7 | export class keyboardFix implements AfterViewInit { 8 | 9 | constructor (private _elRef: ElementRef, private _renderer: Renderer) {} 10 | 11 | ngAfterViewInit() { 12 | 13 | let input = null; 14 | 15 | if( this._elRef.nativeElement.tagName === 'ION-TEXTAREA') { 16 | input = this._elRef.nativeElement.querySelector("textarea"); 17 | } else { 18 | input = this._elRef.nativeElement.querySelector("input"); 19 | } 20 | 21 | if( input ) { 22 | this._renderer.setElementAttribute(input, 'autoComplete', 'on'); 23 | this._renderer.setElementAttribute(input, 'spellcheck', 'on'); 24 | this._renderer.setElementAttribute(input, 'autocorrect', 'on'); 25 | } 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /src/pages/chats/chats.html: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | chats 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |

Cher

25 |

Ugh. As if.

26 |
27 | 28 | 29 | 30 | 31 |

Peter

32 |

What?

33 |
34 | 35 | 36 |
37 | 38 | 39 | 40 | 41 |
42 | -------------------------------------------------------------------------------- /src/pages/chats/chats.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicPageModule } from 'ionic-angular'; 3 | import { ChatsPage } from './chats'; 4 | 5 | @NgModule({ 6 | declarations: [ 7 | // ChatsPage, 8 | ], 9 | imports: [ 10 | IonicPageModule.forChild(ChatsPage), 11 | ], 12 | }) 13 | export class ChatsPageModule {} 14 | -------------------------------------------------------------------------------- /src/pages/chats/chats.scss: -------------------------------------------------------------------------------- 1 | page-chats { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/chats/chats.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { IonicPage, NavController, NavParams } from 'ionic-angular'; 3 | import { HelloIonicPage } from '../hello-ionic/hello-ionic'; 4 | 5 | /** 6 | * Generated class for the ChatsPage page. 7 | * 8 | * See http://ionicframework.com/docs/components/#navigation for more info 9 | * on Ionic pages and navigation. 10 | */ 11 | 12 | @IonicPage() 13 | @Component({ 14 | selector: 'page-chats', 15 | templateUrl: 'chats.html', 16 | }) 17 | export class ChatsPage { 18 | 19 | constructor(public navCtrl: NavController, public navParams: NavParams) { 20 | } 21 | 22 | ionViewDidLoad() { 23 | console.log('ionViewDidLoad ChatsPage'); 24 | } 25 | 26 | click(user){ 27 | this.navCtrl.push(HelloIonicPage, {user: user}) 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/pages/hello-ionic/hello-ionic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | {{user}} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/pages/hello-ionic/hello-ionic.scss: -------------------------------------------------------------------------------- 1 | 2 | hello-ionic-page { 3 | 4 | .item { 5 | padding: 0px; 6 | } 7 | 8 | .back-arrow { 9 | font-size: 2.8rem; 10 | } 11 | 12 | .list { 13 | margin: 0px; 14 | } 15 | 16 | ion-label { 17 | margin: 0px !important; 18 | } 19 | 20 | .item-md.item-block .item-inner { 21 | padding-right: 0px; 22 | } 23 | 24 | .add-image-button { 25 | font-size: 20px; 26 | background: transparent; 27 | } 28 | 29 | .add-image-icon { 30 | color: #005677; 31 | } 32 | 33 | .send-button { 34 | display:block; 35 | width:25px; 36 | height:25px; 37 | line-height:25px; 38 | // border: 2px solid #f5f5f5; 39 | border-radius: 50%; 40 | color: #f2f2f2; 41 | text-align:center; 42 | text-decoration:none; 43 | background-color: #005677; 44 | font-weight:bold; 45 | padding: 0px; 46 | margin-right: 5px; 47 | } 48 | 49 | .toolbar-background { 50 | border-width: 0px !important; 51 | } 52 | 53 | ion-buttons { 54 | margin: 0px !important; 55 | } 56 | 57 | 58 | .send-icon { 59 | font-size: 1.8rem; 60 | } 61 | 62 | .text-input { 63 | margin-left: 5px; 64 | // margin-bottom: 0px; 65 | } 66 | 67 | textarea { 68 | -webkit-appearance: none; 69 | -moz-appearance: none; 70 | -webkit-box-shadow: none; 71 | -moz-box-shadow: none; 72 | box-shadow: none; 73 | border: 1px solid; 74 | margin-bottom: -5px; 75 | 76 | border-radius: 10px; 77 | margin-left: 10px; 78 | border-color: lightgrey; 79 | margin-right: 10px; 80 | padding-top: 5px; 81 | background-color: #f8f8f8; 82 | width: 90%; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Home 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

Cher

24 |

Ugh. As if.

25 |
26 | 27 | 28 | 29 | 30 |

Peter

31 |

What?

32 |
33 | 34 | 35 |
36 | 37 | 38 | 39 | 40 |
-------------------------------------------------------------------------------- /src/pages/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicModule } from 'ionic-angular'; 3 | import { Home } from './home'; 4 | 5 | @NgModule({ 6 | declarations: [ 7 | Home 8 | ], 9 | imports: [ 10 | IonicModule.forRoot(Home), 11 | ], 12 | exports: [ 13 | Home 14 | ] 15 | }) 16 | export class HomeModule {} 17 | -------------------------------------------------------------------------------- /src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { IonicPage, NavController, NavParams } from 'ionic-angular'; 3 | import { HelloIonicPage } from '../hello-ionic/hello-ionic'; 4 | /** 5 | * Generated class for the Home page. 6 | * 7 | * See http://ionicframework.com/docs/components/#navigation for more info 8 | * on Ionic pages and navigation. 9 | */ 10 | @IonicPage() 11 | @Component({ 12 | selector: 'page-home', 13 | templateUrl: 'home.html', 14 | }) 15 | export class Home { 16 | 17 | constructor(public navCtrl: NavController, public navParams: NavParams) { 18 | } 19 | 20 | ionViewDidLoad() { 21 | console.log('ionViewDidLoad Home'); 22 | } 23 | 24 | click(user){ 25 | this.navCtrl.push(HelloIonicPage, {user: user}) 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/pipes/chat-date.ts: -------------------------------------------------------------------------------- 1 | import { Pipe } from '@angular/core'; 2 | import * as moment from 'moment'; 3 | 4 | @Pipe({ 5 | name: 'chatDate' 6 | }) 7 | export class ChatDate { 8 | transform(value, args) { 9 | 10 | let today = moment(); 11 | let yesterday = today.clone().subtract(1, 'days'); 12 | let within5Days = today.clone().subtract(5, 'days'); 13 | let date = moment(value); 14 | 15 | let isToday = today.isSame(date, 'd'); 16 | let isYesterday = date.isSame(yesterday, 'd'); 17 | let isWithin5Days = date.isAfter(within5Days); 18 | 19 | let isDifferentYear = date.year != today.year; 20 | 21 | if (isToday) { 22 | return "Today"; 23 | } else if (isYesterday) { 24 | return "Yesterday"; 25 | } else if (isWithin5Days) { 26 | return date.format('dddd'); 27 | } else if (isDifferentYear) { 28 | return date.format("ddd D MMM YYYY"); 29 | } else { 30 | return date.format("ddd D MMM"); 31 | } 32 | 33 | } 34 | 35 | 36 | 37 | } -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | // tick this to make the cache invalidate and update 2 | const CACHE_VERSION = 1; 3 | const CURRENT_CACHES = { 4 | 'read-through': 'read-through-cache-v' + CACHE_VERSION 5 | }; 6 | 7 | self.addEventListener('activate', (event) => { 8 | // Delete all caches that aren't named in CURRENT_CACHES. 9 | // While there is only one cache in this example, the same logic will handle the case where 10 | // there are multiple versioned caches. 11 | const expectedCacheNames = Object.keys(CURRENT_CACHES).map((key) => { 12 | return CURRENT_CACHES[key]; 13 | }); 14 | 15 | event.waitUntil( 16 | caches.keys().then((cacheNames) => { 17 | return Promise.all( 18 | cacheNames.map((cacheName) => { 19 | if (expectedCacheNames.indexOf(cacheName) === -1) { 20 | // If this cache name isn't present in the array of "expected" cache names, then delete it. 21 | console.log('Deleting out of date cache:', cacheName); 22 | return caches.delete(cacheName); 23 | } 24 | }) 25 | ); 26 | }) 27 | ); 28 | }); 29 | 30 | // This sample illustrates an aggressive approach to caching, in which every valid response is 31 | // cached and every request is first checked against the cache. 32 | // This may not be an appropriate approach if your web application makes requests for 33 | // arbitrary URLs as part of its normal operation (e.g. a RSS client or a news aggregator), 34 | // as the cache could end up containing large responses that might not end up ever being accessed. 35 | // Other approaches, like selectively caching based on response headers or only caching 36 | // responses served from a specific domain, might be more appropriate for those use cases. 37 | self.addEventListener('fetch', (event) => { 38 | 39 | event.respondWith( 40 | caches.open(CURRENT_CACHES['read-through']).then((cache) => { 41 | return cache.match(event.request).then((response) => { 42 | if (response) { 43 | // If there is an entry in the cache for event.request, then response will be defined 44 | // and we can just return it. 45 | 46 | return response; 47 | } 48 | 49 | // Otherwise, if there is no entry in the cache for event.request, response will be 50 | // undefined, and we need to fetch() the resource. 51 | console.log(' No response for %s found in cache. ' + 52 | 'About to fetch from network...', event.request.url); 53 | 54 | // We call .clone() on the request since we might use it in the call to cache.put() later on. 55 | // Both fetch() and cache.put() "consume" the request, so we need to make a copy. 56 | // (see https://fetch.spec.whatwg.org/#dom-request-clone) 57 | return fetch(event.request.clone()).then((response) => { 58 | 59 | // Optional: add in extra conditions here, e.g. response.type == 'basic' to only cache 60 | // responses from the same domain. See https://fetch.spec.whatwg.org/#concept-response-type 61 | if (response.status < 400 && response.type === 'basic') { 62 | // We need to call .clone() on the response object to save a copy of it to the cache. 63 | // (https://fetch.spec.whatwg.org/#dom-request-clone) 64 | cache.put(event.request, response.clone()); 65 | } 66 | 67 | // Return the original response object, which will be used to fulfill the resource request. 68 | return response; 69 | }); 70 | }).catch((error) => { 71 | // This catch() will handle exceptions that arise from the match() or fetch() operations. 72 | // Note that a HTTP error response (e.g. 404) will NOT trigger an exception. 73 | // It will return a normal response object that has the appropriate error code set. 74 | console.error(' Read-through caching failed:', error); 75 | 76 | throw error; 77 | }); 78 | }) 79 | ); 80 | }); -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/v2/theming/ 3 | @import "ionic.globals"; 4 | 5 | 6 | // Shared Variables 7 | // -------------------------------------------------- 8 | // To customize the look and feel of this app, you can override 9 | // the Sass variables found in Ionic's source scss files. 10 | // To view all the possible Ionic variables, see: 11 | // http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/ 12 | 13 | $text-color: #000; 14 | $background-color: #fff; 15 | 16 | 17 | // Named Color Variables 18 | // -------------------------------------------------- 19 | // Named colors makes it easy to reuse colors on various components. 20 | // It's highly recommended to change the default colors 21 | // to match your app's branding. Ionic uses a Sass map of 22 | // colors so you can add, rename and remove colors as needed. 23 | // The "primary" color is the only required color in the map. 24 | 25 | $colors: ( 26 | primary: #387ef5, 27 | secondary: #32db64, 28 | danger: #f53d3d, 29 | light: #f4f4f4, 30 | dark: #222, 31 | favorite: #69BB7B 32 | ); 33 | 34 | 35 | // App iOS Variables 36 | // -------------------------------------------------- 37 | // iOS only Sass variables can go here 38 | 39 | 40 | 41 | 42 | // App Material Design Variables 43 | // -------------------------------------------------- 44 | // Material Design only Sass variables can go here 45 | 46 | 47 | 48 | 49 | // App Windows Variables 50 | // -------------------------------------------------- 51 | // Windows only Sass variables can go here 52 | 53 | 54 | 55 | 56 | // App Theme 57 | // -------------------------------------------------- 58 | // Ionic apps can have different themes applied, which can 59 | // then be future customized. This import comes last 60 | // so that the above variables are used and Ionic's 61 | // default are overridden. 62 | 63 | @import "ionic.theme.default"; 64 | 65 | 66 | // Ionicons 67 | // -------------------------------------------------- 68 | // The premium icon font for Ionic. For more info, please see: 69 | // http://ionicframework.com/docs/v2/ionicons/ 70 | 71 | $ionicons-font-path: "../assets/fonts"; 72 | @import "ionicons"; 73 | 74 | $chat-bubble:( 75 | background-left: #f2f2f2, 76 | background-right: #005677, 77 | ); 78 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | --------------------------------------------------------------------------------