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 ProfileData from '../ProfileData'
|
||||||
import { WalletContext } from '../../Contexts/WalletContext'
|
import { WalletContext } from '../../Contexts/WalletContext'
|
||||||
import { AppContext } from '../../Contexts/AppContext'
|
import { AppContext } from '../../Contexts/AppContext'
|
||||||
|
import VersionNumber from 'react-native-version-number'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
export const MenuItems: React.FC = () => {
|
export const MenuItems: React.FC = () => {
|
||||||
const [drawerItemIndex, setDrawerItemIndex] = React.useState<number>(-1)
|
const [drawerItemIndex, setDrawerItemIndex] = React.useState<number>(-1)
|
||||||
@ -44,6 +46,7 @@ export const MenuItems: React.FC = () => {
|
|||||||
|
|
||||||
const [activerelays, setActiveRelays] = React.useState<number>(0)
|
const [activerelays, setActiveRelays] = React.useState<number>(0)
|
||||||
const [loadingConnection, setLoadingConnection] = React.useState<boolean>(false)
|
const [loadingConnection, setLoadingConnection] = React.useState<boolean>(false)
|
||||||
|
const [newVersion, setNewVerion] = React.useState<boolean>(false)
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setActiveRelays(relays.filter((relay) => relay.active).length)
|
setActiveRelays(relays.filter((relay) => relay.active).length)
|
||||||
@ -82,6 +85,16 @@ export const MenuItems: React.FC = () => {
|
|||||||
setLoadingConnection(false)
|
setLoadingConnection(false)
|
||||||
}, [online])
|
}, [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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<DrawerContentScrollView
|
<DrawerContentScrollView
|
||||||
@ -219,15 +232,24 @@ export const MenuItems: React.FC = () => {
|
|||||||
onPress={() => onPressItem('faq', 5)}
|
onPress={() => onPressItem('faq', 5)}
|
||||||
onTouchEnd={() => setDrawerItemIndex(-1)}
|
onTouchEnd={() => setDrawerItemIndex(-1)}
|
||||||
/>
|
/>
|
||||||
|
{newVersion && (
|
||||||
<Drawer.Item
|
<Drawer.Item
|
||||||
label={t('menuItems.reportBug')}
|
label={t('menuItems.newVersion')}
|
||||||
icon='bug-outline'
|
icon='cellphone-arrow-down'
|
||||||
key='bug'
|
key='version'
|
||||||
active={drawerItemIndex === 2}
|
active={drawerItemIndex === 2}
|
||||||
onPress={async () =>
|
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>
|
</Drawer.Section>
|
||||||
</DrawerContentScrollView>
|
</DrawerContentScrollView>
|
||||||
<Drawer.Section
|
<Drawer.Section
|
||||||
@ -335,7 +357,7 @@ const styles = StyleSheet.create({
|
|||||||
verifyIcon: {
|
verifyIcon: {
|
||||||
paddingTop: 6,
|
paddingTop: 6,
|
||||||
paddingLeft: 5,
|
paddingLeft: 5,
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default MenuItems
|
export default MenuItems
|
||||||
|
@ -159,7 +159,8 @@
|
|||||||
"logout": "Abmelden",
|
"logout": "Abmelden",
|
||||||
"exports": "Export",
|
"exports": "Export",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"configPage": {
|
"configPage": {
|
||||||
"signHeight": "Sign events with latest Bitcoin block",
|
"signHeight": "Sign events with latest Bitcoin block",
|
||||||
|
@ -154,7 +154,8 @@
|
|||||||
"logout": "Logout",
|
"logout": "Logout",
|
||||||
"exports": "Export",
|
"exports": "Export",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"configPage": {
|
"configPage": {
|
||||||
"showPublicImages": "Show images on public feed",
|
"showPublicImages": "Show images on public feed",
|
||||||
|
@ -180,7 +180,8 @@
|
|||||||
"logout": "Salir",
|
"logout": "Salir",
|
||||||
"exports": "Exportar/Importar",
|
"exports": "Exportar/Importar",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"configPage": {
|
"configPage": {
|
||||||
"signHeight": "Firmar con el último bloque bitcoin",
|
"signHeight": "Firmar con el último bloque bitcoin",
|
||||||
|
@ -180,7 +180,8 @@
|
|||||||
"logout": "Sortir",
|
"logout": "Sortir",
|
||||||
"exports": "Export",
|
"exports": "Export",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"en": "English",
|
"en": "English",
|
||||||
|
@ -181,7 +181,8 @@
|
|||||||
"imageHostingService": "Хостинг изображений",
|
"imageHostingService": "Хостинг изображений",
|
||||||
"exports": "Export",
|
"exports": "Export",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"configPage": {
|
"configPage": {
|
||||||
"signHeight": "Sign events with latest Bitcoin block",
|
"signHeight": "Sign events with latest Bitcoin block",
|
||||||
|
@ -179,7 +179,8 @@
|
|||||||
"logout": "退出",
|
"logout": "退出",
|
||||||
"exports": "Export",
|
"exports": "Export",
|
||||||
"online": "Online",
|
"online": "Online",
|
||||||
"offline": "Offline"
|
"offline": "Offline",
|
||||||
|
"newVersion": "Update"
|
||||||
},
|
},
|
||||||
"configPage": {
|
"configPage": {
|
||||||
"signHeight": "用最新的比特币区块签署事件",
|
"signHeight": "用最新的比特币区块签署事件",
|
||||||
|
@ -51,6 +51,22 @@ export const AboutPage: React.FC = () => {
|
|||||||
),
|
),
|
||||||
onPress: async () => await Linking.openURL('https://github.com/KoalaSat/nostros'),
|
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,
|
key: 3,
|
||||||
title: t('aboutPage.telegram'),
|
title: t('aboutPage.telegram'),
|
||||||
|
@ -22,6 +22,7 @@ export const HomeNavigator: React.FC = () => {
|
|||||||
const bottomSheetRelaysRef = React.useRef<RBSheet>(null)
|
const bottomSheetRelaysRef = React.useRef<RBSheet>(null)
|
||||||
const bottomSheetLoginRef = React.useRef<RBSheet>(null)
|
const bottomSheetLoginRef = React.useRef<RBSheet>(null)
|
||||||
const Stack = React.useMemo(() => createStackNavigator(), [])
|
const Stack = React.useMemo(() => createStackNavigator(), [])
|
||||||
|
|
||||||
const cardStyleInterpolator = React.useMemo(
|
const cardStyleInterpolator = React.useMemo(
|
||||||
() =>
|
() =>
|
||||||
Platform.OS === 'android'
|
Platform.OS === 'android'
|
||||||
|
Loading…
Reference in New Issue
Block a user