本文整理匯總了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;
});
}