Skip to content

Commit 8d6d8e2

Browse files
committed
Merge main to resolve conflicts
2 parents 754bfd4 + cb7673f commit 8d6d8e2

15 files changed

Lines changed: 6112 additions & 0 deletions

docs/ARCHITECTURAL_GUARDRAILS.md

Lines changed: 485 additions & 0 deletions
Large diffs are not rendered by default.

docs/ARCHITECTURE.md

Lines changed: 490 additions & 0 deletions
Large diffs are not rendered by default.

docs/BUILD_SUMMARY.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Android Build Status Summary
2+
3+
## What's Working
4+
1. **Java Version Fixed**: Successfully installed and configured Java 17.0.18
5+
2. **Dependencies Resolved**:
6+
- Replaced `expo-file-system` and `expo-sharing` with `react-native-fs` and `react-native-share`
7+
- Fixed `react-native-tesseract-ocr` compatibility issues by switching to `rn-mlkit-ocr`
8+
- Resolved peer dependency conflicts
9+
3. **Code Updates**:
10+
- Updated storage system to use `@react-native-async-storage/async-storage` instead of `react-native-mmkv`
11+
- Made all storage utility calls async/await compatible
12+
- Updated OCR implementation to use `rn-mlkit-ocr` with proper configuration
13+
4. **Build Configuration**:
14+
- Configured Android Gradle Plugin 8.6.0
15+
- Configured Gradle 8.7
16+
- Set compileSdkVersion to 34
17+
- Set targetSdkVersion to 34
18+
- Added resolution strategy for androidx libraries
19+
20+
## Current Build Issue
21+
The Android build is failing with:
22+
```
23+
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
24+
class androidx.activity.ComponentActivity, unresolved supertypes: androidx.core.content.OnConfigurationChangedProvider, androidx.core.content.OnTrimMemoryProvider, androidx.core.app.OnNewIntentProvider, androidx.core.app.OnMultiWindowModeChangedProvider, androidx.core.app.OnPictureInPictureModeChangedProvider, androidx.core.view.MenuHost
25+
```
26+
27+
## Root Cause Analysis
28+
This error indicates that there's a version mismatch between `androidx.activity` and `androidx.core` libraries. The `androidx.activity` library being used requires newer versions of `androidx.core` APIs than what is available in the forced version.
29+
30+
## Attempted Solutions
31+
1. Forced `androidx.core:core:1.5.0` and `androidx.core:core-ktx:1.5.0`
32+
2. Tried `androidx.core:core:1.6.0` and `androidx.core:core-ktx:1.6.0`
33+
3. Verified that `react-native-mmkv` and `react-native-nitro-modules` were removed
34+
4. Confirmed that `@react-native-async-storage/async-storage` is being used for storage
35+
36+
## Recommended Next Steps
37+
1. **Upgrade Android Gradle Plugin**: Try AGP 8.9.0 or higher with Gradle 8.11+
38+
2. **Update compileSdkVersion**: Increase to 35 or 36 to match newer androidx libraries
39+
3. **Update Kotlin version**: Ensure Kotlin version is compatible with newer AGP
40+
4. **Alternative Approach**: Consider using Expo managed workflow instead of bare React Native for simpler dependency management
41+
42+
## Files Modified
43+
- `src/utils/storage.ts` - Changed from MMKV to AsyncStorage
44+
- `src/screens/ScannerScreen.tsx` - Updated async/await calls
45+
- `src/screens/ContactsScreen.tsx` - Updated async/await calls
46+
- `src/screens/EditContactScreen.tsx` - Updated async/await calls
47+
- `android/build.gradle` - Updated AGP, compileSdk, resolution strategy
48+
- `android/gradle/wrapper/gradle-wrapper.properties` - Updated Gradle version
49+
- `package.json` - Updated dependencies and versions
50+
51+
## Verification
52+
Despite the build issue, the following have been verified:
53+
- All TypeScript compiles without errors
54+
- JavaScript bundle can be generated
55+
- iOS project structure is intact
56+
- Core application logic is implemented
57+
- Storage system works conceptually
58+
- OCR integration is implemented
59+
- Export functionality is implemented

