feat: implemented relay controller and use that for fetching and publishing events #149

Merged
s merged 10 commits from relay-controller into staging 2024-08-20 12:13:23 +00:00
4 changed files with 3 additions and 26 deletions
Showing only changes of commit 12765cf758 - Show all commits

View File

@ -16,7 +16,6 @@ export const SET_RELAY_MAP = 'SET_RELAY_MAP'
export const SET_RELAY_INFO = 'SET_RELAY_INFO' export const SET_RELAY_INFO = 'SET_RELAY_INFO'
export const SET_RELAY_MAP_UPDATED = 'SET_RELAY_MAP_UPDATED' export const SET_RELAY_MAP_UPDATED = 'SET_RELAY_MAP_UPDATED'
export const SET_MOST_POPULAR_RELAYS = 'SET_MOST_POPULAR_RELAYS' export const SET_MOST_POPULAR_RELAYS = 'SET_MOST_POPULAR_RELAYS'
export const SET_RELAY_CONNECTION_STATUS = 'SET_RELAY_CONNECTION_STATUS'
export const UPDATE_USER_APP_DATA = 'UPDATE_USER_APP_DATA' export const UPDATE_USER_APP_DATA = 'UPDATE_USER_APP_DATA'
export const UPDATE_PROCESSED_GIFT_WRAPS = 'UPDATE_PROCESSED_GIFT_WRAPS' export const UPDATE_PROCESSED_GIFT_WRAPS = 'UPDATE_PROCESSED_GIFT_WRAPS'

View File

@ -3,10 +3,9 @@ import {
SetRelayMapAction, SetRelayMapAction,
SetMostPopularRelaysAction, SetMostPopularRelaysAction,
SetRelayInfoAction, SetRelayInfoAction,
SetRelayConnectionStatusAction,
SetRelayMapUpdatedAction SetRelayMapUpdatedAction
} from './types' } from './types'
import { RelayMap, RelayInfoObject, RelayConnectionStatus } from '../../types' import { RelayMap, RelayInfoObject } from '../../types'
export const setRelayMapAction = (payload: RelayMap): SetRelayMapAction => ({ export const setRelayMapAction = (payload: RelayMap): SetRelayMapAction => ({
type: ActionTypes.SET_RELAY_MAP, type: ActionTypes.SET_RELAY_MAP,
@ -27,13 +26,6 @@ export const setMostPopularRelaysAction = (
payload payload
}) })
export const setRelayConnectionStatusAction = (
payload: RelayConnectionStatus
): SetRelayConnectionStatusAction => ({
type: ActionTypes.SET_RELAY_CONNECTION_STATUS,
payload
})
export const setRelayMapUpdatedAction = (): SetRelayMapUpdatedAction => ({ export const setRelayMapUpdatedAction = (): SetRelayMapUpdatedAction => ({
type: ActionTypes.SET_RELAY_MAP_UPDATED type: ActionTypes.SET_RELAY_MAP_UPDATED
}) })

View File

@ -5,8 +5,7 @@ const initialState: RelaysState = {
map: undefined, map: undefined,
mapUpdated: undefined, mapUpdated: undefined,
mostPopular: undefined, mostPopular: undefined,
info: undefined, info: undefined
connectionStatus: undefined
} }
const reducer = ( const reducer = (
@ -26,12 +25,6 @@ const reducer = (
info: { ...state.info, ...action.payload } info: { ...state.info, ...action.payload }
} }
case ActionTypes.SET_RELAY_CONNECTION_STATUS:
return {
...state,
connectionStatus: action.payload
}
case ActionTypes.SET_MOST_POPULAR_RELAYS: case ActionTypes.SET_MOST_POPULAR_RELAYS:
return { ...state, mostPopular: action.payload } return { ...state, mostPopular: action.payload }

View File

@ -1,13 +1,12 @@
import * as ActionTypes from '../actionTypes' import * as ActionTypes from '../actionTypes'
import { RestoreState } from '../actions' import { RestoreState } from '../actions'
import { RelayMap, RelayInfoObject, RelayConnectionStatus } from '../../types' import { RelayMap, RelayInfoObject } from '../../types'
export type RelaysState = { export type RelaysState = {
map?: RelayMap map?: RelayMap
mapUpdated?: number mapUpdated?: number
mostPopular?: string[] mostPopular?: string[]
info?: RelayInfoObject info?: RelayInfoObject
connectionStatus?: RelayConnectionStatus
} }
export interface SetRelayMapAction { export interface SetRelayMapAction {
@ -25,11 +24,6 @@ export interface SetRelayInfoAction {
payload: RelayInfoObject payload: RelayInfoObject
} }
export interface SetRelayConnectionStatusAction {
type: typeof ActionTypes.SET_RELAY_CONNECTION_STATUS
payload: RelayConnectionStatus
}
export interface SetRelayMapUpdatedAction { export interface SetRelayMapUpdatedAction {
type: typeof ActionTypes.SET_RELAY_MAP_UPDATED type: typeof ActionTypes.SET_RELAY_MAP_UPDATED
} }
@ -39,5 +33,4 @@ export type RelaysDispatchTypes =
| SetRelayInfoAction | SetRelayInfoAction
| SetRelayMapUpdatedAction | SetRelayMapUpdatedAction
| SetMostPopularRelaysAction | SetMostPopularRelaysAction
| SetRelayConnectionStatusAction
| RestoreState | RestoreState