本文整理汇总了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;
});
}
示例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;
});
});
示例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;
});
}