當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript facebook.Facebook類代碼示例

本文整理匯總了TypeScript中@ionic-native/facebook.Facebook的典型用法代碼示例。如果您正苦於以下問題:TypeScript Facebook類的具體用法?TypeScript Facebook怎麽用?TypeScript Facebook使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Facebook類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: signOut

  signOut() : firebase.Promise<any> {
    if (this.angularFireAuth.auth.currentUser.providerData.length) {
      for (var i = 0; i < this.angularFireAuth.auth.currentUser.providerData.length; i++) {
        var provider = this.angularFireAuth.auth.currentUser.providerData[i];

        if (provider.providerId == firebase.auth.GoogleAuthProvider.PROVIDER_ID) { // Se for o gooogle
          // o disconnect limpa o oAuth token e tambem esquece qual conta foi selecionada para o login
          return this.googlePlus.disconnect()
            .then(() => {
              return this.signOutFirebase();
            });
        } else if (provider.providerId == firebase.auth.FacebookAuthProvider.PROVIDER_ID) { // Se for facebook
          return this.facebook.logout()
            .then(() => {
              return this.signOutFirebase();
            })
        } else if (provider.providerId == firebase.auth.TwitterAuthProvider.PROVIDER_ID) { // Se for twitter
          return this.twitter.logout()
            .then(() => {
              return this.signOutFirebase();
            })
        }
      }
    }

    return this.signOutFirebase();
  }
開發者ID:joaorobertoifrn,項目名稱:ionicfirebaseauth,代碼行數:27,代碼來源:auth-service.ts

示例2: Promise

    return new Promise((resolve, reject) => {
      if (this.plt.is('cordova')) {
        this.facebook.login(["email"])
          .then(loginResponse => {
            let credential = firebase.auth.FacebookAuthProvider.credential(loginResponse.authResponse.accessToken)
            this.afAuth.auth.signInAndRetrieveDataWithCredential(credential)
              .then(info => {
                resolve(info)
                this.loginJobs();
              })
              .catch(err => {
                reject(err)
                alert(err)
              })
          })
          .catch(err => {
            reject(err)
            alert(err)
          })

      } else {
        this.afAuth.auth
          .signInWithPopup(new firebase.auth.FacebookAuthProvider())
          .then(info => {
            resolve(info)
            this.loginJobs();
          })
          .catch(err => {
            reject(err)
            alert(err)
          })
      }
    })
開發者ID:Microsmsm,項目名稱:Dawaey,代碼行數:33,代碼來源:auth.ts

示例3: Promise

 return new Promise((resolve, reject) => {
   if (this.platform.is('cordova')) {
     this.facebook.login(['email', 'public_profile', 'user_friends'])
     .then((facebookData: FacebookLoginResponse) => {
       const loading = this.loadingCtrl.create({
         content: 'Por favor, aguarde...'
       });
       loading.present();
       const credential = firebase.auth.FacebookAuthProvider
         .credential(facebookData.authResponse.accessToken);
       firebase.auth().signInWithCredential(credential).then((firebaseData) => {
         setTimeout(() => {
           this.functions.post('users', {
             facebook: facebookData.authResponse.userID
           }).subscribe((response) => {
             loading.dismiss();
             resolve();
           }, (error) => {
             loading.dismiss();
             reject(error);
           });
         }, 800);
       });
     }, (error) => {
       resolve(error);
     });
   }
 });
開發者ID:squadsea,項目名稱:ionic3-angularfire-login,代碼行數:28,代碼來源:auth.ts

示例4: signInWithFacebook

 signInWithFacebook() {
   return this.facebook.login(['public_profile', 'email'])
     .then((res: FacebookLoginResponse) => {
       //https://developers.facebook.com/docs/graph-api/reference/user
       //Ao logar com o facebook o profile do usuario ĂŠ automaticamente atualizado.
       return this.angularFireAuth.auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken));
     });
 }
開發者ID:joaorobertoifrn,項目名稱:ionicfirebaseauth,代碼行數:8,代碼來源:auth-service.ts

示例5: logout

 logout(){
     this.fb.logout().then((res) => 
     console.log('Logged into Facebook!', res)).catch(e => 
     console.log('Error logging into Facebook', e));
     this.googleplus.logout().then((res) => 
     console.log('logged out of google',res)).catch(err => console.error(err));
     localStorage.clear();
     this.navCtrl.setRoot(LoginPage);
  }
開發者ID:Tanisha9000,項目名稱:shaddivendor,代碼行數:9,代碼來源:logout.ts

示例6: nativeFacebookLogin

  async nativeFacebookLogin(): Promise<void> {
    try {
      const response = await this.facebook.login(["email", "public_profile"]);
      const facebookCredential = firebase.auth.FacebookAuthProvider.credential(
        response.authResponse.accessToken
      );

      const firebaseUser = await firebase
        .auth()
        .signInWithCredential(facebookCredential);

      return await this.updateUserData(firebaseUser);
    } catch (err) {
      console.log(err);
    }
  }
開發者ID:ctimbi,項目名稱:test,代碼行數:16,代碼來源:auth.ts

示例7: login

  login(): void {
      this.loading.present();
      this.Facebook.login(['public_profile']).then((response) => {
          this.getProfile();
      },
      (err) => {
          console.log(err);
          let alert = this.alertCtrl.create({
            title: 'Oops!',
            subTitle: 'Something went wrong, please try again later.',
            buttons: ['Ok']
          });

          this.loading.dismiss();
          alert.present();
      });
  }
開發者ID:aldokhayel,項目名稱:camperchat,代碼行數:17,代碼來源:login.ts

示例8:

 return Observable.create((observer) => {
   if (this.platform.is('cordova')) {
     this.facebook.login(['email', 'public_profile', 'user_friends'])
     .then((facebookData: FacebookLoginResponse) => {
       const credential = firebase.auth.FacebookAuthProvider
         .credential(facebookData.authResponse.accessToken);
       firebase.auth().currentUser.linkWithCredential(credential).then((user) => {
         this.data.update(`users/${user.uid}`, {
           facebook: facebookData.authResponse.userID
         }).then(() => {
           observer.next();
         }, (error) => {
           observer.error(error);
         });
       });
     });
   }
 });
開發者ID:squadsea,項目名稱:ionic3-angularfire-login,代碼行數:18,代碼來源:auth.ts

示例9: login

 login(): void {
   this.facebook.login(['public_profile']).then((response) => {
     this.getProfile();
   }, (err) => {
     this.getProfile();
   });
 }
開發者ID:baptistesa,項目名稱:camper,代碼行數:7,代碼來源:login.ts

示例10: resolve

 this.http.post(this.storageProvider.serverAddress+"/logout",JSON.stringify({version:this.storageProvider.version}),{headers: headers}).map(res=>res.json()).subscribe((res)=>{
     this.fb.logout().then((result)=>{
          resolve(res); 
     },(err)=>{
           resolve(res);
     });
 },(err)=>{
開發者ID:raceyi,項目名稱:takit,代碼行數:7,代碼來源:fb-provider.ts


注:本文中的@ionic-native/facebook.Facebook類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。