Add version number on screen

This commit is contained in:
Tiago Daniel Jacobs
2023-01-27 10:55:56 -03:00
parent 4c07646c90
commit d4686fa064
7 changed files with 63 additions and 30 deletions

View File

@@ -9,6 +9,7 @@ import {
ItemList,
TextButtonOpen,
TextWithoutPortal,
TextVersionInfo,
WrapperItemListText,
WrapperListContainer,
WrapperViewAdd,
@@ -25,8 +26,13 @@ import i18next from 'i18next';
import {initTranslation} from '../../translations/index';
import {TouchableOpacity} from 'react-native';
import {createNewPortal} from '../utils/createNewPortal';
import DeviceInfo from 'react-native-device-info';
export const ListPortals = ({navigation}: IListPortalsDTO) => {
const version = DeviceInfo.getVersion();
const buildNum = DeviceInfo.getBuildNumber();
const versionString = `${version} (#${buildNum})`;
initTranslation();
const icon = (
<FontAwesome5 color={colors.white} solid size={18} name={'plus'} />
@@ -175,6 +181,7 @@ export const ListPortals = ({navigation}: IListPortalsDTO) => {
</BlockTextWithoutPortal>
</>
)}
<TextVersionInfo>V{versionString}</TextVersionInfo>
</WrapperListContainer>
);
};

View File

@@ -82,6 +82,14 @@ export const TextWithoutPortal = styled.Text`
display: flex;
`;
export const TextVersionInfo = styled.Text`
margin-top: 100px;
color: #555;
font-size: 12px;
text-align: center;
display: flex;
`;
export const BlockTextWithoutPortal = styled.View`
flex-direction: row;
padding: 20px;

View File

@@ -8,7 +8,7 @@ import i18next from 'i18next';
import {createDrawerNavigator} from '@react-navigation/drawer';
import SdkContainer from '../../bootstrap/sdk/container';
import {initTranslation} from '../translations/index';
import { Alert, Linking } from 'react-native';
import { Alert, Linking, Text } from 'react-native';
import { createNewPortal } from '../pages/utils/createNewPortal';
import { emitter } from '../emitter/emitter';
import { IPortal } from '../pages/utils/types';
@@ -34,7 +34,11 @@ const DeepLink = ()=>{
return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL'))
}
const linkParts = linkWithoutScheme.split('/https://');
//
let linkParts = linkWithoutScheme.split('/' + encodeURIComponent("https://"));
let portalName = linkParts[0];
let portalLink = linkParts[1];
@@ -144,29 +148,31 @@ export const Routes = () => {
}, []);
return (
<NavigationContainer>
<DeepLink/>
<Drawer.Navigator
initialRouteName={i18next.t('mobileApp.portals.drawerNavigation.button.label')}
screenOptions={{
headerShown: false,
}}>
<Drawer.Screen
name={i18next.t('mobileApp.portals.drawerNavigation.button.label')}
component={ListPortals}
/>
{portals && portals.length
? portals.map((item: { name: React.Key | null | undefined; url: string; }) => {
return (
<Drawer.Screen
key={item.name}
name={item.name}
children={() => <SdkContainer url={item.url} />}
/>
);
})
: null}
</Drawer.Navigator>
</NavigationContainer>
<>
<NavigationContainer>
<DeepLink/>
<Drawer.Navigator
initialRouteName={i18next.t('mobileApp.portals.drawerNavigation.button.label')}
screenOptions={{
headerShown: false,
}}>
<Drawer.Screen
name={i18next.t('mobileApp.portals.drawerNavigation.button.label')}
component={ListPortals}
/>
{portals && portals.length
? portals.map((item: { name: React.Key | null | undefined; url: string; }) => {
return (
<Drawer.Screen
key={item.name}
name={item.name}
children={() => <SdkContainer url={item.url} />}
/>
);
})
: null}
</Drawer.Navigator>
</NavigationContainer>
</>
);
};