Skip to content

Commit

Permalink
feat: share image for android
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoliao666 committed Feb 13, 2023
1 parent b8f0438 commit 54a8e1c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## 下载

- [iOS App Store](https://apps.apple.com/cn/app/awesomev2ex/id1659591551?l=en)
- [Android Apk](https://github.com/liaoliao666/v2ex/releases/download/1.2.5/application-c59088b5-a047-48da-8122-36ce5af4ed41.apk)
- [Android Apk](https://github.com/liaoliao666/v2ex/releases/download/1.2.5/application-ff08ef30-7b05-4ab3-832b-7e28497816fc.apk)

## 本地运行

Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ios": {
"supportsTablet": false,
"bundleIdentifier": "com.liaoliao666.v2ex",
"buildNumber": "1.2.5.5"
"buildNumber": "1.2.5.6"
},
"android": {
"adaptiveIcon": {
Expand Down
2 changes: 1 addition & 1 deletion components/StyledButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function StyledButton({
{
middle: tw`h-9 px-4`,
large: tw`h-[52px] px-8`,
small: tw`h-7 px-3`,
small: tw`h-8 px-3`,
mini: tw`px-1 py-0.5`,
}[size],
{
Expand Down
2 changes: 1 addition & 1 deletion components/topic/ReplyBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const ReplyBox = forwardRef<
shape="rounded"
type="secondary"
size="small"
pressable={getContent().length > 2}
pressable={!!getContent().trim()}
onPress={async () => {
if (!isSignined()) {
navigation.navigate('Login')
Expand Down
22 changes: 15 additions & 7 deletions components/topic/ReplyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack'
import produce from 'immer'
import { compact, find, findIndex, isBoolean } from 'lodash-es'
import { Fragment, memo, useState } from 'react'
import { Pressable, Share, Text, View } from 'react-native'
import { Platform, Pressable, Share, Text, View } from 'react-native'
import Toast from 'react-native-toast-message'
import { inferData } from 'react-query-kit'

Expand Down Expand Up @@ -376,12 +376,20 @@ function MoreButton({
async selectedIndex => {
switch (selectedIndex) {
case options.indexOf('分享'):
Share.share({
title: reply.content,
url: `${baseURL}/t/${topicId}?p=${Math.ceil(
reply.no / 100
)}#r_${reply.id}`,
})
const url = `${baseURL}/t/${topicId}?p=${Math.ceil(
reply.no / 100
)}#r_${reply.id}`
Share.share(
Platform.OS === 'android'
? {
title: reply.content,
message: url,
}
: {
title: reply.content,
url: url,
}
)
break

case destructiveButtonIndex: {
Expand Down
17 changes: 12 additions & 5 deletions components/topic/TopicInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack'
import produce from 'immer'
import { compact } from 'lodash-es'
import { Fragment, ReactElement } from 'react'
import { Pressable, Share, Text, View } from 'react-native'
import { Platform, Pressable, Share, Text, View } from 'react-native'
import Toast from 'react-native-toast-message'
import { inferData } from 'react-query-kit'

Expand Down Expand Up @@ -468,10 +468,17 @@ function MoreButton({
break

case options.indexOf('分享'):
Share.share({
title: topic.title,
url: `${baseURL}/t/${topic.id}`,
})
Share.share(
Platform.OS === 'android'
? {
title: topic.title,
message: `${baseURL}/t/${topic.id}`,
}
: {
title: topic.title,
url: `${baseURL}/t/${topic.id}`,
}
)
break

case destructiveButtonIndex: {
Expand Down
7 changes: 7 additions & 0 deletions screens/SearchScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ function SoV2exList({
) : null}
</SafeAreaView>
}
ListEmptyComponent={
<View style={tw`items-center justify-center py-16`}>
<Text style={tw`text-tint-secondary ${getFontSize(6)}`}>
暂无搜索结果
</Text>
</View>
}
/>
)
}
Expand Down

0 comments on commit 54a8e1c

Please sign in to comment.