@@ -59,7 +59,6 @@ | |||||
"@types/jasminewd2": "~2.0.3", | "@types/jasminewd2": "~2.0.3", | ||||
"@types/node": "^12.11.1", | "@types/node": "^12.11.1", | ||||
"codelyzer": "^6.0.0", | "codelyzer": "^6.0.0", | ||||
"cordova-android": "^9.0.0", | |||||
"cordova-plugin-androidx": "^3.0.0", | "cordova-plugin-androidx": "^3.0.0", | ||||
"cordova-plugin-androidx-adapter": "^1.1.3", | "cordova-plugin-androidx-adapter": "^1.1.3", | ||||
"cordova-plugin-device": "^2.0.2", | "cordova-plugin-device": "^2.0.2", | ||||
@@ -70,7 +69,6 @@ | |||||
"cordova-plugin-splashscreen": "^5.0.2", | "cordova-plugin-splashscreen": "^5.0.2", | ||||
"cordova-plugin-statusbar": "^2.4.2", | "cordova-plugin-statusbar": "^2.4.2", | ||||
"cordova-support-android-plugin": "^1.0.2", | "cordova-support-android-plugin": "^1.0.2", | ||||
"cordova-support-google-services": "^1.4.1", | |||||
"jasmine-core": "~3.5.0", | "jasmine-core": "~3.5.0", | ||||
"jasmine-spec-reporter": "~5.0.0", | "jasmine-spec-reporter": "~5.0.0", | ||||
"karma": "~5.0.0", | "karma": "~5.0.0", | ||||
@@ -104,8 +102,6 @@ | |||||
"PLAY_SERVICES_VERSION": "15.0.1" | "PLAY_SERVICES_VERSION": "15.0.1" | ||||
} | } | ||||
}, | }, | ||||
"platforms": [ | |||||
"android" | |||||
] | |||||
"platforms": [] | |||||
} | } | ||||
} | |||||
} |
@@ -2,9 +2,6 @@ import { NgModule } from '@angular/core'; | |||||
import { BrowserModule, HAMMER_GESTURE_CONFIG, HammerModule } from '@angular/platform-browser'; | import { BrowserModule, HAMMER_GESTURE_CONFIG, HammerModule } from '@angular/platform-browser'; | ||||
import { RouteReuseStrategy } from '@angular/router'; | import { RouteReuseStrategy } from '@angular/router'; | ||||
import { AngularFireModule } from "@angular/fire"; | |||||
import { AngularFireAuthModule } from "@angular/fire/auth"; | |||||
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | ||||
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | ||||
import { StatusBar } from '@ionic-native/status-bar/ngx'; | import { StatusBar } from '@ionic-native/status-bar/ngx'; | ||||
@@ -20,18 +17,6 @@ import { HttpClientModule } from '@angular/common/http'; | |||||
import { NewsService } from './services/news.service'; | import { NewsService } from './services/news.service'; | ||||
import { ToastService } from './services/toast.service'; | import { ToastService } from './services/toast.service'; | ||||
import { GooglePlus } from '@ionic-native/google-plus/ngx'; | |||||
var firebaseConfig = { | |||||
apiKey: "AIzaSyCYlFdGEsSA3bPlYYJMh3TcMiHzAUK2his", | |||||
authDomain: "kxip-21.firebaseapp.com", | |||||
projectId: "kxip-21", | |||||
storageBucket: "kxip-21.appspot.com", | |||||
messagingSenderId: "5602499136", | |||||
appId: "1:5602499136:web:57b81f812e2cbf4b419da5", | |||||
measurementId: "G-4KDJZFCZ59" | |||||
}; | |||||
@NgModule({ | @NgModule({ | ||||
declarations: [AppComponent], | declarations: [AppComponent], | ||||
entryComponents: [], | entryComponents: [], | ||||
@@ -39,14 +24,11 @@ var firebaseConfig = { | |||||
IonicModule.forRoot(), | IonicModule.forRoot(), | ||||
AppRoutingModule, | AppRoutingModule, | ||||
HttpClientModule, | HttpClientModule, | ||||
AngularFireModule.initializeApp(firebaseConfig), | |||||
AngularFireAuthModule, | |||||
HammerModule, | HammerModule, | ||||
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })], | ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })], | ||||
providers: [ | providers: [ | ||||
StatusBar, | StatusBar, | ||||
SplashScreen, | SplashScreen, | ||||
GooglePlus, | |||||
NewsService, | NewsService, | ||||
ToastService, | ToastService, | ||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, | { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, | ||||
@@ -1,19 +1,19 @@ | |||||
<ion-content> | <ion-content> | ||||
<section class="social-login" [ngClass]="{'active' : showSocialLogin }"> | |||||
<!-- <section class="social-login" [ngClass]="{'active' : showSocialLogin }"> | |||||
<section class="login-box"> | <section class="login-box"> | ||||
<button (click)="doLogin()"> Login with <img src="assets/icons/google.png"> </button> | <button (click)="doLogin()"> Login with <img src="assets/icons/google.png"> </button> | ||||
</section> | </section> | ||||
</section> | |||||
</section> --> | |||||
<div class="content-container"> | <div class="content-container"> | ||||
<section class="profile" *ngIf="googleUserData.name"> | |||||
<!-- <section class="profile" *ngIf="googleUserData.name"> | |||||
<img [src]="googleUserData.profileImage" alt="profile-image"> | <img [src]="googleUserData.profileImage" alt="profile-image"> | ||||
<p> {{ googleUserData.name }} </p> | <p> {{ googleUserData.name }} </p> | ||||
</section> | |||||
</section> --> | |||||
<div class="common-heading-holder"> | <div class="common-heading-holder"> | ||||
<h2 class="main-header"> | <h2 class="main-header"> | ||||
@@ -1,9 +1,6 @@ | |||||
import { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, OnInit, ViewChild } from '@angular/core'; | ||||
import { IonItemOption, IonSlides, ModalController } from '@ionic/angular'; | |||||
import { GooglePlus } from '@ionic-native/google-plus/ngx'; | |||||
import { IonSlides, ModalController } from '@ionic/angular'; | |||||
import { Platform } from '@ionic/angular'; | import { Platform } from '@ionic/angular'; | ||||
import { AngularFireAuth } from '@angular/fire/auth'; | |||||
import firebase from 'firebase'; | |||||
import { ArFanCamPage } from '../ar-fan-cam/ar-fan-cam.page'; | import { ArFanCamPage } from '../ar-fan-cam/ar-fan-cam.page'; | ||||
@@ -57,20 +54,10 @@ export class FanZonePage implements OnInit { | |||||
constructor( | constructor( | ||||
private google: GooglePlus, | |||||
private fireAuth: AngularFireAuth, | |||||
private platform: Platform, | private platform: Platform, | ||||
private modalController: ModalController, | private modalController: ModalController, | ||||
) { } | ) { } | ||||
// async loginWithGoogle() { | |||||
// await this.afAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider()).then((data) => { | |||||
// }, (err) => { | |||||
// alert("Failed to login"); | |||||
// this.showSocialLogin = true; | |||||
// }); | |||||
// } | |||||
async ngOnInit() { | async ngOnInit() { | ||||
this.fanStories = [{ | this.fanStories = [{ | ||||
@@ -89,13 +76,7 @@ export class FanZonePage implements OnInit { | |||||
} | } | ||||
ngAfterViewInit() { | ngAfterViewInit() { | ||||
if (localStorage.googleUserData) { | |||||
this.googleUserData = JSON.parse(localStorage.googleUserData); | |||||
this.showSocialLogin = false; | |||||
} else { | |||||
this.googleUserData = {}; | |||||
this.showSocialLogin = false; | |||||
} | |||||
} | } | ||||
generateEmojiStream() { | generateEmojiStream() { | ||||
@@ -128,73 +109,10 @@ export class FanZonePage implements OnInit { | |||||
}); | }); | ||||
} | } | ||||
doLogin(){ | |||||
let params: any; | |||||
if (this.platform.is('cordova')) { | |||||
if (this.platform.is('android')) { | |||||
params = { | |||||
webClientId: '5602499136-aonjflj2acqva5gm4vvbuen4bc10sll1.apps.googleusercontent.com', // webclientID 'string' | |||||
offline: true | |||||
}; | |||||
} else { | |||||
params = {}; | |||||
} | |||||
alert(JSON.stringify(params)); | |||||
this.google.login(params).then((response) => { | |||||
alert("called google login plugin"); | |||||
const { idToken, accessToken } = response; | |||||
this.onLoginSuccess(idToken, accessToken); | |||||
}).catch((error) => { | |||||
console.log(error); | |||||
alert('error:' + JSON.stringify(error)); | |||||
}); | |||||
} else { | |||||
console.log('else...'); | |||||
this.fireAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider()).then(data => { | |||||
console.log('success in google login', data); | |||||
this.googleUserData = { | |||||
name: data.user.displayName, | |||||
email: data.user.email, | |||||
profileImage: data.user.photoURL, | |||||
credentials: data.credential | |||||
}; | |||||
localStorage.googleUserData = JSON.stringify(this.googleUserData); | |||||
this.showSocialLogin = false; | |||||
}).catch(err => { | |||||
alert(err.message); | |||||
}); | |||||
} | |||||
} | |||||
onLoginSuccess(accessToken, accessSecret) { | |||||
const credential = accessSecret ? firebase.auth.GoogleAuthProvider.credential(accessToken, accessSecret) : firebase.auth.GoogleAuthProvider.credential(accessToken); | |||||
this.fireAuth.signInWithCredential(credential).then((data) => { | |||||
alert('successfully logged in'); | |||||
this.googleUserData = { | |||||
name: data.user.displayName, | |||||
email: data.user.email, | |||||
profileImage: data.user.photoURL, | |||||
credentials: data.credential | |||||
}; | |||||
this.showSocialLogin = false; | |||||
}); | |||||
} | |||||
onLoginError(err) { | onLoginError(err) { | ||||
console.log(err); | console.log(err); | ||||
} | } | ||||
logout() { | |||||
this.fireAuth.signOut().then(() => { | |||||
this.isGoogleLogin = false; | |||||
}); | |||||
} | |||||
reversed(data: Array<any>) { | reversed(data: Array<any>) { | ||||
return data.reverse(); | return data.reverse(); | ||||
} | } | ||||