Skip to content
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

for #4905 #4912

Merged
merged 3 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/wocky/friendshare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Friend Share', () => {
// const differentLocation = {longitude: 1.1, latitude: 1.1, accuracy: 1}

beforeAll(async () => {
jest.setTimeout(30000)
jest.setTimeout(50000)
bob = await createUser()
alice = await createUser()
})
Expand Down Expand Up @@ -65,7 +65,6 @@ describe('Friend Share', () => {
friend = alice.profile!.friends.get(bob.profile!.id)
expect(friend!.shareType).toEqual(FriendShareTypeEnum.ALWAYS)
expect(friend!.ownShareType).toEqual(FriendShareTypeEnum.ALWAYS)
expect(friend!.sharesLocation).toBeTruthy()

// check sharing
await alice.setLocation(theLocation)
Expand Down Expand Up @@ -113,6 +112,7 @@ describe('Friend Share', () => {
// change location
await bob.setLocation(differentLocation)
await waitFor(() => !friend!.sharesLocation, 'end sharing location')
await waitFor(() => !bob.profile!.sharesLocation, 'end sharing location')
})

afterAll(async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/model/EventList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {PaginableLoadType} from '../store/Transport'
import {waitFor} from '../utils/utils'
import {EventLocationShare, EventLocationShareType} from './EventLocationShare'
import {EventLocationShareEnd} from './EventLocationShareEnd'
import {EventLocationShareNearbyStart} from './EventLocationShareNearbyStart'
import {EventLocationShareNearbyEnd} from './EventLocationShareNearbyEnd'
import {EventUserBeFriend, EventUserBeFriendType} from './EventUserBefriend'

Expand All @@ -34,7 +33,6 @@ export const EventEntity = types.union(
EventFriendInvite,
EventBotInvite,
EventLocationShare,
EventLocationShareNearbyStart,
EventLocationShareNearbyEnd,
EventLocationShareEnd,
EventUserBeFriend
Expand Down
33 changes: 0 additions & 33 deletions src/model/EventLocationShareNearbyStart.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/model/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const Profile = types
const res = {...snapshot}
delete res.status
delete res.statusUpdatedAt
delete res.sharesLocation
// delete res.location - need to preserve location because now it is passed only via subscriptions
delete res.subscribedBots
return res
Expand Down Expand Up @@ -98,6 +99,7 @@ export const Profile = types
},
setLocation(location: ILocationSnapshot) {
self._location = Location.create(location)
self.sharesLocation = true
self.maybeUpdateActivity()
},
setFriend: (friend: boolean) => {
Expand All @@ -124,7 +126,6 @@ export const Profile = types
}
if (ownShareType) {
self.ownShareType = ownShareType
self.sharesLocation = ownShareType === FriendShareTypeEnum.ALWAYS
}
superLoad(data)

Expand Down
8 changes: 0 additions & 8 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {ILocationSnapshot} from '../model/Location'
import {IMessageIn} from '../model/Message'
import {IEventLocationShareEndData} from '../model/EventLocationShareEnd'
import {IEventLocationShareData} from '../model/EventLocationShare'
import {IEventLocationShareNearbyStartData} from '../model/EventLocationShareNearbyStart'
import {IEventLocationShareNearbyEndData} from '../model/EventLocationShareNearbyEnd'
import {IEventUserBeFriendData} from '../model/EventUserBefriend'

Expand Down Expand Up @@ -487,13 +486,6 @@ export function convertNotification(edge: any): IEventData | {deletedId: string}
id,
}
return locationShareNotification
case 'LocationShareNearbyStartNotification':
const locationShareNearbyStartNotification: IEventLocationShareNearbyStartData = {
time,
sharedNearbyWith: convertProfile({...data.user, _accessedAt: time}),
id,
}
return locationShareNearbyStartNotification
case 'LocationShareNearbyEndNotification':
const locationShareNearbyEndNotification: IEventLocationShareNearbyEndData = {
time,
Expand Down