How to show progressbar and Cancel file downloading to dropbox server in Drop-In Saver - dropbox-api

I have implemented Dropbox Saver API for uploading file to dropbox server after user logged in. Things are working good but I have some queries listed below.
I need to show progress bar how much file's part has been downloaded to dropbox server. How can I show it ?
I need Cancel functionality i.e if user want to cancel file uploading then how I can achieve it.
How large file size uploading can be done using Saver API ?

Related

How make a file preview for moodle documents in flutter

I am developing a mobile application for my school, which requires connecting to the website API with Moodle, the intention is to show the Moodle files from the same app, is there any way to do it?
So far, I can connect to the API, show the files, but the only solution I have achieved so far is to redirect to the browser so that the student can download the file.
Having the URL of the file, I thought about displaying the file via Google Docs, but in doing so, it tells me that the file cannot be displayed.
The URL I get from each file is type:
[moodle_site]/webservice/pluginfile.php/1504591/mod_resource/content/7/[file_name]?forcedownload=1&token=[token_user]
Any idea how to achieve it?

Best way to retrieve facebook profile images using MVC5 OWIN

I am using OWIN in mvc5 to authenticate users, but I want to show their profile pictures as well. I have searched on strackoverflow and found the following way to get it done.
This is for facebook & Google plus :
https://plus.google.com/s2/photos/profile/[USERID]?sz=100
http://graph.facebook.com/[USERID]/picture?type=square
Is this the best way to retrieve the images? Should we store images onto our server and load locally or we call these links every time someone logs in ? I need a proper approach, e.g. If we store them locally then they won't be updated if user changes their profile picture on facebook but if we load them every time from facebook then it takes some loading time to do a 302 redirect to actual image url.
If you're just trying to display the images on a website, I would just store the link your given from Facebook/Google when someone logs in to your site in a local database and use the URL as the image src on the website. Facebook and Google will be storing these images on fast CDNs, you might as well take advantage.
This will off load the image storage and the need to serve up images from your own site, reducing load and storage requirements.
Then every time a user logs into your site retrieve their profile pic urls again and store them to make sure they are up to date.

Is there a way to upload the contents of a URL to Dropbox using their API?

I'm building a client/server video app. The video lives on the server, typically. If I want to allow app users to copy videos to their Dropbox, is there any way to do that using the Dropbox API on the app other than downloading the content to the app and re-uploading it to Dropbox? Reading their API, it seems like they only have file upload, not upload from a URL. Is there any way?
Is the Saver an option for you? That takes a URL and presents the user with UI to choose a location within Dropbox, after which the file will be saved to that location.
It's as simple as including a <script> tag and then adding class="dropbox-saver" to what would otherwise be a normal download hyperlink.
See https://www.dropbox.com/developers/dropins/saver.

Accessing files through picker for users who have not yet enabled Drive

I am running into a difficulty with the picker api for users who have installed our Chrome Web Store app, but who have not yet enabled drive. For users in this state, it is possible to save new files using the files/insert api, which returns a successful response, but these files do not show up in picker. Once the user enables drive, all the files they have previously saved begin showing up in picker.
Is this behavior intended? If so, what is the best way to determine if a user has drive enabled, so that we can prompt users to enable drive instead of making it look like we're not saving their documents?
Currently, the picker and the API will only work if the user has installed your Drive application ont he Chrome webs Store.
We understand the pain involved for developers and we are looking to relax this restriction.
In the mean time there is a way to check if the user has installed the Drive app, for that you need an OAuth 2.0 access token (so your user will need to have gone through the OAuth flow and authorized you to access his Drive data). Then you can simply try to read a file with a bogus ID (lets say ID "000" or "abcdefghijklmnopqrstuvw"). If the API returns the error "403: The authenticated user has not installed the app with client id {clientId}", that means that he has not installed the app yet and that you should hide Drive functionnalities and probably show him something that say "To take advantage of our latest Google Drive integration/features, we recommend that you install our Drive App link to Chrome Web Store listing".
If the user has your Drive app installed you will get a "404: File not found: {fileId}" error on this request.
First it is odd that the picker is not showing files for your non-drive enabled user.
So I just tested the picker with a non-drive account and everything worked as expected... For instance you can try with the Balsamiq Drive app https://chrome.google.com/webstore/detail/pplbmgaodhjmbklkgkgmlghaekcfhhkk They are using the picker in Mockup > Open...
After installing you have to go to https://balsamiqgdrive.appspot.com
I created a mockup first and saved it. It appeard in Docs. Then I tried the picker in Balsamiq and I could see it.

UIDocumentInteractionController

I have a problem that make me crazy.
From my app, when an OpenIn menu is shown, I'll choose an application to open the file (ex:DocsToGo) and the document is opened for edit.
But after editing, how can I send it back to my app or get the link where that document is saved ? How can I get new content of that file ?
Your app cannot get access to the changed version of the file. The new version resides within the sandbox of the app to which you sent it. The only way you can get the file back into your app is if your app registers as an application that can open that document type. THEN you have to hope that the other application gives the user the option to open the new file in another application.
Another option is to use a third party cloud service for storing the documents. Many apps integration with Dropbox now. If your app and DocsToGo both used Dropbox, then you would be able to both edit the same document and get access to it.
In short: there is no Apple-supported way for your app to send a document to another app and then pull it back after changes have been made.
Your app can't "pull" the changed file, as Mark Suman mentioned in his answer, but if the user pushes it back to you from the other app with a similar "open in..." command, you can implement a workflow where a file is passed from your app to another and back again. When the file is sent back to your app, it triggers the application:handleOpenURL: method in the app delegate (or application:openURL:sourceApplication:annotation: in iOS 4.2+). The URL argument is the URL of the edited file, which your app can then resume working with.
More info here.