Skip to content

Commit 4f63648

Browse files
authored
Mobile module implementation (#472)
* feat(mobile-new): add Metro React Native app with demo mode * feat(mobile-new): refine demo app screens and theme support * refactor(mobile): move updated app into mobile folder * fix(mobile): correct monorepo package paths * docs(mobile): add Android build notes * fix(mobile): rename native app to DevCard * docs(mobile): clean up Android README
1 parent f355777 commit 4f63648

30 files changed

Lines changed: 14980 additions & 727 deletions

apps/mobile/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ gem 'bigdecimal'
1414
gem 'logger'
1515
gem 'benchmark'
1616
gem 'mutex_m'
17+
gem 'nkf'

apps/mobile/README.md

Lines changed: 76 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,97 @@
1-
# DevCard Mobile
1+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
22

3-
The mobile application for DevCard, built with bare **React Native** and **React Navigation**.
3+
# Getting Started
44

5-
This app provides:
6-
- Profile and context card management
7-
- Per-Platform OAuth Connections for silent API follows
8-
- Advanced analytics for tracking profile views
9-
- The Hybrid Follow Engine (API, WebView, Link)
5+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
106
11-
## Getting Started
7+
## Step 1: Start Metro
128

13-
> **Note**: Make sure you have completed the [React Native Environment Setup](https://reactnative.dev/docs/environment-setup) guide before proceeding.
9+
First, you will need to run **Metro**, the JavaScript build tool for React Native.
1410

15-
### Install Dependencies
11+
To start the Metro dev server, run the following command from the root of your React Native project:
1612

17-
```bash
18-
pnpm install
13+
```sh
14+
# Using npm
15+
npm start
16+
17+
# OR using Yarn
18+
yarn start
1919
```
2020

21-
### Start Metro Bundler
21+
## Step 2: Build and run your app
22+
23+
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
24+
25+
### Android
2226

23-
First, start Metro, the JavaScript bundler:
27+
```sh
28+
# Using npm
29+
npm run android
2430

25-
```bash
26-
pnpm start
31+
# OR using Yarn
32+
yarn android
2733
```
2834

29-
### Run on Android
35+
### iOS
3036

31-
In a new terminal:
37+
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
3238

33-
```bash
34-
pnpm android
39+
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
40+
41+
```sh
42+
bundle install
3543
```
3644

37-
### Run on iOS
45+
Then, and every time you update your native dependencies, run:
46+
47+
```sh
48+
bundle exec pod install
49+
```
3850

39-
For iOS, you must install CocoaPods dependencies first (Mac only):
51+
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
4052

41-
```bash
42-
cd ios && pod install && cd ..
43-
pnpm ios
53+
```sh
54+
# Using npm
55+
npm run ios
56+
57+
# OR using Yarn
58+
yarn ios
4459
```
4560

46-
## Architecture
61+
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
62+
63+
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
64+
65+
## Step 3: Modify your app
66+
67+
Now that you have successfully run the app, let's make changes!
68+
69+
Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
70+
71+
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
72+
73+
- **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
74+
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
75+
76+
## Congratulations! :tada:
77+
78+
You've successfully run and modified your React Native App. :partying_face:
79+
80+
### Now what?
81+
82+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
83+
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
84+
85+
# Troubleshooting
86+
87+
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
88+
89+
# Learn More
90+
91+
To learn more about React Native, take a look at the following resources:
4792

48-
- **Screens**: Located in `src/screens`
49-
- **Navigation**: Managed via `src/navigation/MainTabs.tsx`
50-
- **Context API**: Handles global authentication and token management
51-
- **Theme**: Tokens are strictly defined in `src/theme/tokens.ts`
93+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
94+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
95+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
96+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
97+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.

apps/mobile/android/README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# DevCard Android
2+
3+
Native Android project for the DevCard React Native app.
4+
5+
Use this folder for Android-specific Gradle builds, native configuration, emulator installs, and troubleshooting. For normal development, run commands from `apps/mobile` unless a command below says otherwise.
6+
7+
## Quick Start
8+
9+
Start Metro from `apps/mobile`:
10+
11+
```cmd
12+
npx react-native start --reset-cache
13+
```
14+
15+
Open a second terminal and run the Android app:
16+
17+
```cmd
18+
cd /d D:\DC\apps\mobile
19+
npx react-native run-android -- --active-arch-only
20+
```
21+
22+
`--active-arch-only` builds only the connected emulator/device architecture, which is much faster during local development.
23+
24+
## Requirements
25+
26+
- Node.js `>= 22.11.0`
27+
- Android Studio with Android SDK and emulator support
28+
- Java version compatible with the Android Gradle Plugin used by this project
29+
- npm dependencies installed from `apps/mobile`
30+
- An Android emulator running, or a physical device connected with USB debugging enabled
31+
32+
Install mobile dependencies from `apps/mobile`:
33+
34+
```cmd
35+
npm install --legacy-peer-deps
36+
```
37+
38+
## Useful Gradle Commands
39+
40+
Run these from `apps/mobile/android`.
41+
42+
Build a debug APK:
43+
44+
```cmd
45+
gradlew.bat app:packageDebug -PreactNativeArchitectures=x86_64
46+
```
47+
48+
Install the debug build on a connected emulator/device:
49+
50+
```cmd
51+
gradlew.bat app:installDebug -PreactNativeArchitectures=x86_64
52+
```
53+
54+
Get detailed output for a failing build:
55+
56+
```cmd
57+
gradlew.bat app:packageDebug --stacktrace -PreactNativeArchitectures=x86_64
58+
```
59+
60+
## Architecture Builds
61+
62+
`gradle.properties` currently sets:
63+
64+
```properties
65+
reactNativeArchitectures=x86_64
66+
```
67+
68+
This keeps Windows emulator builds smaller and faster. Override it when targeting another device architecture:
69+
70+
```cmd
71+
gradlew.bat app:packageDebug -PreactNativeArchitectures=arm64-v8a
72+
```
73+
74+
Use all common Android ABIs only when needed:
75+
76+
```cmd
77+
gradlew.bat app:packageDebug -PreactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
78+
```
79+
80+
## Troubleshooting
81+
82+
### Metro Watches `D:\packages`
83+
84+
If Metro reports `ENOENT` for `D:\packages`, check `apps/mobile/metro.config.js`. The monorepo root should resolve to `D:\DC`, not `D:\`.
85+
86+
### Gradle Fails At `:app:packageDebug`
87+
88+
Rerun the package task with `--stacktrace` so the real error appears:
89+
90+
```cmd
91+
gradlew.bat app:packageDebug --stacktrace -PreactNativeArchitectures=x86_64
92+
```
93+
94+
### Builds Are Slow
95+
96+
Use one of these faster local options:
97+
98+
- `npx react-native run-android -- --active-arch-only`
99+
- `gradlew.bat app:packageDebug -PreactNativeArchitectures=x86_64`
100+
101+
Avoid building every ABI unless you are preparing a broader test or release build.
102+
103+
### Windows Long Path Errors
104+
105+
If Windows reports paths longer than 260 characters, enable long paths from an Administrator PowerShell:
106+
107+
```powershell
108+
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
109+
```
110+
111+
Restart the terminal after changing this setting.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
5+
<application
6+
android:name=".MainApplication"
7+
android:label="@string/app_name"
8+
android:icon="@mipmap/ic_launcher"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:allowBackup="false"
11+
android:theme="@style/AppTheme"
12+
android:usesCleartextTraffic="${usesCleartextTraffic}"
13+
android:supportsRtl="true">
14+
<activity
15+
android:name=".MainActivity"
16+
android:label="@string/app_name"
17+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18+
android:launchMode="singleTask"
19+
android:windowSoftInputMode="adjustResize"
20+
android:exported="true">
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
</application>
27+
</manifest>

apps/mobile/android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ android.useAndroidX=true
2525
# Use this property to specify which architecture you want to build.
2626
# You can also override it from the CLI using
2727
# ./gradlew <task> -PreactNativeArchitectures=x86_64
28-
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
28+
reactNativeArchitectures=x86_64
2929

3030
# Use this property to enable support to the new architecture.
3131
# This will allow you to use TurboModules and the Fabric render in
3232
# your application. You should enable this flag either if you want
3333
# to write custom TurboModules/Fabric components OR use libraries that
3434
# are providing them.
35-
newArchEnabled=false
35+
newArchEnabled=true
3636

3737
# Use this property to enable or disable the Hermes JS engine.
3838
# If set to false, you will be using JSC instead.
718 Bytes
Binary file not shown.

apps/mobile/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

apps/mobile/android/gradlew

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/mobile/android/gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
22
plugins { id("com.facebook.react.settings") }
33
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4-
rootProject.name = 'com.devcard.app'
4+
rootProject.name = 'DevCard'
55
include ':app'
66
includeBuild('../node_modules/@react-native/gradle-plugin')

0 commit comments

Comments
 (0)