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


TypeScript google-plus.GooglePlus類代碼示例

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


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

示例3: signInWithGoogle

 signInWithGoogle() {
   return this.googlePlus.login({
     'webClientId': '638933829742-i0av628updkc723cb3gnirhh3b0829up.apps.googleusercontent.com',
     'offline': true
   })
     .then(res => {
       return this.angularFireAuth.auth.signInWithCredential(firebase.auth.GoogleAuthProvider.credential(res.idToken))
         .then((user: firebase.User) => {
           // atualizando o profile do usuario
           return user.updateProfile({ displayName: res.displayName, photoURL: res.imageUrl });
         });
     });
 }
開發者ID:joaorobertoifrn,項目名稱:ionicfirebaseauth,代碼行數:13,代碼來源:auth-service.ts

示例4: Promise

 return new Promise((resolve, reject) => {
   if (this.plt.is('cordova')) {
     this.google
       .trySilentLogin({})
       .then(result => {
         let token = result.credential["accessToken"];
         resolve(result)
         this.loginJobs()
       })
       .catch(function (error) {
         reject(error)
         alert(error.message)
       });
   } else {
     reject('not cordova')
   }
 })
開發者ID:Microsmsm,項目名稱:Dawaey,代碼行數:17,代碼來源:auth.ts

示例5: resolve

 return new Promise<FirebaseUserModel>((resolve, reject) => {
   if (this.platform.is('cordova')) {
     this.googlePlus.login({
       'scopes': '', // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
       'webClientId': environment.googleWebClientId, // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
       'offline': true
     }).then((response) => {
       const googleCredential = firebase.auth.GoogleAuthProvider.credential(response.idToken);
       firebase.auth().signInWithCredential(googleCredential)
       .then((user) => {
         resolve();
       });
     },(err) => {
       reject(err);
     });
   }
   else{
     this.afAuth.auth
     .signInWithPopup(new firebase.auth.GoogleAuthProvider())
     .then((user) => {
        resolve()
     })
   }
 })
開發者ID:mksalin,項目名稱:test_repository,代碼行數:24,代碼來源:auth.service.ts


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