named-data-mobile / ndn-photo-app

NDN Photo and File Sharing Application (npChat)
https://redmine.named-data.net/projects/npchat/issues
Other
27 stars 24 forks source link

[Feat] Add location co-ordinates to pictures. #162

Closed dev-ritik closed 5 years ago

dev-ritik commented 5 years ago

Description (required)

Fixes 4751

Add a location checkbox to send the location data with the picture. To implement this feature,

Also, bugs, probably generated over the last few commits, relating to sending files are fixed.

jrandallclark commented 5 years ago

I've discovered a few issues. Some of these might have been introduced in your last PR and we missed them:

  1. You can highlight "Friends" in the recipients list and hit send. This causes the app to crash.

  2. There's an issue somewhere with the trading of certificates. When making friends, one device gets their friend's certificate and public key, but the other device somehow gets the wrong certificate. I'm not sure exactly where the problem lies. Here's phone B trying unable to decrypt the symmetric key that was signed by B's public key. 07-18 14:40:17.580 7260-7354/memphis.myapplication W/System.err: net.named_data.jndn.security.tpm.TpmBackEnd$Error: Error in TpmPrivateKey.decrypt: net.named_data.jndn.security.tpm.TpmPrivateKey$Error: Error decrypting with private key: data hash wrong 07-18 14:40:17.580 7260-7354/memphis.myapplication W/System.err: at net.named_data.jndn.security.tpm.TpmKeyHandleMemory.doDecrypt(TpmKeyHandleMemory.java:65) 07-18 14:40:17.580 7260-7354/memphis.myapplication W/System.err: at net.named_data.jndn.security.tpm.TpmKeyHandle.decrypt(TpmKeyHandle.java:56) 07-18 14:40:17.580 7260-7354/memphis.myapplication W/System.err: at memphis.myapplication.psync.ConsumerManager$2.onData(ConsumerManager.java:96)

And here's phone A unable to verify segments signed by B's public key. 07-18 14:54:57.179 20401-21229/memphis.myapplication D/Log: 177 : FetchingTask : getUserInfo: username&PubKey: user: mb 07-18 14:54:57.180 20401-21229/memphis.myapplication D/Log: 109 : FetchingTask : fetch: KeyType: RSA 07-18 14:54:57.180 20401-21229/memphis.myapplication D/Log: 110 : FetchingTask : fetch: interest: /com/test/npChat/mb/file/storage/emulated/0/Android/data/memphis.myapplication/files/photos/2019.07.18.14.54.47.jpg 07-18 14:54:57.283 20401-21229/memphis.myapplication D/Log: 119 : FetchingTask : verifySegment: verifying segment 07-18 14:54:57.285 20401-21229/memphis.myapplication D/Log: 205 : FetchingTask : verifySignature: We've made it to verify(signature) 07-18 14:54:57.299 20401-20401/memphis.myapplication D/Log: 219 : FetchingTask : onPostExecute: Calling onPostExecute 07-18 14:54:57.299 20401-20401/memphis.myapplication D/Log: 221 : FetchingTask : onPostExecute: onPostExecute: not received 07-18 14:54:57.299 20401-20401/memphis.myapplication D/Log: 269 : FetchingTask : onPostExecute: onError: Segment verification failed

In this case, it seems that phone B has phone A's correct certificate. But phone A doesn't have B's.

  1. GPS doesn't work for me at all. I don't receive any notification that location isn't turned on or asking for permissions. Manually adding location permissions in the settings didn't change anything, either. Also, log statements don't explain anything and need to be improved or removed. 07-18 14:50:18.437 19508-19508/memphis.myapplication I/Log: 315 : SelectRecipientsFragmen : work: true : false 07-18 14:50:18.437 19508-19508/memphis.myapplication I/Log: 340 : SelectRecipientsFragmen : work: here 07-18 14:50:18.445 19508-19508/memphis.myapplication D/Log: 347 : SelectRecipientsFragmen : work: GPS Enabled: null 07-18 14:50:22.039 19508-19508/memphis.myapplication I/Log: 315 : SelectRecipientsFragmen : work: true : false 07-18 14:50:22.040 19508-19508/memphis.myapplication I/Log: 340 : SelectRecipientsFragmen : work: here 07-18 14:50:22.047 19508-19508/memphis.myapplication D/Log: 347 : SelectRecipientsFragmen : work: GPS Enabled: null
dev-ritik commented 5 years ago

Fixed 1 & 3. Hopefully, fetching location must work now.

jrandallclark commented 5 years ago

I get the alert asking for location permission, but then the GUI changes to "Updating..." and nothing happens. When I try to send the photo, the logs show that location that is added is 0.0 : 0.0.

Did you get different results on your device?

jrandallclark commented 5 years ago

Ok, I get the coordinates on my personal phone. So it must be a device issue. My test devices are developer edition Motox's, so maybe that's the problem.

jrandallclark commented 5 years ago

Instead of displaying the coordinates to the user (which would be meaningless for most people), can we use the Geocoder class (https://developer.android.com/reference/android/location/Geocoder.html) to display the city and country name instead?

jrandallclark commented 5 years ago

The latest SegmentFetcher from jNDN is placed with little modification and segment verification is bypassed.

I didn't see this before. Why was segment verification bypassed?

dev-ritik commented 5 years ago

Ok, I will try to add Geocoder class. I have removed the 'bypassing' before pushing the fix (I did it because I was getting the same error as you mentioned above, but I left it, for the time being, considering it not to be related with the main objective of the PR).

jrandallclark commented 5 years ago

Ok. The validation issue is odd. User's get their friend's certificates by scanning their QR code. So I'm not sure where the problem is there.

dev-ritik commented 5 years ago

@jrandallclark PTAL.

jrandallclark commented 5 years ago

Everything looks good. Great job!