|
|
@@ -7,6 +7,7 @@ import { HttpClient } from '@angular/common/http'; |
|
|
|
import { FacebookLoginPlugin } from '@capacitor-community/facebook-login'; |
|
|
|
import { FacebookLogin } from '@capacitor-community/facebook-login'; |
|
|
|
registerWebPlugin(FacebookLogin); |
|
|
|
const { App } = Plugins; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'app-facebook-login', |
|
|
@@ -26,9 +27,10 @@ export class FacebookLoginComponent implements OnInit { |
|
|
|
constructor( |
|
|
|
private platform: Platform, |
|
|
|
private http: HttpClient |
|
|
|
) { } |
|
|
|
) { |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
ngAfterViewInit() { |
|
|
|
if (localStorage.getItem('FBUser') && localStorage.getItem('FBToken')) { |
|
|
|
this.user = JSON.parse(localStorage.getItem('FBUser')); |
|
|
|
this.token = localStorage.getItem('FBToken'); |
|
|
@@ -37,6 +39,10 @@ export class FacebookLoginComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
async setupFbLogin() { |
|
|
|
if (this.platform.is('android') || this.platform.is('capacitor')) { |
|
|
|
// Use the native implementation inside a real app! |
|
|
@@ -95,6 +101,7 @@ export class FacebookLoginComponent implements OnInit { |
|
|
|
this.token = null; |
|
|
|
localStorage.removeItem('FBUser'); |
|
|
|
localStorage.removeItem('FBToken'); |
|
|
|
App.exitApp(); |
|
|
|
} |
|
|
|
|
|
|
|
} |