From 207997a20f6e5234cad052d9fd2df80b8a4d98f6 Mon Sep 17 00:00:00 2001 From: Vitalik Date: Tue, 21 Nov 2023 17:01:58 +0200 Subject: [PATCH] FEATURE | Multi stage .env --- .env.development | 3 + .env.production | 3 + .env.stage | 3 + .gitignore | 5 +- android/app/build.gradle | 79 +------- android/settings.gradle | 3 + ...ServiceExtensionStage.Release.entitlements | 10 + ios/Podfile | 1 + ios/Podfile.lock | 12 +- ios/taskme2.xcodeproj/project.pbxproj | 188 +++++++++++++++++- .../xcschemes/taskme-stage.xcscheme | 106 ++++++++++ .../xcshareddata/xcschemes/taskme2.xcscheme | 20 +- ios/taskme2/Info.plist | 17 +- ios/taskme2/taskme2Stage.Release.entitlements | 12 ++ package-lock.json | 20 ++ package.json | 15 +- src/App.tsx | 4 +- src/config/index.ts | 29 +-- 18 files changed, 413 insertions(+), 117 deletions(-) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 .env.stage create mode 100644 ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtensionStage.Release.entitlements create mode 100644 ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme-stage.xcscheme create mode 100644 ios/taskme2/taskme2Stage.Release.entitlements diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..68984b2 --- /dev/null +++ b/.env.development @@ -0,0 +1,3 @@ +API_URL=http://localhost:3000 +SOCKET_URL=http://localhost:3000 +ONE_SIGNAL_KEY=8b9066f5-8c3f-49f7-bef4-c5ab621f9d27 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..bb96c2f --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ +API_URL=https://tasks-api.rwsbank.com.ua +SOCKET_URL=https://tasks-api.rwsbank.com.ua +ONE_SIGNAL_KEY=5e1a5e18-33e5-4ed3-8423-45b1abc354c6 \ No newline at end of file diff --git a/.env.stage b/.env.stage new file mode 100644 index 0000000..76fd817 --- /dev/null +++ b/.env.stage @@ -0,0 +1,3 @@ +API_URL=https://taskme-api.work-jetup.site +SOCKET_URL=https://taskme-api.work-jetup.site +ONE_SIGNAL_KEY=8b9066f5-8c3f-49f7-bef4-c5ab621f9d27 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3a93b5e..895e9ed 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,7 @@ buck-out/ ./vendor ./vendor/* -vendor \ No newline at end of file +vendor + + +.env \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 077a81f..9ec0d91 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,88 +1,16 @@ + apply plugin: "com.android.application" apply plugin: "com.facebook.react" +apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" import com.android.build.OutputFile -/** - * This is the configuration block to customize your React Native Android app. - * By default you don't need to apply any configuration, just uncomment the lines you need. - */ -react { - /* Folders */ - // The root of your project, i.e. where "package.json" lives. Default is '..' - // root = file("../") - // The folder where the react-native NPM package is. Default is ../node_modules/react-native - // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen - // codegenDir = file("../node_modules/react-native-codegen") - // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js - // cliFile = file("../node_modules/react-native/cli.js") - - /* Variants */ - // The list of variants to that are debuggable. For those we're going to - // skip the bundling of the JS bundle and the assets. By default is just 'debug'. - // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. - // debuggableVariants = ["liteDebug", "prodDebug"] - /* Bundling */ - // A list containing the node command and its flags. Default is just 'node'. - // nodeExecutableAndArgs = ["node"] - // - // The command to run when bundling. By default is 'bundle' - // bundleCommand = "ram-bundle" - // - // The path to the CLI configuration file. Default is empty. - // bundleConfig = file(../rn-cli.config.js) - // - // The name of the generated asset file containing your JS bundle - // bundleAssetName = "MyApplication.android.bundle" - // - // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' - // entryFile = file("../js/MyApplication.android.js") - // - // A list of extra flags to pass to the 'bundle' commands. - // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle - // extraPackagerArgs = [] - - /* Hermes Commands */ - // The hermes compiler command to run. By default it is 'hermesc' - // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" - // - // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" - // hermesFlags = ["-O", "-output-source-map"] -} - -/** - * Set this to true to create four separate APKs instead of one, - * one for each native architecture. This is useful if you don't - * use App Bundles (https://developer.android.com/guide/app-bundle/) - * and want to have separate APKs to upload to the Play Store. - */ +react {} def enableSeparateBuildPerCPUArchitecture = false - -/** - * Set this to true to Run Proguard on Release builds to minify the Java bytecode. - */ def enableProguardInReleaseBuilds = false - -/** - * The preferred build flavor of JavaScriptCore (JSC) - * - * 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:+' -/** - * Private function to get the list of Native Architectures you want to build. - * This reads the value from reactNativeArchitectures in your gradle.properties - * file and works together with the --active-arch-only flag of react-native run-android. - */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] @@ -99,6 +27,7 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 210 versionName "2.1" + resValue "string", "build_config_package", "com.app.task_me" } splits { diff --git a/android/settings.gradle b/android/settings.gradle index e5de7f6..317910e 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -2,3 +2,6 @@ rootProject.name = 'taskme2' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../node_modules/react-native-gradle-plugin') + +include ':react-native-config' +project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') diff --git a/ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtensionStage.Release.entitlements b/ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtensionStage.Release.entitlements new file mode 100644 index 0000000..08f699b --- /dev/null +++ b/ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtensionStage.Release.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.com.app.taskme.stage.onesignal + + + diff --git a/ios/Podfile b/ios/Podfile index 600a074..b404830 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -26,6 +26,7 @@ target 'taskme2' do config = use_native_modules! pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage' + pod 'react-native-config/Extension', :path => '../node_modules/react-native-config' # Flags change depending on the env values. flags = get_default_flags() diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ea5fc5d..52d9d1f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -355,6 +355,11 @@ PODS: - glog - react-native-cameraroll (5.7.2): - React-Core + - react-native-config (1.5.1): + - react-native-config/App (= 1.5.1) + - react-native-config/App (1.5.1): + - React-Core + - react-native-config/Extension (1.5.1) - react-native-date-picker (4.2.13): - React-Core - react-native-document-picker (9.0.1): @@ -609,6 +614,8 @@ DEPENDENCIES: - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)" + - react-native-config (from `../node_modules/react-native-config`) + - react-native-config/Extension (from `../node_modules/react-native-config`) - react-native-date-picker (from `../node_modules/react-native-date-picker`) - react-native-document-picker (from `../node_modules/react-native-document-picker`) - react-native-html-to-pdf (from `../node_modules/react-native-html-to-pdf`) @@ -726,6 +733,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/logger" react-native-cameraroll: :path: "../node_modules/@react-native-camera-roll/camera-roll" + react-native-config: + :path: "../node_modules/react-native-config" react-native-date-picker: :path: "../node_modules/react-native-date-picker" react-native-document-picker: @@ -859,6 +868,7 @@ SPEC CHECKSUMS: React-jsinspector: f4ccc5e774f1f7530f55f5367826f7158e3146aa React-logger: 48c0f8e4e2314c50661a827019b506c172328049 react-native-cameraroll: 134805127580aed23403b8c2cb1548920dd77b3a + react-native-config: 86038147314e2e6d10ea9972022aa171e6b1d4d8 react-native-date-picker: 04e866ba4e7857f83abd504ad42e787f0f02ae00 react-native-document-picker: 2b8f18667caee73a96708a82b284a4f40b30a156 react-native-html-to-pdf: 4c5c6e26819fe202971061594058877aa9b25265 @@ -911,6 +921,6 @@ SPEC CHECKSUMS: Yoga: 540948b36b46e9469992c4d30ddcc21110b8afe5 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 8b482b755d9e353d5963aa936fa181a2d5fcf1d2 +PODFILE CHECKSUM: c269a7efafc308e998d432292530c667a3d2655c COCOAPODS: 1.12.1 diff --git a/ios/taskme2.xcodeproj/project.pbxproj b/ios/taskme2.xcodeproj/project.pbxproj index f4a84c2..d8468b7 100644 --- a/ios/taskme2.xcodeproj/project.pbxproj +++ b/ios/taskme2.xcodeproj/project.pbxproj @@ -44,14 +44,14 @@ /* Begin PBXCopyFilesBuildPhase section */ 04FBB3542A84CD0D00436C19 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 8; dstPath = ""; dstSubfolderSpec = 13; files = ( 04FBB3502A84CD0D00436C19 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */, ); name = "Embed Foundation Extensions"; - runOnlyForDeploymentPostprocessing = 0; + runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ @@ -60,11 +60,14 @@ 00E356EE1AD99517003FC87E /* taskme2Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = taskme2Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* taskme2Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = taskme2Tests.m; sourceTree = ""; }; + 04D8E49A2B0BA79200ACC6E2 /* OneSignalNotificationServiceExtensionStage.Release.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneSignalNotificationServiceExtensionStage.Release.entitlements; sourceTree = ""; }; + 04D8E49B2B0BA7BA00ACC6E2 /* taskme2Stage.Release.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = taskme2Stage.Release.entitlements; path = taskme2/taskme2Stage.Release.entitlements; sourceTree = ""; }; 04FBB3442A84CC6700436C19 /* taskme2.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = taskme2.entitlements; path = taskme2/taskme2.entitlements; sourceTree = ""; }; 04FBB3492A84CD0D00436C19 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 04FBB34B2A84CD0D00436C19 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; 04FBB34D2A84CD0D00436C19 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 04FBB3552A84CDFA00436C19 /* OneSignalNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneSignalNotificationServiceExtension.entitlements; sourceTree = ""; }; + 08D358D544954D5B56BAFFAC /* Pods-taskme2-taskme2Tests.stage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2-taskme2Tests.stage.debug.xcconfig"; path = "Target Support Files/Pods-taskme2-taskme2Tests/Pods-taskme2-taskme2Tests.stage.debug.xcconfig"; sourceTree = ""; }; 0AC2880E5264076073DF865D /* Pods-taskme2-taskme2Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2-taskme2Tests.release.xcconfig"; path = "Target Support Files/Pods-taskme2-taskme2Tests/Pods-taskme2-taskme2Tests.release.xcconfig"; sourceTree = ""; }; 0FD9FA6914F2DA8781CBD173 /* libPods-taskme2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-taskme2.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 127996D261A12456ADB5A870 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; sourceTree = ""; }; @@ -76,16 +79,21 @@ 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = taskme2/main.m; sourceTree = ""; }; 36EEF9A60D044056856CEEA6 /* Gilroy-Semibold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Gilroy-Semibold.ttf"; path = "../src/assets/fonts/Gilroy-Semibold.ttf"; sourceTree = ""; }; 527F61C1DD2E37B4CB3A2F5C /* libPods-taskme2-taskme2Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-taskme2-taskme2Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 625CB8CD85666B1AC0D40D6F /* Pods-taskme2.stage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2.stage.release.xcconfig"; path = "Target Support Files/Pods-taskme2/Pods-taskme2.stage.release.xcconfig"; sourceTree = ""; }; 6D174334360E40AEAC86E003 /* fontello.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = fontello.ttf; path = ../src/assets/fonts/fontello.ttf; sourceTree = ""; }; 6D9AB5D106199D173D35A220 /* Pods-taskme2.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2.debug.xcconfig"; path = "Target Support Files/Pods-taskme2/Pods-taskme2.debug.xcconfig"; sourceTree = ""; }; 73C040992F14443E396EB91F /* Pods-taskme2.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2.release.xcconfig"; path = "Target Support Files/Pods-taskme2/Pods-taskme2.release.xcconfig"; sourceTree = ""; }; + 7B57C84A260CC1F37F7723E8 /* Pods-OneSignalNotificationServiceExtension.stage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.stage.release.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.stage.release.xcconfig"; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = taskme2/LaunchScreen.storyboard; sourceTree = ""; }; 821D0F756B605E607EC149FE /* Pods-taskme2-taskme2Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2-taskme2Tests.debug.xcconfig"; path = "Target Support Files/Pods-taskme2-taskme2Tests/Pods-taskme2-taskme2Tests.debug.xcconfig"; sourceTree = ""; }; 878DA92B557C81DAFFCEF3BA /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.release.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig"; sourceTree = ""; }; A86FA5C0ED15EDDDD22D2FCF /* libPods-OneSignalNotificationServiceExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalNotificationServiceExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B25C228D4A644A728CA3561E /* Gilroy-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Gilroy-Medium.ttf"; path = "../src/assets/fonts/Gilroy-Medium.ttf"; sourceTree = ""; }; + CE34B284F5419976E086BB2A /* Pods-OneSignalNotificationServiceExtension.stage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.stage.debug.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.stage.debug.xcconfig"; sourceTree = ""; }; D66CD33E4DEC4377944DC7F7 /* Gilroy-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Gilroy-Regular.ttf"; path = "../src/assets/fonts/Gilroy-Regular.ttf"; sourceTree = ""; }; + E17C446E92AE22D017263DBA /* Pods-taskme2-taskme2Tests.stage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2-taskme2Tests.stage.release.xcconfig"; path = "Target Support Files/Pods-taskme2-taskme2Tests/Pods-taskme2-taskme2Tests.stage.release.xcconfig"; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + FE3A727783B541D29D3F1C9F /* Pods-taskme2.stage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taskme2.stage.debug.xcconfig"; path = "Target Support Files/Pods-taskme2/Pods-taskme2.stage.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -136,6 +144,7 @@ 04FBB34A2A84CD0D00436C19 /* OneSignalNotificationServiceExtension */ = { isa = PBXGroup; children = ( + 04D8E49A2B0BA79200ACC6E2 /* OneSignalNotificationServiceExtensionStage.Release.entitlements */, 04FBB3552A84CDFA00436C19 /* OneSignalNotificationServiceExtension.entitlements */, 04FBB34B2A84CD0D00436C19 /* NotificationService.swift */, 04FBB34D2A84CD0D00436C19 /* Info.plist */, @@ -146,6 +155,7 @@ 13B07FAE1A68108700A75B9A /* taskme2 */ = { isa = PBXGroup; children = ( + 04D8E49B2B0BA7BA00ACC6E2 /* taskme2Stage.Release.entitlements */, 04FBB3442A84CC6700436C19 /* taskme2.entitlements */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.mm */, @@ -223,6 +233,12 @@ 0AC2880E5264076073DF865D /* Pods-taskme2-taskme2Tests.release.xcconfig */, 127996D261A12456ADB5A870 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */, 878DA92B557C81DAFFCEF3BA /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */, + 7B57C84A260CC1F37F7723E8 /* Pods-OneSignalNotificationServiceExtension.stage.release.xcconfig */, + CE34B284F5419976E086BB2A /* Pods-OneSignalNotificationServiceExtension.stage.debug.xcconfig */, + 625CB8CD85666B1AC0D40D6F /* Pods-taskme2.stage.release.xcconfig */, + FE3A727783B541D29D3F1C9F /* Pods-taskme2.stage.debug.xcconfig */, + E17C446E92AE22D017263DBA /* Pods-taskme2-taskme2Tests.stage.release.xcconfig */, + 08D358D544954D5B56BAFFAC /* Pods-taskme2-taskme2Tests.stage.debug.xcconfig */, ); path = Pods; sourceTree = ""; @@ -630,6 +646,170 @@ }; name = Release; }; + 04D8E4962B0BA3EF00ACC6E2 /* Stage.Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + LD_RUNPATH_SEARCH_PATHS = ( + /usr/lib/swift, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Stage.Release; + }; + 04D8E4972B0BA3EF00ACC6E2 /* Stage.Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 625CB8CD85666B1AC0D40D6F /* Pods-taskme2.stage.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = taskme2/taskme2Stage.Release.entitlements; + CURRENT_PROJECT_VERSION = 6; + DEVELOPMENT_TEAM = HQ3J3TDPR2; + INFOPLIST_FILE = taskme2/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Task me ;)"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 2.2; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.app.taskme.stage; + PRODUCT_NAME = taskme2; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Stage.Release; + }; + 04D8E4982B0BA3EF00ACC6E2 /* Stage.Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E17C446E92AE22D017263DBA /* Pods-taskme2-taskme2Tests.stage.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COPY_PHASE_STRIP = NO; + INFOPLIST_FILE = taskme2Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + "$(inherited)", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/taskme2.app/taskme2"; + }; + name = Stage.Release; + }; + 04D8E4992B0BA3EF00ACC6E2 /* Stage.Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B57C84A260CC1F37F7723E8 /* Pods-OneSignalNotificationServiceExtension.stage.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtensionStage.Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = HQ3J3TDPR2; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 2.1; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.app.taskme.stage.OneSignalNotificationServiceExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Stage.Release; + }; 04FBB3522A84CD0D00436C19 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 127996D261A12456ADB5A870 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */; @@ -927,6 +1107,7 @@ buildConfigurations = ( 00E356F61AD99517003FC87E /* Debug */, 00E356F71AD99517003FC87E /* Release */, + 04D8E4982B0BA3EF00ACC6E2 /* Stage.Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -936,6 +1117,7 @@ buildConfigurations = ( 04FBB3522A84CD0D00436C19 /* Debug */, 04FBB3532A84CD0D00436C19 /* Release */, + 04D8E4992B0BA3EF00ACC6E2 /* Stage.Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -945,6 +1127,7 @@ buildConfigurations = ( 13B07F941A680F5B00A75B9A /* Debug */, 13B07F951A680F5B00A75B9A /* Release */, + 04D8E4972B0BA3EF00ACC6E2 /* Stage.Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -954,6 +1137,7 @@ buildConfigurations = ( 83CBBA201A601CBA00E9B192 /* Debug */, 83CBBA211A601CBA00E9B192 /* Release */, + 04D8E4962B0BA3EF00ACC6E2 /* Stage.Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme-stage.xcscheme b/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme-stage.xcscheme new file mode 100644 index 0000000..615377a --- /dev/null +++ b/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme-stage.xcscheme @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme2.xcscheme b/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme2.xcscheme index 49a94e3..c407e7b 100644 --- a/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme2.xcscheme +++ b/ios/taskme2.xcodeproj/xcshareddata/xcschemes/taskme2.xcscheme @@ -1,10 +1,28 @@ + version = "1.7"> + + + + + + + + + + + NSAppleMusicUsageDescription + Додаток не потребує цього дозволу. NSCameraUsageDescription Потрібно надати доступ до камери + NSContactsUsageDescription + Додаток не потребує цього дозволу. NSLocationWhenInUseUsageDescription - + Додаток не потребує цього дозволу. NSMicrophoneUsageDescription Потрібно надати доступ для запису відео/аудіо NSPhotoLibraryUsageDescription @@ -82,14 +86,7 @@ UIViewControllerBasedStatusBarAppearance - - NSContactsUsageDescription - Додаток не потребує цього дозволу. - - NSAppleMusicUsageDescription - Додаток не потребує цього дозволу. - - NSLocationWhenInUseUsageDescription - Додаток не потребує цього дозволу. + ITSAppUsesNonExemptEncryption + diff --git a/ios/taskme2/taskme2Stage.Release.entitlements b/ios/taskme2/taskme2Stage.Release.entitlements new file mode 100644 index 0000000..0394b9b --- /dev/null +++ b/ios/taskme2/taskme2Stage.Release.entitlements @@ -0,0 +1,12 @@ + + + + + aps-environment + development + com.apple.security.application-groups + + group.com.app.taskme.stage.onesignal + + + diff --git a/package-lock.json b/package-lock.json index 6e40580..93e2a2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "react-native-audio-recorder-player": "^3.5.3", "react-native-autolink": "^4.1.0", "react-native-calendars": "^1.1298.0", + "react-native-config": "^1.5.1", "react-native-controlled-mentions": "^2.2.5", "react-native-date-picker": "^4.2.13", "react-native-device-info": "^10.6.0", @@ -14694,6 +14695,19 @@ "resolved": "https://registry.npmjs.org/react-native-communications/-/react-native-communications-2.2.1.tgz", "integrity": "sha512-5+C0X9mopI0+qxyQHzOPEi5v5rxNBQjxydPPiKMQSlX1RBIcJ8uTcqUPssQ9Mo8p6c1IKIWJUSqCj4jAmD0qVQ==" }, + "node_modules/react-native-config": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/react-native-config/-/react-native-config-1.5.1.tgz", + "integrity": "sha512-g1xNgt1tV95FCX+iWz6YJonxXkQX0GdD3fB8xQtR1GUBEqweB9zMROW77gi2TygmYmUkBI7LU4pES+zcTyK4HA==", + "peerDependencies": { + "react-native-windows": ">=0.61" + }, + "peerDependenciesMeta": { + "react-native-windows": { + "optional": true + } + } + }, "node_modules/react-native-controlled-mentions": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/react-native-controlled-mentions/-/react-native-controlled-mentions-2.2.5.tgz", @@ -28610,6 +28624,12 @@ "resolved": "https://registry.npmjs.org/react-native-communications/-/react-native-communications-2.2.1.tgz", "integrity": "sha512-5+C0X9mopI0+qxyQHzOPEi5v5rxNBQjxydPPiKMQSlX1RBIcJ8uTcqUPssQ9Mo8p6c1IKIWJUSqCj4jAmD0qVQ==" }, + "react-native-config": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/react-native-config/-/react-native-config-1.5.1.tgz", + "integrity": "sha512-g1xNgt1tV95FCX+iWz6YJonxXkQX0GdD3fB8xQtR1GUBEqweB9zMROW77gi2TygmYmUkBI7LU4pES+zcTyK4HA==", + "requires": {} + }, "react-native-controlled-mentions": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/react-native-controlled-mentions/-/react-native-controlled-mentions-2.2.5.tgz", diff --git a/package.json b/package.json index 394899e..38e59a8 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,18 @@ "lint": "eslint .", "start": "react-native start", "test": "jest", + "setDevelopment": "ENVFILE=.env.development", + "setStaging": "ENVFILE=.env.stage", + "setProduction": "ENVFILE=.env.production", "postinstall": "react-native setup-ios-permissions && pod-install", - "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'", - "build:android": "cd android && ./gradlew assembleRelease", - "build:android:prod": "cd android && ./gradlew bundleRelease" + "aos:clean": "cd android && ./gradlew clean", + "aos:dev": "ENVFILE=.env.development react-native run-android", + "aos:stage": "ENVFILE=.env.stage react-native run-android", + "aos:build:stage": "cd android && ENVFILE=.env.stage ./gradlew assembleRelease", + + "aos:prod": "ENVFILE=.env.production react-native run-android", + "aos:build:prod": "cd android && ENVFILE=.env.production ./gradlew assembleRelease", + "aos:build:bundle": "cd android && ENVFILE=.env.production ./gradlew bundleRelease" }, "dependencies": { "@bitalikrty/redux-create-reducer": "^1.0.0", @@ -45,6 +53,7 @@ "react-native-audio-recorder-player": "^3.5.3", "react-native-autolink": "^4.1.0", "react-native-calendars": "^1.1298.0", + "react-native-config": "^1.5.1", "react-native-controlled-mentions": "^2.2.5", "react-native-date-picker": "^4.2.13", "react-native-device-info": "^10.6.0", diff --git a/src/App.tsx b/src/App.tsx index c670ab1..7b2969d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,13 +5,14 @@ import store from './store' import './services/system/reactron.service' import { ThemeProvider } from './shared/themes' // import Orientation from 'react-native-orientation-locker' -import { LogBox } from 'react-native' +import { LogBox, Text } from 'react-native' import { appService } from './services/app.service' import 'react-native-gesture-handler' import { BottomSheetModalProvider } from '@gorhom/bottom-sheet' import { SafeAreaProvider } from 'react-native-safe-area-context' import { GestureHandlerRootView } from 'react-native-gesture-handler' +import Config from 'react-native-config' LogBox.ignoreLogs(['Warning: ...', 'Require cycle: ...']) // Ignore log notification by message LogBox.ignoreAllLogs() //Ignore all log notifications @@ -24,6 +25,7 @@ const App: FC = () => { return ( + {Config.API_URL} diff --git a/src/config/index.ts b/src/config/index.ts index ef0e542..b92658f 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,32 +1,15 @@ +import Config from 'react-native-config' import { fonts } from './fonts' -/** - * Dev - */ -export const dynamicConfig = { - // baseUrl: 'http://localhost:3000', - // socketUrl: 'http://localhost:3000', - - // baseUrl: 'https://5763-46-63-4-20.ngrok.io', - // socketUrl: 'https://5763-46-63-4-20.ngrok.io', - - // baseUrl: 'http://46.101.170.206:5000/app/', - // socketUrl: 'http://46.101.170.206:5000', - - // baseUrl: 'https://taskme-api.work-jetup.site', - // socketUrl: 'https://taskme-api.work-jetup.site', - // baseUrl: 'http://185.69.154.136:5000', - // socketUrl: 'http://185.69.154.136:5000', - - baseUrl: 'https://tasks-api.rwsbank.com.ua', - socketUrl: 'https://tasks-api.rwsbank.com.ua', - - // oneSignalKey: '8b9066f5-8c3f-49f7-bef4-c5ab621f9d27', //stage - oneSignalKey: '5e1a5e18-33e5-4ed3-8423-45b1abc354c6', +export const dynamicConfig = { + baseUrl: Config.API_URL, + socketUrl: Config.SOCKET_URL, + oneSignalKey: Config.ONE_SIGNAL_KEY, appStoreUrl: 'https://apps.apple.com/ua/app/task-me/id1482240685?l=uk', googlePlayUrl: 'https://play.google.com/store/apps/details?id=com.app.task_me', } +console.log('config', Config) export const config = { ...dynamicConfig,