Skip to content

Commit 0ba67d6

Browse files
committed
Update version handling: add criticalVersionCode and remove forceUpdate
1 parent 62cad84 commit 0ba67d6

File tree

9 files changed

+154
-91
lines changed

9 files changed

+154
-91
lines changed

bun.lockb

0 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@shopify/react-native-skia": "^1.5.8",
2929
"@tanstack/react-query": "^5.62.12",
3030
"clsx": "^2.1.1",
31-
"hono": "^4.6.11",
31+
"hono": "^4.6.16",
3232
"lottie-react-native": "^7.1.0",
3333
"nativewind": "^4.1.23",
3434
"react": "18.3.1",

src/components/Popup.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ const Popup = React.memo<PopupT>(({ text, title, buttons, index }) => {
3232
<View className='px-6 pt-5'>
3333
<SemiBold className='text-base text-black dark:text-white'>{title}</SemiBold>
3434
<ScrollView style={{ maxHeight: H * 0.65, marginTop: 10 }}>
35-
<Medium className='text-sm leading-4 text-black dark:text-white'>{text}</Medium>
35+
<Medium className='text-sm text-black dark:text-white' style={{ fontSize: 12 }}>
36+
{text}
37+
</Medium>
3638
</ScrollView>
3739
</View>
3840
<View className='mt-5 flex-row flex-wrap items-center justify-end px-4 pb-5'>
@@ -63,7 +65,7 @@ const PopupButton = React.memo<{ text: string; onPress?: () => void }>(({ text,
6365
onPress={onPress}
6466
activeOpacity={1}
6567
>
66-
<SemiBold className='text-black dark:text-white' style={{ fontSize: 11 }}>
68+
<SemiBold className='text-black dark:text-white' style={{ fontSize: 12 }}>
6769
{text}
6870
</SemiBold>
6971
</TouchableOpacity>

src/rpc/hcWithType.d.ts

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { hc } from 'hono/client';
12
declare const client: {
23
api: {
34
version: import("hono/client").ClientRequest<{
@@ -9,15 +10,15 @@ declare const client: {
910
data: {
1011
version: any;
1112
date: any;
12-
forceUpdate: any;
1313
features: any;
1414
versionCode: any;
15+
criticalVersionCode: any;
1516
size: any;
1617
id: any;
1718
};
1819
};
1920
outputFormat: "json";
20-
status: import("hono/utils/http-status").StatusCode;
21+
status: import("hono/utils/http-status").ContentfulStatusCode;
2122
} | {
2223
input: {};
2324
output: {
@@ -26,7 +27,7 @@ declare const client: {
2627
data: null;
2728
};
2829
outputFormat: "json";
29-
status: import("hono/utils/http-status").StatusCode;
30+
status: import("hono/utils/http-status").ContentfulStatusCode;
3031
};
3132
}>;
3233
};
@@ -37,10 +38,10 @@ declare const client: {
3738
$post: {
3839
input: {
3940
form: {
40-
password: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
41-
username: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
42-
deviceName: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
43-
deviceOs: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
41+
password: string;
42+
username: string;
43+
deviceName: string;
44+
deviceOs: string;
4445
};
4546
};
4647
output: {
@@ -50,14 +51,14 @@ declare const client: {
5051
data: null;
5152
};
5253
outputFormat: "json";
53-
status: import("hono/utils/http-status").StatusCode;
54+
status: import("hono/utils/http-status").ContentfulStatusCode;
5455
} | {
5556
input: {
5657
form: {
57-
password: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
58-
username: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
59-
deviceName: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
60-
deviceOs: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
58+
password: string;
59+
username: string;
60+
deviceName: string;
61+
deviceOs: string;
6162
};
6263
};
6364
output: {
@@ -69,7 +70,7 @@ declare const client: {
6970
verificationRequired: boolean;
7071
};
7172
outputFormat: "json";
72-
status: import("hono/utils/http-status").StatusCode;
73+
status: import("hono/utils/http-status").ContentfulStatusCode;
7374
};
7475
}>;
7576
};
@@ -81,18 +82,18 @@ declare const client: {
8182
$post: {
8283
input: {
8384
form: {
84-
password: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
85-
name: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
86-
username: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
87-
email: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
85+
password: string;
86+
name: string;
87+
username: string;
88+
email: string;
8889
};
8990
};
9091
output: {
9192
message: string;
9293
status: boolean;
9394
};
9495
outputFormat: "json";
95-
status: import("hono/utils/http-status").StatusCode;
96+
status: import("hono/utils/http-status").ContentfulStatusCode;
9697
};
9798
}>;
9899
};
@@ -104,16 +105,16 @@ declare const client: {
104105
$post: {
105106
input: {
106107
form: {
107-
username: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
108-
otp: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
108+
username: string;
109+
otp: string;
109110
};
110111
};
111112
output: {
112113
message: string;
113114
status: boolean;
114115
};
115116
outputFormat: "json";
116-
status: import("hono/utils/http-status").StatusCode;
117+
status: import("hono/utils/http-status").ContentfulStatusCode;
117118
};
118119
}>;
119120
};
@@ -126,7 +127,7 @@ declare const client: {
126127
$post: {
127128
input: {
128129
form: {
129-
username: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
130+
username: string;
130131
};
131132
};
132133
output: {
@@ -135,7 +136,7 @@ declare const client: {
135136
username: string;
136137
};
137138
outputFormat: "json";
138-
status: import("hono/utils/http-status").StatusCode;
139+
status: import("hono/utils/http-status").ContentfulStatusCode;
139140
};
140141
}>;
141142
};
@@ -151,7 +152,7 @@ declare const client: {
151152
status: boolean;
152153
};
153154
outputFormat: "json";
154-
status: import("hono/utils/http-status").StatusCode;
155+
status: import("hono/utils/http-status").ContentfulStatusCode;
155156
};
156157
}>;
157158
};
@@ -169,7 +170,7 @@ declare const client: {
169170
};
170171
};
171172
outputFormat: "json";
172-
status: import("hono/utils/http-status").StatusCode;
173+
status: import("hono/utils/http-status").ContentfulStatusCode;
173174
};
174175
}>;
175176
};
@@ -196,7 +197,7 @@ declare const client: {
196197
};
197198
};
198199
outputFormat: "json";
199-
status: import("hono/utils/http-status").StatusCode;
200+
status: import("hono/utils/http-status").ContentfulStatusCode;
200201
};
201202
}>;
202203
};
@@ -207,15 +208,15 @@ declare const client: {
207208
$post: {
208209
input: {
209210
form: {
210-
device: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
211+
device: string;
211212
};
212213
};
213214
output: {
214215
status: boolean;
215216
message: string;
216217
};
217218
outputFormat: "json";
218-
status: import("hono/utils/http-status").StatusCode;
219+
status: import("hono/utils/http-status").ContentfulStatusCode;
219220
};
220221
}>;
221222
};
@@ -232,7 +233,7 @@ declare const client: {
232233
message: string;
233234
};
234235
outputFormat: "json";
235-
status: import("hono/utils/http-status").StatusCode;
236+
status: import("hono/utils/http-status").ContentfulStatusCode;
236237
};
237238
}>;
238239
};
@@ -250,7 +251,7 @@ declare const client: {
250251
message: string;
251252
};
252253
outputFormat: "json";
253-
status: import("hono/utils/http-status").StatusCode;
254+
status: import("hono/utils/http-status").ContentfulStatusCode;
254255
};
255256
}>;
256257
};
@@ -284,7 +285,7 @@ declare const client: {
284285
}[];
285286
};
286287
outputFormat: "json";
287-
status: import("hono/utils/http-status").StatusCode;
288+
status: import("hono/utils/http-status").ContentfulStatusCode;
288289
};
289290
}>;
290291
};
@@ -298,15 +299,15 @@ declare const client: {
298299
$post: {
299300
input: {
300301
form: {
301-
id: import("hono/types").ParsedFormValue | import("hono/types").ParsedFormValue[];
302+
id: string;
302303
};
303304
};
304305
output: {
305306
message: string;
306307
status: boolean;
307308
};
308309
outputFormat: "json";
309-
status: import("hono/utils/http-status").StatusCode;
310+
status: import("hono/utils/http-status").ContentfulStatusCode;
310311
};
311312
}>;
312313
};
@@ -320,19 +321,19 @@ declare const client: {
320321
input: {
321322
json: {
322323
version: string;
323-
features: string[];
324324
versionCode: number;
325+
features: string[];
326+
criticalVersionCode: number;
325327
updateSize: string;
326-
forceUpdate?: boolean | undefined;
327328
};
328329
};
329330
output: {
330331
message: string;
331332
status: boolean;
332-
data: null;
333+
data: any;
333334
};
334335
outputFormat: "json";
335-
status: import("hono/utils/http-status").StatusCode;
336+
status: import("hono/utils/http-status").ContentfulStatusCode;
336337
};
337338
}>;
338339
};
@@ -347,7 +348,7 @@ declare const client: {
347348
status: boolean;
348349
};
349350
outputFormat: "json";
350-
status: import("hono/utils/http-status").StatusCode;
351+
status: import("hono/utils/http-status").ContentfulStatusCode;
351352
};
352353
}>;
353354
};
@@ -360,7 +361,7 @@ declare const client: {
360361
status: boolean;
361362
};
362363
outputFormat: "json";
363-
status: import("hono/utils/http-status").StatusCode;
364+
status: import("hono/utils/http-status").ContentfulStatusCode;
364365
};
365366
}>;
366367
};

