Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix build on ios

ammarahm-eda4b2e33c3b40
diff --git a/apps/mobile/.gitignore b/apps/mobile/.gitignore
index 26c428804..62e455435 100644
--- a/apps/mobile/.gitignore
+++ b/apps/mobile/.gitignore
@@ -1,15 +1,17 @@
+.yarnrc.yml
+artifacts/
# OSX
#
.DS_Store
*Issues.md
-
build_cache/
+#
.yarnrc
.npmrc
-yarnrc.yml
+.yarnrc.yml
.yarn
-artifacts/
+
# Xcode
#
diff --git a/apps/mobile/README.md b/apps/mobile/README.md
index 03797d968..434cf5470 100644
--- a/apps/mobile/README.md
+++ b/apps/mobile/README.md
@@ -74,7 +74,13 @@ yarn install
## Running the app on Android
-[Setup an android emulator from Android studio](https://developer.android.com/studio/run/managing-avds) if you haven't already and run the following command from project root.
+[Setup an android emulator from Android studio](https://developer.android.com/studio/run/managing-avds) if you haven't already and run the following command from `native/` folder.
+
+```
+cd native
+```
+
+and
```
yarn run-android
@@ -84,7 +90,13 @@ If you want to run the app on your phone, make sure to [enable USB debugging](ht
## Running the app on iOS
-To run the app on iOS, simply run the following command from project root.
+To run the app on iOS, simply run the following command from `native/` folder.
+
+```
+cd native
+```
+
+and
```
yarn run-ios
diff --git a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj
index c1d3d3d44..8fc313886 100644
--- a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj
+++ b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj
@@ -451,7 +451,7 @@
65B5013C25A672B200E2D264 /* Sources */,
65B5013D25A672B200E2D264 /* Frameworks */,
65B5013E25A672B200E2D264 /* Resources */,
- 658D06A625A7446E008C70C0 /* ShellScript */,
+ 658D06A625A7446E008C70C0 /* Run Script */,
E81EC4451F76606456BCA61F /* [CP] Copy Pods Resources */,
);
buildRules = (
@@ -722,7 +722,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
- 658D06A625A7446E008C70C0 /* ShellScript */ = {
+ 658D06A625A7446E008C70C0 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 12;
@@ -732,6 +732,7 @@
);
inputPaths = (
);
+ name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
diff --git a/apps/mobile/native/package.json b/apps/mobile/native/package.json
index e27bb98ce..e470489aa 100644
--- a/apps/mobile/native/package.json
+++ b/apps/mobile/native/package.json
@@ -1,11 +1,11 @@
{
"name": "native",
"private": true,
- "main": "./index.js",
+ "main": "index.js",
"scripts": {
"run-android": "REACT_NATIVE_DEPENDENCIES=$HOME/Repos/notesnook-mobile/rn-build-deps/ react-native run-android --active-arch-only",
"release": "react-native run-android --variant=release",
- "ios": "react-native run-ios",
+ "run-ios": "react-native run-ios",
"start": "react-native start",
"repack": "react-native webpack-start",
"test": "jest --forceExit",
@@ -31,7 +31,7 @@
"@sayem314/react-native-keep-awake": "^1.0.4",
"deprecated-react-native-prop-types": "^2.3.0",
"react": "18.0.0",
- "react-native": "latest",
+ "react-native": "0.69.4",
"react-native-background-actions": "^2.6.6",
"react-native-begin-background-task": "https://github.com/blockfirm/react-native-begin-background-task.git",
"react-native-bootsplash": "^4.1.4",
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 397e37d24..d42d01775 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -8,7 +8,9 @@
],
"scripts": {
"postinstall": "yarn patch-package",
- "patch-lib": "./scripts/patch-package.sh"
+ "patch-lib": "./scripts/patch-package.sh",
+ "run-android": "cd native && REACT_NATIVE_DEPENDENCIES=$HOME/Repos/notesnook-mobile/rn-build-deps/ react-native run-android --active-arch-only",
+ "run-ios": "cd native && react-native run-ios"
},
"packageManager": "[email protected]",
"devDependencies": {
diff --git a/apps/mobile/patch-package.sh b/apps/mobile/patch-package.sh
index dd7f5a0f8..058ce23bb 100755
--- a/apps/mobile/patch-package.sh
+++ b/apps/mobile/patch-package.sh
@@ -1,7 +1,7 @@
mkdir tmp
cd tmp
npm init -y
-npm install --save "$1"
+npm install --save "$1@$2"
rsync -av --exclude "node_modules" --delete "../node_modules/$1/" "./node_modules/$1/"
npx patch-package "$1"
mkdir -p ../patches
diff --git a/apps/mobile/patches/jetifier+1.6.8.patch b/apps/mobile/patches/jetifier+1.6.8.patch
index 9c25dfc09..65a4c9b28 100644
--- a/apps/mobile/patches/jetifier+1.6.8.patch
+++ b/apps/mobile/patches/jetifier+1.6.8.patch
@@ -1,22 +1,8 @@
-diff --git a/node_modules/jetifier/CHANGELOG.md b/node_modules/jetifier/CHANGELOG.md
-index 98ea607..4b64dd1 100644
---- a/node_modules/jetifier/CHANGELOG.md
-+++ b/node_modules/jetifier/CHANGELOG.md
-@@ -1,9 +1,5 @@
- # Changelog
-
--## 2.0.0
--
--- this is equivalent to version 1.6.7. No functional change, but it emits deprecation on console.warn
--
- ## 1.6.8
-
- - revert deprecation notice.
diff --git a/node_modules/jetifier/index.js b/node_modules/jetifier/index.js
-index a8431a2..ed609e9 100644
+index ae3979c..ed609e9 100644
--- a/node_modules/jetifier/index.js
+++ b/node_modules/jetifier/index.js
-@@ -6,12 +6,11 @@ const cpus = require('os').cpus().length;
+@@ -6,7 +6,7 @@ const cpus = require('os').cpus().length;
const arg = process.argv.slice(2)[0];
const mode = arg && ((arg === 'reverse') || (arg === '-r')) ? 'reverse' : 'forward';
@@ -25,20 +11,3 @@ index a8431a2..ed609e9 100644
const classesMapping = getClassesMapping();
const files = readDir(SEARCH_DIR);
-
--console.warn('Jetifier is deprecated. Future versions of react-native CLI may not run it by default.')
- console.log(`Jetifier found ${files.length} file(s) to ${mode}-jetify. Using ${cpus} workers...`);
-
- for (const filesChunk of chunk(files, cpus)) {
-diff --git a/node_modules/jetifier/src/worker.js b/node_modules/jetifier/src/worker.js
-index 1ebc758..10e42cc 100644
---- a/node_modules/jetifier/src/worker.js
-+++ b/node_modules/jetifier/src/worker.js
-@@ -6,7 +6,6 @@ process.on('message', ({ filesChunk, classesMapping, mode }) => {
- let data = readFileSync(file, { encoding: 'utf8' });
- for (const [oldClass, newClass] of classesMapping) {
- if (data.includes(mode === 'forward' ? oldClass : newClass)) {
-- console.warn(`Jetifier: propose an AndroidX conversion PR to this repository: ${file}`)
- data = mode === 'forward' ?
- data.replace(new RegExp(oldClass, 'g'), newClass) :
- data.replace(new RegExp(newClass, 'g'), oldClass);
diff --git a/apps/mobile/patches/react-native+0.69.4.patch b/apps/mobile/patches/react-native+0.69.4.patch
index 141c77d46..ee086ff02 100644
--- a/apps/mobile/patches/react-native+0.69.4.patch
+++ b/apps/mobile/patches/react-native+0.69.4.patch
@@ -1,31 +1,5 @@
-diff --git a/node_modules/react-native/scripts/packager.sh b/node_modules/react-native/scripts/packager.sh
-index b9f9016..bf4c76a 100755
---- a/node_modules/react-native/scripts/packager.sh
-+++ b/node_modules/react-native/scripts/packager.sh
-@@ -8,7 +8,7 @@
- THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
- REACT_NATIVE_ROOT="$THIS_DIR/.."
- # Application root directory - General use case: react-native is a dependency
--PROJECT_ROOT="$THIS_DIR/../../.."
-+PROJECT_ROOT="$THIS_DIR/../../../native"
-
- # check and assign NODE_BINARY env
- # shellcheck disable=SC1090
-diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh
-index 6f95a29..900313c 100755
---- a/node_modules/react-native/scripts/react-native-xcode.sh
-+++ b/node_modules/react-native/scripts/react-native-xcode.sh
-@@ -60,7 +60,7 @@ esac
- REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
- # The project should be located next to where react-native is installed
- # in node_modules.
--PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."}
-+PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../native"}
-
- cd "$PROJECT_ROOT" || exit
-
diff --git a/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
-index 4536402..1a6d991 100644
+index 4536402..5ceaf65 100644
--- a/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
+++ b/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
@@ -82,6 +82,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
@@ -70,6 +44,46 @@ index f0f6402..d645d81 100644
CGFloat smallerOffset = 0.0;
CGFloat largerOffset = maximumOffset;
+diff --git a/node_modules/react-native/scripts/packager.sh b/node_modules/react-native/scripts/packager.sh
+index b9f9016..8859130 100755
+--- a/node_modules/react-native/scripts/packager.sh
++++ b/node_modules/react-native/scripts/packager.sh
+@@ -8,17 +8,17 @@
+ THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
+ REACT_NATIVE_ROOT="$THIS_DIR/.."
+ # Application root directory - General use case: react-native is a dependency
+-PROJECT_ROOT="$THIS_DIR/../../.."
++PROJECT_ROOT="$THIS_DIR/../../../native"
+
+ # check and assign NODE_BINARY env
+ # shellcheck disable=SC1090
+ source "${THIS_DIR}/node-binary.sh"
+
+ # When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
+-if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ];
+-then
+- PROJECT_ROOT="$THIS_DIR/.."
+-fi
++# if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ];
++# then
++# PROJECT_ROOT="$THIS_DIR/.."
++# fi
+ # Start packager from PROJECT_ROOT
+ cd "$PROJECT_ROOT" || exit
+ "$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start --custom-log-reporter-path "$THIS_DIR/packager-reporter.js" "$@"
+diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh
+index 6f95a29..900313c 100755
+--- a/node_modules/react-native/scripts/react-native-xcode.sh
++++ b/node_modules/react-native/scripts/react-native-xcode.sh
+@@ -60,7 +60,7 @@ esac
+ REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+ # The project should be located next to where react-native is installed
+ # in node_modules.
+-PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."}
++PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../native"}
+
+ cd "$PROJECT_ROOT" || exit
+
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index e7c59ad..1461d45 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
@@ -82,4 +96,4 @@ index e7c59ad..1461d45 100644
+ 'ios' => '12.0',
},
'source_files' => "**/*.{h,mm,cpp}",
- 'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
\ No newline at end of file
+ 'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
diff --git a/apps/mobile/yarn.lock b/apps/mobile/yarn.lock
index c629bbf1a..a962ce05f 100644
--- a/apps/mobile/yarn.lock
+++ b/apps/mobile/yarn.lock
@@ -11186,7 +11186,7 @@ __metadata:
metro-react-native-babel-preset: ^0.70.3
pixelmatch: ^5.3.0
react: 18.0.0
- react-native: latest
+ react-native: 0.69.4
react-native-background-actions: ^2.6.6
react-native-begin-background-task: "https://github.com/blockfirm/react-native-begin-background-task.git"
react-native-bootsplash: ^4.1.4
@@ -11387,6 +11387,7 @@ __metadata:
dependencies:
patch-package: ^6.4.7
postinstall-postinstall: ^2.1.0
+ react-native: 0.69.4
languageName: unknown
linkType: soft
@@ -13117,7 +13118,7 @@ __metadata:
languageName: node
linkType: hard
-"react-native@npm:latest":
+"react-native@npm:0.69.4":
version: 0.69.4
resolution: "react-native@npm:0.69.4"
dependencies: