Commits (10)
......@@ -63,6 +63,7 @@ import connectivityService from './src/common/services/connectivity.service';
import sqliteStorageProviderService from './src/common/services/sqlite-storage-provider.service';
import commentStorageService from './src/comments/CommentStorageService';
import * as Sentry from '@sentry/react-native';
import boostedContentService from './src/common/services/boosted-content.service';
let deepLinkUrl = '';
......@@ -85,7 +86,7 @@ sessionService.onLogin(async () => {
logService.info('[App] Getting minds settings and onboarding progress');
// load minds settings and onboarding progresss on login
const results = await Promise.all([mindsService.getSettings(), stores.onboarding.getProgress()]);
const results = await Promise.all([mindsService.getSettings(), stores.onboarding.getProgress(), boostedContentService.load()]);
logService.info('[App] updatting features');
// reload fatures on login
......
......@@ -17,7 +17,7 @@ import { isApiError } from './src/common/services/api.service';
// Init Sentry (if not running test)
if (process.env.JEST_WORKER_ID === undefined) {
Sentry.init({
dsn: 'https://d650fc58f2da4dc8ae9d95847bce152d@sentry.io/1538735',
dsn: 'https://16c9b543563140a0936cc3cd3714481d@sentry.io/1766867',
ignoreErrors: [
'Non-Error exception captured with keys: code, domain, localizedDescription', // ignore initial error of sdk
],
......
......@@ -722,6 +722,9 @@ exports[`channel subscribers component should render correctly 1`] = `
"metadataService": null,
"offset": "",
"refreshing": false,
"viewed": Viewed {
"viewed": Map {},
},
},
"loadList": [MockFunction],
"refresh": [MockFunction],
......@@ -1096,6 +1099,9 @@ exports[`channel subscribers component should render correctly 1`] = `
"metadataService": null,
"offset": "",
"refreshing": false,
"viewed": Viewed {
"viewed": Map {},
},
},
"loadList": [MockFunction],
"refresh": [MockFunction],
......@@ -1470,6 +1476,9 @@ exports[`channel subscribers component should render correctly 1`] = `
"metadataService": null,
"offset": "",
"refreshing": false,
"viewed": Viewed {
"viewed": Map {},
},
},
"loadList": [MockFunction],
"refresh": [MockFunction],
......
......@@ -25,7 +25,7 @@ systemProp.org.gradle.internal.http.socketTimeout=180000
versionName=3.11.0
# CUSTOM
versionCode=1050000015
versionCode=1050000016
# PLAY STORE
# versionCode=310033
# versionCode=310034
// @flow
import FeedsService from "./feeds.service";
import sessionService from "./session.service";
import logService from "./log.service";
// types
import type ActivityModel from "../../newsfeed/ActivityModel";
......@@ -16,25 +16,21 @@ class BoostedContentService {
boosts: Array<ActivityModel> = [];
/**
* Constructor
*/
constructor() {
// always reload on login or app restart
sessionService.onLogin(this.load);
}
/**
* Reload boosts list
*/
load = async(): Promise<any> => {
await this.feedsService
.setLimit(12)
.setOffset(0)
.setEndpoint('api/v2/boost/feed')
.fetchRemoteOrLocal();
this.boosts = await this.feedsService.getEntities();
try {
await this.feedsService
.setLimit(12)
.setOffset(0)
.setEndpoint('api/v2/boost/feed')
.fetchRemoteOrLocal();
this.boosts = await this.feedsService.getEntities();
} catch (err) {
logService.exception('[BoostedContentService]', err);
}
}
/**
......
......@@ -3,6 +3,7 @@ import channelService from '../../channel/ChannelService';
import { revokeBoost, rejectBoost, acceptBoost} from '../../boost/BoostService';
import logService from '../services/log.service';
import metadataService from '../services/metadata.service';
import Viewed from './Viewed';
/**
* Common infinite scroll list
......@@ -34,6 +35,11 @@ export default class OffsetListStore {
*/
metadataService = null;
/**
* Viewed store
*/
viewed = new Viewed;
/**
* Constructor
* @param {string} type 'shallow'|'ref'|null
......
......@@ -19,6 +19,7 @@ import CenteredLoading from '../common/components/CenteredLoading';
import commentsStoreProvider from '../comments/CommentsStoreProvider';
import logService from '../common/services/log.service';
import i18n from '../common/services/i18n.service';
import OffsetFeedListStore from '../common/stores/OffsetFeedListStore';
/**
* Activity screen
......@@ -61,10 +62,15 @@ export default class ActivityScreen extends Component {
}
if (params.entity && params.entity._list) {
params.entity._list.viewed.addViewed(
params.entity,
params.entity._list.metadataService
);
// this second condition it's for legacy boost feed
if (params.entity._list instanceof OffsetFeedListStore) {
params.entity._list.addViewed(params.entity);
} else {
params.entity._list.viewed.addViewed(
params.entity,
params.entity._list.metadataService
);
}
}
}
......