Skip to content

Commit 7f8e4b9

Browse files
author
tingyuan
committed
-
1 parent dfad6b6 commit 7f8e4b9

17 files changed

Lines changed: 4696 additions & 8441 deletions

File tree

app.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
"icon": "./assets/images/icon.png",
88
"scheme": "myapp",
99
"userInterfaceStyle": "automatic",
10-
"splash": {
11-
"image": "./assets/images/splash.png",
12-
"resizeMode": "contain",
13-
"backgroundColor": "#e4fcbd"
14-
},
10+
"newArchEnabled": true,
1511
"ios": {
1612
"supportsTablet": true
1713
},
@@ -29,6 +25,15 @@
2925
},
3026
"plugins": [
3127
"expo-router",
28+
[
29+
"expo-splash-screen",
30+
{
31+
"resizeMode": "contain",
32+
"backgroundColor": "#e4fcbd",
33+
"image": "./assets/images/splash-icon.png",
34+
"imageWidth": 200
35+
}
36+
],
3237
[
3338
"expo-build-properties",
3439
{

app/(drawer)/toutiao.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ export default function Toutiao() {
2222
css={`
2323
.float-activate-button-container,
2424
#top-banner-container,
25-
.arco-show-monitor :where(.m-top-container, .m-bottom-container, .m-index-tag),
26-
.m-top-padding {
25+
.arco-show-monitor
26+
:where(.m-top-container, .m-bottom-container, .m-index-tag, .content-bottom),
27+
.m-top-padding,
28+
.m-bottom-bar,
29+
.m-index-tag {
2730
display: none !important;
2831
}
2932
.hot-list-footer {
3033
padding: 24px 0 !important;
3134
}
3235
`}
33-
forbiddenUrls={['zijieapi.com']}
36+
forbiddenUrls={['zijieapi.com', 'artical.zlink.toutiao.com']}
3437
/>
3538
)
3639
}

app/(drawer)/wangyi.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default function Wangyi() {
103103
url={getTabUrl(TabsName.wangyi)!}
104104
css={`
105105
.footer-container,
106-
.js-open-newsapp,
106+
a.js-open-newsapp,
107107
.fixedOpenNewsapp,
108108
.openNewsapp,
109109
.js-bottom-container,
@@ -112,25 +112,26 @@ export default function Wangyi() {
112112
.ad,
113113
.js-ad,
114114
.comment-top-ad,
115-
.js-comment-top-ad {
115+
[data-stat='o-motif-footer'],
116+
.js-comment-top-ad,
117+
.open-app-btn,
118+
.endCover-open,
119+
.comment .logoBottom {
116120
display: none !important;
117121
}
118122
.hot-container-outapp .rank-container {
119123
padding: 0 !important;
120124
}
121-
// #tabContainer::before {
122-
// content: '网易热榜';
123-
// display: block;
124-
// text-align: center;
125-
// font-size: 22px;
126-
// line-height: 55px;
127-
// }
125+
128126
.g-body-wrap .container {
129127
top: 0 !important;
130128
}
131129
.m-news-list.search-list-wrap {
132130
margin-top: 25px;
133131
}
132+
#tabContainer {
133+
padding-top: 12px;
134+
}
134135
`}
135136
js={`(${__$inject})();true;`}
136137
forbiddenUrls={['sentry.music.163.com', 'm.163.com/newsapp/applinks.html']}

app/(drawer)/zhihu.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@ export default function Zhihu() {
1818
<WebView
1919
name={TabsName.zhihu}
2020
url={getTabUrl(TabsName.zhihu)!}
21-
forbiddenUrls={['zhihu-web-analytics.zhihu.com', 'datahub.zhihu.com', 'apm.zhihu.com']}
21+
forbiddenUrls={[
22+
'zhihu-web-analytics.zhihu.com',
23+
'datahub.zhihu.com',
24+
'apm.zhihu.com',
25+
'www.zhihu.com/oia/answers/',
26+
]}
2227
css={`
2328
.OpenInAppButton,
2429
.OpenInApp,
2530
.MobileModal-wrapper,
2631
.MHotFeedAd,
2732
.AdBelowMoreAnswers,
2833
.KfeCollection-VipRecommendCard,
29-
.MBannerAd {
34+
.MBannerAd,
35+
.RelatedReadingsItem:has(.MRelateFeedAd),
36+
.WeiboAd-wrap {
3037
display: none !important;
3138
}
3239
.Question-mainEntity > div:nth-of-type(2) {

app/_layout.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
2-
import { Stack } from 'expo-router'
2+
import { Stack, Slot, useNavigationContainerRef } from 'expo-router'
33
import React from 'react'
44
import { Share } from 'react-native'
55

66
import InitApp from '@/components/InitApp'
77
import ThemedIcon from '@/components/ThemedIcon'
88
import { useColorScheme } from '@/hooks/useColorScheme'
99

10-
export default function RootLayout() {
10+
import * as Sentry from '@sentry/react-native'
11+
import { isRunningInExpoGo } from 'expo'
12+
13+
// Construct a new integration instance. This is needed to communicate between the integration and React
14+
const navigationIntegration = Sentry.reactNavigationIntegration({
15+
enableTimeToInitialDisplay: !isRunningInExpoGo(),
16+
})
17+
18+
Sentry.init({
19+
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
20+
debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
21+
tracesSampleRate: 1.0, // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. Adjusting this value in production.
22+
integrations: [
23+
// Pass integration
24+
navigationIntegration,
25+
],
26+
enableNativeFramesTracking: !isRunningInExpoGo(), // Tracks slow and frozen frames in the application
27+
})
28+
29+
function RootLayout() {
1130
const colorScheme = useColorScheme()
1231

1332
const headerRight = () => {
@@ -27,6 +46,14 @@ export default function RootLayout() {
2746
></ThemedIcon>
2847
)
2948
}
49+
const ref = useNavigationContainerRef()
50+
51+
React.useEffect(() => {
52+
if (ref?.current) {
53+
navigationIntegration.registerNavigationContainer(ref)
54+
}
55+
}, [ref])
56+
3057
return (
3158
<InitApp>
3259
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
@@ -39,9 +66,17 @@ export default function RootLayout() {
3966
headerRight,
4067
}}
4168
/>
69+
{/* <Stack.Screen
70+
name="modal"
71+
options={{
72+
presentation: 'modal',
73+
}}
74+
/> */}
4275
<Stack.Screen name="+not-found" />
4376
</Stack>
4477
</ThemeProvider>
4578
</InitApp>
4679
)
4780
}
81+
82+
export default Sentry.wrap(RootLayout)

app/about.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import AboutHeader from '@/components/about/header'
55
import TabListSetting from '@/components/about/TabListSetting'
66
import Version from '@/components/about/version'
77
import { ThemedView } from '@/components/ThemedView'
8+
import TextSelectable from '@/components/about/TextSelectable'
89

910
export default function About() {
1011
return (
@@ -14,6 +15,7 @@ export default function About() {
1415
>
1516
<AboutHeader></AboutHeader>
1617
<Version></Version>
18+
<TextSelectable />
1719
<TabListSetting></TabListSetting>
1820
</ThemedView>
1921
</ScrollView>

app/modal.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { StyleSheet, Text, View } from 'react-native'
2+
3+
export default function Modal() {
4+
return (
5+
<View style={styles.container}>
6+
<Text>Modal screen</Text>
7+
</View>
8+
)
9+
}
10+
11+
const styles = StyleSheet.create({
12+
container: {
13+
flex: 1,
14+
alignItems: 'center',
15+
justifyContent: 'center',
16+
},
17+
})

components/HeaderRight.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getPageIcon } from '@/utils'
55

66
import ThemedIcon from './ThemedIcon'
77
import { ThemedView } from './ThemedView'
8+
import { Link } from 'expo-router'
89

910
export default function HeaderRight(props: { pathname: string }) {
1011
const { setReloadTab, setShowPageInfo, $tabsList, setShareInfo } = useStore()
@@ -23,6 +24,15 @@ export default function HeaderRight(props: { pathname: string }) {
2324
backgroundColor: 'transparent',
2425
}}
2526
>
27+
{/* <Link href="/modal">
28+
<Image
29+
source={pageIcon}
30+
style={{
31+
width: 24,
32+
height: 24,
33+
}}
34+
></Image>
35+
</Link> */}
2636
<TouchableOpacity
2737
activeOpacity={0.5}
2838
style={{ paddingVertical: 1, paddingHorizontal: 4, width: 36 }}
@@ -34,6 +44,7 @@ export default function HeaderRight(props: { pathname: string }) {
3444
}}
3545
>
3646
{/* <ThemedIcon name="information-circle-outline" size={28}></ThemedIcon> */}
47+
3748
<Image
3849
source={pageIcon}
3950
style={{

components/InitApp/index.tsx

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import './init'
22

33
import AsyncStorage from '@react-native-async-storage/async-storage'
4-
import * as Sentry from '@sentry/react-native'
5-
import { isRunningInExpoGo } from 'expo'
4+
// import * as Sentry from '@sentry/react-native'
5+
// import { isRunningInExpoGo } from 'expo'
66
import * as Application from 'expo-application'
77
import { useFonts } from 'expo-font'
88
import { SplashScreen } from 'expo-router'
9-
import { useNavigationContainerRef } from 'expo-router'
9+
// import { useNavigationContainerRef } from 'expo-router'
1010
import React, { useEffect } from 'react'
1111
import { ProviderOnChangeType } from 'react-atomic-context'
1212
import { Alert, Linking, ToastAndroid } from 'react-native'
@@ -24,21 +24,21 @@ import {
2424
} from '@/store'
2525
import checkAppUpdate from '@/utils/checkAppUpdate'
2626

27-
// Construct a new instrumentation instance. This is needed to communicate between the integration and React
28-
const routingInstrumentation = new Sentry.ReactNavigationInstrumentation()
27+
// // Construct a new instrumentation instance. This is needed to communicate between the integration and React
28+
// const routingInstrumentation = new Sentry.ReactNavigationInstrumentation()
2929

30-
Sentry.init({
31-
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
32-
debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
33-
integrations: [
34-
new Sentry.ReactNativeTracing({
35-
// Pass instrumentation to be used as `routingInstrumentation`
36-
routingInstrumentation,
37-
enableNativeFramesTracking: !isRunningInExpoGo(),
38-
// ...
39-
}),
40-
],
41-
})
30+
// Sentry.init({
31+
// dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
32+
// debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
33+
// integrations: [
34+
// new Sentry.ReactNativeTracing({
35+
// // Pass instrumentation to be used as `routingInstrumentation`
36+
// routingInstrumentation,
37+
// enableNativeFramesTracking: !isRunningInExpoGo(),
38+
// // ...
39+
// }),
40+
// ],
41+
// })
4242

4343
// Prevent the splash screen from auto-hiding before asset loading is complete.
4444
SplashScreen.preventAutoHideAsync()
@@ -159,12 +159,6 @@ function App(props: React.PropsWithChildren) {
159159
}
160160

161161
function RootLayout(props: React.PropsWithChildren<{}>) {
162-
const ref = useNavigationContainerRef()
163-
useEffect(() => {
164-
if (ref) {
165-
routingInstrumentation.registerNavigationContainer(ref)
166-
}
167-
}, [ref])
168162
const appValue = useAppValue()
169163

170164
useMounted(() => {
@@ -198,4 +192,4 @@ function RootLayout(props: React.PropsWithChildren<{}>) {
198192
)
199193
}
200194

201-
export default Sentry.wrap(RootLayout)
195+
export default RootLayout

components/WebView/index.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ export default function WebView(props: {
3434
forbiddenUrls?: (string | RegExp)[]
3535
}) {
3636
const webViewRef = React.useRef<RNWebView | null>(null)
37-
const { reloadTab, showPageInfo, clickTab, clearSelection, $tabsList, shareInfo } = useStore()
37+
const {
38+
reloadTab,
39+
showPageInfo,
40+
clickTab,
41+
clearSelection,
42+
$tabsList,
43+
shareInfo,
44+
$enableTextSelect,
45+
} = useStore()
3846
const [webviewKey, setWebviewKey] = React.useState(0)
3947
const page = $tabsList.find(t => t.name === props.name)
4048
const pageIcon = getPageIcon(page)
@@ -77,12 +85,6 @@ export default function WebView(props: {
7785
return
7886
}
7987
Alert.alert('当前页面:' + title, 'URL: \n' + url, [
80-
// {
81-
// text: '浏览器打开我',
82-
// onPress: () => {
83-
// Linking.openURL(url)
84-
// },
85-
// },
8688
{
8789
text: '浏览器打开',
8890
onPress: () => {
@@ -99,7 +101,7 @@ export default function WebView(props: {
99101
style: 'destructive',
100102
},
101103
{
102-
text: '确定',
104+
text: 'OK',
103105
isPreferred: true,
104106
},
105107
])
@@ -188,15 +190,15 @@ ${
188190
colorScheme === 'dark'
189191
? `
190192
html, img, video {
191-
filter: invert(1) hue-rotate(.5turn);
193+
filter: invert(1) hue-rotate(.5turn);
192194
}
193195
img {
194-
opacity: .75;
196+
opacity: .75;
195197
}
196198
`
197199
: ''
198200
}
199-
`)
201+
${$enableTextSelect ? '* { user-select: none!important; }' : ''} `)
200202
)}
201203
renderLoading={() => (
202204
<ThemedView

0 commit comments

Comments
 (0)