How to convert a class of Objective C to javascript

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

Hi Guys,

I am trying to implement UIActivityItemProvider to our app. Can you please help me to convert the class to javascript. Basically I want to check the "activityType" to determine what content to be displayed in the external app.

This is the objective C code that I want to try and I found it in stackoverflow.

@interface MyActivityItemProvider : UIActivityItemProvider

@end

@implementation MyActivityItemProvider

  • (id)item

{

// Return nil, if you don’t want this provider to apply

// to a particular activity type (say, if you provide

// print data as a separate item for UIActivityViewController).

if ([self.activityType isEqualToString:UIActivityTypePrint])

return nil;

// The data you passed while initialising your provider

// is in placeholderItem now.

if ([self.activityType isEqualToString:UIActivityTypeMail] ||

[self.activityType isEqualToString:UIActivityTypeCopyToPasteboard])

{

return self.placeholderItem;

}

// Return something else for other activities. Obviously,

// you can as well reuse the data in placeholderItem here.

return @“Something else”;

}

@end

MyActivityItemProvider *activityItem =

[[MyActivityItemProvider alloc] initWithPlaceholderItem:@“Your data”];

NSArray *sharingItems = [NSArray arrayWithObjects:

activityItem, _myUITextView.viewPrintFormatter, nil];

UIActivityViewController *activityController =

[[UIActivityViewController alloc]

initWithActivityItems:sharingItems applicationActivities:nil];

Found it at https://stackoverflow.com/questions/13551042/different-data-for-sharing-providers-in-uiactivityviewcontroller

Thanks

Please make use of code blocks and other formatting tools to make both your questions and answers more readable. There's a "Code Snippet" button in the tool bar.

**Image removed for security reasons**