├── .gitignore ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.e2e.json ├── ionic.config.json ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── auth.service.ts │ ├── edit-profile │ │ ├── edit-profile.module.ts │ │ ├── edit-profile.page.html │ │ ├── edit-profile.page.scss │ │ ├── edit-profile.page.spec.ts │ │ └── edit-profile.page.ts │ ├── feed │ │ ├── feed.module.ts │ │ ├── feed.page.html │ │ ├── feed.page.scss │ │ ├── feed.page.spec.ts │ │ └── feed.page.ts │ ├── firebase.ts │ ├── loading │ │ ├── loading.component.html │ │ ├── loading.component.scss │ │ ├── loading.component.spec.ts │ │ └── loading.component.ts │ ├── login │ │ ├── login.module.ts │ │ ├── login.page.html │ │ ├── login.page.scss │ │ ├── login.page.spec.ts │ │ └── login.page.ts │ ├── post │ │ ├── post.module.ts │ │ ├── post.page.html │ │ ├── post.page.scss │ │ ├── post.page.spec.ts │ │ └── post.page.ts │ ├── profile │ │ ├── profile.module.ts │ │ ├── profile.page.html │ │ ├── profile.page.scss │ │ ├── profile.page.ts │ │ └── profile.spec.ts │ ├── register │ │ ├── register.module.ts │ │ ├── register.page.html │ │ ├── register.page.scss │ │ ├── register.page.spec.ts │ │ └── register.page.ts │ ├── share.module.ts │ ├── tabs │ │ ├── tabs.module.ts │ │ ├── tabs.page.html │ │ ├── tabs.page.scss │ │ ├── tabs.page.spec.ts │ │ ├── tabs.page.ts │ │ └── tabs.router.module.ts │ ├── uploader │ │ ├── uploader.module.ts │ │ ├── uploader.page.html │ │ ├── uploader.page.scss │ │ ├── uploader.page.spec.ts │ │ └── uploader.page.ts │ └── user.service.ts ├── assets │ ├── icon │ │ └── favicon.png │ └── shapes.svg ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── global.scss ├── index.html ├── karma.conf.js ├── main.ts ├── polyfills.ts ├── test.ts ├── theme │ └── variables.scss ├── tsconfig.app.json └── tsconfig.spec.json ├── 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 | .ionic/ 17 | .sourcemaps/ 18 | .sass-cache/ 19 | .tmp/ 20 | .versions/ 21 | coverage/ 22 | www/ 23 | node_modules/ 24 | tmp/ 25 | temp/ 26 | platforms/ 27 | plugins/ 28 | plugins/android.json 29 | plugins/ios.json 30 | $RECYCLE.BIN/ 31 | 32 | .DS_Store 33 | Thumbs.db 34 | UserInterfaceState.xcuserstate 35 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json", 3 | "version": 1, 4 | "defaultProject": "app", 5 | "newProjectRoot": "projects", 6 | "projects": { 7 | "app": { 8 | "root": "", 9 | "sourceRoot": "src", 10 | "projectType": "application", 11 | "prefix": "app", 12 | "schematics": {}, 13 | "architect": { 14 | "build": { 15 | "builder": "@angular-devkit/build-angular:browser", 16 | "options": { 17 | "outputPath": "www", 18 | "index": "src/index.html", 19 | "main": "src/main.ts", 20 | "polyfills": "src/polyfills.ts", 21 | "tsConfig": "src/tsconfig.app.json", 22 | "assets": [ 23 | { 24 | "glob": "**/*", 25 | "input": "src/assets", 26 | "output": "assets" 27 | } 28 | ], 29 | "styles": [ 30 | { 31 | "input": "src/theme/variables.scss" 32 | }, 33 | { 34 | "input": "src/global.scss" 35 | } 36 | ], 37 | "scripts": [] 38 | }, 39 | "configurations": { 40 | "production": { 41 | "fileReplacements": [ 42 | { 43 | "replace": "src/environments/environment.ts", 44 | "with": "src/environments/environment.prod.ts" 45 | } 46 | ], 47 | "optimization": true, 48 | "outputHashing": "all", 49 | "sourceMap": false, 50 | "extractCss": true, 51 | "namedChunks": false, 52 | "aot": true, 53 | "extractLicenses": true, 54 | "vendorChunk": false, 55 | "buildOptimizer": true, 56 | "budgets": [ 57 | { 58 | "type": "initial", 59 | "maximumWarning": "2mb", 60 | "maximumError": "5mb" 61 | } 62 | ] 63 | }, 64 | "ci": { 65 | "progress": false 66 | } 67 | } 68 | }, 69 | "serve": { 70 | "builder": "@angular-devkit/build-angular:dev-server", 71 | "options": { 72 | "browserTarget": "app:build" 73 | }, 74 | "configurations": { 75 | "production": { 76 | "browserTarget": "app:build:production" 77 | }, 78 | "ci": { 79 | "progress": false 80 | } 81 | } 82 | }, 83 | "extract-i18n": { 84 | "builder": "@angular-devkit/build-angular:extract-i18n", 85 | "options": { 86 | "browserTarget": "app:build" 87 | } 88 | }, 89 | "test": { 90 | "builder": "@angular-devkit/build-angular:karma", 91 | "options": { 92 | "main": "src/test.ts", 93 | "polyfills": "src/polyfills.ts", 94 | "tsConfig": "src/tsconfig.spec.json", 95 | "karmaConfig": "src/karma.conf.js", 96 | "styles": [], 97 | "scripts": [], 98 | "assets": [ 99 | { 100 | "glob": "favicon.ico", 101 | "input": "src/", 102 | "output": "/" 103 | }, 104 | { 105 | "glob": "**/*", 106 | "input": "src/assets", 107 | "output": "/assets" 108 | } 109 | ] 110 | }, 111 | "configurations": { 112 | "ci": { 113 | "progress": false, 114 | "watch": false 115 | } 116 | } 117 | }, 118 | "lint": { 119 | "builder": "@angular-devkit/build-angular:tslint", 120 | "options": { 121 | "tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"], 122 | "exclude": ["**/node_modules/**"] 123 | } 124 | }, 125 | "ionic-cordova-build": { 126 | "builder": "@ionic/angular-toolkit:cordova-build", 127 | "options": { 128 | "browserTarget": "app:build" 129 | }, 130 | "configurations": { 131 | "production": { 132 | "browserTarget": "app:build:production" 133 | } 134 | } 135 | }, 136 | "ionic-cordova-serve": { 137 | "builder": "@ionic/angular-toolkit:cordova-serve", 138 | "options": { 139 | "cordovaBuildTarget": "app:ionic-cordova-build", 140 | "devServerTarget": "app:serve" 141 | }, 142 | "configurations": { 143 | "production": { 144 | "cordovaBuildTarget": "app:ionic-cordova-build:production", 145 | "devServerTarget": "app:serve:production" 146 | } 147 | } 148 | } 149 | } 150 | }, 151 | "app-e2e": { 152 | "root": "e2e/", 153 | "projectType": "application", 154 | "architect": { 155 | "e2e": { 156 | "builder": "@angular-devkit/build-angular:protractor", 157 | "options": { 158 | "protractorConfig": "e2e/protractor.conf.js", 159 | "devServerTarget": "app:serve" 160 | }, 161 | "configurations": { 162 | "ci": { 163 | "devServerTarget": "app:serve:ci" 164 | } 165 | } 166 | }, 167 | "lint": { 168 | "builder": "@angular-devkit/build-angular:tslint", 169 | "options": { 170 | "tsConfig": "e2e/tsconfig.e2e.json", 171 | "exclude": ["**/node_modules/**"] 172 | } 173 | } 174 | } 175 | } 176 | }, 177 | "cli": { 178 | "defaultCollection": "@ionic/angular-toolkit" 179 | }, 180 | "schematics": { 181 | "@ionic/angular-toolkit:component": { 182 | "styleext": "scss" 183 | }, 184 | "@ionic/angular-toolkit:page": { 185 | "styleext": "scss" 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('new App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should be blank', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toContain('The world is your oyster.'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.deepCss('app-root ion-content')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "integrations": {}, 4 | "type": "angular" 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "build": "ng build", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/common": "~7.1.4", 17 | "@angular/core": "~7.1.4", 18 | "@angular/fire": "^5.1.1", 19 | "@angular/forms": "~7.1.4", 20 | "@angular/http": "~7.1.4", 21 | "@angular/platform-browser": "~7.1.4", 22 | "@angular/platform-browser-dynamic": "~7.1.4", 23 | "@angular/router": "~7.1.4", 24 | "@ionic-native/core": "5.0.0-beta.21", 25 | "@ionic-native/splash-screen": "5.0.0-beta.21", 26 | "@ionic-native/status-bar": "5.0.0-beta.21", 27 | "@ionic/angular": "4.0.0-rc.0", 28 | "core-js": "^2.5.4", 29 | "firebase": "^5.7.2", 30 | "rxjs": "~6.3.3", 31 | "zone.js": "~0.8.26" 32 | }, 33 | "devDependencies": { 34 | "@angular-devkit/architect": "~0.11.4", 35 | "@angular-devkit/build-angular": "~0.11.4", 36 | "@angular-devkit/core": "~7.1.4", 37 | "@angular-devkit/schematics": "~7.1.4", 38 | "@angular/cli": "~7.1.4", 39 | "@angular/compiler": "~7.1.4", 40 | "@angular/compiler-cli": "~7.1.4", 41 | "@angular/language-service": "~7.1.4", 42 | "@ionic/angular-toolkit": "~1.2.0", 43 | "@ionic/lab": "1.0.16", 44 | "@types/jasmine": "~2.8.8", 45 | "@types/jasminewd2": "~2.0.3", 46 | "@types/node": "~10.12.0", 47 | "codelyzer": "~4.5.0", 48 | "jasmine-core": "~2.99.1", 49 | "jasmine-spec-reporter": "~4.2.1", 50 | "karma": "~3.1.4", 51 | "karma-chrome-launcher": "~2.2.0", 52 | "karma-coverage-istanbul-reporter": "~2.0.1", 53 | "karma-jasmine": "~1.1.2", 54 | "karma-jasmine-html-reporter": "^0.2.2", 55 | "protractor": "~5.4.0", 56 | "ts-node": "~7.0.0", 57 | "tslint": "~5.12.0", 58 | "typescript": "~3.1.6" 59 | }, 60 | "description": "An Ionic project" 61 | } 62 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { AuthService } from './auth.service' 4 | 5 | const routes: Routes = [ 6 | { path: '', redirectTo: 'tabs', pathMatch: 'full' }, 7 | { path: 'login', loadChildren: './login/login.module#LoginPageModule' }, 8 | { path: 'register', loadChildren: './register/register.module#RegisterPageModule' }, 9 | { path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule', canActivate: [AuthService] }, 10 | ]; 11 | 12 | // localhost/tabs 13 | 14 | @NgModule({ 15 | imports: [RouterModule.forRoot(routes)], 16 | exports: [RouterModule] 17 | }) 18 | export class AppRoutingModule { } 19 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { TestBed, async } from '@angular/core/testing'; 3 | 4 | import { Platform } from '@ionic/angular'; 5 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 6 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 7 | 8 | import { AppComponent } from './app.component'; 9 | 10 | describe('AppComponent', () => { 11 | 12 | let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy; 13 | 14 | beforeEach(async(() => { 15 | statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']); 16 | splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']); 17 | platformReadySpy = Promise.resolve(); 18 | platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy }); 19 | 20 | TestBed.configureTestingModule({ 21 | declarations: [AppComponent], 22 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 23 | providers: [ 24 | { provide: StatusBar, useValue: statusBarSpy }, 25 | { provide: SplashScreen, useValue: splashScreenSpy }, 26 | { provide: Platform, useValue: platformSpy }, 27 | ], 28 | }).compileComponents(); 29 | })); 30 | 31 | it('should create the app', () => { 32 | const fixture = TestBed.createComponent(AppComponent); 33 | const app = fixture.debugElement.componentInstance; 34 | expect(app).toBeTruthy(); 35 | }); 36 | 37 | it('should initialize the app', async () => { 38 | TestBed.createComponent(AppComponent); 39 | expect(platformSpy.ready).toHaveBeenCalled(); 40 | await platformReadySpy; 41 | expect(statusBarSpy.styleDefault).toHaveBeenCalled(); 42 | expect(splashScreenSpy.hide).toHaveBeenCalled(); 43 | }); 44 | 45 | // TODO: add more tests! 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { Platform } from '@ionic/angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 5 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: 'app.component.html' 10 | }) 11 | export class AppComponent { 12 | constructor( 13 | private platform: Platform, 14 | private splashScreen: SplashScreen, 15 | private statusBar: StatusBar 16 | ) { 17 | this.initializeApp(); 18 | } 19 | 20 | initializeApp() { 21 | this.platform.ready().then(() => { 22 | this.statusBar.styleDefault(); 23 | this.splashScreen.hide(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouteReuseStrategy } from '@angular/router'; 4 | 5 | import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; 6 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 7 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 8 | 9 | import { AppComponent } from './app.component'; 10 | import { AppRoutingModule } from './app-routing.module'; 11 | import firebaseConfig from './firebase' 12 | import { AngularFireModule } from '@angular/fire'; 13 | import { AngularFireAuthModule } from '@angular/fire/auth' 14 | import { HttpModule } from '@angular/http' 15 | import { UserService } from './user.service'; 16 | import { AngularFirestoreModule } from '@angular/fire/firestore'; 17 | import { AuthService } from './auth.service'; 18 | import { ShareModule } from './share.module'; 19 | 20 | @NgModule({ 21 | declarations: [AppComponent], 22 | entryComponents: [], 23 | imports: [ 24 | BrowserModule, 25 | IonicModule.forRoot(), 26 | AppRoutingModule, 27 | AngularFireModule.initializeApp(firebaseConfig), 28 | AngularFireAuthModule, 29 | AngularFirestoreModule, 30 | HttpModule, 31 | ShareModule 32 | ], 33 | providers: [ 34 | StatusBar, 35 | SplashScreen, 36 | { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, 37 | UserService, 38 | AuthService 39 | ], 40 | bootstrap: [AppComponent] 41 | }) 42 | export class AppModule {} 43 | -------------------------------------------------------------------------------- /src/app/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core' 2 | import { Router, CanActivate } from '@angular/router' 3 | import { UserService } from './user.service' 4 | 5 | @Injectable() 6 | export class AuthService implements CanActivate { 7 | 8 | constructor(private router: Router, private user: UserService) { 9 | 10 | } 11 | 12 | async canActivate(route) { 13 | if(await this.user.isAuthenticated()) { 14 | return true 15 | } 16 | 17 | this.router.navigate(['/login']) 18 | return false 19 | } 20 | } -------------------------------------------------------------------------------- /src/app/edit-profile/edit-profile.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { EditProfilePage } from './edit-profile.page'; 9 | import { ShareModule } from '../share.module'; 10 | 11 | const routes: Routes = [ 12 | { 13 | path: '', 14 | component: EditProfilePage 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [ 20 | CommonModule, 21 | FormsModule, 22 | IonicModule, 23 | RouterModule.forChild(routes), 24 | ShareModule 25 | ], 26 | declarations: [EditProfilePage] 27 | }) 28 | export class EditProfilePageModule {} 29 | -------------------------------------------------------------------------------- /src/app/edit-profile/edit-profile.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Edit Profile 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Username 23 | 24 | 25 | 26 | 27 | New Password? 28 | 29 | 30 | 31 | 32 | Enter old password 33 | 34 | 35 | 36 | Save 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/app/edit-profile/edit-profile.page.scss: -------------------------------------------------------------------------------- 1 | .filebtn { 2 | opacity: 0; 3 | position: absolute; 4 | top: -100em; 5 | left: -100em; 6 | } 7 | 8 | .profile-pic { 9 | width: 200px; 10 | height: 200px; 11 | } -------------------------------------------------------------------------------- /src/app/edit-profile/edit-profile.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { EditProfilePage } from './edit-profile.page'; 5 | 6 | describe('EditProfilePage', () => { 7 | let component: EditProfilePage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ EditProfilePage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(EditProfilePage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/edit-profile/edit-profile.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore'; 4 | import { UserService } from '../user.service'; 5 | import { AlertController } from '@ionic/angular'; 6 | import { Router } from '@angular/router'; 7 | 8 | @Component({ 9 | selector: 'app-edit-profile', 10 | templateUrl: './edit-profile.page.html', 11 | styleUrls: ['./edit-profile.page.scss'], 12 | }) 13 | export class EditProfilePage implements OnInit { 14 | 15 | mainuser: AngularFirestoreDocument 16 | sub 17 | username: string 18 | profilePic: string 19 | 20 | password: string 21 | newpassword: string 22 | 23 | busy: boolean = false 24 | 25 | @ViewChild('fileBtn') fileBtn: { 26 | nativeElement: HTMLInputElement 27 | } 28 | 29 | constructor( 30 | private http: Http, 31 | private afs: AngularFirestore, 32 | private router: Router, 33 | private alertController: AlertController, 34 | private user: UserService) { 35 | this.mainuser = afs.doc(`users/${user.getUID()}`) 36 | this.sub = this.mainuser.valueChanges().subscribe(event => { 37 | this.username = event.username 38 | this.profilePic = event.profilePic 39 | }) 40 | } 41 | 42 | ngOnInit() { 43 | } 44 | 45 | ngOnDestroy() { 46 | this.sub.unsubscribe() 47 | } 48 | 49 | updateProfilePic() { 50 | this.fileBtn.nativeElement.click() 51 | } 52 | 53 | uploadPic(event) { 54 | const files = event.target.files 55 | 56 | const data = new FormData() 57 | data.append('file', files[0]) 58 | data.append('UPLOADCARE_STORE', '1') 59 | data.append('UPLOADCARE_PUB_KEY', 'ada5e3cb2da06dee6d82') 60 | 61 | this.http.post('https://upload.uploadcare.com/base/', data) 62 | .subscribe(event => { 63 | const uuid = event.json().file 64 | this.mainuser.update({ 65 | profilePic: uuid 66 | }) 67 | }) 68 | } 69 | 70 | async presentAlert(title: string, content: string) { 71 | const alert = await this.alertController.create({ 72 | header: title, 73 | message: content, 74 | buttons: ['OK'] 75 | }) 76 | 77 | await alert.present() 78 | } 79 | 80 | async updateDetails() { 81 | this.busy = true 82 | 83 | if(!this.password) { 84 | this.busy = false 85 | return this.presentAlert('Error!', 'You have to enter a password') 86 | } 87 | 88 | try { 89 | await this.user.reAuth(this.user.getUsername(), this.password) 90 | } catch(error) { 91 | this.busy = false 92 | return this.presentAlert('Error!', 'Wrong password!') 93 | } 94 | 95 | if(this.newpassword) { 96 | await this.user.updatePassword(this.newpassword) 97 | } 98 | 99 | if(this.username !== this.user.getUsername()) { 100 | await this.user.updateEmail(this.username) 101 | this.mainuser.update({ 102 | username: this.username 103 | }) 104 | } 105 | 106 | this.password = "" 107 | this.newpassword = "" 108 | this.busy = false 109 | 110 | await this.presentAlert('Done!', 'Your profile was updated!') 111 | 112 | this.router.navigate(['/tabs/feed']) 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/app/feed/feed.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { FeedPage } from './feed.page'; 9 | 10 | const routes: Routes = [ 11 | { 12 | path: '', 13 | component: FeedPage 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | FormsModule, 21 | IonicModule, 22 | RouterModule.forChild(routes) 23 | ], 24 | declarations: [FeedPage] 25 | }) 26 | export class FeedPageModule {} 27 | -------------------------------------------------------------------------------- /src/app/feed/feed.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | feed 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/app/feed/feed.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/app/feed/feed.page.scss -------------------------------------------------------------------------------- /src/app/feed/feed.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { FeedPage } from './feed.page'; 5 | 6 | describe('FeedPage', () => { 7 | let component: FeedPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ FeedPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(FeedPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/feed/feed.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-feed', 5 | templateUrl: './feed.page.html', 6 | styleUrls: ['./feed.page.scss'], 7 | }) 8 | export class FeedPage implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/firebase.ts: -------------------------------------------------------------------------------- 1 | const config = { 2 | apiKey: "AIzaSyAk0794OsQuDuoEdUfF9nUM_zD17lfRXEE", 3 | authDomain: "codedamn-socialapp.firebaseapp.com", 4 | databaseURL: "https://codedamn-socialapp.firebaseio.com", 5 | projectId: "codedamn-socialapp", 6 | storageBucket: "codedamn-socialapp.appspot.com", 7 | messagingSenderId: "263473733320" 8 | } 9 | 10 | export default config -------------------------------------------------------------------------------- /src/app/loading/loading.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/app/loading/loading.component.scss: -------------------------------------------------------------------------------- 1 | #loader { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | width: 100%; 6 | height: 100%; 7 | } -------------------------------------------------------------------------------- /src/app/loading/loading.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoadingComponent } from './loading.component'; 4 | 5 | describe('LoadingComponent', () => { 6 | let component: LoadingComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoadingComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoadingComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/loading/loading.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-loading', 5 | templateUrl: './loading.component.html', 6 | styleUrls: ['./loading.component.scss'] 7 | }) 8 | export class LoadingComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/login/login.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { LoginPage } from './login.page'; 9 | 10 | const routes: Routes = [ 11 | { 12 | path: '', 13 | component: LoginPage 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | FormsModule, 21 | IonicModule, 22 | RouterModule.forChild(routes) 23 | ], 24 | declarations: [LoginPage] 25 | }) 26 | export class LoginPageModule {} 27 | -------------------------------------------------------------------------------- /src/app/login/login.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Login 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Username 12 | 13 | 14 | 15 | 16 | Password 17 | 18 | 19 | 20 | 21 | 22 | Login 23 | -------------------------------------------------------------------------------- /src/app/login/login.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/app/login/login.page.scss -------------------------------------------------------------------------------- /src/app/login/login.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { LoginPage } from './login.page'; 5 | 6 | describe('LoginPage', () => { 7 | let component: LoginPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ LoginPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(LoginPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/login/login.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AngularFireAuth } from '@angular/fire/auth' 3 | import { auth } from 'firebase/app' 4 | import { UserService } from '../user.service'; 5 | import { Router } from '@angular/router'; 6 | 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.page.html', 10 | styleUrls: ['./login.page.scss'], 11 | }) 12 | export class LoginPage implements OnInit { 13 | 14 | username: string = "" 15 | password: string = "" 16 | 17 | constructor(public afAuth: AngularFireAuth, public user: UserService, public router: Router) { } 18 | 19 | ngOnInit() { 20 | } 21 | 22 | async login() { 23 | const { username, password } = this 24 | try { 25 | // kind of a hack. 26 | const res = await this.afAuth.auth.signInWithEmailAndPassword(username + '@codedamn.com', password) 27 | 28 | if(res.user) { 29 | this.user.setUser({ 30 | username, 31 | uid: res.user.uid 32 | }) 33 | this.router.navigate(['/tabs']) 34 | } 35 | 36 | } catch(err) { 37 | console.dir(err) 38 | if(err.code === "auth/user-not-found") { 39 | console.log("User not found") 40 | } 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/app/post/post.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { PostPage } from './post.page'; 9 | import { ShareModule } from '../share.module'; 10 | 11 | const routes: Routes = [ 12 | { 13 | path: '', 14 | component: PostPage 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [ 20 | CommonModule, 21 | FormsModule, 22 | IonicModule, 23 | RouterModule.forChild(routes), 24 | ShareModule 25 | ], 26 | declarations: [PostPage] 27 | }) 28 | export class PostPageModule {} 29 | -------------------------------------------------------------------------------- /src/app/post/post.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | post 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{ postData.desc }} 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/app/post/post.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/app/post/post.page.scss -------------------------------------------------------------------------------- /src/app/post/post.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { PostPage } from './post.page'; 5 | 6 | describe('PostPage', () => { 7 | let component: PostPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ PostPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(PostPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/post/post.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore'; 4 | import { UserService } from '../user.service'; 5 | import { firestore } from 'firebase/app' 6 | 7 | @Component({ 8 | selector: 'app-post', 9 | templateUrl: './post.page.html', 10 | styleUrls: ['./post.page.scss'], 11 | }) 12 | export class PostPage implements OnInit { 13 | 14 | postID: string 15 | effect: string = '' 16 | post 17 | postReference: AngularFirestoreDocument 18 | sub 19 | 20 | heartType: string = "heart-empty" 21 | 22 | constructor( 23 | private route: ActivatedRoute, 24 | private afs: AngularFirestore, 25 | private user: UserService) { 26 | 27 | } 28 | 29 | ngOnInit() { 30 | this.postID = this.route.snapshot.paramMap.get('id') 31 | this.postReference = this.afs.doc(`posts/${this.postID}`) 32 | this.sub = this.postReference.valueChanges().subscribe(val => { 33 | this.post = val 34 | this.effect = val.effect 35 | this.heartType = val.likes.includes(this.user.getUID()) ? 'heart' : 'heart-empty' 36 | }) 37 | } 38 | 39 | ngOnDestroy() { 40 | this.sub.unsubscribe() 41 | } 42 | 43 | toggleHeart() { 44 | if(this.heartType == 'heart-empty') { 45 | this.postReference.update({ 46 | likes: firestore.FieldValue.arrayUnion(this.user.getUID()) 47 | }) 48 | } else { 49 | this.postReference.update({ 50 | likes: firestore.FieldValue.arrayRemove(this.user.getUID()) 51 | }) 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/app/profile/profile.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { ProfilePage } from './profile.page'; 9 | import { ShareModule } from '../share.module'; 10 | 11 | const routes: Routes = [ 12 | { 13 | path: '', 14 | component: ProfilePage 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [ 20 | CommonModule, 21 | FormsModule, 22 | IonicModule, 23 | RouterModule.forChild(routes), 24 | ShareModule 25 | ], 26 | declarations: [ProfilePage] 27 | }) 28 | export class ProfilePageModule {} 29 | -------------------------------------------------------------------------------- /src/app/profile/profile.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Profile 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{ username }} 19 | Edit Profile 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/app/profile/profile.page.scss: -------------------------------------------------------------------------------- 1 | #images { 2 | display: flex; 3 | flex-wrap: wrap; 4 | margin: 0 auto; 5 | max-width: 100%; 6 | width: 606px; 7 | } 8 | 9 | .image { 10 | margin-left: 1px; 11 | margin-right: 1px; 12 | } 13 | 14 | .main-image, .user-image { 15 | width: 200px; 16 | height: 200px; 17 | } -------------------------------------------------------------------------------- /src/app/profile/profile.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore' 3 | import { UserService } from '../user.service'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Component({ 7 | selector: 'app-page', 8 | templateUrl: './profile.page.html', 9 | styleUrls: ['./profile.page.scss'], 10 | }) 11 | export class ProfilePage implements OnInit { 12 | 13 | mainuser: AngularFirestoreDocument 14 | userPosts 15 | sub 16 | posts 17 | username: string 18 | profilePic: string 19 | 20 | constructor(private afs: AngularFirestore, private user: UserService, private router: Router) { 21 | this.mainuser = afs.doc(`users/${user.getUID()}`) 22 | this.sub = this.mainuser.valueChanges().subscribe(event => { 23 | this.posts = event.posts 24 | this.username = event.username 25 | this.profilePic = event.profilePic 26 | }) 27 | } 28 | 29 | ngOnDestroy() { 30 | this.sub.unsubscribe() 31 | } 32 | 33 | goTo(postID: string) { 34 | 35 | this.router.navigate(['/tabs/post/' + postID.split('/')[0]]) 36 | } 37 | 38 | ngOnInit() { 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/app/profile/profile.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { ProfilePage } from './profile.page'; 5 | 6 | describe('PagePage', () => { 7 | let component: ProfilePage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ ProfilePage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(ProfilePage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/register/register.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { RegisterPage } from './register.page'; 9 | 10 | const routes: Routes = [ 11 | { 12 | path: '', 13 | component: RegisterPage 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | FormsModule, 21 | IonicModule, 22 | RouterModule.forChild(routes) 23 | ], 24 | declarations: [RegisterPage] 25 | }) 26 | export class RegisterPageModule {} 27 | -------------------------------------------------------------------------------- /src/app/register/register.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Register 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Username 12 | 13 | 14 | 15 | 16 | Password 17 | 18 | 19 | 20 | 21 | Confirm Password 22 | 23 | 24 | 25 | 26 | 27 | Signup 28 | -------------------------------------------------------------------------------- /src/app/register/register.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/app/register/register.page.scss -------------------------------------------------------------------------------- /src/app/register/register.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { RegisterPage } from './register.page'; 5 | 6 | describe('RegisterPage', () => { 7 | let component: RegisterPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ RegisterPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(RegisterPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/register/register.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AngularFireAuth } from '@angular/fire/auth' 3 | import { auth } from 'firebase/app' 4 | 5 | import { AngularFirestore } from '@angular/fire/firestore' 6 | import { UserService } from '../user.service'; 7 | import { AlertController } from '@ionic/angular'; 8 | import { Router } from '@angular/router'; 9 | 10 | @Component({ 11 | selector: 'app-register', 12 | templateUrl: './register.page.html', 13 | styleUrls: ['./register.page.scss'], 14 | }) 15 | export class RegisterPage implements OnInit { 16 | 17 | username: string = "" 18 | password: string = "" 19 | cpassword: string = "" 20 | 21 | constructor( 22 | public afAuth: AngularFireAuth, 23 | public afstore: AngularFirestore, 24 | public user: UserService, 25 | public alertController: AlertController, 26 | public router: Router 27 | ) { } 28 | 29 | ngOnInit() { 30 | } 31 | 32 | async presentAlert(title: string, content: string) { 33 | const alert = await this.alertController.create({ 34 | header: title, 35 | message: content, 36 | buttons: ['OK'] 37 | }) 38 | 39 | await alert.present() 40 | } 41 | 42 | async register() { 43 | const { username, password, cpassword } = this 44 | if(password !== cpassword) { 45 | return console.error("Passwords don't match") 46 | } 47 | 48 | try { 49 | const res = await this.afAuth.auth.createUserWithEmailAndPassword(username + '@codedamn.com', password) 50 | 51 | this.afstore.doc(`users/${res.user.uid}`).set({ 52 | username 53 | }) 54 | 55 | this.user.setUser({ 56 | username, 57 | uid: res.user.uid 58 | }) 59 | 60 | this.presentAlert('Success', 'You are registered!') 61 | this.router.navigate(['/tabs']) 62 | 63 | } catch(error) { 64 | console.dir(error) 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/app/share.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | 5 | import { IonicModule } from '@ionic/angular'; 6 | import { LoadingComponent } from './loading/loading.component'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | CommonModule, 11 | FormsModule, 12 | IonicModule, 13 | ], 14 | declarations: [LoadingComponent], 15 | exports: [LoadingComponent] 16 | }) 17 | export class ShareModule {} 18 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | 5 | import { IonicModule } from '@ionic/angular'; 6 | 7 | import { TabsPage } from './tabs.page'; 8 | import { TabsRoutingModule } from './tabs.router.module' 9 | 10 | 11 | @NgModule({ 12 | imports: [ 13 | CommonModule, 14 | FormsModule, 15 | IonicModule, 16 | TabsRoutingModule 17 | ], 18 | declarations: [TabsPage] 19 | }) 20 | export class TabsPageModule {} 21 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Feed 6 | 7 | 8 | 9 | 10 | Upload 11 | 12 | 13 | 14 | 15 | Profile 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/app/tabs/tabs.page.scss -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { TabsPage } from './tabs.page'; 5 | 6 | describe('TabsPage', () => { 7 | let component: TabsPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ TabsPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(TabsPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild } from '@angular/core'; 2 | import { IonTabs } from '@ionic/angular'; 3 | 4 | @Component({ 5 | selector: 'app-tabs', 6 | templateUrl: './tabs.page.html', 7 | styleUrls: ['./tabs.page.scss'], 8 | }) 9 | export class TabsPage implements OnInit { 10 | 11 | @ViewChild('tabs') tabs: IonTabs 12 | 13 | constructor() { } 14 | 15 | ngOnInit() { 16 | this.tabs.select('feed') 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.router.module.ts: -------------------------------------------------------------------------------- 1 | import { RouterModule, Routes } from '@angular/router'; 2 | import { NgModule } from '@angular/core' 3 | import { TabsPage } from './tabs.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: TabsPage, 9 | children: [ 10 | { path: 'feed', loadChildren: '../feed/feed.module#FeedPageModule' }, 11 | { path: 'uploader', loadChildren: '../uploader/uploader.module#UploaderPageModule' }, 12 | { path: 'profile', loadChildren: '../profile/profile.module#ProfilePageModule' }, 13 | { path: 'post/:id', loadChildren: '../post/post.module#PostPageModule' }, 14 | { path: 'edit-profile', loadChildren: '../edit-profile/edit-profile.module#EditProfilePageModule' }, 15 | ] 16 | } 17 | ]; 18 | 19 | @NgModule({ 20 | imports: [RouterModule.forChild(routes)], 21 | exports: [RouterModule] 22 | }) 23 | export class TabsRoutingModule { } 24 | -------------------------------------------------------------------------------- /src/app/uploader/uploader.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { UploaderPage } from './uploader.page'; 9 | import { ShareModule } from '../share.module'; 10 | 11 | const routes: Routes = [ 12 | { 13 | path: '', 14 | component: UploaderPage 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [ 20 | CommonModule, 21 | FormsModule, 22 | IonicModule, 23 | RouterModule.forChild(routes), 24 | ShareModule 25 | ], 26 | declarations: [UploaderPage] 27 | }) 28 | export class UploaderPageModule {} 29 | -------------------------------------------------------------------------------- /src/app/uploader/uploader.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Upload Image 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Upload File 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | POST 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 | Images with faces perform 150 times better! 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/app/uploader/uploader.page.scss: -------------------------------------------------------------------------------- 1 | .camera { 2 | width: 200px; 3 | height: 200px; 4 | margin: 0 auto; 5 | background: black; 6 | display: none; 7 | } 8 | 9 | .filebtn { 10 | opacity: 0; 11 | position: absolute; 12 | top: -100em; 13 | left: -100em; 14 | } 15 | 16 | .center { 17 | display: flex; 18 | height: 100%; 19 | justify-content: center; 20 | align-items: center; 21 | } 22 | 23 | .active { 24 | border: 2px solid black; 25 | } 26 | 27 | .no-face { 28 | font-weight: bold; 29 | text-align: center; 30 | font-style: italic; 31 | } -------------------------------------------------------------------------------- /src/app/uploader/uploader.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { UploaderPage } from './uploader.page'; 5 | 6 | describe('UploaderPage', () => { 7 | let component: UploaderPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ UploaderPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(UploaderPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/uploader/uploader.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild } from '@angular/core'; 2 | import { Http } from '@angular/http' 3 | import { AngularFirestore } from '@angular/fire/firestore'; 4 | import { UserService } from '../user.service'; 5 | import { firestore } from 'firebase/app'; 6 | import { AlertController } from '@ionic/angular'; 7 | import { Router } from '@angular/router'; 8 | 9 | @Component({ 10 | selector: 'app-uploader', 11 | templateUrl: './uploader.page.html', 12 | styleUrls: ['./uploader.page.scss'], 13 | }) 14 | export class UploaderPage implements OnInit { 15 | 16 | imageURL: string 17 | desc: string 18 | noFace: boolean = false 19 | 20 | scaleCrop: string = '-/scale_crop/200x200' 21 | 22 | effects = { 23 | effect1: '', 24 | effect2: '-/exposure/50/-/saturation/50/-/warmth/-30/', 25 | effect3: '-/filter/vevera/150/', 26 | effect4: '-/filter/carris/150/', 27 | effect5: '-/filter/misiara/150/' 28 | } 29 | 30 | activeEffect: string = this.effects.effect1 31 | busy: boolean = false 32 | 33 | @ViewChild('fileButton') fileButton 34 | 35 | constructor( 36 | public http: Http, 37 | public afstore: AngularFirestore, 38 | public user: UserService, 39 | private alertController: AlertController, 40 | private router: Router) { } 41 | 42 | ngOnInit() { 43 | } 44 | 45 | async createPost() { 46 | this.busy = true 47 | 48 | const image = this.imageURL 49 | const activeEffect = this.activeEffect 50 | const desc = this.desc 51 | 52 | this.afstore.doc(`users/${this.user.getUID()}`).update({ 53 | posts: firestore.FieldValue.arrayUnion(`${image}/${activeEffect}`) 54 | }) 55 | 56 | this.afstore.doc(`posts/${image}`).set({ 57 | desc, 58 | author: this.user.getUsername(), 59 | likes: [], 60 | effect: activeEffect 61 | }) 62 | 63 | this.busy = false 64 | this.imageURL = "" 65 | this.desc = "" 66 | 67 | 68 | 69 | const alert = await this.alertController.create({ 70 | header: 'Done', 71 | message: 'Your post was created!', 72 | buttons: ['Cool!'] 73 | }) 74 | 75 | await alert.present() 76 | 77 | this.router.navigate(['/tabs/feed']) 78 | } 79 | 80 | setSelected(effect: string) { 81 | this.activeEffect = this.effects[effect] 82 | } 83 | 84 | uploadFile() { 85 | this.fileButton.nativeElement.click() 86 | } 87 | 88 | fileChanged(event) { 89 | 90 | this.busy = true 91 | 92 | const files = event.target.files 93 | 94 | const data = new FormData() 95 | data.append('file', files[0]) 96 | data.append('UPLOADCARE_STORE', '1') 97 | data.append('UPLOADCARE_PUB_KEY', 'ada5e3cb2da06dee6d82') 98 | 99 | this.http.post('https://upload.uploadcare.com/base/', data) 100 | .subscribe(event => { 101 | console.log(event) 102 | this.imageURL = event.json().file 103 | this.busy = false 104 | this.http.get(`https://ucarecdn.com/${this.imageURL}/detect_faces/`) 105 | .subscribe(event => { 106 | this.noFace = event.json().faces == 0 107 | }) 108 | }) 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/app/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core' 2 | import { AngularFireAuth } from '@angular/fire/auth' 3 | import { first } from 'rxjs/operators' 4 | import { auth } from 'firebase/app' 5 | 6 | interface user { 7 | username: string, 8 | uid: string 9 | } 10 | 11 | @Injectable() 12 | export class UserService { 13 | private user: user 14 | 15 | constructor(private afAuth: AngularFireAuth) { 16 | 17 | } 18 | 19 | setUser(user: user) { 20 | this.user = user 21 | } 22 | 23 | getUsername(): string { 24 | return this.user.username 25 | } 26 | 27 | reAuth(username: string, password: string) { 28 | return this.afAuth.auth.currentUser.reauthenticateWithCredential(auth.EmailAuthProvider.credential(username + '@codedamn.com', password)) 29 | } 30 | 31 | updatePassword(newpassword: string) { 32 | return this.afAuth.auth.currentUser.updatePassword(newpassword) 33 | } 34 | 35 | updateEmail(newemail: string) { 36 | return this.afAuth.auth.currentUser.updateEmail(newemail + '@codedamn.com') 37 | } 38 | 39 | async isAuthenticated() { 40 | if(this.user) return true 41 | 42 | const user = await this.afAuth.authState.pipe(first()).toPromise() 43 | 44 | if(user) { 45 | this.setUser({ 46 | username: user.email.split('@')[0], 47 | uid: user.uid 48 | }) 49 | 50 | return true 51 | } 52 | return false 53 | } 54 | 55 | getUID(): string { 56 | return this.user.uid 57 | } 58 | } -------------------------------------------------------------------------------- /src/assets/icon/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedamn/social-media-app-ionic4/3bb8c88f520d6ddbfa6c829cde88aba38885e313/src/assets/icon/favicon.png -------------------------------------------------------------------------------- /src/assets/shapes.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` 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 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/global.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/theming/ 2 | @import '~@ionic/angular/css/core.css'; 3 | @import '~@ionic/angular/css/normalize.css'; 4 | @import '~@ionic/angular/css/structure.css'; 5 | @import '~@ionic/angular/css/typography.css'; 6 | 7 | @import '~@ionic/angular/css/padding.css'; 8 | @import '~@ionic/angular/css/float-elements.css'; 9 | @import '~@ionic/angular/css/text-alignment.css'; 10 | @import '~@ionic/angular/css/text-transformation.css'; 11 | @import '~@ionic/angular/css/flex-utils.css'; 12 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/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-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /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.log(err)); 13 | -------------------------------------------------------------------------------- /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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10, IE11, and older Chrome requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** 38 | * If the application will be indexed by Google Search, the following is required. 39 | * Googlebot uses a renderer based on Chrome 41. 40 | * https://developers.google.com/search/docs/guides/rendering 41 | **/ 42 | // import 'core-js/es6/array'; 43 | 44 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 45 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 46 | 47 | /** IE10 and IE11 requires the following for the Reflect API. */ 48 | // import 'core-js/es6/reflect'; 49 | 50 | /** 51 | * Web Animations `@angular/platform-browser/animations` 52 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 53 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 54 | **/ 55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 56 | 57 | /** 58 | * By default, zone.js will patch all possible macroTask and DomEvents 59 | * user can disable parts of macroTask/DomEvents patch by setting following flags 60 | * because those flags need to be set before `zone.js` being loaded, and webpack 61 | * will put import in the top of bundle, so user need to create a separate file 62 | * in this directory (for example: zone-flags.ts), and put the following flags 63 | * into that file, and then add the following code before importing zone.js. 64 | * import './zone-flags.ts'; 65 | * 66 | * The flags allowed in zone-flags.ts are listed here. 67 | * 68 | * The following flags will work for all browsers. 69 | * 70 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 71 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 72 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 73 | * 74 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 75 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 76 | * 77 | * (window as any).__Zone_enable_cross_context_check = true; 78 | * 79 | */ 80 | 81 | /*************************************************************************************************** 82 | * Zone JS is required by default for Angular itself. 83 | */ 84 | import 'zone.js/dist/zone'; // Included with Angular CLI. 85 | 86 | 87 | /*************************************************************************************************** 88 | * APPLICATION IMPORTS 89 | */ 90 | -------------------------------------------------------------------------------- /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/dist/zone-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: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | /** Ionic CSS Variables **/ 5 | :root { 6 | /** primary **/ 7 | --ion-color-primary: #3880ff; 8 | --ion-color-primary-rgb: 56, 128, 255; 9 | --ion-color-primary-contrast: #ffffff; 10 | --ion-color-primary-contrast-rgb: 255, 255, 255; 11 | --ion-color-primary-shade: #3171e0; 12 | --ion-color-primary-tint: #4c8dff; 13 | 14 | /** secondary **/ 15 | --ion-color-secondary: #0cd1e8; 16 | --ion-color-secondary-rgb: 12, 209, 232; 17 | --ion-color-secondary-contrast: #ffffff; 18 | --ion-color-secondary-contrast-rgb: 255, 255, 255; 19 | --ion-color-secondary-shade: #0bb8cc; 20 | --ion-color-secondary-tint: #24d6ea; 21 | 22 | /** tertiary **/ 23 | --ion-color-tertiary: #7044ff; 24 | --ion-color-tertiary-rgb: 112, 68, 255; 25 | --ion-color-tertiary-contrast: #ffffff; 26 | --ion-color-tertiary-contrast-rgb: 255, 255, 255; 27 | --ion-color-tertiary-shade: #633ce0; 28 | --ion-color-tertiary-tint: #7e57ff; 29 | 30 | /** success **/ 31 | --ion-color-success: #10dc60; 32 | --ion-color-success-rgb: 16, 220, 96; 33 | --ion-color-success-contrast: #ffffff; 34 | --ion-color-success-contrast-rgb: 255, 255, 255; 35 | --ion-color-success-shade: #0ec254; 36 | --ion-color-success-tint: #28e070; 37 | 38 | /** warning **/ 39 | --ion-color-warning: #ffce00; 40 | --ion-color-warning-rgb: 255, 206, 0; 41 | --ion-color-warning-contrast: #ffffff; 42 | --ion-color-warning-contrast-rgb: 255, 255, 255; 43 | --ion-color-warning-shade: #e0b500; 44 | --ion-color-warning-tint: #ffd31a; 45 | 46 | /** danger **/ 47 | --ion-color-danger: #f04141; 48 | --ion-color-danger-rgb: 245, 61, 61; 49 | --ion-color-danger-contrast: #ffffff; 50 | --ion-color-danger-contrast-rgb: 255, 255, 255; 51 | --ion-color-danger-shade: #d33939; 52 | --ion-color-danger-tint: #f25454; 53 | 54 | /** dark **/ 55 | --ion-color-dark: #222428; 56 | --ion-color-dark-rgb: 34, 34, 34; 57 | --ion-color-dark-contrast: #ffffff; 58 | --ion-color-dark-contrast-rgb: 255, 255, 255; 59 | --ion-color-dark-shade: #1e2023; 60 | --ion-color-dark-tint: #383a3e; 61 | 62 | /** medium **/ 63 | --ion-color-medium: #989aa2; 64 | --ion-color-medium-rgb: 152, 154, 162; 65 | --ion-color-medium-contrast: #ffffff; 66 | --ion-color-medium-contrast-rgb: 255, 255, 255; 67 | --ion-color-medium-shade: #86888f; 68 | --ion-color-medium-tint: #a2a4ab; 69 | 70 | /** light **/ 71 | --ion-color-light: #f4f5f8; 72 | --ion-color-light-rgb: 244, 244, 244; 73 | --ion-color-light-contrast: #000000; 74 | --ion-color-light-contrast-rgb: 0, 0, 0; 75 | --ion-color-light-shade: #d7d8da; 76 | --ion-color-light-tint: #f5f6f9; 77 | } 78 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2018", 18 | "dom" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-spacing": true, 20 | "indent": [ 21 | true, 22 | "spaces" 23 | ], 24 | "interface-over-type-literal": true, 25 | "label-position": true, 26 | "max-line-length": [ 27 | true, 28 | 140 29 | ], 30 | "member-access": false, 31 | "member-ordering": [ 32 | true, 33 | { 34 | "order": [ 35 | "static-field", 36 | "instance-field", 37 | "static-method", 38 | "instance-method" 39 | ] 40 | } 41 | ], 42 | "no-arg": true, 43 | "no-bitwise": true, 44 | "no-console": [ 45 | true, 46 | "debug", 47 | "info", 48 | "time", 49 | "timeEnd", 50 | "trace" 51 | ], 52 | "no-construct": true, 53 | "no-debugger": true, 54 | "no-duplicate-super": true, 55 | "no-empty": false, 56 | "no-empty-interface": true, 57 | "no-eval": true, 58 | "no-inferrable-types": [ 59 | true, 60 | "ignore-params" 61 | ], 62 | "no-misused-new": true, 63 | "no-non-null-assertion": true, 64 | "no-shadowed-variable": true, 65 | "no-string-literal": false, 66 | "no-string-throw": true, 67 | "no-switch-case-fall-through": true, 68 | "no-trailing-whitespace": true, 69 | "no-unnecessary-initializer": true, 70 | "no-unused-expression": true, 71 | "no-use-before-declare": true, 72 | "no-var-keyword": true, 73 | "object-literal-sort-keys": false, 74 | "one-line": [ 75 | true, 76 | "check-open-brace", 77 | "check-catch", 78 | "check-else", 79 | "check-whitespace" 80 | ], 81 | "prefer-const": true, 82 | "quotemark": [ 83 | true, 84 | "single" 85 | ], 86 | "radix": true, 87 | "semicolon": [ 88 | true, 89 | "always" 90 | ], 91 | "triple-equals": [ 92 | true, 93 | "allow-null-check" 94 | ], 95 | "typedef-whitespace": [ 96 | true, 97 | { 98 | "call-signature": "nospace", 99 | "index-signature": "nospace", 100 | "parameter": "nospace", 101 | "property-declaration": "nospace", 102 | "variable-declaration": "nospace" 103 | } 104 | ], 105 | "unified-signatures": true, 106 | "variable-name": false, 107 | "whitespace": [ 108 | true, 109 | "check-branch", 110 | "check-decl", 111 | "check-operator", 112 | "check-separator", 113 | "check-type" 114 | ], 115 | "directive-selector": [ 116 | true, 117 | "attribute", 118 | "app", 119 | "camelCase" 120 | ], 121 | "component-selector": [ 122 | true, 123 | "element", 124 | "app", 125 | "page", 126 | "kebab-case" 127 | ], 128 | "no-output-on-prefix": true, 129 | "use-input-property-decorator": true, 130 | "use-output-property-decorator": true, 131 | "use-host-property-decorator": true, 132 | "no-input-rename": true, 133 | "no-output-rename": true, 134 | "use-life-cycle-interface": true, 135 | "use-pipe-transform-interface": true, 136 | "directive-class-suffix": true 137 | } 138 | } 139 | --------------------------------------------------------------------------------
{{ postData.desc }}
{{ username }}
Images with faces perform 150 times better!