Skip to content

Commit 6ab1370

Browse files
committed
workin
1 parent a6b942e commit 6ab1370

38 files changed

Lines changed: 2016 additions & 907 deletions

App.tsx

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,72 @@
1-
/**
2-
* FILE: App.tsx
3-
* ROOT ENTRY POINT
4-
* -------------------------------------------------------
5-
* WRAPS:
6-
* - ThemeProvider (light/dark)
7-
* - i18n initialization
8-
* - NavigationContainer
9-
* - RootNavigator
10-
* -------------------------------------------------------
11-
*/
1+
// FILE: App.tsx
2+
// ROOT ENTRY POINT
3+
// -------------------------------------------------------
4+
// WRAPS:
5+
// - ThemeProvider (light/dark)
6+
// - i18n initialization (side-effect import)
7+
// - React Query (persisted via MMKV)
8+
// - NavigationContainer
9+
// - RootNavigator
10+
// - OfflineBanner
11+
// -------------------------------------------------------
1212

1313
import React from 'react';
1414
import { NavigationContainer } from '@react-navigation/native';
1515

1616
// THEME
1717
import { ThemeProvider } from '@/core/theme/ThemeProvider';
1818

19-
// i18n (auto-init)
19+
// i18n (auto-init via side-effect)
2020
import '@/core/i18n/i18n';
21-
import RootNavigator from './src/app/navigation/root/root-navigator';
2221

23-
// NAVIGATION ROOT
22+
// NAVIGATION ROOT + helpers
23+
import RootNavigator from '@/app/navigation/root/root-navigator';
24+
import { navigationRef } from '@/app/navigation/helpers/navigation-helpers';
25+
import { useBackButtonHandler } from '@/app/navigation/helpers/use-back-handler';
26+
import { ROUTES } from '@/app/navigation/routes';
27+
28+
// REACT QUERY (persisted)
29+
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
30+
import { createQueryClient } from '@/infra/query/client/query-client';
31+
import { mmkvPersister } from '@/infra/query/persistence/mmkv-persister';
32+
33+
// OFFLINE/SYNC: wire QueryClient + tag maps + NetInfo bridge
34+
import { initNetInfoBridge } from '@/infra/network/netinfo';
35+
import {
36+
setQueryClientForSync,
37+
setTagMapsForSync,
38+
} from '@/infra/offline/sync-engine';
39+
import { authKeys } from '@/features/auth/api/keys';
40+
import { userKeys } from '@/features/user/api/keys';
41+
42+
// Global offline UI
43+
import { OfflineBanner } from '@/app/components/OfflineBanner';
44+
45+
// Create client once
46+
const queryClient = createQueryClient();
47+
setQueryClientForSync(queryClient);
48+
setTagMapsForSync([authKeys.tagMap, userKeys.tagMap]);
49+
initNetInfoBridge();
2450

2551
export default function App() {
52+
// Android back button handling (exit only on root tabs)
53+
useBackButtonHandler(routeName => {
54+
return routeName === ROUTES.HOME_TABS || routeName === ROUTES.TAB_HOME;
55+
});
56+
2657
return (
2758
<ThemeProvider>
28-
<NavigationContainer>
29-
<RootNavigator />
30-
</NavigationContainer>
59+
<PersistQueryClientProvider
60+
client={queryClient}
61+
persistOptions={{ persister: mmkvPersister }}
62+
>
63+
{/* Global offline status banner */}
64+
<OfflineBanner />
65+
66+
<NavigationContainer ref={navigationRef}>
67+
<RootNavigator />
68+
</NavigationContainer>
69+
</PersistQueryClientProvider>
3170
</ThemeProvider>
3271
);
3372
}

android/gradle.properties

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
11
# Project-wide Gradle settings.
22

3-
# IDE (e.g. Android Studio) users:
4-
# Gradle settings configured through the IDE *will override*
5-
# any settings specified in this file.
3+
# Specifies the JVM arguments used for the daemon process.
4+
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
65