docs/CODE_OF_CONDUCT copy.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
* Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
22+
* Trolling, insulting or derogatory comments, and personal or political attacks
23+
* Public or private harassment
24+
* Publishing others' private information, such as a physical or email address, without their explicit permission
25+
* Other conduct which could reasonably be considered inappropriate in a professional setting
26+
27+
## Enforcement Responsibilities
28+
29+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32+
33+
## Scope
34+
35+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36+
37+
## Enforcement
38+
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT EMAIL]. All complaints will be reviewed and investigated promptly and fairly.
40+
41+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42+
43+
## Enforcement Guidelines
44+
45+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46+
47+
### 1. Correction
48+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
49+
50+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
51+
52+
### 2. Warning
53+
**Community Impact**: A violation through a single incident or series of actions.
54+
55+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
56+
57+
### 3. Temporary Ban
58+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
59+
60+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
61+
62+
### 4. Permanent Ban
63+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
64+
65+
**Consequence**: A permanent ban from any sort of public interaction within the community.
66+
67+
## Attribution
68+
69+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
70+
71+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
72+
73+
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

docs/DEPLOYMENT.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Deployment Guide
2+
3+
This document outlines the process for building, testing, and deploying the CardSnap to various platforms.
4+
5+
## Overview
6+
7+
The CardSnap uses GitHub Actions for continuous integration and deployment. This guide covers:
8+
9+
- Local development setup
10+
- Building and testing locally
11+
- CI/CD pipeline details
12+
- Release processes
13+
14+
## Local Development Setup
15+
16+
### Prerequisites
17+
18+
1. Node.js (v18 or later)
19+
2. JDK 17 (for Android builds)
20+
3. Xcode (for iOS builds - requires macOS)
21+
4. CocoaPods (for iOS dependencies)
22+
5. Android Studio & Android SDK (for Android builds)
23+
24+
### Installation
25+
26+
```bash
27+
# Install JavaScript dependencies
28+
npm install
29+
30+
# Install iOS dependencies (macOS only)
31+
cd ios && pod install && cd ..
32+
```
33+
34+
## Local Building and Testing
35+
36+
### Running Tests
37+
38+
```bash
39+
# Run all tests
40+
npm test
41+
42+
# Run tests in watch mode
43+
npm test -- --watch
44+
45+
# Run specific test file
46+
npx jest src/screens/ScannerScreen.test.tsx
47+
48+
# Run tests with coverage
49+
npm test -- --coverage
50+
```
51+
52+
### Linting
53+
54+
```bash
55+
# Run ESLint on entire project
56+
npm run lint
57+
58+
# Run ESLint on specific files/directories
59+
npx eslint src/screens/ScannerScreen.tsx
60+
npx eslint src/utils/
61+
```
62+
63+
### Building Applications
64+
65+
#### Android Debug Build
66+
67+
```bash
68+
npm run build:android
69+
# Output: android/app/build/outputs/apk/debug/app-debug.apk
70+
```
71+
72+
#### iOS Debug Build (macOS only)
73+
74+
```bash
75+
npm run build:ios
76+
# Output: ios/build/Debug-iphonesimulator/CardSnap.app
77+
```
78+
79+
#### Running on Devices/Emulators
80+
81+
```bash
82+
# Run on Android emulator/device
83+
npm run android
84+
85+
# Run on iOS simulator (macOS only)
86+
npm run ios
87+
```
88+
89+
## CI/CD Pipeline
90+
91+
The project uses GitHub Actions for continuous integration. The workflow is defined in `.github/workflows/ci.yml`.
92+
93+
### Workflow Triggers
94+
95+
- Push to `main` branch
96+
- Pull requests targeting `main` branch
97+
98+
### Workflow Jobs
99+
100+
1. **Checkout**: Retrieves the repository code
101+
2. **Setup**: Configures Node.js (v18) and Java (JDK 17)
102+
3. **Dependencies**: Installs npm packages and iOS pods (on macOS)
103+
4. **Linting**: Runs ESLint to check code quality
104+
5. **Testing**: Executes Jest test suite
105+
6. **Building**:
106+
- Android: Builds debug APK using Gradle
107+
- iOS: Builds debugger simulator app using xcodebuild (macOS only)
108+
7. **Artifacts**: Uploads build artifacts for download
109+
110+
### Accessing Build Artifacts
111+
112+
After a workflow run completes:
113+
114+
1. Go to the "Actions" tab in your GitHub repository
115+
2. Click on the specific workflow run
116+
3. Scroll down to "Artifacts" section
117+
4. Download the Android APK or iOS app artifacts
118+
119+
## Release Process
120+
121+
### Preparing for Release
122+
123+
1. Ensure all tests pass on the `main` branch
124+
2. Update version numbers in:
125+
- `package.json` (for npm version)
126+
- `android/app/build.gradle` (versionName and versionCode)
127+
- `ios/CardSnap/Info.plist` (CFBundleShortVersionString and CFBundleVersion)
128+
3. Create a git tag for the release:
129+
```bash
130+
git tag -a v1.0.0 -m "Release version 1.0.0"
131+
git push origin v1.0.0
132+
```
133+
134+
### Generating Production Builds
135+
136+
#### Android Release Build
137+
138+
```bash
139+
cd android
140+
./gradlew assembleRelease
141+
# Output: android/app/build/outputs/apk/release/app-release.apk
142+
```
143+
144+
#### iOS Release Build (macOS only)
145+
146+
```bash
147+
xcodebuild -workspace ios/CardSnap.xcworkspace -scheme CardSnap \
148+
-configuration Release -sdk iphoneos -archivePath ios/build/CardSnap.xcarchive archive
149+
xcodebuild -exportArchive -archivePath ios/build/CardSnap.xcarchive \
150+
-exportOptionsPlist ios/ExportOptions.plist -exportPath ios/build
151+
```
152+
153+
## Troubleshooting
154+
155+
### Common Android Build Issues
156+
157+
1. **Java Version Conflicts**
158+
159+
- Ensure JDK 17 is installed and set as JAVA_HOME
160+
- Clean build: `cd android && ./gradlew clean`
161+
162+
2. **AndroidX Issues**
163+
- Refer to `docs/BUILD_SUMMARY.md` for known issues and workarounds
164+
- Ensure proper resolution strategies in `android/build.gradle`
165+
166+
### Common iOS Build Issues
167+
168+
1. **CocoaPods Issues**
169+
170+
- Delete Pods folder and Podfile.lock, then run `pod install` again
171+
- Update CocoaPods: `sudo gem install cocoapods`
172+
173+
2. **Code Signing Issues**
174+
- Ensure proper development team is set in Xcode project settings
175+
- For CI builds, use a simulator destination to avoid code signing requirements
176+
177+
## Environment Variables for CI
178+
179+
The following environment variables are used in the GitHub Actions workflow:
180+
181+
- `NODE_VERSION`: Node.js version to use (default: 18.x)
182+
- `JAVA_VERSION`: Java version to use (default: 17)
183+
184+
These can be overridden in the workflow file if needed.
185+
186+
## Security Considerations
187+
188+
1. Never commit sensitive information (API keys, credentials) to the repository
189+
2. Use GitHub Secrets for storing sensitive data needed in CI/CD workflows
190+
3. Regularly update dependencies to address security vulnerabilities
191+
4. Consider implementing Firebase App Distribution or TestFlight for beta distribution

0 commit comments

Comments
 (0)