Sending files from server via email within app - pdf

I'm a little lost on how to achieve this problem.
We have a list of files brought into a app linking to the files stored on a remote server. Currently when the file is selected in the list, it opens up within safari which is fine. Once the file loads in safari you do have the option for forward from there, but my client wants to be able to it from within the app, rather than opening in safari.
We are using query mobile and phone gap to create the app. I was thinking about just creating a new mail, with a link to the file embedded in to the email.
Any ideas or help is welcome on this.

You may be much better off if you just have the mobile app make an Ajax call to the server to trigger the sending of the email and attachments? That would really reduce the complexity off the mobile app and decouple you from any issues that might occur based on different hardware or OS's.
So when the user is viewing the list of files, maybe offer them two buttons. View and Send. View would open in Safari as intended, Send would make a call to the server to do the heavy work.
http://yourserver.com/sendFilesToRecipient?file_id=XX&email_address=target#email.com
Then the server loads the correct file and sends it out, maybe responding the client app with a success/failure message.
Would that type of design solve the issue?

I have created a link:
Open File<br/>Email File
Which has seemed to do the job, opens up the default email client, with the set values in them.

Related

Anchor.click using executeJs function not working in real iPhone safari browser

I have a question regarding executeJs function.
page.executeJs("$0.click();", downloadAnchor.getElement());
This line of code is not working in real iPhone Safari browser, though it works in mobile responsive mode from desktop safari. Appreciate your help on this
Browsers will be "suspicious" of anything starting a download that isn't a direct reaction to interaction by the user. This is done as a security precaution since starting to download files without the user's explicit consent can be dangerous in specific cases. Different browsers and configurations have different policies for exactly where to draw the line.
In your case, the download isn't started as a direct consequence of user interaction but instead as direct consequence of receiving a message from the server. This kind of pattern will simply not work reliably no matter what you do.
Instead, you need to design the interaction so that the download is directly triggered by the user. The easiest way of doing that is by having the user directly click on the actual download link. If you want to have some indirection, then you still need to make the action work directly in the browser without going through the server.

How to automate sending credentials to a DRM server to open a DRM pdf?

I have a client who wants me to automate certain document processing work.
There is this pdf that can only be opened by sending in username and password to a DRM server.
When I open it using Acrobat, I see this.
I have the username and password, courtesy of the client.
Issue is how do I automate this?
I have done web scraping before, where I automate a web login so that I can execute certain routine tasks.
But this is the first time I am trying to automate an authentication that does not occur inside the browser.
How do I go about doing this?
Companies pay a lot of money to do exactly not this. http://www.adobe.com/devnet/reader/topic_drm.html. I suspect the amount of effort to do this will not be worth it, especially if you are going to try and dive into the actual protocols/plugins used and hook in directly. This would be very implementations specific and likely to break in the future.
Your best bet is to leverage the existing Adobe Application and wrap it in an Automator script. Unfortunately, OSX specific.
They won't have generic workflow hooks, so the quick and nasty way would be to just record yourself doing it once, and play it back time and time again.
Workflow:
Drag PDF onto custom app
Automatically populate username
Automatically populate password
If you are looking for somewhere to start: http://www.macosxautomation.com/automator/features/virtual-user.html
The DRM module itself can set permissions about how you can print and re-distribute the files itself, you won't be able to get around any of that, but assuming you have all the permissions set correctly, you should at least be able to automate opening the file itself on OSX.

Is it possible for a ClickOnce application to interact with a web page

My application, written in VB.Net 4.5 and deployed using ClickOnce, gets information through parameters when it is opened via the link on a website. The application uses that information to modify data collected from hardware connected to a virtual serial port. The data is usually on the order of a 3-15 kilobytes of plain text. The data then needs to return to the page (in a text box), and the page submitted, at which point the application closes.
Previously, the page used a Java applet, but increased Java security has made upkeep very time consuming.
Is it possible for the application to send data back to the same web page, still open in the browser, and submit that page?
If not, what would the simplest way for the application to send its data to the webserver, knowing that it needs user credentials (and a few other pieces of data) to do so?
You can make a post to the webpage from your application. See the WebRequest object

Is there a way to update SMLoginItemBookmarks data on launchd overrides.plist

I'm working on an OS X app that most users choose to "launch at login", the kind you'd find at the menu bar.
In order to launch it at login I'm using SMLoginItemSetEnabled to launch a LoginHelper app that will open the main app, as described in this tutorial.
The app is failing to start up at login for just a handful of our users.
I was unable to reproduce this or to track the cause but I found (on a user's machine) that:
Deleting /Root/_com.apple.SMLoginItemBookmarks/[myapp] and /Root/[myapp] on /var/db/launchd.db/com.apple.launchd.peruser.$UID/overrides.plist and then resetting the Launch at login on the app fixed the issue. Also, we diff'd the files and the Data on the bookmark had changed.
For reference, I found about the overrides.plist here.
Since the app has both a Mac App Store and a Direct download version, I'm suspecting multiple copies of the app setting themselves as Launch at login may be the reason for this to fail, maybe these "bookmarks" are trying to open another instance of the app, that may or may not be deleted.
Now the questions, provided that this app needs to remain sandboxed:
Is there a way of updating that Data on the overrides.plist bookmarks?
Is there any way of deleting one self's app from the overrides.plist to start clean?
Is this maybe a known issue?
Any other suggestions on why the bookmark seems to point nowhere or how to fix it will be appreciated.
Note: This is my first question on StackOverflow, please excuse me if I failed to follow some of the suggested etiquette.
I don't know a definitive solution to this, I wasn't even aware of the overrides.plist. It could be related to multiple copies. As far as I understand, adding login through SMLoginItemSetEnabled sets a metadata flag that this Bundle ID should be launched on start. Then Spotlight, on start, will go do a metadata search on the file system and see which Bundle IDs need to be launched. Then, I guess, it will initiate the launch using the bundle ID. In my own application, Trickster, which uses the same technique for launching, I see that if I enable launch-on-login through the app itself, it might pop-up this strange message which refers to a debug build. I'm not even sure why it says about the first time. Very strange.
So, to have them launched, you have to make sure that the relevant bundles are in locations where Spotlight indexes (that the user hasn't disable Spotlight for these locations). Usually users don't disable Spotlight, especially for /Applications/ but I'm just saying.
What I usually suggest when support comes my way (and how I have it set up for me because I have multiple copies), is I to disable launch from within the app and instead add the correct one (from /Applications) manually in Login Items in System Preferences.

way to alert me the developer of an error in my iPhone app

I have this iPhone that loads a different part of a website based on what button you click. AKA it links to a sport website and the first page contains all the sports the site offers as buttons. I have code to check if the website is valid/up and if it’s not to display an error message. Is there a way in the code to like alert me somehow, like an email maybe, of such an error such as an invalid url? Like for example if the website removes a sport w/o my knowledge and a user goes to open the link and receives that error, can the app send an email to me (not from the users account, but like a background account maybe) that can alert me of such an error. Or maybe somehow have me access then NSLog of an error that i give?
There is something called TestFlight App that I use to log errors like that. You can read up on it here
http://help.testflightapp.com/customer/portal/articles/829571-does-the-sdk-support-production-builds-
Hope it helps!
You could create a Parse integrated app.
Alternatively, if you have access to a web server you could create a simple script that you could POST to in the app to let you know of any problems.
Since the user has connectivity on the internet, try creating a web service and use POST with some meaningful data.
If you don't develop server side as well find a web server that offers such a service.