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


TypeScript SocialSharing.canShareVia方法代碼示例

本文整理匯總了TypeScript中@ionic-native/social-sharing.SocialSharing.canShareVia方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SocialSharing.canShareVia方法的具體用法?TypeScript SocialSharing.canShareVia怎麽用?TypeScript SocialSharing.canShareVia使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ionic-native/social-sharing.SocialSharing的用法示例。


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

示例1: ionViewWillEnter

 ionViewWillEnter() {
   this.socialSharing
     .canShareVia('com.apple.social.facebook', 'msg', null, null, null)
     .then(() => {
       this.shareFacebookVia = 'com.apple.social.facebook';
       this.facebook = true;
     })
     .catch(() => {
       this.socialSharing
         .canShareVia('com.facebook.katana', 'msg', null, null, null)
         .then(() => {
           this.shareFacebookVia = 'com.facebook.katana';
           this.facebook = true;
         })
         .catch(e => {
           this.logger.error('facebook error: ' + e);
           this.facebook = false;
         });
     });
   this.socialSharing
     .canShareVia('com.apple.social.twitter', 'msg', null, null, null)
     .then(() => {
       this.shareTwitterVia = 'com.apple.social.twitter';
       this.twitter = true;
     })
     .catch(() => {
       this.socialSharing
         .canShareVia('com.twitter.android', 'msg', null, null, null)
         .then(() => {
           this.shareTwitterVia = 'com.twitter.android';
           this.twitter = true;
         })
         .catch(e => {
           this.logger.error('twitter error: ' + e);
           this.twitter = false;
         });
     });
   this.socialSharing
     .canShareVia('whatsapp', 'msg', null, null, null)
     .then(() => {
       this.whatsapp = true;
     })
     .catch(e => {
       this.logger.error('whatsapp error: ' + e);
       this.whatsapp = false;
     });
 }
開發者ID:bitpay,項目名稱:copay,代碼行數:47,代碼來源:share.ts

示例2:

 }).catch((e) => {
   this.socialSharing.canShareVia('com.facebook.katana', 'msg', null, null, null).then(() => {
     this.shareFacebookVia = 'com.facebook.katana';
     this.facebook = true;
   }).catch((e) => {
     this.logger.debug('facebook error: ' + e);
     this.facebook = false;
   });
 });
開發者ID:bitjson,項目名稱:copay,代碼行數:9,代碼來源:feedback-complete.ts

示例3: ionViewWillEnter

  ionViewWillEnter() {
    this.persistenceProvider.getFeedbackInfo().then((info: any) => {
      let feedbackInfo = info;
      feedbackInfo.sent = true;
      this.persistenceProvider.setFeedbackInfo(feedbackInfo);
    });

    if (!this.isCordova) return;

    this.socialSharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null).then(() => {
      this.shareFacebookVia = 'com.apple.social.facebook';
      this.facebook = true;
    }).catch((e) => {
      this.socialSharing.canShareVia('com.facebook.katana', 'msg', null, null, null).then(() => {
        this.shareFacebookVia = 'com.facebook.katana';
        this.facebook = true;
      }).catch((e) => {
        this.logger.debug('facebook error: ' + e);
        this.facebook = false;
      });
    });
    this.socialSharing.canShareVia('com.apple.social.twitter', 'msg', null, null, null).then(() => {
      this.shareTwitterVia = 'com.apple.social.twitter';
      this.twitter = true;
    }).catch((e) => {
      this.socialSharing.canShareVia('com.twitter.android', 'msg', null, null, null).then(() => {
        this.shareTwitterVia = 'com.twitter.android';
        this.twitter = true;
      }).catch((e) => {
        this.logger.debug('twitter error: ' + e);
        this.twitter = false;
      });
    });
    this.socialSharing.canShareVia('whatsapp', 'msg', null, null, null).then(() => {
      this.whatsapp = true;
    }).catch((e) => {
      this.logger.debug('whatsapp error: ' + e);
      this.whatsapp = false;
    });
  }
開發者ID:bitjson,項目名稱:copay,代碼行數:40,代碼來源:feedback-complete.ts


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