hippware / rn-chat

MIT License
5 stars 0 forks source link

Sharing nearby not working properly #4905

Open mstidham opened 4 years ago

mstidham commented 4 years ago

Users that are nearby each other do not dynamically show sharing on the header or map (Pink ring around avatar is missing). However if the users move the action emoti appears on the header.

image

mstidham commented 4 years ago

User will briefly see the avatar appear after android device does a kill/reload. Once the user taps on the map to go to the HS the avatar disappears from the map and becomes grey on the header.

image

bengtan commented 4 years ago

Let's fix this:

Users that are nearby each other do not dynamically show sharing on the header or map (Pink ring around avatar is missing).

and then re-evaluate this:

However if the users move the action emoti appears on the header.

aksonov commented 4 years ago

I was not able to reproduce such situation with iOS simulator, but found atleast one nearby issue. After one user A became nearby, another B sees him correctly, but A doesn't see B.

cc @southerneer

@toland As I understand the issue above happens because A doesn't receive 'nearby' start location (for B), but B - receives it normally (for A)

mstidham commented 4 years ago

Note: If user A leaves (2km) and returns to the nearby User B and User B has the app open. User B will see User A properly sharing but once User B does a kill/reload they no longer appear sharing location nearby. I was able to easily reproduce this. If users have the app closed when they become nearby, one user will receive the push notification but when they deep link it does not show they are sharing.

Steps to see user sharing:

  1. 2 users sharing live location "Nearby"
  2. 1 user leaves device at current location with app open and no screen lock on the device.
  3. 1 user drives for 2 km and then returns.
  4. Verify on device that is open and stationary that user is visible on header and map, then do a kill/reload on that device. User is now no longer sharing live location.

Steps to see user with motion emoti after deep link but not sharing:

  1. 2 user sharing live location "Nearby"
  2. Have the app in a killed state on device that remains at location
  3. Take other device (app in killed state) at least 2 km away from other device.
  4. Return to location
  5. 1 user will have received a push notification that other user is nearby
  6. Tap on push notification and the app will open with motion emoti but no other visible sign they are sharing.
southerneer commented 4 years ago

I think the issue has to do with this line: https://github.com/hippware/rn-chat/blob/master/src/model/Profile.ts#L127

sharesLocation will only be true if shareType == ALWAYS but of course it should be true if shareType == NEARBY and the user is within the nearby radius. @toland is adding a new "active" field to the Friend GraphQL type that we can use to correct the problem.

bernardd commented 4 years ago

@toland is adding a new "active" field to the Friend GraphQL type that we can use to correct the problem.

Not yet he's not :) I'm going to talk to Pavel tonight (my time) and establish what exactly (if anything) is actually needed from the server because at this point it's not clear that the client doesn't have what it needs.

aksonov commented 4 years ago

Okey, we talked with Bernard and agreed that 'share nearby' start event is not good mechanism to use, so I changed the app to use location property - so a user is 'active' while the server sends location for him. So it works better now, but I found two issues:

  1. when user A left nearby but B went to background before, A still be 'active' for B (the server still sends location even if A is not in B's range)

  2. 'nearby end' event is not sent for A when A is moving outside (it is sent only to B) - it is very similar to 'nearby start' event issue I've posted before

cc @toland @southerneer

toland commented 4 years ago

@aksonov I've just merged some changes to the server that should address the two issues you mentioned. Those changes will be going to staging shortly.

mstidham commented 4 years ago

Codepush Staging- Pavel "4905 - sharing nearby" @aksonov I just tested the codepush and going to report my findings knowing that you are aware of them also.

Issue 1: User A has the app open and leaves the nearby User B radius (works perfectly User B fades on header and disappears from map). User A then returns within radius and nothing happens (user does not dynamically show up on header or map). User does a kill/reload and then they appear.

Issue 2: User A has the app in a killed state and leaves nearby radius of User B. User A opens the app outside of the radius and User B still displays sharing live location even though they are outside of the radius.

I'm also unable to get any push notifications to generate for nearby, when entering the radius.

mstidham commented 4 years ago

This is now working good for me after the server deploy.