|
|
@ -7,6 +7,10 @@ import {
|
|
|
|
expandHomeTimeline,
|
|
|
|
expandHomeTimeline,
|
|
|
|
connectTimeline,
|
|
|
|
connectTimeline,
|
|
|
|
disconnectTimeline,
|
|
|
|
disconnectTimeline,
|
|
|
|
|
|
|
|
fillHomeTimelineGaps,
|
|
|
|
|
|
|
|
fillPublicTimelineGaps,
|
|
|
|
|
|
|
|
fillCommunityTimelineGaps,
|
|
|
|
|
|
|
|
fillListTimelineGaps,
|
|
|
|
} from './timelines';
|
|
|
|
} from './timelines';
|
|
|
|
import { updateNotifications, expandNotifications } from './notifications';
|
|
|
|
import { updateNotifications, expandNotifications } from './notifications';
|
|
|
|
import { updateConversations } from './conversations';
|
|
|
|
import { updateConversations } from './conversations';
|
|
|
@ -35,6 +39,7 @@ const randomUpTo = max =>
|
|
|
|
* @param {Object.<string, string>} params
|
|
|
|
* @param {Object.<string, string>} params
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {function(Function, Function): void} [options.fallback]
|
|
|
|
* @param {function(Function, Function): void} [options.fallback]
|
|
|
|
|
|
|
|
* @param {function(): void} [options.fillGaps]
|
|
|
|
* @param {function(object): boolean} [options.accept]
|
|
|
|
* @param {function(object): boolean} [options.accept]
|
|
|
|
* @return {function(): void}
|
|
|
|
* @return {function(): void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -61,6 +66,10 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
|
|
|
|
clearTimeout(pollingId);
|
|
|
|
clearTimeout(pollingId);
|
|
|
|
pollingId = null;
|
|
|
|
pollingId = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (options.fillGaps) {
|
|
|
|
|
|
|
|
dispatch(options.fillGaps());
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onDisconnect() {
|
|
|
|
onDisconnect() {
|
|
|
@ -119,7 +128,7 @@ const refreshHomeTimelineAndNotification = (dispatch, done) => {
|
|
|
|
* @return {function(): void}
|
|
|
|
* @return {function(): void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const connectUserStream = () =>
|
|
|
|
export const connectUserStream = () =>
|
|
|
|
connectTimelineStream('home', 'user', {}, { fallback: refreshHomeTimelineAndNotification });
|
|
|
|
connectTimelineStream('home', 'user', {}, { fallback: refreshHomeTimelineAndNotification, fillGaps: fillHomeTimelineGaps });
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {Object} options
|
|
|
@ -127,7 +136,7 @@ export const connectUserStream = () =>
|
|
|
|
* @return {function(): void}
|
|
|
|
* @return {function(): void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
|
|
|
export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
|
|
|
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`);
|
|
|
|
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {Object} options
|
|
|
@ -136,7 +145,7 @@ export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
|
|
|
* @return {function(): void}
|
|
|
|
* @return {function(): void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) =>
|
|
|
|
export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) =>
|
|
|
|
connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`);
|
|
|
|
connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => fillPublicTimelineGaps({ onlyMedia, onlyRemote }) });
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {string} columnId
|
|
|
|
* @param {string} columnId
|
|
|
@ -159,4 +168,4 @@ export const connectDirectStream = () =>
|
|
|
|
* @return {function(): void}
|
|
|
|
* @return {function(): void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const connectListStream = listId =>
|
|
|
|
export const connectListStream = listId =>
|
|
|
|
connectTimelineStream(`list:${listId}`, 'list', { list: listId });
|
|
|
|
connectTimelineStream(`list:${listId}`, 'list', { list: listId }, { fillGaps: () => fillListTimelineGaps(listId) });
|
|
|
|