Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
feat: retry the friends initialization (#282)
Browse files Browse the repository at this point in the history
* Create NotifyAboutFriendsNotInitialized function

* Create RETRY_FRIENDS_INITIALIZATION action

* Update sagas.ts

* Revert "Update sagas.ts"

This reverts commit 146fb55.

* Update sagas.ts

* Remove TODO comment

* Remove RETRY flow

* Add a retry system for the friends initialization

* Fix lint

* Fix lint

* Improve the retry flow

* Fix lint

* Fix 'apply' call

* Solve conflicts from last merge

* Fix lint

* Solve conflicts from last merge

* enable reconnection and prevent multiplication of callbacks

* Remove uneeded imports

* fix friends logic

* fix friends logic

Co-authored-by: menduz <[email protected]>
  • Loading branch information
sandrade-dcl and menduz authored May 12, 2022
1 parent 7f2950d commit 21d029f
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 262 deletions.
2 changes: 1 addition & 1 deletion packages/entryPoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async function loadWebsiteSystems(options: KernelOptions['kernelOptions']) {
enableQuestPanel: isFeatureEnabled(store.getState(), FeatureFlags.QUESTS, false)
}
)
i.ConfigureHUDElement(HUDElementID.WORLD_CHAT_WINDOW, { active: true, visible: true })
i.ConfigureHUDElement(HUDElementID.WORLD_CHAT_WINDOW, { active: true, visible: false })
i.ConfigureHUDElement(HUDElementID.CONTROLS_HUD, { active: true, visible: false })
i.ConfigureHUDElement(HUDElementID.HELP_AND_SUPPORT_HUD, { active: true, visible: false })
}
Expand Down
5 changes: 5 additions & 0 deletions packages/shared/friends/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import { action } from 'typesafe-actions'
import { FriendshipAction } from 'shared/types'

import { FriendsState } from './types'
import { SocialAPI } from 'dcl-social-client'

export const UPDATE_FRIENDSHIP = 'Update friendship'
export const updateFriendship = (_action: FriendshipAction, userId: string, incoming: boolean) =>
action(UPDATE_FRIENDSHIP, { action: _action, userId }, { incoming })
export type UpdateFriendship = ReturnType<typeof updateFriendship>

export const SET_MATRIX_CLIENT = '[CHAT] Set Matrix client'
export const setMatrixClient = (socialApi: SocialAPI) => action(SET_MATRIX_CLIENT, { socialApi })
export type SetMatrixClient = ReturnType<typeof setMatrixClient>

export const UPDATE_PRIVATE_MESSAGING = 'Update private messaging state'
export const updatePrivateMessagingState = (state: FriendsState) => action(UPDATE_PRIVATE_MESSAGING, state)
export type UpdatePrivateMessagingState = ReturnType<typeof updatePrivateMessagingState>
Expand Down
13 changes: 12 additions & 1 deletion packages/shared/friends/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { AnyAction } from 'redux'

import { FriendsState, SocialData } from './types'
import { UPDATE_PRIVATE_MESSAGING, UpdatePrivateMessagingState, UPDATE_USER_DATA, UpdateUserData } from './actions'
import {
UPDATE_PRIVATE_MESSAGING,
UpdatePrivateMessagingState,
UPDATE_USER_DATA,
UpdateUserData,
SET_MATRIX_CLIENT,
SetMatrixClient
} from './actions'

const FRIENDS_INITIAL_STATE: FriendsState = {
client: null,
Expand All @@ -24,6 +31,10 @@ export function friendsReducer(state?: State, action?: AnyAction): State {
case UPDATE_PRIVATE_MESSAGING: {
return reducePrivateMessaging(state, action as UpdatePrivateMessagingState)
}
case SET_MATRIX_CLIENT: {
const { socialApi } = (action as SetMatrixClient).payload
return { ...state, client: socialApi }
}
case UPDATE_USER_DATA: {
return reduceUpdateUserData(state, action as UpdateUserData)
}
Expand Down
Loading

0 comments on commit 21d029f

Please sign in to comment.