exports.activity = function(args) { args = parseArgs(args); // iOS Activity native if (OS_IOS && dkNappSocial != null) { dkNappSocial[ Util.isIPad() ? 'activityPopover' : 'activityView' ]({ text: args.text, title: args.title, image: args.image, removeIcons: args.removeIcons, view: args.view, url: args.url }, args.customIcons || []); return true; } // Android intents if (OS_ANDROID) { var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_SEND }); if (args.fullText) intent.putExtra(Ti.Android.EXTRA_TEXT, args.fullText); if (args.title) intent.putExtra(Ti.Android.EXTRA_TITLE, args.title); if (args.image) intent.putExtraUri(Ti.Android.EXTRA_STREAM, args.image); Ti.Android.currentActivity.startActivity(Ti.Android.createIntentChooser(intent, L('Share'))); return true; } };
exports.activity = function(args) { args = parseArgs(args); if (OS_IOS) { /* iOS Activity native */ if (dkNappSocial == null) { return Ti.API.error('Sharer: module `dk.napp.social` is required for `activity` method'); } dkNappSocial[ Util.isIPad() ? 'activityPopover' : 'activityView' ]({ text: args.text, title: args.title, image: args.image, removeIcons: args.removeIcons, view: args.view, url: args.url }, args.customIcons || []); } else if (OS_ANDROID) { /* Android intents */ /* FACEBOOK-BUG EXTRA_TEXT https://developers.facebook.com/bugs/332619626816423 */ var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_SEND }); if (args.fullText) intent.putExtra(Ti.Android.EXTRA_TEXT, args.fullText); if (args.title) intent.putExtra(Ti.Android.EXTRA_TITLE, args.title); if (args.image) intent.putExtraUri(Ti.Android.EXTRA_STREAM, args.image); Ti.Android.currentActivity.startActivity(Ti.Android.createIntentChooser(intent, L('Share'))); } };