Skip to content

Commit

Permalink
Merge pull request zingolabs#604 from juanky201271/dev_ios_sync_backg…
Browse files Browse the repository at this point in the history
…round_fix

IOS background sync - fix
  • Loading branch information
juanky201271 authored Feb 22, 2024
2 parents 7f655c1 + a6d1710 commit f58ee7e
Show file tree
Hide file tree
Showing 19 changed files with 188 additions and 337 deletions.
1 change: 1 addition & 0 deletions __tests__/LoadedApp.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('Component LoadedApp - test', () => {
const mode = 'basic';
const background = {
batches: 0,
message: '',
date: 0,
};
const readOnly = false;
Expand Down
1 change: 1 addition & 0 deletions __tests__/LoadingApp.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('Component LoadingApp - test', () => {
const mode = 'basic';
const background = {
batches: 0,
message: '',
date: 0,
};
const firstLaunchingMessage = false;
Expand Down
7 changes: 0 additions & 7 deletions __tests__/__snapshots__/About.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ exports[`Component About - test About - snapshot 1`] = `
>
text translated
</Text>
<View
style={
{
"width": 10,
}
}
/>
</View>
<View
style={
Expand Down
14 changes: 0 additions & 14 deletions __tests__/__snapshots__/DetailLine.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ exports[`Component DetailLine - test DetailLine children - snapshot 1`] = `
>
label
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View />
</View>
`;
Expand All @@ -49,13 +42,6 @@ exports[`Component DetailLine - test DetailLine value - snapshot 1`] = `
>
label
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down
35 changes: 0 additions & 35 deletions __tests__/__snapshots__/Info.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ exports[`Component Info - test Info - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -225,13 +218,6 @@ exports[`Component Info - test Info - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -281,13 +267,6 @@ exports[`Component Info - test Info - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -337,13 +316,6 @@ exports[`Component Info - test Info - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -393,13 +365,6 @@ exports[`Component Info - test Info - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down
35 changes: 0 additions & 35 deletions __tests__/__snapshots__/Pools.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,6 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
style={
{
Expand Down Expand Up @@ -346,13 +339,6 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
style={
{
Expand Down Expand Up @@ -540,13 +526,6 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
style={
{
Expand Down Expand Up @@ -697,13 +676,6 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
style={
{
Expand Down Expand Up @@ -891,13 +863,6 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
style={
{
Expand Down
35 changes: 0 additions & 35 deletions __tests__/__snapshots__/SyncReport.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ exports[`Component SyncReport - test SyncReport - snapshot 1`] = `
>
Sync ID
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -753,13 +746,6 @@ exports[`Component SyncReport - test SyncReport - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -810,13 +796,6 @@ exports[`Component SyncReport - test SyncReport - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -875,13 +854,6 @@ exports[`Component SyncReport - test SyncReport - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down Expand Up @@ -946,13 +918,6 @@ exports[`Component SyncReport - test SyncReport - snapshot 1`] = `
>
translated text
</Text>
<View
style={
{
"width": 10,
}
}
/>
<View
accessible={true}
collapsable={false}
Expand Down
1 change: 1 addition & 0 deletions app/AppState/types/BackgroundType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default interface BackgroundType {
batches: number;
message: string;
date: number;
// eslint-disable-next-line semi
}
2 changes: 1 addition & 1 deletion app/LoadedApp/LoadedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function LoadedApp(props: LoadedAppProps) {
const [sendAll, setSendAll] = useState<boolean>(false);
const [privacy, setPrivacy] = useState<boolean>(false);
const [mode, setMode] = useState<'basic' | 'advanced'>('basic');
const [background, setBackground] = useState<BackgroundType>({ batches: 0, date: 0 });
const [background, setBackground] = useState<BackgroundType>({ batches: 0, message: '', date: 0 });
const [loading, setLoading] = useState<boolean>(true);
const file = useMemo(
() => ({
Expand Down
2 changes: 1 addition & 1 deletion app/LoadingApp/LoadingApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function LoadingApp(props: LoadingAppProps) {
const [sendAll, setSendAll] = useState<boolean>(false);
const [privacy, setPrivacy] = useState<boolean>(false);
const [mode, setMode] = useState<'basic' | 'advanced'>('advanced'); // by default advanced
const [background, setBackground] = useState<BackgroundType>({ batches: 0, date: 0 });
const [background, setBackground] = useState<BackgroundType>({ batches: 0, message: '', date: 0 });
const [firstLaunchingMessage, setFirstLaunchingMessage] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const file = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo!",
"version": "zingo-1.3.3 (131)",
"version": "zingo-1.3.4 (137)",
"loading": "loading...",
"connectingserver": "Connecting to the server...",
"wait": "Please wait...",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/es.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo!",
"version": "zingo-1.3.3 (131)",
"version": "zingo-1.3.4 (137)",
"loading": "cargando...",
"connectingserver": "Conectando con el servidor...",
"wait": "Por favor espere...",
Expand Down
8 changes: 5 additions & 3 deletions components/Background/BackgroundFileImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class BackgroundFileImpl {
// Write the server background
static async reset() {
const fileName = await this.getFileName();
const newBackground: BackgroundType = { batches: 0, date: 0 };
const newBackground: BackgroundType = { batches: 0, message: '', date: 0 };

RNFS.writeFile(fileName, JSON.stringify(newBackground), 'utf8')
.then(() => {
Expand All @@ -28,10 +28,12 @@ export default class BackgroundFileImpl {
const fileName = await this.getFileName();

try {
return JSON.parse((await RNFS.readFile(fileName, 'utf8')).toString()) as BackgroundType;
const r = JSON.parse((await RNFS.readFile(fileName, 'utf8')).toString()) as BackgroundType;
console.log('background json', r);
return r;
} catch (err) {
// File probably doesn't exist, so return nothing
//console.log(err);
console.log('background json Error', err);
return { batches: 0, date: 0 } as BackgroundType;
}
}
Expand Down
1 change: 0 additions & 1 deletion components/Components/DetailLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const DetailLine: React.FunctionComponent<DetailLineProps> = ({ label, value, ch
return (
<View style={{ display: 'flex', marginTop: 20 }}>
<FadeText>{label}</FadeText>
<View style={{ width: 10 }} />
{!!value && (
<TouchableOpacity
onPress={() => {
Expand Down
7 changes: 4 additions & 3 deletions components/SyncReport/SyncReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ const SyncReport: React.FunctionComponent<SyncReportProps> = ({ closeModal }) =>
/>
</View>
)}
{background.date > 0 && showBackgroundLegend && (
{Number(background.date) > 0 && showBackgroundLegend && (
<View
style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'flex-end',
flexDirection: 'column',
alignItems: 'flex-start',
marginHorizontal: 20,
}}>
<DetailLine
Expand All @@ -235,6 +235,7 @@ const SyncReport: React.FunctionComponent<SyncReportProps> = ({ closeModal }) =>
moment(Number(Number(background.date).toFixed(0)) * 1000).format('YYYY MMM D h:mm a')
}
/>
{!!background.message && <RegText color={colors.text}>{background.message}</RegText>}
</View>
)}
{maxBlocks && netInfo.isConnected ? (
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target 'ZingoMobile' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
# use_flipper!()

post_install do |installer|
react_native_post_install(installer)
Expand Down
Loading

0 comments on commit f58ee7e

Please sign in to comment.