• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ionic-native.Facebook类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ionic-native.Facebook的典型用法代码示例。如果您正苦于以下问题:TypeScript Facebook类的具体用法?TypeScript Facebook怎么用?TypeScript Facebook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Facebook类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: if

 Facebook.getLoginStatus().then((result) => {
   //this.test = JSON.stringify(result);
   if (result.status == 'unknown') {
     //this.test = 'status : ' + result.status;
     Facebook.login(["public_profile", "email"]).then((result) => {
       //this.test = 'result : ' + JSON.stringify(result);
       this.getFacebokInfo(result.authResponse.userID);
     }, function (error) {
       this.test = 'error : ' + error;
     })
   }
   else if (result.status == 'connected') {
     this.global.storage.get('member').then((member) => {
       let json = JSON.parse(member);
       if (member.type == 'facebook') {
         this.getFacebokInfo(member.id);
       }
       else {
         this.getFacebokInfo(result.authResponse.userID);
       }
     });
     //this.test = 'status : ' + result.status;
     //this.getFacebokInfo(result.authResponse.userID);
   }
   //alert(JSON.stringify(result));
 }, function (error) {
开发者ID:RemaxThailand,项目名称:RemaxMobile,代码行数:26,代码来源:login.ts


示例2:

 .then((res:any) => {
   if (res.status === 'connected') {
     return Facebook.logout();
   } else {
     return Promise.resolve();
   }
 })
开发者ID:hack4change,项目名称:hambasafe-client,代码行数:7,代码来源:auth.actions.ts


示例3: Date

 .then((res) => {
   console.log('login Status');
   console.log(res);
   if(res.status !== 'connected') {
     return Facebook.login(['public_profile', 'email']).then((res)=>{
       console.log('post Login');
       console.log(res);
       var expDate = new Date(new Date().getTime() + res.authResponse.expiresIn * 1000 ).toISOString();
       var authData = {
         id: res.authResponse.userID,
         access_token: res.authResponse.accessToken,
         expiration_date: expDate
       }
       return Promise.resolve(authData);
     })
   } else {
     var expDate = new Date(new Date().getTime() + res.authResponse.expiresIn * 1000 ).toISOString();
     var authData = {
       id: res.authResponse.userID,
       access_token: res.authResponse.accessToken,
       expiration_date: expDate
     }
     return Promise.resolve(authData);
   }
 })
开发者ID:hack4change,项目名称:hambasafe-client,代码行数:25,代码来源:auth.actions.ts


示例4: Promise

 return new Promise(function(resolve, reject) {
     if (typeof cordova === "undefined") {
         if( navigator.userAgent.match('CriOS') ){
             alert("don't work chrome for iOS.you should use safari.");
         } else {
             console.log("start login");
             FB.login(
                 function(response) {
                     console.log("login is resolve");
                     resolve(response);
                 },
                 {scope:'public_profile,user_friends,email'});
         }
     } else {
         // using native
         ngFacebook.login(['email','public_profile','user_friends']).then(
             (response) => {
                 resolve(response);
             },
             (failed) => {
                 reject(failed);
             }
         );
     }
 });
开发者ID:rdlabo,项目名称:FacebookLogin-Ionic2-browser,代码行数:25,代码来源:facebook.ts


示例5: getDeviceFacebookProfile

  getDeviceFacebookProfile() : any { 
    var respJson : any = {
      'isRegistered' : false,
    }
    return Facebook.getLoginStatus().then((response)=> {
      console.log('Status');
      console.log(JSON.stringify(response));
      if (response.status !== 'connected') {
        this.setAnonymous()
      } else {
        _.merge(respJson, _.pick(response.authResponse, ['accessToken' , 'userID']));
        respJson.fbId = respJson.userID;
        respJson.userID = undefined;
        //TODO: Remove
        console.log(response);
      }
      return Promise.resolve();
    }).then((res)=> {
      return Facebook.api('/me?fields=first_name,last_name,birthday,gender,email,picture', [])
    })
    .then((apiResponse: any) => {
      console.log(apiResponse);
      _.merge(respJson,  _.pick(apiResponse, [
        'first_name',
        'last_name',
        'birthday',
        'gender',
        'email',
      ]));
      respJson.picture = apiResponse.picture.data.url;
      respJson.isSilhouette = apiResponse.picture.data.is_silhouette;
      return Promise.resolve(respJson);
    });

  }
开发者ID:hack4change,项目名称:hambasafe-client,代码行数:35,代码来源:auth.actions.ts


示例6: loginWithFacebook

    loginWithFacebook() {

        return Facebook.login(['email', 'public_profile', 'user_friends']).then(response => {
            console.log('Response: ' + JSON.stringify(response));

            let creds = firebase.auth.FacebookAuthProvider
                .credential(response.authResponse.accessToken)

            let scope = new firebase.auth.FacebookAuthProvider()

            console.log('Credentials: ' + JSON.stringify(creds));

            let providerConfig = {
                provider: AuthProviders.Facebook,
                method: AuthMethods.OAuthToken,
                remember: 'default',
                scope: ['public_profile', 'email', 'user_friends']
            }

            this.af.auth.login(creds, providerConfig)
                .then((authData) => {
                    /* Check if user exists, if not add user to database */
                    this.addUser(authData);
                    console.log("Firebase Success: " + JSON.stringify(authData));

                });

        }).catch(error => {
            console.warn('Facebook Error: ' + JSON.stringify(error));
            throw error;

        });

    }
开发者ID:maxamillion32,项目名称:Fittist,代码行数:34,代码来源:AuthService.ts


示例7: login

 static login(successCallback, errorCallback) {
     Facebook.login(['user_friends']).then(response => {
         successCallback(response.authResponse);
     }, error => {
         errorCallback(error.errorMessage);
     })
 }
开发者ID:in-dex,项目名称:ionic2-foodApp,代码行数:7,代码来源:facebook-login.ts


示例8: authDevice

 authDevice() : Promise<any> {
   // Set loading state.
   console.log('dispatching auth Device');
   return Facebook.getLoginStatus()
   .then((res) => {
     console.log('login Status');
     console.log(res);
     if(res.status !== 'connected') {
       return Facebook.login(['public_profile', 'email']).then((res)=>{
         console.log('post Login');
         console.log(res);
         var expDate = new Date(new Date().getTime() + res.authResponse.expiresIn * 1000 ).toISOString();
         var authData = {
           id: res.authResponse.userID,
           access_token: res.authResponse.accessToken,
           expiration_date: expDate
         }
         return Promise.resolve(authData);
       })
     } else {
       var expDate = new Date(new Date().getTime() + res.authResponse.expiresIn * 1000 ).toISOString();
       var authData = {
         id: res.authResponse.userID,
         access_token: res.authResponse.accessToken,
         expiration_date: expDate
       }
       return Promise.resolve(authData);
     }
   })
   .then((res) => {
     console.log('call parse Login');
     console.log(res);
     return this.parseManager.deviceLogin(res);
   })
 }
开发者ID:hack4change,项目名称:hambasafe-client,代码行数:35,代码来源:auth.actions.ts


示例9: facebookLogin

 facebookLogin(successCallback,errorCallback){
   Facebook.login(['user_friends']).then(response => {
     console.log(response);
     successCallback(response.authResponse);
   }, error => {
     errorCallback(error);
   });
 }
开发者ID:guihendias,项目名称:iniciacao-cientifica,代码行数:8,代码来源:UtilServices.ts


示例10:

      .then(() => {
        Facebook.login(['email'])
          .then((result: FacebookLoginResponse) => {

            console.log("Facebook success: " + JSON.stringify(result));
            //   });
          })
          .catch((err) => { console.log('err accured', err) })
      })
开发者ID:Muhammad-MuZzammil,项目名称:Ionic2-Projects,代码行数:9,代码来源:home.ts



注:本文中的ionic-native.Facebook类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ionic-native.Flashlight类代码示例发布时间:2022-05-25
下一篇:
TypeScript ionic-native.EmailComposer类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap