Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

Added support for including attachments in tickets #138

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

mronkko
Copy link
Contributor

@mronkko mronkko commented Jun 13, 2013

No description provided.

@austintaylor
Copy link
Contributor

I'm hesitant to add a dependency on MobileCoreServices just for this. Seems strange for UV to be messing with the file system in general. Why not just have clients pass in the name, content type, and base64 data?

Actually what would be even simpler would be to have a callback on that lets you modify the NSMutableDictionary before we make the request.

@mronkko
Copy link
Contributor Author

mronkko commented Jun 29, 2013

The reasons why I did not implement it in either of the two alternative ways you explain is ease of use of the SDK.

When using this functionality, the developer starts with a path to a file. Then he needs to determine the content type and do the encoding. Because this is a step that needs to be done always, it makes sense to encapsulate it inside the SDK.

I do not like the idea of the callback that much. The key advantage of the SDK is that the developer does not need to know the UserVoice REST API at all. Using a callback would eliminate this advantage, as the developer would need to learn the API to use it.

But I also understand that including the MobileCoreServices is totally unnecessary for the developers that do not use this feature. I will give this some more thought to see if I come up with a better solution. (And if not, I can just use my own fork in my projects.)

@mronkko
Copy link
Contributor Author

mronkko commented Jun 29, 2013

How about adding a compiler flag that needs to be set for this feature to be enabled? This way it would be available for those that want to include MobileCoreServices, but would not be included by default.

@austintaylor
Copy link
Contributor

I agree that in general users of the SDK shouldn't have to know the UserVoice API. But it seems like this is a pretty unusual use case, which would justify someone looking at API docs, etc. I mean if I had several people asking for this then it would make sense to include it. It just seems like a significant amount of code to add if you are the only person who is going to use it. (I have a number of people complaining about the size of the library.)

@nvh
Copy link
Contributor

nvh commented Jul 2, 2013

Just for the record, I would like this functionality as well.
Maybe we can create some kind of extension of the SDK? Or split the SDK up in a lightweight component and an extended version. This would help the people complaining about the size as well. Do you have any data on what are the most used parts of the SDK? Is there any logical split of basic an advanced functionality?

@mronkko
Copy link
Contributor Author

mronkko commented Jul 2, 2013

Wouldn't the use of a compiler flag to prevent including this code eliminate the issue of added size? Or is it more of a question of the size of the source code than that of the compiled files?

@austintaylor
Copy link
Contributor

A compiler flag wouldn't work very nicely with our static lib distribution scheme.

I'm thinking about moving to a cocoapods / source distribution model such that it would be easier for people to select the components they need. Once I figure that out I'll revisit this. I think I want to leave it as a fork for now.

@mronkko
Copy link
Contributor Author

mronkko commented Jul 23, 2013

@mronkko
Copy link
Contributor Author

mronkko commented Jul 30, 2013

This pull request also addresses the following issue #152

@fzuppa-zz
Copy link

Is there any way to use this repository? (I need this functionality) - I cloned it and tried to build it, but got stucked with a compiler error:

/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVTicket.m:135:23: error: implicit declaration of function 'UTTypeCreatePreferredIdentifierForTag'
is invalid in C99 [-Werror,-Wimplicit-function-declaration]
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)[file pathExtension], NULL);
^
/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVTicket.m:135:61: error: use of undeclared identifier 'kUTTagClassFilenameExtension'
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)[file pathExtension], NULL);
^
/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVTicket.m:136:28: error: implicit declaration of function 'UTTypeCopyPreferredTagWithClass' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass (UTI, kUTTagClassMIMEType);
^
/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVTicket.m:136:66: error: use of undeclared identifier 'kUTTagClassMIMEType'
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass (UTI, kUTTagClassMIMEType);
^
4 errors generated.

@mronkko
Copy link
Contributor Author

mronkko commented Nov 26, 2013

You need to include the MobileCoreServices framework. (It is mentioned in the comments above)

@fzuppa-zz
Copy link

That worked, thanks! I get another error. In line 28 of UVBaseTicketViewController.m, there's @implementation UVBaseTicketViewController. That seems to force to implement a couple of methods that are missing

  • tableView:numberOfRowsInSection
  • tableView:cellForRowAtIndexPath

This could be related to the XCode version I'm using?
Below are the error messages:

/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVBaseTicketViewController.m:28:17: error: method 'tableView:numberOfRowsInSection:' in protocol not
implemented [-Werror,-Wprotocol]
@implementation UVBaseTicketViewController

/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVBaseTicketViewController.h:16:12: note: required for direct or indirect protocol
'UITableViewDataSource'
@interface UVBaseTicketViewController : UVBaseInstantAnswersViewController<UITextViewDelegate, UITableViewDataSource, UITableViewDelegate, UITextFieldDele...
^
/Users/Fede/RubyProjects/Payango/uservoice-iphone-sdk/Classes/UVBaseTicketViewController.m:28:17: error: method 'tableView:cellForRowAtIndexPath:' in protocol not
implemented [-Werror,-Wprotocol]
@implementation UVBaseTicketViewController

@nighthawk
Copy link
Contributor

This is a feature that would be very useful for us as well. Is there any change this will get merged into V3 of the user voice module any time soon? Otherwise, I might try to create a lightweight version of this.

@nighthawk nighthawk mentioned this pull request May 19, 2014
@mgod
Copy link

mgod commented Dec 3, 2014

I'd also like this feature. Letting users add attachments is something we get complaints about in our app from time to time.

@viraf
Copy link

viraf commented Sep 29, 2015

You could use this to pre-add attachment to a contact us message.

UVConfig *config = [UVConfig configWithSite:@"yoursite.uservoice.com"];

[config addAttachmentNamed:@"DiagnosticLog.txt" contentType:@"text/plain" base64EncodedData:[self.diagnosticLog base64EncodedString]];

[UserVoice presentUserVoiceContactUsFormForParentViewController:self andConfig:config];

Issues with doing this : It does not visually indicate the user of the attached log to the message

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants