Skip to content

Commit

Permalink
🔀 Merge today list removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed May 18, 2020
2 parents 87f3cbe + ac7c1a9 commit c95d4a1
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 239 deletions.
3 changes: 3 additions & 0 deletions app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { translate } from "./i18n"
import * as React from "react"
import { Alert, AppRegistry, Linking, YellowBox } from "react-native"
import { enableScreens } from "react-native-screens"
import { mapping, light as lightTheme } from '@eva-design/eva'
import { ApplicationProvider, IconRegistry } from 'react-native-ui-kitten'
import RNExitApp from 'react-native-exit-app'
Expand All @@ -21,6 +22,8 @@ import { LoadingScreen } from "./components/loading-screen"
import { SaveToBookmarkScreen } from "./screens/save-to-bookmark-screen"
import { StorybookUIRoot } from "../storybook"

enableScreens()

/**
* Ignore some yellowbox warnings. Some of these are for deprecated functions
* that we haven't gotten around to replacing yet.
Expand Down
1 change: 0 additions & 1 deletion app/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
},
"readerScreen": {
"emptyLabel": "No content",
"featuredLabel": "Today",
"followingLabel": "Your following list"
},
"receiveScreen": {
Expand Down
1 change: 0 additions & 1 deletion app/i18n/zh-Hant-HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
},
"readerScreen": {
"emptyLabel": "沒有內容",
"featuredLabel": "今日",
"followingLabel": "你的追蹤列表"
},
"receiveScreen": {
Expand Down
35 changes: 0 additions & 35 deletions app/models/reader-store/reader-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export const ReaderStoreModel = types
.props({
contents: types.map(types.late(() => ContentModel)),
creators: types.map(types.late(() => CreatorModel)),
featuredList: ContentList,
featuredListLastFetchedDate: types.optional(types.Date, () => new Date(0)),
followedList: ContentList,
bookmarkList: ContentList,
followingCreators: types.array(types.safeReference(CreatorModel)),
Expand All @@ -38,8 +36,6 @@ export const ReaderStoreModel = types
.volatile(() => ({
isFetchingCreatorList: false,
hasFetchedCreatorList: false,
isFetchingFeaturedList: false,
hasFetchedFeaturedList: false,
isFetchingFollowedList: false,
hasFetchedFollowedList: false,
followedListLastFetchedDate: new Date(),
Expand All @@ -50,20 +46,8 @@ export const ReaderStoreModel = types
hasFetchedBookmarkList: false,
}))
.extend(withEnvironment)
.views(self => ({
getHasSeenFeaturedListToday() {
const past = self.featuredListLastFetchedDate
const now = new Date()
return past.getFullYear() === now.getFullYear() &&
past.getMonth() === now.getMonth() &&
past.getDate() === now.getDate()
},
}))
.actions(self => ({
clearAllLists: () => {
self.featuredList.replace([])
self.hasFetchedFeaturedList = false
self.featuredListLastFetchedDate = new Date(0)
self.followedList.replace([])
self.hasFetchedFollowedList = false
self.hasReachedEndOfFollowedList = false
Expand Down Expand Up @@ -152,25 +136,6 @@ export const ReaderStoreModel = types
self.hasFetchedCreatorList = true
}
}),
fetchFeaturedList: flow(function * () {
self.isFetchingFeaturedList = true
try {
const result: ContentListResult = yield self.env.likerLandAPI.fetchReaderFeatured()
switch (result.kind) {
case "ok":
self.featuredList.replace([])
result.data.forEach((data) => {
self.featuredList.push(self.parseContentResult(data))
})
}
} catch (error) {
logError(error.message)
} finally {
self.isFetchingFeaturedList = false
self.hasFetchedFeaturedList = true
self.featuredListLastFetchedDate = new Date()
}
}),
fetchFollowingList: flow(function * () {
self.isFetchingFollowedList = true
try {
Expand Down
4 changes: 0 additions & 4 deletions app/models/root-store/setup-root-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ export async function setupRootStore() {
readerStore: {
contents,
creators,
featuredListLastFetchedDate,
featuredList, // Never cache
followedList, // Never cache
bookmarkList,
},
Expand All @@ -108,7 +106,6 @@ export async function setupRootStore() {
}) => {
const toBePersistedContentURLs = new Set([].concat(
bookmarkList,
featuredList,
followedList.slice(0, 20)
))
const [toBePersistedContents, restContents] = partition(
Expand All @@ -134,7 +131,6 @@ export async function setupRootStore() {
readerStore: {
contents: snContents,
creators: snCreators,
featuredListLastFetchedDate,
bookmarkList,
},
statisticsRewardedStore:
Expand Down
4 changes: 2 additions & 2 deletions app/navigation/app-navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
createBottomTabNavigator,
} from "react-navigation"

import { ReaderNavigator } from "./reader-navigator"
import { SettingsNavigator } from "./settings-navigator"
import { TransferNavigator } from "./transfer-navigator"
import { StakingDelegationNavigator } from "./staking-delegation-navigator"
Expand All @@ -17,13 +16,14 @@ import { BookmarkScreen } from "../screens/bookmark-screen"
import { ContentViewScreen } from "../screens/content-view-screen"
import { CrispSupportScreen } from "../screens/crisp-support-screen"
import { QrcodeScannerScreen } from "../screens/qrcode-scanner-screen"
import { ReaderScreen } from "../screens/reader-screen"
import { ReceiveScreen } from "../screens/receive-screen"
import { StakingRewardsWithdrawScreen } from "../screens/staking-rewards-withdraw-screen"

import { color } from "../theme"

const MainTabs = createBottomTabNavigator({
Reader: ReaderNavigator,
Reader: ReaderScreen,
Bookmark: BookmarkScreen,
Settings: SettingsNavigator,
}, {
Expand Down
99 changes: 0 additions & 99 deletions app/navigation/reader-navigator.tsx

This file was deleted.

17 changes: 17 additions & 0 deletions app/screens/reader-screen/reader-screen.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
StyleSheet,
ViewStyle,
} from "react-native"

import { color } from "../../theme"

export const ReaderScreenStyle = StyleSheet.create({
List: {
backgroundColor: color.palette.white,
} as ViewStyle,
Root: {
flex: 1,
alignItems: "stretch",
backgroundColor: color.primary,
} as ViewStyle,
})
Loading

0 comments on commit c95d4a1

Please sign in to comment.