Skip to content

Commit

Permalink
Merge pull request zingolabs#593 from juanky201271/dev_New_version_zi…
Browse files Browse the repository at this point in the history
…ngo_1.3.3_131

New version zingo 1.3.3 131
  • Loading branch information
Oscar-Pepper authored Feb 4, 2024
2 parents 854899c + 7c493c4 commit 10eed23
Show file tree
Hide file tree
Showing 14 changed files with 298 additions and 75 deletions.
2 changes: 2 additions & 0 deletions __tests__/LoadingApp.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe('Component LoadingApp - test', () => {
batches: 0,
date: 0,
};
const firstLaunchingMessage = false;
const receive = render(
<LoadingAppClass
navigation={navigationMock}
Expand All @@ -138,6 +139,7 @@ describe('Component LoadingApp - test', () => {
privacy={privacy}
mode={mode}
background={background}
firstLaunchingMessage={firstLaunchingMessage}
/>,
);
expect(receive.toJSON()).toMatchSnapshot();
Expand Down
103 changes: 84 additions & 19 deletions __tests__/__snapshots__/LoadingApp.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,102 @@ exports[`Component LoadingApp - test LoadingApp - snapshot 1`] = `
}
>
<View />
<View
<RCTSafeAreaView
style={
{
"alignItems": "center",
"flex": 1,
"flexDirection": "column",
"backgroundColor": "rgb(242, 242, 242)",
"display": "flex",
"height": "100%",
"justifyContent": "center",
}
}
>
<Text
<View
style={
{
"color": "#888888",
"fontSize": 40,
"fontWeight": "bold",
"alignItems": "center",
"flex": 1,
"flexDirection": "column",
"justifyContent": "center",
"width": "95%",
}
}
>
text traslated
</Text>
<Text
style={
{
"color": "#888888",
"fontSize": 15,
<Text
style={
{
"color": undefined,
"fontSize": 40,
"fontWeight": "bold",
}
}
}
>
text traslated
</Text>
</View>
>
text traslated
</Text>
<Text
style={
{
"color": undefined,
"fontSize": 15,
}
}
>
text traslated
</Text>
<View
style={
{
"alignItems": "center",
"flexDirection": "column",
"justifyContent": "center",
"marginTop": 20,
"padding": 10,
"width": "80%",
}
}
>
<Text
style={
{
"color": "rgb(28, 28, 30)",
"fontSize": 20,
"fontWeight": "bold",
"marginTop": 10,
"opacity": 0,
}
}
>
text traslated
</Text>
<Text
style={
{
"color": "rgb(28, 28, 30)",
"fontSize": 15,
"marginTop": 10,
"opacity": 0,
"textAlign": "center",
}
}
>
text traslated
</Text>
<Text
style={
{
"color": "rgb(28, 28, 30)",
"fontSize": 15,
"marginBottom": 10,
"marginTop": 10,
"opacity": 0,
}
}
>
text traslated
</Text>
</View>
</View>
</RCTSafeAreaView>
</RCTSafeAreaView>
`;
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ android {
//applicationId 'com.ZingoMobile' // @Test
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 130 // Real
versionCode 131 // Real
//versionCode 117 // @Test
versionName "zingo-1.3.2" // Real
versionName "zingo-1.3.3" // Real
missingDimensionStrategy 'react-native-camera', 'general'
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
2 changes: 2 additions & 0 deletions app/AppState/AppStateLoading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ export default interface AppStateLoading {
snackbars: SnackbarType[];
addLastSnackbar: (snackbar: SnackbarType) => void;

firstLaunchingMessage: boolean;

// eslint-disable-next-line semi
}
7 changes: 7 additions & 0 deletions app/AppState/classes/SettingsFileClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export default class SettingsFileClass {
mode: 'basic' | 'advanced';
firstInstall: boolean;
basicFirstViewSeed: boolean;
version: string | null;
// three values:
// - '': means the prior version doesn't have this field in settings
// - null: means is a fresh install
// - string: means it have a normal value

constructor(
server: ServerType,
Expand All @@ -19,6 +24,7 @@ export default class SettingsFileClass {
mode: 'basic' | 'advanced',
firstInstall: boolean,
basicFirstViewSeed: boolean,
version: string,
) {
this.server = server;
this.currency = currency;
Expand All @@ -28,5 +34,6 @@ export default class SettingsFileClass {
this.mode = mode;
this.firstInstall = firstInstall;
this.basicFirstViewSeed = basicFirstViewSeed;
this.version = version;
}
}
39 changes: 25 additions & 14 deletions app/LoadedApp/LoadedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
NativeEventSubscription,
Platform,
Linking,
SafeAreaView,
} from 'react-native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
Expand Down Expand Up @@ -56,6 +57,7 @@ import { createAlert } from '../createAlert';
import Snackbars from '../../components/Components/Snackbars';
import SnackbarType from '../AppState/types/SnackbarType';
import { RPCSeedType } from '../rpc/types/RPCSeedType';
import { Launching } from '../LoadingApp';

const History = React.lazy(() => import('../../components/History'));
const Send = React.lazy(() => import('../../components/Send'));
Expand All @@ -78,6 +80,9 @@ const es = require('../translations/es.json');

const Tab = createBottomTabNavigator();

// for testing
//const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

type LoadedAppProps = {
navigation: StackScreenProps<any>['navigation'];
route: StackScreenProps<any>['route'];
Expand Down Expand Up @@ -120,8 +125,18 @@ export default function LoadedApp(props: LoadedAppProps) {
// update layout direction
I18nManager.forceRTL(isRTL);

// If the App is mounting this component, I know I have to reset the firstInstall prop in settings.
await SettingsFileImpl.writeSettings('firstInstall', false);

// If the App is mounting this component, I know I have to update the version prop in settings.
await SettingsFileImpl.writeSettings('version', translate('version') as string);

//I have to check what language is in the settings
const settings = await SettingsFileImpl.readSettings();

// for testing
//await delay(5000);

if (settings.language) {
setLanguage(settings.language);
i18n.locale = settings.language;
Expand Down Expand Up @@ -180,16 +195,15 @@ export default function LoadedApp(props: LoadedAppProps) {

if (loading) {
return (
<View
<SafeAreaView
style={{
flex: 1,
flexDirection: 'column',
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100%',
}}>
<Text style={{ color: '#888888', fontSize: 40, fontWeight: 'bold' }}>{translate('zingo') as string}</Text>
<Text style={{ color: '#888888', fontSize: 15 }}>{translate('version') as string}</Text>
</View>
<Launching translate={translate} firstLaunchingMessage={false} />
</SafeAreaView>
);
} else {
return (
Expand Down Expand Up @@ -274,14 +288,11 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, AppStateLoade
componentDidMount = () => {
this.clearToAddr();

// If the App is mounting this component, I know I have to reset the firstInstall props in settings.
(async () => {
await SettingsFileImpl.writeSettings('firstInstall', false);
})();

// Configure the RPC to start doing refreshes
(async () => {
// Configure the RPC to start doing refreshes
await this.rpc.configure();

//console.log(await SettingsFileImpl.readSettings());
})();

this.appstate = AppState.addEventListener('change', async nextAppState => {
Expand Down Expand Up @@ -1149,7 +1160,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, AppStateLoade
);
};

//console.log('render LoadedAppClass - 3');
//console.log('render LoadedAppClass - 3', translate('version'));

return (
<ContextAppLoadedProvider value={this.state}>
Expand Down
95 changes: 95 additions & 0 deletions app/LoadingApp/Launching.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/* eslint-disable react-native/no-inline-styles */
import React from 'react';
import { SafeAreaView, Text, View, ActivityIndicator } from 'react-native';
import { useTheme } from '@react-navigation/native';

import { ThemeType } from '../types';
import { TranslateType } from '../AppState';

type LaunchingProps = {
translate: (key: string) => TranslateType;
firstLaunchingMessage: boolean;
message?: string;
};

const Launching: React.FunctionComponent<LaunchingProps> = props => {
const { colors } = useTheme() as unknown as ThemeType;

return (
<SafeAreaView
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100%',
backgroundColor: colors.background,
}}>
<View
style={{
flex: 1,
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
width: '95%',
}}>
<Text style={{ color: colors.zingo, fontSize: 40, fontWeight: 'bold' }}>
{props.translate('zingo') as string}
</Text>
<Text style={{ color: colors.zingo, fontSize: 15 }}>{props.translate('version') as string}</Text>
<View
style={{
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
width: '80%',
marginTop: 20,
padding: 10,
}}>
{!!props.message && (
<Text
style={{
color: colors.primaryDisabled,
fontSize: 15,
marginTop: 10,
}}>
{props.message}
</Text>
)}
{props.firstLaunchingMessage && <ActivityIndicator size="large" color={colors.primary} />}
<Text
style={{
color: colors.text,
fontSize: 20,
fontWeight: 'bold',
marginTop: 10,
opacity: props.firstLaunchingMessage ? 1 : 0,
}}>
{props.translate('firstlaunchingmessage-title') as string}
</Text>
<Text
style={{
color: colors.text,
fontSize: 15,
marginTop: 10,
opacity: props.firstLaunchingMessage ? 1 : 0,
textAlign: 'center',
}}>
{props.translate('firstlaunchingmessage-body') as string}
</Text>
<Text
style={{
color: colors.text,
fontSize: 15,
marginTop: 10,
marginBottom: 10,
opacity: props.firstLaunchingMessage ? 1 : 0,
}}>
{props.translate('firstlaunchingmessage-footer') as string}
</Text>
</View>
</View>
</SafeAreaView>
);
};

export default Launching;
Loading

0 comments on commit 10eed23

Please sign in to comment.