src/screens/Home/CheckVersion.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,25 @@ export default function CheckVersion({ navigation }: NavProp) {
1313

1414
const setVersion = versionStore((state) => state.setVersion)
1515

16+
1617
useEffect(() => {
1718
if (data && data.status) {
18-
const isNew = APP_VERSION_CODE < data.data?.versionCode
19+
const isForceUpdate = APP_VERSION_CODE < data.data?.criticalVersionCode
20+
21+
// Update the local version store
1922
setVersion({
2023
features: data.data?.features,
21-
forceUpdate: data.data?.forceUpdate,
2224
size: data.data?.size,
2325
version: data.data?.version,
2426
versionCode: data.data?.versionCode,
27+
criticalVersionCode: data.data?.criticalVersionCode,
2528
})
26-
if (isNew) {
27-
console.log('New Version Available')
28-
if (data.data?.forceUpdate) {
29-
console.log('Force Update')
30-
navigation.reset({
31-
index: 0,
32-
routes: [{ name: 'Update', params: data.data }],
33-
})
34-
} else {
35-
console.log('Update Available')
36-
}
29+
30+
if (isForceUpdate) {
31+
navigation.reset({
32+
index: 0,
33+
routes: [{ name: 'Update', params: data.data ?? {} }],
34+
})
3735
}
3836
}
3937
}, [data, navigation, setVersion])

0 commit comments

Comments
 (0)