A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
clean build.gradle file
ammarahm-ed432f1c3e8829
diff --git a/apps/mobile/android/app/build.gradle b/apps/mobile/android/app/build.gradlenew file mode 100644index 000000000..9c9769192--- /dev/null+++ b/apps/mobile/android/app/build.gradle@@ -0,0 +1,373 @@+apply plugin: "com.android.application"+apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"++import com.android.build.OutputFile+import groovy.json.JsonSlurper+import org.apache.tools.ant.taskdefs.condition.Os+++/**+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets+ * and bundleReleaseJsAndAssets).+ * These basically call `react-native bundle` with the correct arguments during the Android build+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the+ * bundle directly from the development server. Below you can see all the possible configurations+ * and their defaults. If you decide to add a configuration block, make sure to add it before the+ * `apply from: "../../node_modules/react-native/react.gradle"` line.+ *+ * project.ext.react = [+ * // the name of the generated asset file containing your JS bundle+ * bundleAssetName: "index.android.bundle",+ *+ * // the entry file for bundle generation. If none specified and+ * // "index.android.js" exists, it will be used. Otherwise "index.js" is+ * // default. Can be overridden with ENTRY_FILE environment variable.+ * entryFile: "index.android.js",+ *+ * // https://reactnative.dev/docs/performance#enable-the-ram-format+ * bundleCommand: "ram-bundle",+ *+ * // whether to bundle JS and assets in debug mode+ * bundleInDebug: false,+ *+ * // whether to bundle JS and assets in release mode+ * bundleInRelease: true,+ *+ * // whether to bundle JS and assets in another build variant (if configured).+ * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants+ * // The configuration property can be in the following formats+ * // 'bundleIn${productFlavor}${buildType}'+ * // 'bundleIn${buildType}'+ * // bundleInFreeDebug: true,+ * // bundleInPaidRelease: true,+ * // bundleInBeta: true,+ *+ * // whether to disable dev mode in custom build variants (by default only disabled in release)+ * // for example: to disable dev mode in the staging build type (if configured)+ * devDisabledInStaging: true,+ * // The configuration property can be in the following formats+ * // 'devDisabledIn${productFlavor}${buildType}'+ * // 'devDisabledIn${buildType}'+ *+ * // the root of your project, i.e. where "package.json" lives+ * root: "../../",+ *+ * // where to put the JS bundle asset in debug mode+ * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",+ *+ * // where to put the JS bundle asset in release mode+ * jsBundleDirRelease: "$buildDir/intermediates/assets/release",+ *+ * // where to put drawable resources / React Native assets, e.g. the ones you use via+ * // require('./image.png')), in debug mode+ * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",+ *+ * // where to put drawable resources / React Native assets, e.g. the ones you use via+ * // require('./image.png')), in release mode+ * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",+ *+ * // by default the gradle tasks are skipped if none of the JS files or assets change; this means+ * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to+ * // date; if you have any other folders that you want to ignore for performance reasons (gradle+ * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/+ * // for example, you might want to remove it from here.+ * inputExcludes: ["android/**", "ios/**"],+ *+ * // override which node gets called and with what additional arguments+ * nodeExecutableAndArgs: ["node"],+ *+ * // supply additional arguments to the packager+ * extraPackagerArgs: []+ * ]+ */++project.ext.react = [+ enableHermes: true, // clean and rebuild if changing+ bundleCommand: "webpack-bundle",+ bundleInDebug: false+]++apply from: "../../node_modules/react-native/react.gradle"++/**+ * Set this to true to create two separate APKs instead of one:+ * - An APK that only works on ARM devices+ * - An APK that only works on x86 devices+ * The advantage is the size of the APK is reduced by about 4MB.+ * Upload all the APKs to the Play Store and people will download+ * the correct one based on the CPU architecture of their device.+ */+def enableSeparateBuildPerCPUArchitecture = true++/**+ * Run Proguard to shrink the Java bytecode in release builds.+ */+def enableProguardInReleaseBuilds = true++/**+ * The preferred build flavor of JavaScriptCore.+ *+ * For example, to use the international variant, you can use:+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`+ *+ * The international variant includes ICU i18n library and necessary data+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that+ * give correct results when using with locales other than en-US. Note that+ * this variant is about 6MiB larger per architecture than default.+ */+def jscFlavor = 'org.webkit:android-jsc:+'++/**+ * Whether to enable the Hermes VM.+ *+ * This should be set on project.ext.react and mirrored here. If it is not set+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode+ * and the benefits of using Hermes will therefore be sharply reduced.+ */+def enableHermes = project.ext.react.get("enableHermes", true);++++/**+ * Architectures to build native code for.+ */+def reactNativeArchitectures() {+ def value = project.getProperties().get("reactNativeArchitectures")+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]+}++def getNpmVersion() {+ def inputFile = file("$rootDir/../package.json")+ def jsonPackage = new JsonSlurper().parseText(inputFile.text)++ return jsonPackage["version"]+}+++android {+ compileSdkVersion rootProject.ext.compileSdkVersion+ ndkVersion rootProject.ext.ndkVersion+ compileOptions {+ sourceCompatibility JavaVersion.VERSION_1_8+ targetCompatibility JavaVersion.VERSION_1_8+ }++ defaultConfig {+ applicationId "com.streetwriters.notesnook"+ minSdkVersion rootProject.ext.minSdkVersion+ targetSdkVersion rootProject.ext.targetSdkVersion+ multiDexEnabled true+ versionCode 2010+ versionName getNpmVersion()+ testBuildType System.getProperty('testBuildType', 'debug')+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()+ if (isNewArchitectureEnabled()) {+ // We configure the NDK build only if you decide to opt-in for the New Architecture.+ externalNativeBuild {+ ndkBuild {+ arguments "APP_PLATFORM=android-21",+ "APP_STL=c++_shared",+ "NDK_TOOLCHAIN_VERSION=clang",+ "GENERATED_SRC_DIR=$buildDir/generated/source",+ "PROJECT_BUILD_DIR=$buildDir",+ "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",+ "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",+ "NODE_MODULES_DIR=$rootDir/../node_modules"+ cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"+ cppFlags "-std=c++17"+ // Make sure this target name is the same you specify inside the+ // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.+ targets "notesnook_appmodules"++ }+ }+ if (!enableSeparateBuildPerCPUArchitecture) {+ ndk {+ abiFilters (*reactNativeArchitectures())+ }+ }+ }+ }++ if (isNewArchitectureEnabled()) {+ // We configure the NDK build only if you decide to opt-in for the New Architecture.+ externalNativeBuild {+ ndkBuild {+ path "$projectDir/src/main/jni/Android.mk"+ }+ }+ def reactAndroidProjectDir = project(':ReactAndroid').projectDir+ def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {+ dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")+ from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")+ into("$buildDir/react-ndk/exported")+ }+ def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {+ dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")+ from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")+ into("$buildDir/react-ndk/exported")+ }+ afterEvaluate {+ // If you wish to add a custom TurboModule or component locally,+ // you should uncomment this line.+ // preBuild.dependsOn("generateCodegenArtifactsFromSchema")+ preDebugBuild.dependsOn(packageReactNdkDebugLibs)+ preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)+ // Due to a bug inside AGP, we have to explicitly set a dependency+ // between configureNdkBuild* tasks and the preBuild tasks.+ // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732+ configureNdkBuildRelease.dependsOn(preReleaseBuild)+ configureNdkBuildDebug.dependsOn(preDebugBuild)+ reactNativeArchitectures().each { architecture ->+ tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {+ dependsOn("preDebugBuild")+ }+ tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {+ dependsOn("preReleaseBuild")+ }+ }+ }+ }++ splits {+ abi {+ reset()+ enable enableSeparateBuildPerCPUArchitecture+ universalApk false // If true, also generate a universal APK+ include (*reactNativeArchitectures())+ }+ }+ signingConfigs {+ debug {+ storeFile file('debug.keystore')+ storePassword 'android'+ keyAlias 'androiddebugkey'+ keyPassword 'android'+ }+ release {+ storeFile file('debug.keystore')+ storePassword 'android'+ keyAlias 'androiddebugkey'+ keyPassword 'android'+ }+ }+ buildTypes {+ debug {+ signingConfig signingConfigs.debug+ }+ release {+ if (file("debug.keystore").exists()) {+ signingConfig signingConfigs.release+ }+ minifyEnabled enableProguardInReleaseBuilds+ shrinkResources false+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"+ proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"++ }+ }++ // applicationVariants are e.g. debug, release+ applicationVariants.all { variant ->+ variant.outputs.each { output ->+ // For each separate APK per architecture, set a unique version code as described here:+ // https://developer.android.com/studio/build/configure-apk-splits.html+ def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]+ def abi = output.getFilter(OutputFile.ABI)+ if (abi != null) { // null for the universal-debug, universal-release variants+ output.versionCodeOverride =+ versionCodes.get(abi) * 1048576 + defaultConfig.versionCode+ }++ }+ }+++++++}++dependencies {+ implementation fileTree(dir: "libs", include: ["*.jar"])+ //noinspection GradleDynamicVersion+ implementation "com.facebook.react:react-native:+" // From node_modules+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"+ implementation 'androidx.multidex:multidex:2.0.1'+ implementation 'com.squareup.okhttp3:okhttp:4.9.2'+ implementation 'com.squareup.okhttp3:logging-interceptor:4.9.2'+ implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.9.2'+ implementation "androidx.core:core-splashscreen:1.0.0-rc01"+ androidTestImplementation('com.wix:detox:+')+ implementation 'com.tencent:mmkv-static:1.2.7'+ implementation 'androidx.appcompat:appcompat:1.1.0'+ debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {+ exclude group:'com.facebook.fbjni'+ }++ debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {+ exclude group:'com.facebook.flipper'+ exclude group:'com.squareup.okhttp3', module:'okhttp'+ }++ debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {+ exclude group:'com.facebook.flipper'+ }++ if (enableHermes) {+ implementation("com.facebook.react:hermes-engine:+") { // From node_modules+ exclude group:'com.facebook.fbjni'+ }+ } else {+ implementation jscFlavor+ }+}++if (isNewArchitectureEnabled()) {+ // If new architecture is enabled, we let you build RN from source+ // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.+ // This will be applied to all the imported transtitive dependency.+ configurations.all {+ resolutionStrategy.dependencySubstitution {+ substitute(module("com.facebook.react:react-native"))+ .using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")+ substitute(module("com.facebook.react:hermes-engine"))+ .using(project(":ReactAndroid:hermes-engine"))+ .because("On New Architecture we're building Hermes from source")+ }+ }+}+++// Run this once to be able to run the application with BUCK+// puts all compile dependencies into folder libs for BUCK to use+task copyDownloadableDepsToLibs(type: Copy) {+ from configurations.implementation+ into 'libs'+}++task copyFiles(type: Copy) {+ from '../../web.bundle'+ into './src/main/assets'+}++preBuild.dependsOn(copyFiles)+++project.ext.vectoricons = [+ iconFontNames: ['MaterialCommunityIcons.ttf' ] // Name of the font files you want to copy+]++apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"++apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)++def isNewArchitectureEnabled() {+ // To opt-in for the New Architecture, you can either:+ // - Set `newArchEnabled` to true inside the `gradle.properties` file+ // - Invoke gradle with `-newArchEnabled=true`+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"+}diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonnew file mode 100644index 000000000..5b8023f1f--- /dev/null+++ b/apps/mobile/package.json@@ -0,0 +1,140 @@+{+ "name": "notesnook",+ "version": "2.1.6",+ "private": true,+ "scripts": {+ "run-android": "REACT_NATIVE_DEPENDENCIES=$HOME/Repos/notesnook-mobile/rn-build-deps/ react-native run-android --active-arch-only",+ "postinstall": "patch-package",+ "release": "react-native run-android --variant=release",+ "ios": "react-native run-ios",+ "start": "react-native start",+ "repack": "react-native webpack-start",+ "test": "jest",+ "lint": "eslint .",+ "build-detox-android": "REACT_NATIVE_DEPENDENCIES=$HOME/Repos/notesnook-mobile/rn-build-deps/ ENVFILE=.env.test detox build -c android.emu.debug",+ "update": "yarn add @streetwriters/notesnook-core",+ "test-android": "adb reverse tcp:8081 tcp:8081 && yarn detox test --configuration android.emu.debug --detectOpenHandles",+ "test-android-release": "detox test --configuration android.emu.release",+ "bump": "npx react-native bump-version --skip-semver-for android",+ "online": "adb reverse tcp:8081 tcp:8081 && adb reverse tcp:3000 tcp:3000"+ },+ "dependencies": {+ "@flyerhq/react-native-link-preview": "^1.6.0",+ "@mdi/js": "^6.7.96",+ "@react-native-clipboard/clipboard": "^1.9.0",+ "@react-native-community/checkbox": "^0.5.8",+ "@react-native-community/netinfo": "^6.0.4",+ "@react-native-community/push-notification-ios": "^1.10.1",+ "@react-native-community/toolbar-android": "^0.2.1",+ "@react-native-masked-view/masked-view": "^0.2.6",+ "@react-navigation/bottom-tabs": "^6.3.1",+ "@react-navigation/elements": "^1.3.3",+ "@react-navigation/native": "^6.0.10",+ "@react-navigation/native-stack": "^6.6.2",+ "@sayem314/react-native-keep-awake": "^1.0.4",+ "@streetwriters/editor": "^1.2.3",+ "@streetwriters/notesnook-core": "^7.3.5",+ "@types/react-native-vector-icons": "^6.4.10",+ "absolutify": "^0.1.0",+ "buffer": "^6.0.3",+ "dayjs": "^1.10.4",+ "deprecated-react-native-prop-types": "^2.3.0",+ "entities": "^3.0.1",+ "html-to-text": "8.1.0",+ "phone": "^3.1.14",+ "react": "18.0.0",+ "react-native": "^0.69.3",+ "react-native-actions-sheet": "^0.7.2",+ "react-native-background-actions": "^2.6.6",+ "react-native-bars": "^1.1.3",+ "react-native-begin-background-task": "https://github.com/blockfirm/react-native-begin-background-task.git",+ "react-native-bootsplash": "^4.1.4",+ "react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",+ "react-native-config": "^1.4.6",+ "react-native-device-info": "^8.4.1",+ "react-native-document-picker": "^7.1.1",+ "react-native-drax": "^0.10.2",+ "react-native-eventsource": "github:ammarahm-ed/react-native-eventsource",+ "react-native-exception-handler": "^2.10.10",+ "react-native-exit-app": "https://github.com/ammarahm-ed/react-native-exit-app.git",+ "react-native-file-viewer": "^2.1.1",+ "react-native-fingerprint-scanner": "https://github.com/standardnotes/react-native-fingerprint-scanner.git",+ "react-native-gesture-handler": "^2.5.0",+ "react-native-get-random-values": "^1.7.0",+ "react-native-html-to-pdf-lite": "^0.9.1",+ "react-native-iap": "5.2.14",+ "react-native-image-picker": "4.1.2",+ "react-native-image-zoom-viewer": "^3.0.1",+ "react-native-keychain": "4.0.5",+ "react-native-mmkv-storage": "^0.8.0",+ "react-native-orientation": "https://github.com/yamill/react-native-orientation.git",+ "react-native-privacy-snapshot": "https://github.com/standardnotes/react-native-privacy-snapshot.git",+ "react-native-progress": "^5.0.0",+ "react-native-push-notification": "^8.1.1",+ "react-native-qrcode-svg": "^6.0.6",+ "react-native-reanimated": "^2.9.1",+ "react-native-reanimated-material-menu": "github:ammarahm-ed/react-native-reanimated-material-menu",+ "react-native-reanimated-progress-bar": "1.0.1",+ "react-native-safe-area-context": "^4.3.1",+ "react-native-scoped-storage": "^1.9.3",+ "react-native-screens": "^3.13.1",+ "react-native-securerandom": "^1.0.0",+ "react-native-share": "^7.2.0",+ "react-native-sodium": "github:ammarahm-ed/react-native-sodium",+ "react-native-svg": "^12.3.0",+ "react-native-tooltips": "^1.0.3",+ "react-native-vector-icons": "^9.0.0",+ "react-native-webview": "^11.14.1",+ "rn-extensions-share": "^2.4.0",+ "rn-fetch-blob": "^0.12.0",+ "showdown": "https://github.com/thecodrr/showdown.git",+ "toggle-switch-react-native": "3.2.0",+ "url": "^0.11.0",+ "validator": "^13.5.2",+ "zustand": "^3.6.0"+ },+ "devDependencies": {+ "@babel/core": "^7.12.9",+ "@babel/eslint-parser": "^7.16.5",+ "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.5",+ "@babel/preset-env": "^7.18.6",+ "@babel/runtime": "^7.12.5",+ "@callstack/repack": "3.0.0-next.2",+ "@react-native-community/eslint-config": "^2.0.0",+ "@types/html-to-text": "^8.0.1",+ "@types/jest": "^27.0.3",+ "@types/react-native": "^0.69.1",+ "@types/react-native-push-notification": "^7.3.2",+ "@types/react-test-renderer": "^17.0.1",+ "@typescript-eslint/eslint-plugin": "^5.14.0",+ "@typescript-eslint/parser": "^5.14.0",+ "babel-jest": "^28.1.3",+ "babel-loader": "^8.2.5",+ "babel-plugin-transform-remove-console": "6.9.4",+ "detox": "^19.9.1",+ "eslint": "^8.7.0",+ "eslint-config-prettier": "^8.3.0",+ "eslint-plugin-prettier": "^4.0.0",+ "eslint-plugin-react": "^7.28.0",+ "eslint-plugin-react-native": "^4.0.0",+ "eslint-plugin-unused-imports": "^2.0.0",+ "expect": "^28.1.3",+ "jest": "^28.1.3",+ "jest-circus": "^28.1.3",+ "jest-image-snapshot": "^5.1.0",+ "metro-react-native-babel-preset": "^0.70.3",+ "patch-package": "^6.4.7",+ "pixelmatch": "^5.3.0",+ "postinstall-postinstall": "^2.1.0",+ "react-native-bundle-visualizer": "^3.1.1",+ "react-native-cli-bump-version": "^1.3.0",+ "react-test-renderer": "18.0.0",+ "terser-webpack-plugin": "^5.3.3",+ "ts-jest": "^28.0.7",+ "typescript": "^4.5.4",+ "webpack": "^5.73.0"+ },+ "jest": {+ "preset": "react-native"+ }+}