You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, right now the interface is thought to share files. Maybe we extend this in the future, but at this moment we have a lot of things with higher priority.
Checking the 'type' field in the received Intent. If Twitter is polite, it should be filling it with a "text/something" value. A match with "text/*" in Uploader.java could be interpreted as a try to create a new text file.
But if Twitter, or any other app sending text, is not polite enough... well, trying to parse whatever content is passed from any possible application is not a good idea, IMHO.
Couldn't the mimetype of a file be in there too? Since ownCloud would have to prompt a filename for text-only streams, it would be unfortunate if it did that for every textfile.
Seems that a file should be putting the data in Intent.EXTRA_STREAM, while a chunk of text should put them in Intent.EXTRA_TEXT. The second one is not being checked now in Uploader.java.
I currently have the problem that there don't exist local paths for the files i am creating. Should i actually create local files? If so, what's the preferred way to do so?
Sorry, I do not understand what you mean with the question about the "data:text/plain,...".
About the other, you have come to the key point for this functionality, IMHO. Right now there is no functionality in the code to create new files on the fly.
UploadFileOperation now try to copy any file to upload in FileStorageUtils.getTemporalPath() before start to uploading it. Consider modify the UploadFileOperation to work with a piece of text (or still better, any piece of data in memory) instead of a file as source for that temporal copy; and later, what changes are necessary to let the piece of data arrives from Uploader.java to the UploadFileOperation, going through FileUploader.
I already think that your current model is sufficient for doing the functionality needed. Using java.io.File to actually create the file and then telling the file uploader through an intent the location doesn't really seem like a bad API.
Coming from a Python background, I have to say it quite baffles me that OCFile doesn' t inherit from java.io.File, but is another model to represent the same thing. Why is that so?
I thought in making it inherit a couple of times, but it would affect a loooot of code, so the risk of breaking things is high, while the benefits at this moment would be cosmetic.
IMHO, it should be as easy as possible for 90% of all usage scenarios. That is, the settings should allow to set a default path and a file name structure. E.g. \notes\income\ $date-$time-$sending-app-name.
The workflow would go straight to ask the user to save the text by the default settings (single click) and prompt for a file name and path otherwise.
I agree with @tobiasKaminsky I also wouldn't like to see this realized using a setting, an expected behavior like Tobias described with "currently for upload files" seems to be a consistent way imho
Honestly this seems like a very specific usecase. Doing this properly would be to implement the ability to view & edit text files: #88 – then you can paste stuff and edit it afterwards too.
@jancborchardt@davivel
It seems that now some more people would like to have this feature.
So, in order to have someone that can implement this, we should discuss the proper way?
In a first step I would just do this like files:
An user shares text with owncloud app, selects the folder and then a dialog appears where the filename is entered with automatically extension ".txt" and save.
Regarding linked #88: it seems that (at least) viewing text files is working.
Activity
untitaker commentedon Mar 6, 2013
The current message for this is "no content recieved". I digged a bit in the sourcecode and found that https://github.com/owncloud/android/blob/master/src/com/owncloud/android/Uploader.java#L352 populates the ArrayList with
nullor something else that causes this method to returnfalse.Using getStringExtra gets me the full text of the tweet though.
davivel commentedon Mar 6, 2013
Well, right now the interface is thought to share files. Maybe we extend this in the future, but at this moment we have a lot of things with higher priority.
untitaker commentedon Mar 6, 2013
What would be a sensible way to detect whether the user is sharing text or something else? I am considering working on this.
davivel commentedon Mar 6, 2013
Checking the 'type' field in the received Intent. If Twitter is polite, it should be filling it with a "text/something" value. A match with "text/*" in Uploader.java could be interpreted as a try to create a new text file.
But if Twitter, or any other app sending text, is not polite enough... well, trying to parse whatever content is passed from any possible application is not a good idea, IMHO.
untitaker commentedon Mar 7, 2013
Couldn't the mimetype of a file be in there too? Since ownCloud would have to prompt a filename for text-only streams, it would be unfortunate if it did that for every textfile.
davivel commentedon Mar 7, 2013
Mmmm, yes. I talked too fast.
Seems that a file should be putting the data in Intent.EXTRA_STREAM, while a chunk of text should put them in Intent.EXTRA_TEXT. The second one is not being checked now in Uploader.java.
More help from here: http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND
untitaker commentedon Mar 7, 2013
Is it sensible to build a data-URI out of the text to store in
mStreamsToUpload? Like this:untitaker commentedon Mar 7, 2013
I currently have the problem that there don't exist local paths for the files i am creating. Should i actually create local files? If so, what's the preferred way to do so?
davivel commentedon Mar 7, 2013
Sorry, I do not understand what you mean with the question about the "data:text/plain,...".
About the other, you have come to the key point for this functionality, IMHO. Right now there is no functionality in the code to create new files on the fly.
UploadFileOperation now try to copy any file to upload in FileStorageUtils.getTemporalPath() before start to uploading it. Consider modify the UploadFileOperation to work with a piece of text (or still better, any piece of data in memory) instead of a file as source for that temporal copy; and later, what changes are necessary to let the piece of data arrives from Uploader.java to the UploadFileOperation, going through FileUploader.
untitaker commentedon Mar 7, 2013
I already think that your current model is sufficient for doing the functionality needed. Using
java.io.Fileto actually create the file and then telling the file uploader through an intent the location doesn't really seem like a bad API.Coming from a Python background, I have to say it quite baffles me that OCFile doesn' t inherit from
java.io.File, but is another model to represent the same thing. Why is that so?davivel commentedon Mar 7, 2013
Well, that was there when a I joined the project.
I thought in making it inherit a couple of times, but it would affect a loooot of code, so the risk of breaking things is high, while the benefits at this moment would be cosmetic.
untitaker commentedon Mar 7, 2013
Meh, the effort isn't worth it for me, especially as somebody who hardly knows Java. I stopped working on this for now.
davivel commentedon Mar 7, 2013
OK. Anyway, the Uploader.java itself needs a deep review for its current functions, there are some ugly crashes with the upload of images.
A brave step going from Python to Java. I know some people recommending the opposite way to me :)
untitaker commentedon Mar 7, 2013
I didn't and won't stop writing Python. 😯
11 remaining items
tobiasKaminsky commentedon Aug 16, 2015
So the workflow would be:
torwag commentedon Aug 16, 2015
IMHO, it should be as easy as possible for 90% of all usage scenarios. That is, the settings should allow to set a default path and a file name structure. E.g. \notes\income\ $date-$time-$sending-app-name.
The workflow would go straight to ask the user to save the text by the default settings (single click) and prompt for a file name and path otherwise.
tobiasKaminsky commentedon Aug 16, 2015
I do not like the idea of a setting, here.
Maybe just remember the last storage path of txt files (just like it is currently for upload files)
@jancborchardt your opinion here, please!
tobiasKaminsky commentedon Aug 16, 2015
ref: #1098 (comment)
purigarcia commentedon Aug 21, 2015
@tobiasKaminsky , @AndyScherzinger , @LukeOwncloud and whoever feels like, contributions are wellcome here :)
AndyScherzinger commentedon Aug 21, 2015
I agree with @tobiasKaminsky I also wouldn't like to see this realized using a setting, an expected behavior like Tobias described with "currently for upload files" seems to be a consistent way imho
tobiasKaminsky commentedon Aug 21, 2015
@jancborchardt
@davivel
We need your opinion here first :)
jancborchardt commentedon Aug 24, 2015
Honestly this seems like a very specific usecase. Doing this properly would be to implement the ability to view & edit text files: #88 – then you can paste stuff and edit it afterwards too.
tobiasKaminsky commentedon Apr 16, 2016
@jancborchardt @davivel
It seems that now some more people would like to have this feature.
So, in order to have someone that can implement this, we should discuss the proper way?
In a first step I would just do this like files:
An user shares text with owncloud app, selects the folder and then a dialog appears where the filename is entered with automatically extension ".txt" and save.
Regarding linked #88: it seems that (at least) viewing text files is working.
jancborchardt commentedon Apr 17, 2016
Ok, functionality-wise that seems good. :)
davivel commentedon Apr 18, 2016
@tobiasKaminsky , 👍 👍 👍 👍 👍 👍 👍
tobiasKaminsky commentedon May 1, 2016
#1647
davivel commentedon Apr 4, 2017
This was resolved with #1926 and will be available in the next release 2.4.0
Thanks, @cinnamonsalt