7-
# For more details on how to configure your build environment visit
8-
# http://www.gradle.org/docs/current/userguide/build_environment.html
6+
# Gradle optimizations
7+
org.gradle.parallel=true
8+
org.gradle.configureondemand=true
9+
org.gradle.daemon=true
10+
org.gradle.caching=true
911

10-
# Specifies the JVM arguments used for the daemon process.
11-
# The setting is particularly useful for tweaking memory settings.
12-
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13-
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14-
15-
# When configured, Gradle will run in incubating parallel mode.
16-
# This option should only be used with decoupled projects. More details, visit
17-
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
19-
20-
# AndroidX package structure to make it clearer which packages are bundled with the
21-
# Android operating system, and which are packaged with your app's APK
22-
# https://developer.android.com/topic/libraries/support-library/androidx-rn
12+
# AndroidX package structure
2313
android.useAndroidX=true
14+
android.enableJetifier=true
2415

25-
# Use this property to specify which architecture you want to build.
26-
# You can also override it from the CLI using
27-
# ./gradlew <task> -PreactNativeArchitectures=x86_64
28-
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
16+
# React Native architectures
17+
reactNativeArchitectures=arm64-v8a,x86,x86_64
2918

30-
# Use this property to enable support to the new architecture.
31-
# This will allow you to use TurboModules and the Fabric render in
32-
# your application. You should enable this flag either if you want
33-
# to write custom TurboModules/Fabric components OR use libraries that
34-
# are providing them.
19+
# New Architecture (required for RN 0.82)
3520
newArchEnabled=true
3621

37-
# Use this property to enable or disable the Hermes JS engine.
38-
# If set to false, you will be using JSC instead.
22+
# Hermes JS engine
3923
hermesEnabled=true
4024

41-
# Use this property to enable edge-to-edge display support.
42-
# This allows your app to draw behind system bars for an immersive UI.
43-
# Note: Only works with ReactActivity and should not be used with custom Activity.
25+
# Edge-to-edge display
4426
edgeToEdgeEnabled=false
27+
28+
# Additional Android settings
29+
android.defaults.buildfeatures.buildconfig=true
30+
android.nonTransitiveRClass=false
31+
android.nonFinalResIds=false

docs/TODO.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
New react components
3+
1. <Activity> - wrapper which show / hide elements but remains the state
4+
2. <Suspense> - loading until promise is resolved ( TanQuery )
5+
3. <ErrorBoundary> - catch errors in child components and show fallback UI
6+
4. <Portal> - render children into a DOM node that exists outside the DOM hierarchy of the parent component
7+
5. <LazyLoad> - load components only when they are visible in viewport
8+
9+
10+
Advanced typescript features
11+
1. Conditional types
12+
2. Mapped types
13+
3. infer
14+
4. Generics
15+
5. Utility Types
16+
a. Exclude - exclude specific types from union (type A = Exclude<"a" | "b" | "c", "a">)
17+
b. Extract - extract specific types from union (type B = Extract<"a" | "b" | "c", "a" | "c">)
18+
c. NonNullable - exclude null and undefined from type (type C = NonNullable<string | number | null | undefined>)
19+
d. Pick - pick specific fields from type (user: Pick<User, "name" | "age")
20+
d. Omit - remove specific fields from type (user: Omit<User, "password">)
21+
e. Record - create object type with specific keys and values type (Record<string, number>)
22+
f. Partial - make all fields optional (user: Partial<User>)
23+
g. Required - make all fields required (user: Required<User>)
24+
h. Readonly - make all fields readonly (user: Readonly<User>) - Object.freeze()
25+
i. ReturnType - get return type of function ()
26+
j. Parameters - get parameters type of function
27+
k. keyof - get keys of type as union
28+
k. Extract - extract specific types from union (type B = Extract<User, "name" | "age">)
29+
l. Exclude - exclude specific types from union
30+

0 commit comments

Comments
 (0)