mirror of
https://github.com/KoalaSat/nostros.git
synced 2024-09-29 22:50:43 +00:00
new-version-alert (#561)
This commit is contained in:
commit
b04544cfd9
@ -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
|
||||
|
@ -159,7 +159,8 @@
|
||||
"logout": "Abmelden",
|
||||
"exports": "Export",
|
||||
"online": "Online",
|
||||
"offline": "Offline"
|
||||
"offline": "Offline",
|
||||
"newVersion": "Update"
|
||||
},
|
||||
"configPage": {
|
||||
"signHeight": "Sign events with latest Bitcoin block",
|
||||
|
@ -154,7 +154,8 @@
|
||||
"logout": "Logout",
|
||||
"exports": "Export",
|
||||
"online": "Online",
|
||||
"offline": "Offline"
|
||||
"offline": "Offline",
|
||||
"newVersion": "Update"
|
||||
},
|
||||
"configPage": {
|
||||
"showPublicImages": "Show images on public feed",
|
||||
|
@ -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",
|
||||
|
@ -180,7 +180,8 @@
|
||||
"logout": "Sortir",
|
||||
"exports": "Export",
|
||||
"online": "Online",
|
||||
"offline": "Offline"
|
||||
"offline": "Offline",
|
||||
"newVersion": "Update"
|
||||
},
|
||||
"language": {
|
||||
"en": "English",
|
||||
|
@ -181,7 +181,8 @@
|
||||
"imageHostingService": "Хостинг изображений",
|
||||
"exports": "Export",
|
||||
"online": "Online",
|
||||
"offline": "Offline"
|
||||
"offline": "Offline",
|
||||
"newVersion": "Update"
|
||||
},
|
||||
"configPage": {
|
||||
"signHeight": "Sign events with latest Bitcoin block",
|
||||
|
@ -179,7 +179,8 @@
|
||||
"logout": "退出",
|
||||
"exports": "Export",
|
||||
"online": "Online",
|
||||
"offline": "Offline"
|
||||
"offline": "Offline",
|
||||
"newVersion": "Update"
|
||||
},
|
||||
"configPage": {
|
||||
"signHeight": "用最新的比特币区块签署事件",
|
||||
|
@ -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'),
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user