Skip to content

Commit 1b9e9e9

Browse files
authored
build(major): release v2 (#482)
1 parent ffbd056 commit 1b9e9e9

File tree

94 files changed

+4304
-8776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4304
-8776
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup
2121
uses: ./.github/actions/setup
2222

23-
- name: Biome check
23+
- name: Lint check
2424
run: yarn lint
2525

2626
test:
@@ -46,109 +46,3 @@ jobs:
4646

4747
- name: Build package
4848
run: yarn prepare
49-
50-
# build-android:
51-
# runs-on: ubuntu-latest
52-
# env:
53-
# TURBO_CACHE_DIR: .turbo/android
54-
# steps:
55-
# - name: Checkout
56-
# uses: actions/checkout@v4
57-
58-
# - name: Setup
59-
# uses: ./.github/actions/setup
60-
61-
# - name: Cache turborepo for Android
62-
# uses: actions/cache@v4
63-
# with:
64-
# path: ${{ env.TURBO_CACHE_DIR }}
65-
# key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
66-
# restore-keys: |
67-
# ${{ runner.os }}-turborepo-android-
68-
69-
# - name: Check turborepo cache for Android
70-
# run: |
71-
# TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
72-
73-
# if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
74-
# echo "turbo_cache_hit=1" >> $GITHUB_ENV
75-
# fi
76-
77-
# - name: Install JDK
78-
# if: env.turbo_cache_hit != 1
79-
# uses: actions/setup-java@v4
80-
# with:
81-
# distribution: 'zulu'
82-
# java-version: '17'
83-
84-
# - name: Finalize Android SDK
85-
# if: env.turbo_cache_hit != 1
86-
# run: |
87-
# /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
88-
89-
# - name: Cache Gradle
90-
# if: env.turbo_cache_hit != 1
91-
# uses: actions/cache@v4
92-
# with:
93-
# path: |
94-
# ~/.gradle/wrapper
95-
# ~/.gradle/caches
96-
# key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
97-
# restore-keys: |
98-
# ${{ runner.os }}-gradle-
99-
100-
# - name: Build example for Android
101-
# env:
102-
# JAVA_OPTS: "-XX:MaxHeapSize=6g"
103-
# run: |
104-
# yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
105-
106-
# build-ios:
107-
# runs-on: macos-14
108-
# env:
109-
# TURBO_CACHE_DIR: .turbo/ios
110-
# steps:
111-
# - name: Checkout
112-
# uses: actions/checkout@v4
113-
114-
# - name: Setup
115-
# uses: ./.github/actions/setup
116-
117-
# - name: Cache turborepo for iOS
118-
# uses: actions/cache@v4
119-
# with:
120-
# path: ${{ env.TURBO_CACHE_DIR }}
121-
# key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
122-
# restore-keys: |
123-
# ${{ runner.os }}-turborepo-ios-
124-
125-
# - name: Check turborepo cache for iOS
126-
# run: |
127-
# TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
128-
129-
# if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
130-
# echo "turbo_cache_hit=1" >> $GITHUB_ENV
131-
# fi
132-
133-
# - name: Cache cocoapods
134-
# if: env.turbo_cache_hit != 1
135-
# id: cocoapods-cache
136-
# uses: actions/cache@v4
137-
# with:
138-
# path: |
139-
# **/ios/Pods
140-
# key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
141-
# restore-keys: |
142-
# ${{ runner.os }}-cocoapods-
143-
144-
# - name: Install cocoapods
145-
# if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
146-
# run: |
147-
# cd example/ios
148-
# pod install
149-
# env:
150-
# NO_FLIPPER: 1
151-
152-
# - name: Build example for iOS
153-
# run: |
154-
# yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ DerivedData
2828
*.ipa
2929
*.xcuserstate
3030
project.xcworkspace
31+
**/.xcode.env.local
3132

3233
# Android/IJ
3334
#
@@ -81,5 +82,8 @@ lib/
8182
ios/generated
8283
android/generated
8384

85+
# React Native Nitro Modules
86+
nitrogen/
87+
8488
# Coverage
85-
coverage/
89+
coverage/

.releaserc.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/f
1111
- The library package in the root directory.
1212
- An example app in the `example/` directory.
1313

14-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
14+
To get started with the project, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for the version used in this project.
15+
16+
Run `yarn` in the root directory to install the required dependencies for each package:
1517

1618
```sh
1719
yarn
1820
```
1921

20-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
22+
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development without manually migrating.
2123
2224
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
2325

2426
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
2527

26-
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ScreenshotAwareExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-screenshot-aware`.
28+
If you want to use Android Studio or Xcode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ScreenshotAwareExample.xcworkspace` in Xcode and find the source files at `Pods > Development Pods > react-native-screenshot-aware`.
2729

2830
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-screenshot-aware` under `Android`.
2931

@@ -47,29 +49,6 @@ To run the example app on iOS:
4749
yarn example ios
4850
```
4951

50-
By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following:
51-
52-
1. For Android, run:
53-
54-
```sh
55-
ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android
56-
```
57-
58-
2. For iOS, run:
59-
60-
```sh
61-
cd example/ios
62-
RCT_NEW_ARCH_ENABLED=1 pod install
63-
cd -
64-
yarn example ios
65-
```
66-
67-
If you are building for a different architecture than your previous build, make sure to remove the build folders first. You can run the following command to cleanup all build folders:
68-
69-
```sh
70-
yarn clean
71-
```
72-
7352
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
7453

7554
```sh
@@ -78,7 +57,13 @@ Running "ScreenshotAwareExample" with {"fabric":true,"initialProps":{"concurrent
7857

7958
Note the `"fabric":true` and `"concurrentRoot":true` properties.
8059

81-
Make sure your code passes Biome. Run the following to verify:
60+
Make sure your code passes TypeScript:
61+
62+
```sh
63+
yarn typecheck
64+
```
65+
66+
To check for linting errors, run the following:
8267

8368
```sh
8469
yarn lint
@@ -87,7 +72,7 @@ yarn lint
8772
To fix formatting errors, run the following:
8873

8974
```sh
90-
yarn lint:fix
75+
yarn lint --fix
9176
```
9277

9378
Remember to add tests for your change if possible. Run the unit tests by:
@@ -96,33 +81,16 @@ Remember to add tests for your change if possible. Run the unit tests by:
9681
yarn test
9782
```
9883

99-
### Commit message convention
100-
101-
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
102-
103-
- `fix`: bug fixes, e.g. fix crash due to deprecated method.
104-
- `feat`: new features, e.g. add new method to the module.
105-
- `refactor`: code refactor, e.g. migrate from class components to hooks.
106-
- `docs`: changes into documentation, e.g. add usage example for the module..
107-
- `test`: adding or updating tests, e.g. add integration tests using detox.
108-
- `chore`: tooling changes, e.g. change CI config.
109-
110-
Our pre-commit hooks verify that your commit message matches this format when committing.
111-
112-
### Linting and tests
113-
114-
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [Biome](https://biomejs.dev/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
11584

116-
Our pre-commit hooks verify that the linter and tests pass when committing.
11785

11886
### Scripts
11987

12088
The `package.json` file contains various scripts for common tasks:
12189

12290
- `yarn`: setup project by installing dependencies.
123-
- `yarn lint`: lint files with Biome.
124-
- `yarn lint:fix`: lint fix files with Biome.
125-
- `yarn test`: run unit tests with Jest.
91+
- `yarn typecheck`: type-check files with TypeScript.
92+
- `yarn lint`: lint files with [ESLint](https://eslint.org/).
93+
- `yarn test`: run unit tests with [Jest](https://jestjs.io/).
12694
- `yarn example start`: start the Metro server for the example app.
12795
- `yarn example android`: run the example app on Android.
12896
- `yarn example ios`: run the example app on iOS.
@@ -137,4 +105,4 @@ When you're sending a pull request:
137105
- Verify that linters and tests are passing.
138106
- Review the documentation to make sure it looks good.
139107
- Follow the pull request template when opening a pull request.
140-
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
108+
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Hugo EXTRAT
3+
Copyright (c) 2026 Hugo Extrat
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
66
in the Software without restriction, including without limitation the rights

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@
1010
Real-time screenshot detection for React Native apps
1111
</h3>
1212

13+
> **v2 is here:** Version 2 supports **only the New Architecture**. Versions older than v2 are **no longer maintained**.
14+
1315
## Features
1416

1517
- 🚀 Real-time screenshot detection
1618
- 🔄 Cross-platform support (iOS & Android)
1719
- 🎣 Easy-to-use React hooks
1820
- ⚡ Optimized for performance
1921
- 📱 Supports Android 14+ (API level 34+) and iOS 14+
20-
- 🏗️ Supports the new architecture for React Native
21-
22+
- 🏗️ New Architecture only
2223

2324
## Compatibility
2425

26+
- **v2:** New Architecture only. No legacy architecture support.
27+
- **v1.x and below:** **No longer maintained.**
2528
- React Native <0.76, use version 1.2.2 or below 1.2.0 of this package (1.2.1 is buggy)
2629
- React Native >=0.76, use version 1.3.0 or later
2730
- React Native >=0.79, use version 1.3.10 or later

ScreenshotAware.podspec

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
54

65
Pod::Spec.new do |s|
76
s.name = "ScreenshotAware"
@@ -14,29 +13,8 @@ Pod::Spec.new do |s|
1413
s.platforms = { :ios => min_ios_version_supported }
1514
s.source = { :git => "https://github.com/huextrat/react-native-screenshot-aware.git", :tag => "#{s.version}" }
1615

17-
s.source_files = "ios/**/*.{h,m,mm,cpp}"
18-
s.private_header_files = "ios/generated/**/*.h"
16+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17+
s.private_header_files = "ios/**/*.h"
1918

20-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22-
if respond_to?(:install_modules_dependencies, true)
23-
install_modules_dependencies(s)
24-
else
25-
s.dependency "React-Core"
26-
27-
# Don't install the dependencies when we run `pod install` in the old architecture.
28-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
29-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
30-
s.pod_target_xcconfig = {
31-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
32-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
33-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
34-
}
35-
s.dependency "React-Codegen"
36-
s.dependency "RCT-Folly"
37-
s.dependency "RCTRequired"
38-
s.dependency "RCTTypeSafety"
39-
s.dependency "ReactCommon/turbomodule/core"
40-
end
41-
end
19+
install_modules_dependencies(s)
4220
end

0 commit comments

Comments
 (0)