new-version-alert

This commit is contained in:
KoalaSat 2023-11-28 16:42:25 +01:00
parent bc43383729
commit 29a67fee71
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
9 changed files with 61 additions and 16 deletions

View File

@ -20,6 +20,8 @@ import { usernamePubKey } from '../../Functions/RelayFunctions/Users'
import ProfileData from '../ProfileData'
import { WalletContext } from '../../Contexts/WalletContext'
import { AppContext } from '../../Contexts/AppContext'
import VersionNumber from 'react-native-version-number'
import axios from 'axios'
export const MenuItems: React.FC = () => {
const [drawerItemIndex, setDrawerItemIndex] = React.useState<number>(-1)
@ -44,6 +46,7 @@ export const MenuItems: React.FC = () => {
const [activerelays, setActiveRelays] = React.useState<number>(0)
const [loadingConnection, setLoadingConnection] = React.useState<boolean>(false)
const [newVersion, setNewVerion] = React.useState<boolean>(false)
React.useEffect(() => {
setActiveRelays(relays.filter((relay) => relay.active).length)
@ -82,6 +85,16 @@ export const MenuItems: React.FC = () => {
setLoadingConnection(false)
}, [online])
React.useEffect(() => {
axios.get('https://api.github.com/repos/KoalaSat/nostros/releases/latest')
.then((response) => {
if (response) {
const tag = response.data.tag_name
setNewVerion(online && Boolean(tag) && tag !== VersionNumber.appVersion)
}
})
}, [])
return (
<>
<DrawerContentScrollView
@ -219,15 +232,24 @@ export const MenuItems: React.FC = () => {
onPress={() => onPressItem('faq', 5)}
onTouchEnd={() => setDrawerItemIndex(-1)}
/>
{newVersion && (
<Drawer.Item
label={t('menuItems.reportBug')}
icon='bug-outline'
key='bug'
label={t('menuItems.newVersion')}
icon='cellphone-arrow-down'
key='version'
active={drawerItemIndex === 2}
onPress={async () =>
await Linking.openURL('https://github.com/KoalaSat/nostros/issues/new/choose')
await Linking.openURL('https://github.com/KoalaSat/nostros/releases/latest')
}
right={() =>
<MaterialCommunityIcons
name='exclamation-thick'
size={25}
color='#FFDCBB'
/>
}
/>
)}
</Drawer.Section>
</DrawerContentScrollView>
<Drawer.Section
@ -335,7 +357,7 @@ const styles = StyleSheet.create({
verifyIcon: {
paddingTop: 6,
paddingLeft: 5,
},
}
})
export default MenuItems

View File

@ -159,7 +159,8 @@
"logout": "Abmelden",
"exports": "Export",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"configPage": {
"signHeight": "Sign events with latest Bitcoin block",

View File

@ -154,7 +154,8 @@
"logout": "Logout",
"exports": "Export",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"configPage": {
"showPublicImages": "Show images on public feed",

View File

@ -180,7 +180,8 @@
"logout": "Salir",
"exports": "Exportar/Importar",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"configPage": {
"signHeight": "Firmar con el último bloque bitcoin",

View File

@ -180,7 +180,8 @@
"logout": "Sortir",
"exports": "Export",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"language": {
"en": "English",

View File

@ -181,7 +181,8 @@
"imageHostingService": "Хостинг изображений",
"exports": "Export",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"configPage": {
"signHeight": "Sign events with latest Bitcoin block",

View File

@ -179,7 +179,8 @@
"logout": "退出",
"exports": "Export",
"online": "Online",
"offline": "Offline"
"offline": "Offline",
"newVersion": "Update"
},
"configPage": {
"signHeight": "用最新的比特币区块签署事件",

View File

@ -51,6 +51,22 @@ export const AboutPage: React.FC = () => {
),
onPress: async () => await Linking.openURL('https://github.com/KoalaSat/nostros'),
},
{
key: 2,
title: t('menuItems.reportBug'),
left: (
<List.Icon
icon={() => (
<MaterialCommunityIcons
name='bug-outline'
size={25}
color={theme.colors.onPrimaryContainer}
/>
)}
/>
),
onPress: async () => await Linking.openURL('https://github.com/KoalaSat/nostros/issues/new/choose'),
},
{
key: 3,
title: t('aboutPage.telegram'),

View File

@ -22,6 +22,7 @@ export const HomeNavigator: React.FC = () => {
const bottomSheetRelaysRef = React.useRef<RBSheet>(null)
const bottomSheetLoginRef = React.useRef<RBSheet>(null)
const Stack = React.useMemo(() => createStackNavigator(), [])
const cardStyleInterpolator = React.useMemo(
() =>
Platform.OS === 'android'