-
-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot add photo to note #3967
Comments
Typo. |
Well you've obviously gone: Is this now you? I'd start by trying to add a new note now you've changed your name? When you say without images, do you mean they have the link but it points to a 404? This sounds like potentially two bugs, firstly you can't see notes with your edge case username in SC (is this all, or image only ones)? Secondly your edge case username doesn't correctly attach images to notes. Does this also happen if you comment on someone else's note with an image? |
Can you link one of affected notes? |
I changed my user name to Mike_Be. One of the notes from yesterday that I apparently haven't closed yet is this: https://www.openstreetmap.org/note/3136708 (old user name; I tried to take a photo when I created this note) No, there were no links whatsoever. However: on today's walks, the photo in note did work: see If I make a note in SC it never shows up there, and if I comment on another user's note, it disappears from SC for me. So I guess at least one part of the bug could be closed as there's a workaround: don't use the \ character in the user name, at least not as the first character. |
I asked another user if they can see my unresolved notes in the SC app. They can not. Neither could they see the note where I had commented on their existing note (3138263). Not clear if they would have been able to see their own notes before I commented, of if my comment was what hid it. |
What you mean by "tried to take photo"? Have you managed to see photo attached in SC? I suspect that things are going wromg with your photo app or with handover of photo to SC. |
Let's see if I can describe this better: Case 1:
Case 2:
Therefore, it appears to be the case that the initial \ character broke something in the handling of photos. Did I answer your question? |
The OSM username is not used in any part of the taking-a-photo process. So when you rename yourself to \Mike, can you still reproduce this? Generally, if there is an error while taking the photo (cannot write to disk etc.), there should be a toast that shows an error message. An error message is only not shown if either
|
I can't comment on what the camera app does or does not do. All I can report is what effects I see, and that was that I tried perhaps a dozen times to add a photo to a note when I used the user name "\Mike" and zero of them got saved; then I changed user name and succeeded in perhaps 6 out of 6 attempts, so I did indeed draw a, perhaps premature, connection between that user name and the behavior of the app. I have now changed my user name back, and have managed to get the app to attach photos to notes in 3 out of 3 attempts. Time to close the bug as unreproducible? |
Yeah, I guess. My bet is on the camera app, but 🤷 |
I have the same problem with v42.0 (f-droid) on a Sony Xperia XA2. I recently noticed that attaching photos to notes doesn't work anymore, but the behavior is a little bit other than the on described by MikaelBe:
I didn't get a error toast, and the app has the camera permission (checked it), so your explanation seems that the photo app reported that no photo was taken... But it worked in the past and afaik I had not changed anything since then.
|
Did anyones version of Android change? Just checked on v42.0 from FDroid. Mi A1, Lineage OS 18.1/Android 11. It worked like usual. Launched the normal camera activity, confirmed it and the thumbnail was at the bottom as expected. |
Not mine, it is still an Android 9... |
|
@gojhub try downgrading to v40.2, can you attach a photo? Then upgrade to v41.2. Can you attach a photo? |
@westnordost I tried to downgrade, but the installer told me it can't do it for an unknown reason... So I decided to do a reboot and before trying again to downgrade, I tested it again with v42... But: As my mobile nags me after 28 days that I really should do a reboot and I obey my mobile ;-), I had done a reboot not so long ago (maybe two weeks ago). Don't know why this reboot now solves the problem. So, sorry for the noise, can't confirm @MikaelBe problem anymore. |
Hm. Another theory: The app asks for the camera permission before taking a photo. If the user denies it, a rationale is displayed and after acknowledgement by the user, asks again. If the user then denies this again, the app will not ask for permission at all anymore. (This is enforced by the Android system, to the app it just looks as if the user has denied the permission.) Now, for v41, the camera permission was added. Maybe for some Android versions, an upgrade to v41 led to a state where the camera permission was not granted and it was set as "do not ask again". |
Oh nevermind, a message is shown to the user in that case "no camera permission". Actually, in case a photo is not attached, the only code path where no (error) message is displayed is when the photo app simply does not return a photo. |
Interesting, now after three days I couldn't take photos again.
It's the same as described above, no error message, but also no photo for the note.
And now I'm really sure, that no update of Android or the photo app happens.
edit: A few hours later it worked again... And then not, then it worked again and so on.
I tried to find some regularity and something reproducible, e.g. does it matter if other apps are running or not, is the mobile connected to WLAN, do I need a more precise position, but found nothing. It also doesn't matter if the photo app saves to the internal storage or to the micro SD.
I had even the case, that I had opened the note editor and attaching the photo worked, but after canceling this and immediately open a new note for the same position (all in the same session, so no app switching) attaching a photo doesn't work...
For the moment it seems very random to me.
…-------- Ursprüngliche Nachricht --------
Von: gojhub ***@***.***>
Gesendet: 20. April 2022 22:34:36 UTC
An: streetcomplete/StreetComplete ***@***.***>
CC: gojhub ***@***.***>, Your activity ***@***.***>
Betreff: Re: [streetcomplete/StreetComplete] Cannot add photo to note (Issue #3967)
@westnordost I tried to downgrade, but the installer told me it can't do it for an unknown reason...
So I decided to do a reboot and before trying again to downgrade, I tested it again with v42...
I think you can guess it, now it works... The photo app closes and below the input box finally the icon with the photo preview appeared as before.
But: As my mobile nags me after 28 days that I really should do a reboot and I obey my mobile ;-), I had done a reboot not so long ago (maybe two weeks ago). Don't know why this reboot now solves the problem.
So, sorry for the noise, can't confirm @MikaelBe problem anymore.
@MikaelBe: Had you tried to reboot your device? Maybe it works for you too?
--
Reply to this email directly or view it on GitHub:
#3967 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
When it does not work - does it fix it if you remove StreetComplete from recents (i.e. cold re-start) the app? Or the other way round: If you remove the camera app from recents? |
I did some testing, for which I removed all apps from recents. In the afternoon I had a long series of around 25 continuous attempts for which no photo was attached. In the meanwhile I got the notification about running out of space on my internal space, so I had a look at |
Interesting... does the photo file contain the photo at all, or is it empty? |
FWIW I looked at the same place out of curiosity and I had three files in mine, two test ones showing bits of my sofa, and a postbox from in the real world. Mine were all from a long time ago, but shouldn't these failed photos be cleaned up at some point at least? |
Interesting... does the photo file contain the photo at all, or is it empty?
All files contains the photo, e.g. yesterday a lot of photos of my feet on the terrace. But also the photos of the situation which reminds me to report a issue about it.
|
Thank you for this clue. I think I now know what is happening: The process of taking a photo is interrupted if the Right now I can't think of a good solution for this, will think about this some more. |
This can be reproduced reliably when enabling "Don't keep activities" in the developer options. The issue is that the asynchronous "start another activity and return its result" in StreetComplete has been (recently) refactored to work with coroutines so that it can be written like synchronous code. E.g. something like if (!hasCameraPermission && !requestCameraPermission()) return
val photo = takePhoto()
resizePhoto(photo)
// etc... ...instead of the above code scattered all over the place in a state machine because activities are (potentially) volatile. It is too bad that I didn't think of this case before. This method is not only done for taking a photo, but also for measuring a width/height, for requesting location to be enabled and for requesting camera permission (for AR). This refactor made the code and logic much easier to read and much shorter, so I am kind of reluctant to revert this (if I even cleanly put that refactor into one commit). I am considering (finally) using ViewModels (and thus So, I don't know, other ideas or volunteers who'd like to try out initial ViewModel support are welcome. |
I noticed that the ViewModels wouldn't solve this at all, because ViewModels have of course no access to the view. But starting an activity for result is done from fragments / activities, which are part of the view. |
Since the photos exist, SC could just look whether there are some new ones. |
The reason why this does not (always) work is because coroutines may not survive the app being tabbed out and tabbed in again (e.g. going to location settings). So the flow cannot be handled by coroutines on the lifecycle scope of the activity/fragment (see #3967)
How to Reproduce
Create new note at my present location.
Click "add photo to the note".
Take photo.
Accept the photo (check mark).
Click OK to save the note.
Result: note gets saved, but:
To be clear:
Versions affected
Streetcomplete v. 42.0
Android v11, Moto One Hyper, model nr XT2027-1
Username: \Mike
And that's 5 characters, yes, there's a backslash in my username/display name. Could this mess something up? I tried to change my display name on openstreetmap.org to something without that special character, but can still not see my own notes. Haven't tried adding a photo since the display name change.
The text was updated successfully, but these errors were encountered: