From 595a1b0a6809dceabe4f6942c142db8de731c6e3 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 12:08:53 +0100 Subject: [PATCH 001/138] add required changes to run hybrid app --- package-lock.json | 14 ++-- package.json | 2 +- ...react-native-image-manipulator+1.0.5.patch | 4 +- patches/@onfido+react-native-sdk+8.3.0.patch | 46 ++++++++++ .../@react-native+gradle-plugin+0.72.11.patch | 83 +++++++++++++++++++ ...-async-storage+async-storage+1.17.11.patch | 13 +++ ...native-camera-roll+camera-roll+5.4.0.patch | 15 ++++ ...ommunity+cli-platform-android+11.3.6.patch | 57 +++++++++++++ ...ve-community+cli-platform-ios+11.3.6.patch | 51 ++++++++++++ ...act-native-firebase+analytics+12.9.3.patch | 18 ++++ .../@react-native-firebase+app+12.9.3.patch | 25 ++++++ ...t-native-firebase+crashlytics+12.9.3.patch | 17 ++++ .../@react-native-firebase+perf+12.9.3.patch | 17 ++++ patches/react-native-reanimated+3.5.4.patch | 17 ++++ src/App.js | 77 ++++++++++------- src/InitialUrlContext.ts | 5 ++ src/libs/Navigation/AppNavigator/index.js | 17 +++- src/pages/LogOutPreviousUserPage.js | 14 ++-- 18 files changed, 445 insertions(+), 47 deletions(-) create mode 100644 patches/@react-native+gradle-plugin+0.72.11.patch create mode 100644 patches/@react-native-async-storage+async-storage+1.17.11.patch create mode 100644 patches/@react-native-camera-roll+camera-roll+5.4.0.patch create mode 100644 patches/@react-native-community+cli-platform-android+11.3.6.patch create mode 100644 patches/@react-native-community+cli-platform-ios+11.3.6.patch create mode 100644 patches/@react-native-firebase+analytics+12.9.3.patch create mode 100644 patches/@react-native-firebase+app+12.9.3.patch create mode 100644 patches/@react-native-firebase+crashlytics+12.9.3.patch create mode 100644 patches/@react-native-firebase+perf+12.9.3.patch create mode 100644 patches/react-native-reanimated+3.5.4.patch create mode 100644 src/InitialUrlContext.ts diff --git a/package-lock.json b/package-lock.json index 1d6333ad719e..cccdd27c6bcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,7 +108,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "^2.16.2", + "react-native-vision-camera": "2.16.5", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", @@ -44717,9 +44717,9 @@ } }, "node_modules/react-native-vision-camera": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.2.tgz", - "integrity": "sha512-QIpG33l3QB0AkTfX/ccRknwNRu1APNUkokVKF1lpRO2+tBnkXnGL0UapgXg5u9KIONZtrpupeDeO+J5B2TeQVw==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", + "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", "peerDependencies": { "react": "*", "react-native": "*" @@ -84992,9 +84992,9 @@ "requires": {} }, "react-native-vision-camera": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.2.tgz", - "integrity": "sha512-QIpG33l3QB0AkTfX/ccRknwNRu1APNUkokVKF1lpRO2+tBnkXnGL0UapgXg5u9KIONZtrpupeDeO+J5B2TeQVw==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", + "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", "requires": {} }, "react-native-web": { diff --git a/package.json b/package.json index 1453e85fef53..79a74d05a281 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "^2.16.2", + "react-native-vision-camera": "2.16.5", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", diff --git a/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch b/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch index c613a47a3072..eb5ef2da6247 100644 --- a/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch +++ b/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch @@ -7,13 +7,13 @@ index 3a1a548..fe030bb 100644 android { - compileSdkVersion 28 -+ compileSdkVersion 30 ++ compileSdkVersion 33 buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 -+ targetSdkVersion 30 ++ targetSdkVersion 33 versionCode 1 versionName "1.0" } diff --git a/patches/@onfido+react-native-sdk+8.3.0.patch b/patches/@onfido+react-native-sdk+8.3.0.patch index 12245cb58355..940c40eb9bb0 100644 --- a/patches/@onfido+react-native-sdk+8.3.0.patch +++ b/patches/@onfido+react-native-sdk+8.3.0.patch @@ -15,3 +15,49 @@ index b4c7106..d5083d3 100644 } classDirectories.setFrom(fileTree( dir: 'build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/onfido/reactnative/sdk', +diff --git a/node_modules/@onfido/react-native-sdk/android/publish.gradle b/node_modules/@onfido/react-native-sdk/android/publish.gradle +index 216d52d..1f1c17f 100644 +--- a/node_modules/@onfido/react-native-sdk/android/publish.gradle ++++ b/node_modules/@onfido/react-native-sdk/android/publish.gradle +@@ -4,41 +4,5 @@ afterEvaluate { + archiveClassifier = "sources" + } + +- publishing { +- def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) + +- publications { +- mavenJava(MavenPublication) { +- // The new gradle publish plugin doesn't allow the @onfido/ prefix +- artifactId = packageJson.name.replace("@onfido/", "onfido-") +- groupId = 'com.onfido.reactnative.sdk' +- version = packageJson.version +- +- from components.release +- +- artifact sourceJar +- +- pom { +- name = packageJson.title +- description = packageJson.description +- url = packageJson.repository.baseUrl +- +- licenses { +- license { +- name = packageJson.license +- url = packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename +- distribution = 'repo' +- } +- } +- +- developers { +- developer { +- id = packageJson.author.email +- name = packageJson.author.name +- } +- } +- } +- } +- } +- } + } diff --git a/patches/@react-native+gradle-plugin+0.72.11.patch b/patches/@react-native+gradle-plugin+0.72.11.patch new file mode 100644 index 000000000000..8609c992b4d6 --- /dev/null +++ b/patches/@react-native+gradle-plugin+0.72.11.patch @@ -0,0 +1,83 @@ +diff --git a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +index 062dcc7..cb400ec 100644 +--- a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt ++++ b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +@@ -15,6 +15,7 @@ import com.facebook.react.tasks.GenerateCodegenArtifactsTask + import com.facebook.react.tasks.GenerateCodegenSchemaTask + import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFields + import com.facebook.react.utils.AgpConfiguratorUtils.configureDevPorts ++import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries + import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap + import com.facebook.react.utils.DependencyUtils.configureDependencies + import com.facebook.react.utils.DependencyUtils.configureRepositories +@@ -64,6 +65,7 @@ class ReactPlugin : Plugin { + + configureReactNativeNdk(project, extension) + configureBuildConfigFields(project) ++ configureNamespaceForLibraries(project) + configureDevPorts(project) + configureBackwardCompatibilityReactMap(project) + +diff --git a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +index 3bf0085..59397b4 100644 +--- a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt ++++ b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +@@ -8,11 +8,17 @@ + package com.facebook.react.utils + + import com.android.build.api.variant.AndroidComponentsExtension ++import com.facebook.react.ReactExtension + import com.facebook.react.utils.ProjectUtils.isHermesEnabled + import com.facebook.react.utils.ProjectUtils.isNewArchEnabled + import org.gradle.api.Action + import org.gradle.api.Project + import org.gradle.api.plugins.AppliedPlugin ++import java.io.File ++import com.android.build.gradle.LibraryExtension ++import javax.xml.parsers.DocumentBuilder ++import javax.xml.parsers.DocumentBuilderFactory ++import org.w3c.dom.Element + + @Suppress("UnstableApiUsage") + internal object AgpConfiguratorUtils { +@@ -49,6 +55,40 @@ internal object AgpConfiguratorUtils { + project.pluginManager.withPlugin("com.android.application", action) + project.pluginManager.withPlugin("com.android.library", action) + } ++ ++ fun configureNamespaceForLibraries(appProject: Project) { ++ appProject.rootProject.allprojects { subproject -> ++ subproject.pluginManager.withPlugin("com.android.library") { ++ subproject.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext -> ++ if(ext.namespace == null){ ++ val android = subproject.extensions.getByType(LibraryExtension::class.java) ++ val manifestFile = android.sourceSets.getByName("main").manifest.srcFile ++ ++ manifestFile.takeIf { it.exists() }?.let { file -> ++ getPackageNameFromManifest(file)?.let { packageName -> ++ ext.namespace = packageName ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ fun getPackageNameFromManifest(manifest: File): String? { ++ val factory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance() ++ val builder: DocumentBuilder = factory.newDocumentBuilder() ++ ++ try { ++ val xmlDocument = builder.parse(manifest) ++ ++ val manifestElement = xmlDocument.getElementsByTagName("manifest").item(0) as? Element ++ val packageName = manifestElement?.getAttribute("package") ++ ++ return if (packageName.isNullOrEmpty()) null else packageName ++ } catch (e: Exception) { ++ return null ++ } ++ } + } + + const val DEFAULT_DEV_SERVER_PORT = "8081" diff --git a/patches/@react-native-async-storage+async-storage+1.17.11.patch b/patches/@react-native-async-storage+async-storage+1.17.11.patch new file mode 100644 index 000000000000..1c8a139bc10f --- /dev/null +++ b/patches/@react-native-async-storage+async-storage+1.17.11.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@react-native-async-storage/async-storage/android/build.gradle b/node_modules/@react-native-async-storage/async-storage/android/build.gradle +index ff1baa4..32d8020 100644 +--- a/node_modules/@react-native-async-storage/async-storage/android/build.gradle ++++ b/node_modules/@react-native-async-storage/async-storage/android/build.gradle +@@ -112,7 +112,7 @@ repositories { + dependencies { + + if (useNextStorage) { +- def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.2') ++ def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.3') + def coroutines_version = "1.6.0" + def coroutinesTest_version = "1.6.0" + // if we don't provide explicit dependency on reflection, kotlin plugin \ No newline at end of file diff --git a/patches/@react-native-camera-roll+camera-roll+5.4.0.patch b/patches/@react-native-camera-roll+camera-roll+5.4.0.patch new file mode 100644 index 000000000000..f0429bc10125 --- /dev/null +++ b/patches/@react-native-camera-roll+camera-roll+5.4.0.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle +index 3f76132..63dc946 100644 +--- a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle ++++ b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle +@@ -81,7 +81,9 @@ def findNodeModulePath(baseDir, packageName) { + } + + def resolveReactNativeDirectory() { +- def reactNative = file("${findNodeModulePath(rootProject.projectDir, "react-native")}") ++ def projectDir = this.hasProperty('reactNativeProject') ? this.reactNativeProject : rootProject.projectDir ++ def modulePath = file(projectDir); ++ def reactNative = file("${findNodeModulePath(modulePath, 'react-native')}") + if (reactNative.exists()) { + return reactNative + } diff --git a/patches/@react-native-community+cli-platform-android+11.3.6.patch b/patches/@react-native-community+cli-platform-android+11.3.6.patch new file mode 100644 index 000000000000..ddebb53db36d --- /dev/null +++ b/patches/@react-native-community+cli-platform-android+11.3.6.patch @@ -0,0 +1,57 @@ +diff --git a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle +index 8a218d5..8deb9c0 100644 +--- a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle ++++ b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle +@@ -140,6 +140,7 @@ class ReactNativeModules { + private Logger logger + private String packageName + private File root ++ private File rnRoot + private ArrayList> reactNativeModules + private ArrayList unstable_reactLegacyComponentNames + private HashMap reactNativeModulesBuildVariants +@@ -147,8 +148,13 @@ class ReactNativeModules { + private static String LOG_PREFIX = ":ReactNative:" + + ReactNativeModules(Logger logger, File root) { ++ this(logger, root, root) ++ } ++ ++ ReactNativeModules(Logger logger, File root, File rnRoot) { + this.logger = logger + this.root = root ++ this.rnRoot = rnRoot + + def (nativeModules, reactNativeModulesBuildVariants, androidProject) = this.getReactNativeConfig() + this.reactNativeModules = nativeModules +@@ -413,11 +419,12 @@ class ReactNativeModules { + * @todo: `fastlane` has been reported to not work too. + */ + def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" ++ + String[] nodeCommand = ["node", "-e", cliResolveScript] +- def cliPath = this.getCommandOutput(nodeCommand, this.root) ++ def cliPath = this.getCommandOutput(nodeCommand, this.rnRoot) + + String[] reactNativeConfigCommand = ["node", cliPath, "config"] +- def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.root) ++ def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.rnRoot) + + def json + try { +@@ -482,8 +489,14 @@ class ReactNativeModules { + * where build files of an active project are located. + */ + def projectRoot = rootProject.projectDir ++def autoModules ++ ++if(this.hasProperty('reactNativeProject')){ ++ autoModules = new ReactNativeModules(logger, projectRoot, new File(projectRoot, reactNativeProject)) ++} else { ++ autoModules = new ReactNativeModules(logger, projectRoot) ++} + +-def autoModules = new ReactNativeModules(logger, projectRoot) + + /** ----------------------- + * Exported Extensions diff --git a/patches/@react-native-community+cli-platform-ios+11.3.6.patch b/patches/@react-native-community+cli-platform-ios+11.3.6.patch new file mode 100644 index 000000000000..9c97b8666ef2 --- /dev/null +++ b/patches/@react-native-community+cli-platform-ios+11.3.6.patch @@ -0,0 +1,51 @@ +diff --git a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb +index 1b6eece..914039e 100644 +--- a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb ++++ b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb +@@ -12,7 +12,7 @@ + require 'pathname' + require 'cocoapods' + +-def use_native_modules!(config = nil) ++def updateConfig(config = nil) + if (config.is_a? String) + Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.", + [ +@@ -24,7 +24,6 @@ def use_native_modules!(config = nil) + # Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects + cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" + cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip +- + if (!config) + json = [] + +@@ -36,10 +35,29 @@ def use_native_modules!(config = nil) + + config = JSON.parse(json.join("\n")) + end ++end ++ ++def use_native_modules!(config = nil) ++ if (ENV['REACT_NATIVE_DIR']) ++ Dir.chdir(ENV['REACT_NATIVE_DIR']) do ++ config = updateConfig(config) ++ end ++ else ++ config = updateConfig(config) ++ end + + project_root = Pathname.new(config["project"]["ios"]["sourceDir"]) ++ if(ENV["PROJECT_ROOT_DIR"]) ++ project_root = File.join(Dir.pwd, ENV["PROJECT_ROOT_DIR"]) ++ ++ end + + packages = config["dependencies"] ++ ++ if (ENV["NO_FLIPPER"]) ++ packages["react-native-flipper"]["platforms"]["ios"] = nil ++ end ++ + found_pods = [] + + packages.each do |package_name, package| diff --git a/patches/@react-native-firebase+analytics+12.9.3.patch b/patches/@react-native-firebase+analytics+12.9.3.patch new file mode 100644 index 000000000000..74d3e2a8005a --- /dev/null +++ b/patches/@react-native-firebase+analytics+12.9.3.patch @@ -0,0 +1,18 @@ +diff --git a/node_modules/@react-native-firebase/analytics/android/build.gradle b/node_modules/@react-native-firebase/analytics/android/build.gradle +index d223ebf..821b730 100644 +--- a/node_modules/@react-native-firebase/analytics/android/build.gradle ++++ b/node_modules/@react-native-firebase/analytics/android/build.gradle +@@ -45,6 +45,8 @@ if (coreVersionDetected != coreVersionRequired) { + } + } + ++apply plugin: 'com.android.library' ++ + project.ext { + set('react-native', [ + versions: [ +@@ -144,4 +146,3 @@ dependencies { + ReactNative.shared.applyPackageVersion() + ReactNative.shared.applyDefaultExcludes() + ReactNative.module.applyAndroidVersions() +-ReactNative.module.applyReactNativeDependency("api") diff --git a/patches/@react-native-firebase+app+12.9.3.patch b/patches/@react-native-firebase+app+12.9.3.patch new file mode 100644 index 000000000000..312fdacf4432 --- /dev/null +++ b/patches/@react-native-firebase+app+12.9.3.patch @@ -0,0 +1,25 @@ +diff --git a/node_modules/@react-native-firebase/app/android/build.gradle b/node_modules/@react-native-firebase/app/android/build.gradle +index 05f629a..7c36693 100644 +--- a/node_modules/@react-native-firebase/app/android/build.gradle ++++ b/node_modules/@react-native-firebase/app/android/build.gradle +@@ -18,6 +18,7 @@ buildscript { + + plugins { + id "io.invertase.gradle.build" version "1.5" ++ id 'com.android.library' + } + + def packageJson = PackageJson.getForProject(project) +@@ -91,6 +92,7 @@ repositories { + } + + dependencies { ++ api 'com.facebook.react:react-native:+' + implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}") + implementation "com.google.firebase:firebase-common" + implementation "com.google.android.gms:play-services-auth:${ReactNative.ext.getVersion("play", "play-services-auth")}" +@@ -99,4 +101,3 @@ dependencies { + ReactNative.shared.applyPackageVersion() + ReactNative.shared.applyDefaultExcludes() + ReactNative.module.applyAndroidVersions() +-ReactNative.module.applyReactNativeDependency("api") diff --git a/patches/@react-native-firebase+crashlytics+12.9.3.patch b/patches/@react-native-firebase+crashlytics+12.9.3.patch new file mode 100644 index 000000000000..560f462731dc --- /dev/null +++ b/patches/@react-native-firebase+crashlytics+12.9.3.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/@react-native-firebase/crashlytics/android/build.gradle b/node_modules/@react-native-firebase/crashlytics/android/build.gradle +index 6b6de57..9b89ae7 100644 +--- a/node_modules/@react-native-firebase/crashlytics/android/build.gradle ++++ b/node_modules/@react-native-firebase/crashlytics/android/build.gradle +@@ -18,6 +18,7 @@ buildscript { + + plugins { + id "io.invertase.gradle.build" version "1.5" ++ id 'com.android.library' + } + + def appProject +@@ -92,4 +93,3 @@ dependencies { + ReactNative.shared.applyPackageVersion() + ReactNative.shared.applyDefaultExcludes() + ReactNative.module.applyAndroidVersions() +-ReactNative.module.applyReactNativeDependency("api") diff --git a/patches/@react-native-firebase+perf+12.9.3.patch b/patches/@react-native-firebase+perf+12.9.3.patch new file mode 100644 index 000000000000..7d8a9f4f23b5 --- /dev/null +++ b/patches/@react-native-firebase+perf+12.9.3.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/@react-native-firebase/perf/android/build.gradle b/node_modules/@react-native-firebase/perf/android/build.gradle +index b4a9c7b..5835e3d 100644 +--- a/node_modules/@react-native-firebase/perf/android/build.gradle ++++ b/node_modules/@react-native-firebase/perf/android/build.gradle +@@ -19,6 +19,7 @@ buildscript { + + plugins { + id "io.invertase.gradle.build" version "1.5" ++ id 'com.android.library' + } + + def appProject +@@ -129,4 +130,3 @@ dependencies { + ReactNative.shared.applyPackageVersion() + ReactNative.shared.applyDefaultExcludes() + ReactNative.module.applyAndroidVersions() +-ReactNative.module.applyReactNativeDependency("api") diff --git a/patches/react-native-reanimated+3.5.4.patch b/patches/react-native-reanimated+3.5.4.patch new file mode 100644 index 000000000000..3b40360d5860 --- /dev/null +++ b/patches/react-native-reanimated+3.5.4.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/react-native-reanimated/scripts/reanimated_utils.rb b/node_modules/react-native-reanimated/scripts/reanimated_utils.rb +index af0935f..ccd2a9e 100644 +--- a/node_modules/react-native-reanimated/scripts/reanimated_utils.rb ++++ b/node_modules/react-native-reanimated/scripts/reanimated_utils.rb +@@ -17,7 +17,11 @@ def find_config() + :react_native_common_dir => nil, + } + +- react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..') ++ root_project = Pod::Config.instance.installation_root.to_s ++ if(ENV['PROJECT_ROOT_DIR']) ++ root_project = ENV['PROJECT_ROOT_DIR'] ++ end ++ react_native_node_modules_dir = File.join(File.dirname(`cd "#{root_project}" && node --print "require.resolve('react-native/package.json')"`), '..') + react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir) + + if react_native_json == nil diff --git a/src/App.js b/src/App.js index 2caa6b9ffc29..6479e05e13da 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,5 @@ import {PortalProvider} from '@gorhom/portal'; +import PropTypes from 'prop-types'; import React from 'react'; import {LogBox} from 'react-native'; import {GestureHandlerRootView} from 'react-native-gesture-handler'; @@ -22,6 +23,7 @@ import {KeyboardStateProvider} from './components/withKeyboardState'; import {WindowDimensionsProvider} from './components/withWindowDimensions'; import Expensify from './Expensify'; import useDefaultDragAndDrop from './hooks/useDefaultDragAndDrop'; +import InitialUrlContext from './InitialUrlContext'; import OnyxUpdateManager from './libs/actions/OnyxUpdateManager'; import * as Session from './libs/actions/Session'; import * as Environment from './libs/Environment/Environment'; @@ -30,6 +32,15 @@ import ThemeIllustrationsProvider from './styles/illustrations/ThemeIllustration import ThemeProvider from './styles/themes/ThemeProvider'; import ThemeStylesProvider from './styles/ThemeStylesProvider'; +const propTypes = { + /** If we have an authToken this is true */ + url: PropTypes.string, +}; + +const defaultProps = { + url: null, +}; + // For easier debugging and development, when we are in web we expose Onyx to the window, so you can more easily set data into Onyx if (window && Environment.isDevelopment()) { window.Onyx = Onyx; @@ -45,43 +56,47 @@ LogBox.ignoreLogs([ const fill = {flex: 1}; -function App() { +function App(props) { useDefaultDragAndDrop(); OnyxUpdateManager(); return ( - - - - - - - - - - + + + + + + + + + + + + ); } +App.propTypes = propTypes; +App.defaultProps = defaultProps; App.displayName = 'App'; export default App; diff --git a/src/InitialUrlContext.ts b/src/InitialUrlContext.ts new file mode 100644 index 000000000000..eabf099dafe0 --- /dev/null +++ b/src/InitialUrlContext.ts @@ -0,0 +1,5 @@ +import {createContext} from 'react'; + +const InitialUrlContext = createContext<{initialUrl: string | null}>({initialUrl: null}); + +export default InitialUrlContext; diff --git a/src/libs/Navigation/AppNavigator/index.js b/src/libs/Navigation/AppNavigator/index.js index 0d03badf37bc..0a39a0bafeb9 100644 --- a/src/libs/Navigation/AppNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/index.js @@ -1,5 +1,8 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, {useContext, useEffect} from 'react'; +import {NativeModules} from 'react-native'; +import Navigation from '@libs/Navigation/Navigation'; +import InitialUrlContext from '@src/InitialUrlContext'; const propTypes = { /** If we have an authToken this is true */ @@ -7,6 +10,18 @@ const propTypes = { }; function AppNavigator(props) { + const initUrl = useContext(InitialUrlContext); + + useEffect(() => { + if (!NativeModules.ReactNativeModule) { + return; + } + + Navigation.isNavigationReady().then(() => { + Navigation.navigate(initUrl); + }); + }, [initUrl]); + if (props.authenticated) { const AuthScreens = require('./AuthScreens').default; diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index df38c28e561a..81fe480ffcce 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -1,12 +1,14 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; -import React, {useEffect} from 'react'; -import {Linking} from 'react-native'; +import React, {useContext, useEffect} from 'react'; +import {Linking, NativeModules} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import * as SessionUtils from '@libs/SessionUtils'; import Navigation from '@navigation/Navigation'; import * as Session from '@userActions/Session'; +import CONST from '@src/CONST'; +import InitialUrlContext from '@src/InitialUrlContext'; import ONYXKEYS from '@src/ONYXKEYS'; const propTypes = { @@ -33,10 +35,12 @@ const defaultProps = { }; function LogOutPreviousUserPage(props) { + const initUrl = useContext(InitialUrlContext); useEffect(() => { - Linking.getInitialURL().then((transitionURL) => { + Linking.getInitialURL().then((url) => { const sessionEmail = props.session.email; - const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(transitionURL, sessionEmail); + const transitionUrl = NativeModules.ReactNativeModule ? CONST.DEEPLINK_BASE_URL + initUrl : url; + const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(transitionUrl, sessionEmail); if (isLoggingInAsNewUser) { Session.signOutAndRedirectToSignIn(); @@ -60,7 +64,7 @@ function LogOutPreviousUserPage(props) { }); } }); - }, [props]); + }, [initUrl, props]); return ; } From cd14eca4326575f36d5b6fb39649fc7f5eae3e61 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 12:28:15 +0100 Subject: [PATCH 002/138] update comment for appjs prop --- src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index c12f2654b5c9..b88d9b564864 100644 --- a/src/App.js +++ b/src/App.js @@ -33,7 +33,7 @@ import ThemeProvider from './styles/themes/ThemeProvider'; import ThemeStylesProvider from './styles/ThemeStylesProvider'; const propTypes = { - /** If we have an authToken this is true */ + /** Initial url that may be passed as deeplink from Hybrid App */ url: PropTypes.string, }; From a818a6bf212b910869627d85222c537476cada25 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 12:34:13 +0100 Subject: [PATCH 003/138] move InitialUrlContext --- src/App.js | 3 ++- src/{InitialUrlContext.ts => libs/InitialUrlContext/index.ts} | 0 src/libs/Navigation/AppNavigator/index.js | 2 +- src/pages/LogOutPreviousUserPage.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) rename src/{InitialUrlContext.ts => libs/InitialUrlContext/index.ts} (100%) diff --git a/src/App.js b/src/App.js index b88d9b564864..19e9d45a530c 100644 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,7 @@ import {KeyboardStateProvider} from './components/withKeyboardState'; import {WindowDimensionsProvider} from './components/withWindowDimensions'; import Expensify from './Expensify'; import useDefaultDragAndDrop from './hooks/useDefaultDragAndDrop'; -import InitialUrlContext from './InitialUrlContext'; + import OnyxUpdateManager from './libs/actions/OnyxUpdateManager'; import * as Session from './libs/actions/Session'; import * as Environment from './libs/Environment/Environment'; @@ -31,6 +31,7 @@ import {ReportAttachmentsProvider} from './pages/home/report/ReportAttachmentsCo import ThemeIllustrationsProvider from './styles/illustrations/ThemeIllustrationsProvider'; import ThemeProvider from './styles/themes/ThemeProvider'; import ThemeStylesProvider from './styles/ThemeStylesProvider'; +import InitialUrlContext from './libs/InitialUrlContext'; const propTypes = { /** Initial url that may be passed as deeplink from Hybrid App */ diff --git a/src/InitialUrlContext.ts b/src/libs/InitialUrlContext/index.ts similarity index 100% rename from src/InitialUrlContext.ts rename to src/libs/InitialUrlContext/index.ts diff --git a/src/libs/Navigation/AppNavigator/index.js b/src/libs/Navigation/AppNavigator/index.js index 0a39a0bafeb9..b56e2dcf57e6 100644 --- a/src/libs/Navigation/AppNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/index.js @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React, {useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; import Navigation from '@libs/Navigation/Navigation'; -import InitialUrlContext from '@src/InitialUrlContext'; +import InitialUrlContext from '@libs/InitialUrlContext'; const propTypes = { /** If we have an authToken this is true */ diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 81fe480ffcce..e1c18f8211d4 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -8,7 +8,7 @@ import * as SessionUtils from '@libs/SessionUtils'; import Navigation from '@navigation/Navigation'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; -import InitialUrlContext from '@src/InitialUrlContext'; +import InitialUrlContext from '@libs/InitialUrlContext'; import ONYXKEYS from '@src/ONYXKEYS'; const propTypes = { From 0e228ca18b9ec48b9cf9d82c5a1847349e52fa96 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 13:57:12 +0100 Subject: [PATCH 004/138] add short explanation to InitialurlContext --- src/libs/InitialUrlContext/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/InitialUrlContext/index.ts b/src/libs/InitialUrlContext/index.ts index eabf099dafe0..e0593c7cf152 100644 --- a/src/libs/InitialUrlContext/index.ts +++ b/src/libs/InitialUrlContext/index.ts @@ -1,5 +1,6 @@ import {createContext} from 'react'; +// Context to keep the initial url that will be opened when NewDot is embedded into Hybrid App const InitialUrlContext = createContext<{initialUrl: string | null}>({initialUrl: null}); export default InitialUrlContext; From 3ab29cc77597a8263ebe61cb624797f545fc94a4 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 13:58:58 +0100 Subject: [PATCH 005/138] add last lint to async storage patch --- patches/@react-native-async-storage+async-storage+1.17.11.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/@react-native-async-storage+async-storage+1.17.11.patch b/patches/@react-native-async-storage+async-storage+1.17.11.patch index 1c8a139bc10f..4f695d4607b1 100644 --- a/patches/@react-native-async-storage+async-storage+1.17.11.patch +++ b/patches/@react-native-async-storage+async-storage+1.17.11.patch @@ -10,4 +10,4 @@ index ff1baa4..32d8020 100644 + def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.3') def coroutines_version = "1.6.0" def coroutinesTest_version = "1.6.0" - // if we don't provide explicit dependency on reflection, kotlin plugin \ No newline at end of file + // if we don't provide explicit dependency on reflection, kotlin plugin From 7ce52547cc41f913fbb0a1ac8c7cb54ed21172e4 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 13:59:34 +0100 Subject: [PATCH 006/138] remove line from App.js --- src/App.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App.js b/src/App.js index 19e9d45a530c..db6a41cc11ec 100644 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,6 @@ import {KeyboardStateProvider} from './components/withKeyboardState'; import {WindowDimensionsProvider} from './components/withWindowDimensions'; import Expensify from './Expensify'; import useDefaultDragAndDrop from './hooks/useDefaultDragAndDrop'; - import OnyxUpdateManager from './libs/actions/OnyxUpdateManager'; import * as Session from './libs/actions/Session'; import * as Environment from './libs/Environment/Environment'; From 4da5437979a32d8a86de13001a49b1cbcc82f607 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 14:00:10 +0100 Subject: [PATCH 007/138] run prettier --- src/App.js | 2 +- src/libs/Navigation/AppNavigator/index.js | 2 +- src/pages/LogOutPreviousUserPage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index db6a41cc11ec..6f2f61a11061 100644 --- a/src/App.js +++ b/src/App.js @@ -26,11 +26,11 @@ import useDefaultDragAndDrop from './hooks/useDefaultDragAndDrop'; import OnyxUpdateManager from './libs/actions/OnyxUpdateManager'; import * as Session from './libs/actions/Session'; import * as Environment from './libs/Environment/Environment'; +import InitialUrlContext from './libs/InitialUrlContext'; import {ReportAttachmentsProvider} from './pages/home/report/ReportAttachmentsContext'; import ThemeIllustrationsProvider from './styles/illustrations/ThemeIllustrationsProvider'; import ThemeProvider from './styles/themes/ThemeProvider'; import ThemeStylesProvider from './styles/ThemeStylesProvider'; -import InitialUrlContext from './libs/InitialUrlContext'; const propTypes = { /** Initial url that may be passed as deeplink from Hybrid App */ diff --git a/src/libs/Navigation/AppNavigator/index.js b/src/libs/Navigation/AppNavigator/index.js index b56e2dcf57e6..b89f2aa5071e 100644 --- a/src/libs/Navigation/AppNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/index.js @@ -1,8 +1,8 @@ import PropTypes from 'prop-types'; import React, {useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; -import Navigation from '@libs/Navigation/Navigation'; import InitialUrlContext from '@libs/InitialUrlContext'; +import Navigation from '@libs/Navigation/Navigation'; const propTypes = { /** If we have an authToken this is true */ diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index e1c18f8211d4..77d282611da7 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -4,11 +4,11 @@ import React, {useContext, useEffect} from 'react'; import {Linking, NativeModules} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; +import InitialUrlContext from '@libs/InitialUrlContext'; import * as SessionUtils from '@libs/SessionUtils'; import Navigation from '@navigation/Navigation'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; -import InitialUrlContext from '@libs/InitialUrlContext'; import ONYXKEYS from '@src/ONYXKEYS'; const propTypes = { From d33702c1fe8e0b9afeed6da672a9149c56f27c6c Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 14:09:38 +0100 Subject: [PATCH 008/138] cleanup --- src/libs/InitialUrlContext/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/InitialUrlContext/index.ts b/src/libs/InitialUrlContext/index.ts index e0593c7cf152..432a2f6c583b 100644 --- a/src/libs/InitialUrlContext/index.ts +++ b/src/libs/InitialUrlContext/index.ts @@ -1,6 +1,6 @@ import {createContext} from 'react'; -// Context to keep the initial url that will be opened when NewDot is embedded into Hybrid App -const InitialUrlContext = createContext<{initialUrl: string | null}>({initialUrl: null}); +/** Initial url that will be opened when NewDot is embedded into Hybrid App. */ +const InitialUrlContext = createContext(null); export default InitialUrlContext; From ae2bec1410b98c334ea0164b0448b791e9e5f242 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 15:01:17 +0100 Subject: [PATCH 009/138] improve if statement --- src/libs/Navigation/AppNavigator/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/index.js b/src/libs/Navigation/AppNavigator/index.js index b89f2aa5071e..4cfb24a3f34b 100644 --- a/src/libs/Navigation/AppNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/index.js @@ -13,7 +13,7 @@ function AppNavigator(props) { const initUrl = useContext(InitialUrlContext); useEffect(() => { - if (!NativeModules.ReactNativeModule) { + if (!NativeModules.ReactNativeModule || initUrl === null) { return; } From 7796468797db46f34461490bdbbd90aea0bf71d5 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 15:25:47 +0100 Subject: [PATCH 010/138] rename ReactNativeModule to HybridAppModule --- src/libs/InitialUrlContext/index.ts | 2 +- src/libs/Navigation/AppNavigator/index.js | 2 +- src/pages/LogOutPreviousUserPage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/InitialUrlContext/index.ts b/src/libs/InitialUrlContext/index.ts index 432a2f6c583b..684af2bb2b60 100644 --- a/src/libs/InitialUrlContext/index.ts +++ b/src/libs/InitialUrlContext/index.ts @@ -1,6 +1,6 @@ import {createContext} from 'react'; /** Initial url that will be opened when NewDot is embedded into Hybrid App. */ -const InitialUrlContext = createContext(null); +const InitialUrlContext = createContext(undefined); export default InitialUrlContext; diff --git a/src/libs/Navigation/AppNavigator/index.js b/src/libs/Navigation/AppNavigator/index.js index 4cfb24a3f34b..5f4958f61f70 100644 --- a/src/libs/Navigation/AppNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/index.js @@ -13,7 +13,7 @@ function AppNavigator(props) { const initUrl = useContext(InitialUrlContext); useEffect(() => { - if (!NativeModules.ReactNativeModule || initUrl === null) { + if (!NativeModules.HybridAppModule || initUrl === undefined) { return; } diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 77d282611da7..36dce86b3be7 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -39,7 +39,7 @@ function LogOutPreviousUserPage(props) { useEffect(() => { Linking.getInitialURL().then((url) => { const sessionEmail = props.session.email; - const transitionUrl = NativeModules.ReactNativeModule ? CONST.DEEPLINK_BASE_URL + initUrl : url; + const transitionUrl = NativeModules.HybridAppModule ? CONST.DEEPLINK_BASE_URL + initUrl : url; const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(transitionUrl, sessionEmail); if (isLoggingInAsNewUser) { From 405c29bb1b9518ef028fea5f9ef4d07fdad46489 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 5 Dec 2023 17:20:20 +0100 Subject: [PATCH 011/138] update patch for onfido --- patches/@onfido+react-native-sdk+8.3.0.patch | 64 +++++--------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/patches/@onfido+react-native-sdk+8.3.0.patch b/patches/@onfido+react-native-sdk+8.3.0.patch index 940c40eb9bb0..5d3fd51bf826 100644 --- a/patches/@onfido+react-native-sdk+8.3.0.patch +++ b/patches/@onfido+react-native-sdk+8.3.0.patch @@ -1,8 +1,22 @@ diff --git a/node_modules/@onfido/react-native-sdk/android/build.gradle b/node_modules/@onfido/react-native-sdk/android/build.gradle -index b4c7106..d5083d3 100644 +index b4c7106..c6efb0f 100644 --- a/node_modules/@onfido/react-native-sdk/android/build.gradle +++ b/node_modules/@onfido/react-native-sdk/android/build.gradle -@@ -135,9 +135,9 @@ afterEvaluate { project -> +@@ -84,6 +84,13 @@ android { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } ++ ++ publishing { ++ singleVariant('release') { ++ withSourcesJar() ++ withJavadocJar() ++ } ++ } + } + + repositories { +@@ -135,9 +142,9 @@ afterEvaluate { project -> group = "Reporting" description = "Generate Jacoco coverage reports after running tests." reports { @@ -15,49 +29,3 @@ index b4c7106..d5083d3 100644 } classDirectories.setFrom(fileTree( dir: 'build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/onfido/reactnative/sdk', -diff --git a/node_modules/@onfido/react-native-sdk/android/publish.gradle b/node_modules/@onfido/react-native-sdk/android/publish.gradle -index 216d52d..1f1c17f 100644 ---- a/node_modules/@onfido/react-native-sdk/android/publish.gradle -+++ b/node_modules/@onfido/react-native-sdk/android/publish.gradle -@@ -4,41 +4,5 @@ afterEvaluate { - archiveClassifier = "sources" - } - -- publishing { -- def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) - -- publications { -- mavenJava(MavenPublication) { -- // The new gradle publish plugin doesn't allow the @onfido/ prefix -- artifactId = packageJson.name.replace("@onfido/", "onfido-") -- groupId = 'com.onfido.reactnative.sdk' -- version = packageJson.version -- -- from components.release -- -- artifact sourceJar -- -- pom { -- name = packageJson.title -- description = packageJson.description -- url = packageJson.repository.baseUrl -- -- licenses { -- license { -- name = packageJson.license -- url = packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename -- distribution = 'repo' -- } -- } -- -- developers { -- developer { -- id = packageJson.author.email -- name = packageJson.author.name -- } -- } -- } -- } -- } -- } - } From 486533054bb6aab94d4fe9036dc9c7de59a89961 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 6 Dec 2023 10:08:45 +0100 Subject: [PATCH 012/138] add way to go back to Expensify Classic --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/pages/settings/InitialSettingsPage.js | 22 ++++++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index b03e5d228a55..63cadbe4245f 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -750,6 +750,7 @@ export default { phrase3: 'and', phrase4: 'Privacy', }, + returnToClassic: 'Return to Expensify Classic', help: 'Help', }, closeAccountPage: { diff --git a/src/languages/es.ts b/src/languages/es.ts index c6bc77681b21..63c10d4556e7 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -744,6 +744,7 @@ export default { phrase3: 'y', phrase4: 'Privacidad', }, + returnToClassic: 'Volver a Expensify Clásico', help: 'Ayuda', }, closeAccountPage: { diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index 8ca1f96b3796..0bf34a99b91f 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -1,7 +1,7 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; -import {View} from 'react-native'; +import {NativeModules, View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import Avatar from '@components/Avatar'; @@ -187,7 +187,7 @@ function InitialSettingsPage(props) { const paymentCardList = props.fundList || {}; - return [ + const defaultMenuItems = [ { translationKey: 'common.shareCode', icon: Expensicons.QrCode, @@ -264,6 +264,24 @@ function InitialSettingsPage(props) { }, }, ]; + + if (NativeModules.HybridAppModule) { + // eslint-disable-next-line rulesdir/prefer-underscore-method + const hybridAppMenuItems = [ + { + translationKey: 'initialSettingsPage.returnToClassic', + icon: Expensicons.RotateLeft, + shouldShowRightIcon: true, + iconRight: Expensicons.NewWindow, + action: () => NativeModules.HybridAppModule.closeReactNativeApp(), + }, + ...defaultMenuItems, + ].filter((item) => item.translationKey !== 'initialSettingsPage.signOut'); + + return hybridAppMenuItems; + } + + return defaultMenuItems; }, [ props.allPolicyMembers, props.bankAccountList, From c75ea5653d2fcd1103ded0955f5c2b9f5996feeb Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 6 Dec 2023 11:27:57 +0100 Subject: [PATCH 013/138] tweak BootSplash to work with Hybrid App --- ios/NewExpensify/RCTBootSplash.h | 1 + ios/NewExpensify/RCTBootSplash.m | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ios/NewExpensify/RCTBootSplash.h b/ios/NewExpensify/RCTBootSplash.h index df38a5eb35bf..c25c676feb4a 100644 --- a/ios/NewExpensify/RCTBootSplash.h +++ b/ios/NewExpensify/RCTBootSplash.h @@ -10,6 +10,7 @@ @interface RCTBootSplash : NSObject ++ (void)invalidateBootSplash; + (void)initWithStoryboard:(NSString * _Nonnull)storyboardName rootView:(RCTRootView * _Nullable)rootView; diff --git a/ios/NewExpensify/RCTBootSplash.m b/ios/NewExpensify/RCTBootSplash.m index bceac70efdcf..6c2baaed4ee0 100644 --- a/ios/NewExpensify/RCTBootSplash.m +++ b/ios/NewExpensify/RCTBootSplash.m @@ -26,6 +26,12 @@ - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); } ++ (void)invalidateBootSplash { + _resolverQueue = nil; + _rootView = nil; + _nativeHidden = false; +} + + (void)initWithStoryboard:(NSString * _Nonnull)storyboardName rootView:(RCTRootView * _Nullable)rootView { if (rootView == nil || _rootView != nil || RCTRunningInAppExtension()) @@ -102,6 +108,9 @@ + (void)onContentDidAppear { block:^(NSTimer * _Nonnull timer) { [timer invalidate]; + if (_rootView == nil) + return; + if (_resolverQueue == nil) _resolverQueue = [[NSMutableArray alloc] init]; From 4dc32d4d6ff6120baa66af9ef0358df12a44ecd1 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 6 Dec 2023 14:06:33 +0100 Subject: [PATCH 014/138] switch to lodash filter --- src/pages/settings/InitialSettingsPage.js | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index 0bf34a99b91f..4039768cacf4 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -266,17 +266,19 @@ function InitialSettingsPage(props) { ]; if (NativeModules.HybridAppModule) { - // eslint-disable-next-line rulesdir/prefer-underscore-method - const hybridAppMenuItems = [ - { - translationKey: 'initialSettingsPage.returnToClassic', - icon: Expensicons.RotateLeft, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - action: () => NativeModules.HybridAppModule.closeReactNativeApp(), - }, - ...defaultMenuItems, - ].filter((item) => item.translationKey !== 'initialSettingsPage.signOut'); + const hybridAppMenuItems = _.filter( + [ + { + translationKey: 'initialSettingsPage.returnToClassic', + icon: Expensicons.RotateLeft, + shouldShowRightIcon: true, + iconRight: Expensicons.NewWindow, + action: () => NativeModules.HybridAppModule.closeReactNativeApp(), + }, + ...defaultMenuItems, + ], + (item) => item.translationKey !== 'initialSettingsPage.signOut', + ); return hybridAppMenuItems; } From b53412c8f2faf1ac7035967438d05822c7363705 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 6 Dec 2023 14:12:18 +0100 Subject: [PATCH 015/138] update InitialUrlContext --- src/libs/InitialUrlContext/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/InitialUrlContext/index.ts b/src/libs/InitialUrlContext/index.ts index 684af2bb2b60..989f3369585f 100644 --- a/src/libs/InitialUrlContext/index.ts +++ b/src/libs/InitialUrlContext/index.ts @@ -1,6 +1,7 @@ import {createContext} from 'react'; +import {Route} from '@src/ROUTES'; /** Initial url that will be opened when NewDot is embedded into Hybrid App. */ -const InitialUrlContext = createContext(undefined); +const InitialUrlContext = createContext(undefined); export default InitialUrlContext; From fd1e6447fa7f5f8cc738617bcc42ee0d9f194c5e Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 7 Dec 2023 15:30:53 +0100 Subject: [PATCH 016/138] upgrade async storage and remove patch --- package-lock.json | 13 ++++++++----- package.json | 2 +- ...native-async-storage+async-storage+1.17.11.patch | 13 ------------- 3 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 patches/@react-native-async-storage+async-storage+1.17.11.patch diff --git a/package-lock.json b/package-lock.json index 2e78d6b02264..3d879b57220a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@kie/mock-github": "^1.0.0", "@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52", "@onfido/react-native-sdk": "8.3.0", - "@react-native-async-storage/async-storage": "^1.17.10", + "@react-native-async-storage/async-storage": "1.21.0", "@react-native-camera-roll/camera-roll": "5.4.0", "@react-native-clipboard/clipboard": "^1.12.1", "@react-native-community/geolocation": "^3.0.6", @@ -6648,13 +6648,14 @@ } }, "node_modules/@react-native-async-storage/async-storage": { - "version": "1.17.11", - "license": "MIT", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.21.0.tgz", + "integrity": "sha512-JL0w36KuFHFCvnbOXRekqVAUplmOyT/OuCQkogo6X98MtpSaJOKEAeZnYO8JB0U/RIEixZaGI5px73YbRm/oag==", "dependencies": { "merge-options": "^3.0.4" }, "peerDependencies": { - "react-native": "^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" + "react-native": "^0.0.0-0 || >=0.60 <1.0" } }, "node_modules/@react-native-camera-roll/camera-roll": { @@ -57465,7 +57466,9 @@ } }, "@react-native-async-storage/async-storage": { - "version": "1.17.11", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.21.0.tgz", + "integrity": "sha512-JL0w36KuFHFCvnbOXRekqVAUplmOyT/OuCQkogo6X98MtpSaJOKEAeZnYO8JB0U/RIEixZaGI5px73YbRm/oag==", "requires": { "merge-options": "^3.0.4" } diff --git a/package.json b/package.json index 968bea8c8abf..c876fd441465 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@kie/mock-github": "^1.0.0", "@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52", "@onfido/react-native-sdk": "8.3.0", - "@react-native-async-storage/async-storage": "^1.17.10", + "@react-native-async-storage/async-storage": "1.21.0", "@react-native-camera-roll/camera-roll": "5.4.0", "@react-native-clipboard/clipboard": "^1.12.1", "@react-native-community/geolocation": "^3.0.6", diff --git a/patches/@react-native-async-storage+async-storage+1.17.11.patch b/patches/@react-native-async-storage+async-storage+1.17.11.patch deleted file mode 100644 index 4f695d4607b1..000000000000 --- a/patches/@react-native-async-storage+async-storage+1.17.11.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/@react-native-async-storage/async-storage/android/build.gradle b/node_modules/@react-native-async-storage/async-storage/android/build.gradle -index ff1baa4..32d8020 100644 ---- a/node_modules/@react-native-async-storage/async-storage/android/build.gradle -+++ b/node_modules/@react-native-async-storage/async-storage/android/build.gradle -@@ -112,7 +112,7 @@ repositories { - dependencies { - - if (useNextStorage) { -- def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.2') -+ def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.3') - def coroutines_version = "1.6.0" - def coroutinesTest_version = "1.6.0" - // if we don't provide explicit dependency on reflection, kotlin plugin From 48d422ae495d134a953de5a050d8daf59f21dc45 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 18 Dec 2023 16:21:41 +0700 Subject: [PATCH 017/138] fix: add singleExecution for menu items --- src/components/MenuItemGroup.js | 35 +++++++++++++++++++ .../PersonalDetailsInitialPage.js | 3 ++ 2 files changed, 38 insertions(+) create mode 100644 src/components/MenuItemGroup.js diff --git a/src/components/MenuItemGroup.js b/src/components/MenuItemGroup.js new file mode 100644 index 000000000000..60d27247a45f --- /dev/null +++ b/src/components/MenuItemGroup.js @@ -0,0 +1,35 @@ +import useSingleExecution from '@hooks/useSingleExecution'; +import _ from 'lodash'; +import PropTypes from 'prop-types'; +import React, {Children, cloneElement} from 'react'; + +const propTypes = { + /* Actual content wrapped by this component */ + children: PropTypes.node.isRequired, + + /** Whether or not to use the single execution hook */ + shouldUseSingleExecution: PropTypes.bool, +}; +const defaultProps = { + shouldUseSingleExecution: true +}; + +function MenuItemGroup(props){ + const {isExecuting, singleExecution} = useSingleExecution(); + const arrayChildren = Children.toArray(props.children); + + return <> + {Children.map(arrayChildren, (child, index) => { + return cloneElement(child,{ + ...child.props, + onPress: props.shouldUseSingleExecution ? singleExecution(child.props.onPress) : child.props.onPress + }) + })} + +} + +MenuItemGroup.displayName = 'MenuItemGroup'; +MenuItemGroup.propTypes = propTypes; +MenuItemGroup.defaultProps = defaultProps; + +export default MenuItemGroup; \ No newline at end of file diff --git a/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js b/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js index cf6887b7e04c..a35ad78836b8 100644 --- a/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js +++ b/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js @@ -17,6 +17,7 @@ import Navigation from '@libs/Navigation/Navigation'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import MenuItemGroup from '@components/MenuItemGroup'; const propTypes = { /* Onyx Props */ @@ -77,6 +78,7 @@ function PersonalDetailsInitialPage(props) { {props.translate('privatePersonalDetails.privateDataMessage')} + Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)} /> + )} From b81373faf01130e8f568e2bc3a63141933b28d78 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 18 Dec 2023 16:32:51 +0700 Subject: [PATCH 018/138] disable when is executing --- src/components/MenuItemGroup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MenuItemGroup.js b/src/components/MenuItemGroup.js index 60d27247a45f..4fe5adf989b6 100644 --- a/src/components/MenuItemGroup.js +++ b/src/components/MenuItemGroup.js @@ -1,5 +1,4 @@ import useSingleExecution from '@hooks/useSingleExecution'; -import _ from 'lodash'; import PropTypes from 'prop-types'; import React, {Children, cloneElement} from 'react'; @@ -22,7 +21,8 @@ function MenuItemGroup(props){ {Children.map(arrayChildren, (child, index) => { return cloneElement(child,{ ...child.props, - onPress: props.shouldUseSingleExecution ? singleExecution(child.props.onPress) : child.props.onPress + onPress: props.shouldUseSingleExecution ? singleExecution(child.props.onPress) : child.props.onPress, + disabled: child.props.disabled || isExecuting }) })} From 10cb535cedbe180f6ef73c90bd6f8a9a501d6573 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 3 Jan 2024 12:02:34 +0300 Subject: [PATCH 019/138] Migrate SettlementButton.js component to TypeScript --- src/components/KYCWall/kycWallPropTypes.js | 5 + ...ttlementButton.js => SettlementButton.tsx} | 189 +++++++----------- 2 files changed, 79 insertions(+), 115 deletions(-) rename src/components/{SettlementButton.js => SettlementButton.tsx} (65%) diff --git a/src/components/KYCWall/kycWallPropTypes.js b/src/components/KYCWall/kycWallPropTypes.js index 2f14f1e12e11..aeda8544dd0d 100644 --- a/src/components/KYCWall/kycWallPropTypes.js +++ b/src/components/KYCWall/kycWallPropTypes.js @@ -65,6 +65,11 @@ const propTypes = { /** Whether the personal bank account option should be shown */ shouldShowPersonalBankAccountOption: PropTypes.bool, + + /** Callback to execute when KYC is successful */ + onSuccessfulKYC: PropTypes.func.isRequired, + + children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, }; const defaultProps = { diff --git a/src/components/SettlementButton.js b/src/components/SettlementButton.tsx similarity index 65% rename from src/components/SettlementButton.js rename to src/components/SettlementButton.tsx index 0c8e193af4cc..2786cd852434 100644 --- a/src/components/SettlementButton.js +++ b/src/components/SettlementButton.tsx @@ -1,143 +1,106 @@ -import PropTypes from 'prop-types'; -import React, {useEffect, useMemo} from 'react'; -import {withOnyx} from 'react-native-onyx'; -import _ from 'underscore'; +import _ from 'lodash'; +import React, {MutableRefObject, useEffect, useMemo} from 'react'; +import {StyleProp, ViewStyle} from 'react-native'; +import {OnyxEntry, withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; -import compose from '@libs/compose'; import * as ReportUtils from '@libs/ReportUtils'; -import iouReportPropTypes from '@pages/iouReportPropTypes'; import * as BankAccounts from '@userActions/BankAccounts'; import * as IOU from '@userActions/IOU'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import {ButtonSizeValue} from '@src/styles/utils/types'; +import type {Report} from '@src/types/onyx'; +import {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; -import withNavigation from './withNavigation'; -const propTypes = { - /** Callback to execute when this button is pressed. Receives a single payment type argument. */ - onPress: PropTypes.func.isRequired, +type AnchorAlignment = { + horizontal: 'left' | 'right' | 'center'; + vertical: 'top' | 'center' | 'bottom'; +}; - /** Call the onPress function on main button when Enter key is pressed */ - pressOnEnter: PropTypes.bool, +type TriggerKYCFlow = (event: Event, iouPaymentType: string) => void; - /** Settlement currency type */ - currency: PropTypes.string, +type SettlementButtonOnyxProps = { + /** The last payment method used per policy */ + nvpLastPaymentMethod?: Record; +}; +type SettlementButtonProps = SettlementButtonOnyxProps & { + /** Callback to execute when this button is pressed. Receives a single payment type argument. */ + onPress: (paymentType: string) => void; + /** The route to redirect if user does not have a payment method setup */ + enablePaymentsRoute: string; + /** Call the onPress function on main button when Enter key is pressed */ + pressOnEnter?: boolean; + /** Settlement currency type */ + currency?: string; /** When the button is opened via an IOU, ID for the chatReport that the IOU is linked to */ - chatReportID: PropTypes.string, - + chatReportID?: string; /** The IOU/Expense report we are paying */ - iouReport: iouReportPropTypes, - - /** The route to redirect if user does not have a payment method setup */ - enablePaymentsRoute: PropTypes.string.isRequired, - - /** Should we show the approve button? */ - shouldHidePaymentOptions: PropTypes.bool, - + iouReport?: OnyxEntry | EmptyObject; /** Should we show the payment options? */ - shouldShowApproveButton: PropTypes.bool, - - /** The last payment method used per policy */ - nvp_lastPaymentMethod: PropTypes.objectOf(PropTypes.string), - + shouldHidePaymentOptions?: boolean; + /** Should we show the payment options? */ + shouldShowApproveButton?: boolean; /** The policyID of the report we are paying */ - policyID: PropTypes.string, - + policyID?: string; /** Additional styles to add to the component */ - style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]), - + style?: StyleProp; /** Total money amount in form */ - formattedAmount: PropTypes.string, - + formattedAmount?: string; /** The size of button size */ - buttonSize: PropTypes.oneOf(_.values(CONST.DROPDOWN_BUTTON_SIZE)), - + buttonSize?: ButtonSizeValue; // Replace with the actual sizes /** Route for the Add Bank Account screen for a given navigation stack */ - addBankAccountRoute: PropTypes.string, - + addBankAccountRoute?: string; /** Route for the Add Debit Card screen for a given navigation stack */ - addDebitCardRoute: PropTypes.string, - + addDebitCardRoute?: string; /** Whether the button should be disabled */ - isDisabled: PropTypes.bool, - + isDisabled?: boolean; /** Whether we should show a loading state for the main button */ - isLoading: PropTypes.bool, - + isLoading?: boolean; /** The anchor alignment of the popover menu for payment method dropdown */ - paymentMethodDropdownAnchorAlignment: PropTypes.shape({ - horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)), - vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)), - }), - + paymentMethodDropdownAnchorAlignment?: AnchorAlignment; /** The anchor alignment of the popover menu for KYC wall popover */ - kycWallAnchorAlignment: PropTypes.shape({ - horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)), - vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)), - }), - + kycWallAnchorAlignment?: AnchorAlignment; /** Whether the personal bank account option should be shown */ - shouldShowPersonalBankAccountOption: PropTypes.bool, + shouldShowPersonalBankAccountOption?: boolean; }; -const defaultProps = { - isLoading: false, - isDisabled: false, - pressOnEnter: false, - addBankAccountRoute: '', - addDebitCardRoute: '', - currency: CONST.CURRENCY.USD, - chatReportID: '', - - // The "iouReport" and "nvp_lastPaymentMethod" objects needs to be stable to prevent the "useMemo" - // hook from being recreated unnecessarily, hence the use of CONST.EMPTY_ARRAY and CONST.EMPTY_OBJECT - iouReport: CONST.EMPTY_OBJECT, - nvp_lastPaymentMethod: CONST.EMPTY_OBJECT, - shouldHidePaymentOptions: false, - shouldShowApproveButton: false, - style: [], - policyID: '', - formattedAmount: '', - buttonSize: CONST.DROPDOWN_BUTTON_SIZE.MEDIUM, - kycWallAnchorAlignment: { +function SettlementButton({ + addDebitCardRoute = '', + addBankAccountRoute = '', + kycWallAnchorAlignment = { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, // button is at left, so horizontal anchor is at LEFT vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, // we assume that popover menu opens below the button, anchor is at TOP }, - paymentMethodDropdownAnchorAlignment: { + paymentMethodDropdownAnchorAlignment = { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, // caret for dropdown is at right, so horizontal anchor is at RIGHT vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, // we assume that popover menu opens below the button, anchor is at TOP }, - shouldShowPersonalBankAccountOption: false, -}; - -function SettlementButton({ - addDebitCardRoute, - addBankAccountRoute, - kycWallAnchorAlignment, - paymentMethodDropdownAnchorAlignment, - buttonSize, - chatReportID, - currency, + buttonSize = CONST.DROPDOWN_BUTTON_SIZE.MEDIUM, + chatReportID = '', + currency = CONST.CURRENCY.USD, enablePaymentsRoute, - iouReport, - isDisabled, - isLoading, - formattedAmount, - nvp_lastPaymentMethod, + // The "iouReport" and "nvpLastPaymentMethod" objects needs to be stable to prevent the "useMemo" + // hook from being recreated unnecessarily, hence the use of CONST.EMPTY_ARRAY and CONST.EMPTY_OBJECT + iouReport = CONST.EMPTY_OBJECT, + nvpLastPaymentMethod = CONST.EMPTY_OBJECT, + isDisabled = false, + isLoading = false, + formattedAmount = '', onPress, - pressOnEnter, - policyID, - shouldHidePaymentOptions, - shouldShowApproveButton, - style, - shouldShowPersonalBankAccountOption, -}) { + pressOnEnter = false, + policyID = '', + shouldHidePaymentOptions = false, + shouldShowApproveButton = false, + style = [], + shouldShowPersonalBankAccountOption = false, +}: SettlementButtonProps) { const {translate} = useLocalize(); const {isOffline} = useNetwork(); @@ -179,7 +142,7 @@ function SettlementButton({ // To achieve the one tap pay experience we need to choose the correct payment type as default, // if user already paid for some request or expense, let's use the last payment method or use default. - const paymentMethod = nvp_lastPaymentMethod[policyID] || ''; + const paymentMethod = nvpLastPaymentMethod[policyID] || ''; if (canUseWallet) { buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]); } @@ -197,9 +160,9 @@ function SettlementButton({ return _.sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1)); } return buttonOptions; - }, [currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); + }, [currency, formattedAmount, iouReport, nvpLastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); - const selectPaymentType = (event, iouPaymentType, triggerKYCFlow) => { + const selectPaymentType = (event: Event, iouPaymentType: string, triggerKYCFlow: TriggerKYCFlow) => { if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { triggerKYCFlow(event, iouPaymentType); BankAccounts.setPersonalBankAccountContinueKYCOnSuccess(ROUTES.ENABLE_PAYMENTS); @@ -227,7 +190,7 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow, buttonRef) => ( + {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} - style={style} + style={[style]} buttonSize={buttonSize} anchorAlignment={paymentMethodDropdownAnchorAlignment} /> @@ -244,15 +207,11 @@ function SettlementButton({ ); } -SettlementButton.propTypes = propTypes; -SettlementButton.defaultProps = defaultProps; SettlementButton.displayName = 'SettlementButton'; -export default compose( - withNavigation, - withOnyx({ - nvp_lastPaymentMethod: { - key: ONYXKEYS.NVP_LAST_PAYMENT_METHOD, - }, - }), -)(SettlementButton); +export default withOnyx({ + nvpLastPaymentMethod: { + key: ONYXKEYS.NVP_LAST_PAYMENT_METHOD, + selector: (paymentMethod) => paymentMethod ?? {}, + }, +})(SettlementButton); From 53e4b00429ebc9663d55599f3487d90280faea69 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 3 Jan 2024 13:06:18 +0300 Subject: [PATCH 020/138] Update types --- src/components/SettlementButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 2786cd852434..3eb4ac844fb2 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -195,10 +195,10 @@ function SettlementButton({ buttonRef={buttonRef} isDisabled={isDisabled} isLoading={isLoading} - onPress={(event, iouPaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} + onPress={(event: Event, iouPaymentType: string) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} - style={[style]} + style={style as Record} buttonSize={buttonSize} anchorAlignment={paymentMethodDropdownAnchorAlignment} /> From 4d9d193f09ef42b84d728615b1853993b7474b56 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 5 Jan 2024 16:13:22 +0700 Subject: [PATCH 021/138] set default category for distance request --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index d41442edd670..3ff22ba218ab 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -115,6 +115,15 @@ function IOURequestStepConfirmation({ IOU.setMoneyRequestBillable_temporaryForRefactor(transactionID, defaultBillable); }, [transactionID, defaultBillable]); + const defaultCategory = _.chain(policy) + .get('customUnits') + .find((customUnit) => customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE) + .get('defaultCategory') + .value(); + useEffect(() => { + IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); + }, [transactionID, defaultCategory]); + const navigateBack = useCallback(() => { // If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken // back to the participants step From 62f1fb19cf7f9c62ed0245876ba6f5551961ed5d Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 5 Jan 2024 16:26:21 +0700 Subject: [PATCH 022/138] use lodashGet instead --- .../iou/request/step/IOURequestStepConfirmation.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 3ff22ba218ab..27d284eb4965 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -115,11 +115,11 @@ function IOURequestStepConfirmation({ IOU.setMoneyRequestBillable_temporaryForRefactor(transactionID, defaultBillable); }, [transactionID, defaultBillable]); - const defaultCategory = _.chain(policy) - .get('customUnits') - .find((customUnit) => customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE) - .get('defaultCategory') - .value(); + const defaultCategory = lodashGet( + _.find(lodashGet(policy, 'customUnits', {}), (customUnit) => customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE), + 'defaultCategory', + '', + ); useEffect(() => { IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); }, [transactionID, defaultCategory]); From dcdf95b12e86c34f0efb4f366c0b01ee02fabf0b Mon Sep 17 00:00:00 2001 From: Yauheni Date: Fri, 5 Jan 2024 13:30:24 +0300 Subject: [PATCH 023/138] Update types --- src/components/Popover/types.ts | 13 ++-------- src/components/PopoverMenu.tsx | 2 +- src/components/SettlementButton.tsx | 37 ++++++++++++++++------------- src/types/onyx/AnchorAlignment.ts | 12 ++++++++++ 4 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 src/types/onyx/AnchorAlignment.ts diff --git a/src/components/Popover/types.ts b/src/components/Popover/types.ts index 3d1f95822e6a..4875676a3caa 100644 --- a/src/components/Popover/types.ts +++ b/src/components/Popover/types.ts @@ -1,16 +1,7 @@ -import type {ValueOf} from 'type-fest'; import type {PopoverAnchorPosition} from '@components/Modal/types'; import type BaseModalProps from '@components/Modal/types'; import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; -import type CONST from '@src/CONST'; - -type AnchorAlignment = { - /** The horizontal anchor alignment of the popover */ - horizontal: ValueOf; - - /** The vertical anchor alignment of the popover */ - vertical: ValueOf; -}; +import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; type PopoverDimensions = { width: number; @@ -48,4 +39,4 @@ type PopoverProps = BaseModalProps & { type PopoverWithWindowDimensionsProps = PopoverProps & WindowDimensionsProps; -export type {PopoverProps, PopoverWithWindowDimensionsProps, AnchorAlignment}; +export type {PopoverProps, PopoverWithWindowDimensionsProps}; diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 502bdbf83b53..9b59b87056e0 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -10,8 +10,8 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import CONST from '@src/CONST'; import type {AnchorPosition} from '@src/styles'; +import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; import MenuItem from './MenuItem'; -import type {AnchorAlignment} from './Popover/types'; import PopoverWithMeasuredContent from './PopoverWithMeasuredContent'; import Text from './Text'; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 3eb4ac844fb2..f09a31701536 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,7 +1,9 @@ import _ from 'lodash'; -import React, {MutableRefObject, useEffect, useMemo} from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {MutableRefObject} from 'react'; +import React, {useEffect, useMemo} from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import * as ReportUtils from '@libs/ReportUtils'; @@ -11,30 +13,29 @@ import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import {ButtonSizeValue} from '@src/styles/utils/types'; +import type {ButtonSizeValue} from '@src/styles/utils/types'; import type {Report} from '@src/types/onyx'; -import {EmptyObject} from '@src/types/utils/EmptyObject'; +import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; -type AnchorAlignment = { - horizontal: 'left' | 'right' | 'center'; - vertical: 'top' | 'center' | 'bottom'; -}; - type TriggerKYCFlow = (event: Event, iouPaymentType: string) => void; +type PaymentType = DeepValueOf; + type SettlementButtonOnyxProps = { /** The last payment method used per policy */ - nvpLastPaymentMethod?: Record; + nvpLastPaymentMethod?: OnyxEntry>; }; type SettlementButtonProps = SettlementButtonOnyxProps & { /** Callback to execute when this button is pressed. Receives a single payment type argument. */ - onPress: (paymentType: string) => void; + onPress: (paymentType: PaymentType) => void; /** The route to redirect if user does not have a payment method setup */ - enablePaymentsRoute: string; + enablePaymentsRoute: typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; /** Call the onPress function on main button when Enter key is pressed */ pressOnEnter?: boolean; /** Settlement currency type */ @@ -98,7 +99,7 @@ function SettlementButton({ policyID = '', shouldHidePaymentOptions = false, shouldShowApproveButton = false, - style = [], + style, shouldShowPersonalBankAccountOption = false, }: SettlementButtonProps) { const {translate} = useLocalize(); @@ -142,7 +143,7 @@ function SettlementButton({ // To achieve the one tap pay experience we need to choose the correct payment type as default, // if user already paid for some request or expense, let's use the last payment method or use default. - const paymentMethod = nvpLastPaymentMethod[policyID] || ''; + const paymentMethod = nvpLastPaymentMethod?.[policyID] ?? ''; if (canUseWallet) { buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]); } @@ -162,7 +163,7 @@ function SettlementButton({ return buttonOptions; }, [currency, formattedAmount, iouReport, nvpLastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); - const selectPaymentType = (event: Event, iouPaymentType: string, triggerKYCFlow: TriggerKYCFlow) => { + const selectPaymentType = (event: Event, iouPaymentType: PaymentType, triggerKYCFlow: TriggerKYCFlow) => { if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { triggerKYCFlow(event, iouPaymentType); BankAccounts.setPersonalBankAccountContinueKYCOnSuccess(ROUTES.ENABLE_PAYMENTS); @@ -195,7 +196,9 @@ function SettlementButton({ buttonRef={buttonRef} isDisabled={isDisabled} isLoading={isLoading} - onPress={(event: Event, iouPaymentType: string) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} + onPress={(event: Event, iouPaymentType: PaymentType) => + selectPaymentType(event, iouPaymentType, triggerKYCFlow) + } pressOnEnter={pressOnEnter} options={paymentButtonOptions} style={style as Record} diff --git a/src/types/onyx/AnchorAlignment.ts b/src/types/onyx/AnchorAlignment.ts new file mode 100644 index 000000000000..899e3d9e277b --- /dev/null +++ b/src/types/onyx/AnchorAlignment.ts @@ -0,0 +1,12 @@ +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; + +type AnchorAlignment = { + /** The horizontal anchor alignment of the popover */ + horizontal: ValueOf; + + /** The vertical anchor alignment of the popover */ + vertical: ValueOf; +}; + +export default AnchorAlignment; From f3004da4052942de46f8134f1faa9a9434794593 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Fri, 5 Jan 2024 15:01:21 +0300 Subject: [PATCH 024/138] Update types x2 --- src/components/SettlementButton.tsx | 39 +++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index f09a31701536..a11481c99cb1 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,7 +1,6 @@ -import _ from 'lodash'; import type {MutableRefObject} from 'react'; import React, {useEffect, useMemo} from 'react'; -import type {StyleProp, ViewStyle} from 'react-native'; +import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; @@ -11,6 +10,7 @@ import * as BankAccounts from '@userActions/BankAccounts'; import * as IOU from '@userActions/IOU'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; +import type {OnyxValues} from '@src/ONYXKEYS'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; @@ -22,52 +22,72 @@ import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; +type Event = GestureResponderEvent | KeyboardEvent; + type TriggerKYCFlow = (event: Event, iouPaymentType: string) => void; type PaymentType = DeepValueOf; type SettlementButtonOnyxProps = { /** The last payment method used per policy */ - nvpLastPaymentMethod?: OnyxEntry>; + nvpLastPaymentMethod?: OnyxEntry; }; type SettlementButtonProps = SettlementButtonOnyxProps & { /** Callback to execute when this button is pressed. Receives a single payment type argument. */ onPress: (paymentType: PaymentType) => void; + /** The route to redirect if user does not have a payment method setup */ enablePaymentsRoute: typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; + /** Call the onPress function on main button when Enter key is pressed */ pressOnEnter?: boolean; + /** Settlement currency type */ currency?: string; + /** When the button is opened via an IOU, ID for the chatReport that the IOU is linked to */ chatReportID?: string; + /** The IOU/Expense report we are paying */ iouReport?: OnyxEntry | EmptyObject; + /** Should we show the payment options? */ shouldHidePaymentOptions?: boolean; + /** Should we show the payment options? */ shouldShowApproveButton?: boolean; + /** The policyID of the report we are paying */ policyID?: string; + /** Additional styles to add to the component */ style?: StyleProp; + /** Total money amount in form */ formattedAmount?: string; + /** The size of button size */ - buttonSize?: ButtonSizeValue; // Replace with the actual sizes + buttonSize?: ButtonSizeValue; + /** Route for the Add Bank Account screen for a given navigation stack */ addBankAccountRoute?: string; + /** Route for the Add Debit Card screen for a given navigation stack */ addDebitCardRoute?: string; + /** Whether the button should be disabled */ isDisabled?: boolean; + /** Whether we should show a loading state for the main button */ isLoading?: boolean; + /** The anchor alignment of the popover menu for payment method dropdown */ paymentMethodDropdownAnchorAlignment?: AnchorAlignment; + /** The anchor alignment of the popover menu for KYC wall popover */ kycWallAnchorAlignment?: AnchorAlignment; + /** Whether the personal bank account option should be shown */ shouldShowPersonalBankAccountOption?: boolean; }; @@ -158,7 +178,7 @@ function SettlementButton({ // Put the preferred payment method to the front of the array so its shown as default if (paymentMethod) { - return _.sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1)); + return buttonOptions.sort((method) => (method.value === paymentMethod ? 0 : 1)); } return buttonOptions; }, [currency, formattedAmount, iouReport, nvpLastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); @@ -191,17 +211,16 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( + {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( - selectPaymentType(event, iouPaymentType, triggerKYCFlow) - } + onPress={(event: Event, iouPaymentType: PaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} - style={style as Record} + // @ts-expect-error TODO: Remove this once OptionsListUtils (https://github.com/Expensify/App/issues/25065) is migrated to TypeScript. + style={style} buttonSize={buttonSize} anchorAlignment={paymentMethodDropdownAnchorAlignment} /> From c3de7d1faf23f915b781b29eef7e978fe08dd983 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 8 Jan 2024 08:45:39 +0100 Subject: [PATCH 025/138] bump minor of vision camera --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index b10078ee7e6b..4a3b55d65205 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,7 +111,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "2.16.5", + "react-native-vision-camera": "2.16.6", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", @@ -47872,9 +47872,9 @@ } }, "node_modules/react-native-vision-camera": { - "version": "2.16.5", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", - "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", + "version": "2.16.6", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.6.tgz", + "integrity": "sha512-rhlRC+yLB1fIB5eVjtnbjgTqNzihFqvoc4B0n+PlytYvHeK3BpD3Shawmy8Me/nBVL5k4Ay+QOd4niFOir+6YQ==", "peerDependencies": { "react": "*", "react-native": "*" @@ -90688,9 +90688,9 @@ "requires": {} }, "react-native-vision-camera": { - "version": "2.16.5", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", - "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", + "version": "2.16.6", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.6.tgz", + "integrity": "sha512-rhlRC+yLB1fIB5eVjtnbjgTqNzihFqvoc4B0n+PlytYvHeK3BpD3Shawmy8Me/nBVL5k4Ay+QOd4niFOir+6YQ==", "requires": {} }, "react-native-web": { diff --git a/package.json b/package.json index 2c25c863f49f..446a815d4f79 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "2.16.5", + "react-native-vision-camera": "2.16.6", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", From c92cde7964361533e28ef4b04f8ce1880faba90a Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 8 Jan 2024 10:59:51 +0300 Subject: [PATCH 026/138] Fix ts issue --- src/components/ProcessMoneyRequestHoldMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProcessMoneyRequestHoldMenu.tsx b/src/components/ProcessMoneyRequestHoldMenu.tsx index 1b711633ed3b..a6b53da467b5 100644 --- a/src/components/ProcessMoneyRequestHoldMenu.tsx +++ b/src/components/ProcessMoneyRequestHoldMenu.tsx @@ -2,11 +2,11 @@ import React from 'react'; import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; import Button from './Button'; import HoldMenuSectionList from './HoldMenuSectionList'; import type {PopoverAnchorPosition} from './Modal/types'; import Popover from './Popover'; -import type {AnchorAlignment} from './Popover/types'; import Text from './Text'; import TextPill from './TextPill'; From a7e9e5aec49d03ba0fb95fad080deadcdd026425 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 8 Jan 2024 15:12:13 +0100 Subject: [PATCH 027/138] add patches and fixes for expo --- package-lock.json | 14 ++-- package.json | 2 +- patches/expo+49.0.21.patch | 32 ++++++++ patches/expo-modules-autolinking+1.5.1.patch | 82 ++++++++++++++++++++ patches/expo-modules-core+1.5.12.patch | 16 ++++ 5 files changed, 138 insertions(+), 8 deletions(-) create mode 100644 patches/expo+49.0.21.patch create mode 100644 patches/expo-modules-autolinking+1.5.1.patch create mode 100644 patches/expo-modules-core+1.5.12.patch diff --git a/package-lock.json b/package-lock.json index 4a3b55d65205..b10078ee7e6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,7 +111,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "2.16.6", + "react-native-vision-camera": "2.16.5", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", @@ -47872,9 +47872,9 @@ } }, "node_modules/react-native-vision-camera": { - "version": "2.16.6", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.6.tgz", - "integrity": "sha512-rhlRC+yLB1fIB5eVjtnbjgTqNzihFqvoc4B0n+PlytYvHeK3BpD3Shawmy8Me/nBVL5k4Ay+QOd4niFOir+6YQ==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", + "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", "peerDependencies": { "react": "*", "react-native": "*" @@ -90688,9 +90688,9 @@ "requires": {} }, "react-native-vision-camera": { - "version": "2.16.6", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.6.tgz", - "integrity": "sha512-rhlRC+yLB1fIB5eVjtnbjgTqNzihFqvoc4B0n+PlytYvHeK3BpD3Shawmy8Me/nBVL5k4Ay+QOd4niFOir+6YQ==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-2.16.5.tgz", + "integrity": "sha512-MzXhNd597OyMQSEGhqWI4DufWkdr7PR7U9B30E3gXnln7cnvjMVIp4j3eIW9BIrgvEyUcEeL7nZM5NLhTmO/fA==", "requires": {} }, "react-native-web": { diff --git a/package.json b/package.json index 446a815d4f79..2c25c863f49f 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "^3.6.0", - "react-native-vision-camera": "2.16.6", + "react-native-vision-camera": "2.16.5", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-webview": "^11.17.2", diff --git a/patches/expo+49.0.21.patch b/patches/expo+49.0.21.patch new file mode 100644 index 000000000000..0e246b301c28 --- /dev/null +++ b/patches/expo+49.0.21.patch @@ -0,0 +1,32 @@ +diff --git a/node_modules/expo/scripts/autolinking.gradle b/node_modules/expo/scripts/autolinking.gradle +index 0505395..08098e0 100644 +--- a/node_modules/expo/scripts/autolinking.gradle ++++ b/node_modules/expo/scripts/autolinking.gradle +@@ -1,2 +1,3 @@ + def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json')"].execute(null, rootDir).text.trim() +-apply from: new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); ++ ++apply from: hasProperty("reactNativeProject") ? file('../../expo-modules-autolinking/scripts/android/autolinking_implementation.gradle') : new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); +diff --git a/node_modules/expo/scripts/autolinking.rb b/node_modules/expo/scripts/autolinking.rb +index 0617de5..584364f 100644 +--- a/node_modules/expo/scripts/autolinking.rb ++++ b/node_modules/expo/scripts/autolinking.rb +@@ -2,13 +2,14 @@ require 'json' + require 'pathname' + require 'colored2' # dependency of CocoaPods + +-require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/autolinking_manager") +-require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/xcode_env_generator") +-require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/react_import_patcher") ++AUTOLINKING_PATH = ENV['REACT_NATIVE_DIR'] ? `node --print "require.resolve('#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking/package.json')"` : `node --print "require.resolve('expo-modules-autolinking/package.json')"` ++ ++require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/autolinking_manager") ++require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/xcode_env_generator") ++require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/react_import_patcher") + + def use_expo_modules!(options = {}) + # When run from the Podfile, `self` points to Pod::Podfile object +- + if @current_target_definition.autolinking_manager.present? + Pod::UI.message 'Expo modules are already being used in this target definition'.red + return diff --git a/patches/expo-modules-autolinking+1.5.1.patch b/patches/expo-modules-autolinking+1.5.1.patch new file mode 100644 index 000000000000..312c1aa8967e --- /dev/null +++ b/patches/expo-modules-autolinking+1.5.1.patch @@ -0,0 +1,82 @@ +diff --git a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle +index 5f4cd8e..bdbea02 100644 +--- a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle ++++ b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle +@@ -135,6 +135,7 @@ class ExpoAutolinkingManager { + } + + static String exec(String[] commandArgs, File dir) { ++ print(dir) + Process proc = commandArgs.execute(null, dir) + StringBuffer outputStream = new StringBuffer() + proc.waitForProcessOutput(outputStream, System.err) +@@ -142,11 +143,12 @@ class ExpoAutolinkingManager { + } + + static private String[] convertOptionsToCommandArgs(String command, Map options) { ++ def expoModulesPath = options.searchPaths ? "../react-native/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" + String[] args = [ + 'node', + '--no-warnings', + '--eval', +- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', ++ "require(\'${expoModulesPath}\')(process.argv.slice(1))", + '--', + command, + '--platform', +diff --git a/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb b/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb +index d570ad2..b9c5350 100644 +--- a/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb ++++ b/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb +@@ -26,7 +26,6 @@ module Expo + if has_packages? + return + end +- + global_flags = @options.fetch(:flags, {}) + tests_only = @options.fetch(:testsOnly, false) + include_tests = @options.fetch(:includeTests, false) +@@ -174,11 +173,12 @@ module Expo + end + + private def node_command_args(command_name) ++ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" + eval_command_args = [ + 'node', + '--no-warnings', + '--eval', +- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', ++ "require(\'#{autolinking_path}\')(process.argv.slice(1))", + command_name, + '--platform', + 'ios' +diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb +index bddfa0d..3ae2c6c 100644 +--- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb ++++ b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb +@@ -213,6 +213,7 @@ module Expo + # Generates the support script that is executed by the build script phase. + def self.generate_support_script(autolinking_manager, modules_provider_path) + args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" }.join(' ') ++ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" + + <<~SUPPORT_SCRIPT + #!/usr/bin/env bash +@@ -245,7 +246,6 @@ module Expo + You can set this up quickly by running: + + echo "export NODE_BINARY=\\$(command -v node)" >> .xcode.env +- + in the ios folder of your project. + NODE_NOT_FOUND + +@@ -257,8 +257,7 @@ module Expo + "$NODE_BINARY" "$@" + fi + } +- +- with_node --no-warnings --eval "require(\'expo-modules-autolinking\')(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" ++ with_node --no-warnings --eval "require(\'#{autolinking_path}\')(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" + SUPPORT_SCRIPT + end + diff --git a/patches/expo-modules-core+1.5.12.patch b/patches/expo-modules-core+1.5.12.patch new file mode 100644 index 000000000000..93383f04440c --- /dev/null +++ b/patches/expo-modules-core+1.5.12.patch @@ -0,0 +1,16 @@ +diff --git a/node_modules/expo-modules-core/android/build.gradle b/node_modules/expo-modules-core/android/build.gradle +index 8f9e0dc..539a201 100644 +--- a/node_modules/expo-modules-core/android/build.gradle ++++ b/node_modules/expo-modules-core/android/build.gradle +@@ -54,9 +54,10 @@ def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File( + def thirdPartyNdkDir = new File("$buildDir/third-party-ndk") + + def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":packages:react-native:ReactAndroid") != null ++def FALLBACK_REACT_NATIVE_DIR = ext.has("customRNProjectPath") ? ext.customRNProjectPath : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent) + def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE + ? findProject(":packages:react-native:ReactAndroid").getProjectDir().parent +- : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent ++ : FALLBACK_REACT_NATIVE_DIR + def REACT_NATIVE_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE + ? Paths.get(findProject(":packages:react-native:ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni") + : "${buildDir}/react/jni" From d17163a1b7e019dc292aff09f3aacae255cd0045 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 8 Jan 2024 15:18:49 +0100 Subject: [PATCH 028/138] one more fix --- patches/expo-modules-autolinking+1.5.1.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/patches/expo-modules-autolinking+1.5.1.patch b/patches/expo-modules-autolinking+1.5.1.patch index 312c1aa8967e..20fed8608ebd 100644 --- a/patches/expo-modules-autolinking+1.5.1.patch +++ b/patches/expo-modules-autolinking+1.5.1.patch @@ -80,3 +80,21 @@ index bddfa0d..3ae2c6c 100644 SUPPORT_SCRIPT end +diff --git a/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb b/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb +index 4acf193..b54ea94 100644 +--- a/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb ++++ b/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb +@@ -10,11 +10,12 @@ module Expo + end + + public def run! ++ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" + args = [ + 'node', + '--no-warnings', + '--eval', +- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', ++ "require(\'#{autolinking_path}\')(process.argv.slice(1))", + 'patch-react-imports', + '--pods-root', + File.expand_path(@root), From 3fec0575686d919ac3e1b341e39dfb281fae9b43 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 9 Jan 2024 18:39:13 +0100 Subject: [PATCH 029/138] Fix comments --- src/components/SettlementButton.tsx | 15 +++++++-------- src/types/onyx/LastPaymentMethod.ts | 3 +++ src/types/onyx/index.ts | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 src/types/onyx/LastPaymentMethod.ts diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index a11481c99cb1..1ad4cb496008 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -10,11 +10,10 @@ import * as BankAccounts from '@userActions/BankAccounts'; import * as IOU from '@userActions/IOU'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; -import type {OnyxValues} from '@src/ONYXKEYS'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; -import type {Report} from '@src/types/onyx'; +import type {LastPaymentMethod, Report} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; @@ -22,15 +21,15 @@ import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; -type Event = GestureResponderEvent | KeyboardEvent; +type KYCFlowEvent = GestureResponderEvent | KeyboardEvent; -type TriggerKYCFlow = (event: Event, iouPaymentType: string) => void; +type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: string) => void; type PaymentType = DeepValueOf; type SettlementButtonOnyxProps = { /** The last payment method used per policy */ - nvpLastPaymentMethod?: OnyxEntry; + nvpLastPaymentMethod?: OnyxEntry; }; type SettlementButtonProps = SettlementButtonOnyxProps & { @@ -183,7 +182,7 @@ function SettlementButton({ return buttonOptions; }, [currency, formattedAmount, iouReport, nvpLastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); - const selectPaymentType = (event: Event, iouPaymentType: PaymentType, triggerKYCFlow: TriggerKYCFlow) => { + const selectPaymentType = (event: KYCFlowEvent, iouPaymentType: PaymentType, triggerKYCFlow: TriggerKYCFlow) => { if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { triggerKYCFlow(event, iouPaymentType); BankAccounts.setPersonalBankAccountContinueKYCOnSuccess(ROUTES.ENABLE_PAYMENTS); @@ -211,12 +210,12 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( + {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( selectPaymentType(event, iouPaymentType, triggerKYCFlow)} + onPress={(event: KYCFlowEvent, iouPaymentType: PaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} // @ts-expect-error TODO: Remove this once OptionsListUtils (https://github.com/Expensify/App/issues/25065) is migrated to TypeScript. diff --git a/src/types/onyx/LastPaymentMethod.ts b/src/types/onyx/LastPaymentMethod.ts new file mode 100644 index 000000000000..677a23fa9586 --- /dev/null +++ b/src/types/onyx/LastPaymentMethod.ts @@ -0,0 +1,3 @@ +type LastPaymentMethod = Record; + +export default LastPaymentMethod; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 7bd9c321be5e..824275ace170 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -15,6 +15,7 @@ import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import type {FundList} from './Fund'; import type Fund from './Fund'; import type IOU from './IOU'; +import type LastPaymentMethod from './LastPaymentMethod'; import type Locale from './Locale'; import type {LoginList} from './Login'; import type Login from './Login'; @@ -137,4 +138,5 @@ export type { ReportUserIsTyping, PolicyReportField, RecentlyUsedReportFields, + LastPaymentMethod, }; From 1c1fa2638917145e489f91ea80571b294a0e78df Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 10 Jan 2024 10:58:13 +0100 Subject: [PATCH 030/138] fix patch --- patches/expo-modules-core+1.5.12.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/expo-modules-core+1.5.12.patch b/patches/expo-modules-core+1.5.12.patch index 93383f04440c..9025a7c42d9f 100644 --- a/patches/expo-modules-core+1.5.12.patch +++ b/patches/expo-modules-core+1.5.12.patch @@ -1,12 +1,12 @@ diff --git a/node_modules/expo-modules-core/android/build.gradle b/node_modules/expo-modules-core/android/build.gradle -index 8f9e0dc..539a201 100644 +index 8f9e0dc..af5b5d6 100644 --- a/node_modules/expo-modules-core/android/build.gradle +++ b/node_modules/expo-modules-core/android/build.gradle @@ -54,9 +54,10 @@ def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File( def thirdPartyNdkDir = new File("$buildDir/third-party-ndk") def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":packages:react-native:ReactAndroid") != null -+def FALLBACK_REACT_NATIVE_DIR = ext.has("customRNProjectPath") ? ext.customRNProjectPath : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent) ++def FALLBACK_REACT_NATIVE_DIR = hasProperty("reactNativeProject") ? file('../../react-native') : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE ? findProject(":packages:react-native:ReactAndroid").getProjectDir().parent - : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent From 5754adc74b3158b0c0d63a74999974f6cf709dc7 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 10 Jan 2024 11:34:14 +0100 Subject: [PATCH 031/138] Update type imports --- src/components/Popover/types.ts | 2 +- src/components/PopoverMenu.tsx | 2 +- src/components/ProcessMoneyRequestHoldMenu.tsx | 2 +- src/components/SettlementButton.tsx | 3 +-- src/types/onyx/index.ts | 2 ++ 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Popover/types.ts b/src/components/Popover/types.ts index 4875676a3caa..298c95eeca76 100644 --- a/src/components/Popover/types.ts +++ b/src/components/Popover/types.ts @@ -1,7 +1,7 @@ import type {PopoverAnchorPosition} from '@components/Modal/types'; import type BaseModalProps from '@components/Modal/types'; import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; -import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; +import type {AnchorAlignment} from '@src/types/onyx'; type PopoverDimensions = { width: number; diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 9b59b87056e0..0a1fdf38a172 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -10,7 +10,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import CONST from '@src/CONST'; import type {AnchorPosition} from '@src/styles'; -import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; +import type {AnchorAlignment} from '@src/types/onyx'; import MenuItem from './MenuItem'; import PopoverWithMeasuredContent from './PopoverWithMeasuredContent'; import Text from './Text'; diff --git a/src/components/ProcessMoneyRequestHoldMenu.tsx b/src/components/ProcessMoneyRequestHoldMenu.tsx index a6b53da467b5..1fd37b82afc8 100644 --- a/src/components/ProcessMoneyRequestHoldMenu.tsx +++ b/src/components/ProcessMoneyRequestHoldMenu.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; +import type {AnchorAlignment} from '@src/types/onyx'; import Button from './Button'; import HoldMenuSectionList from './HoldMenuSectionList'; import type {PopoverAnchorPosition} from './Modal/types'; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 1ad4cb496008..2fe45e6f7b90 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -13,8 +13,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; -import type {LastPaymentMethod, Report} from '@src/types/onyx'; -import type AnchorAlignment from '@src/types/onyx/AnchorAlignment'; +import type {AnchorAlignment, LastPaymentMethod, Report} from '@src/types/onyx'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 824275ace170..ecc3603e8f8d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -1,5 +1,6 @@ import type Account from './Account'; import type AccountData from './AccountData'; +import type AnchorAlignment from './AnchorAlignment'; import type {BankAccountList} from './BankAccount'; import type BankAccount from './BankAccount'; import type Beta from './Beta'; @@ -139,4 +140,5 @@ export type { PolicyReportField, RecentlyUsedReportFields, LastPaymentMethod, + AnchorAlignment, }; From ef7487ab74bc146b82e40dcbe69dd6875cb617dc Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 10 Jan 2024 14:24:13 +0100 Subject: [PATCH 032/138] Fix comments --- src/ONYXKEYS.ts | 4 +++- src/components/SettlementButton.tsx | 7 +++++-- src/types/onyx/LastPaymentMethod.ts | 3 --- src/types/onyx/index.ts | 2 -- 4 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 src/types/onyx/LastPaymentMethod.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 89ddbdc06883..d3c7756b0dee 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -530,5 +530,7 @@ type OnyxValues = { type OnyxKeyValue = OnyxEntry; +type LastPaymentMethod = Record; + export default ONYXKEYS; -export type {OnyxKey, OnyxCollectionKey, OnyxValues, OnyxKeyValue, OnyxFormKey, OnyxKeysMap}; +export type {OnyxKey, OnyxCollectionKey, OnyxValues, OnyxKeyValue, OnyxFormKey, OnyxKeysMap,LastPaymentMethod}; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 2fe45e6f7b90..1fae611018c1 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -10,10 +10,11 @@ import * as BankAccounts from '@userActions/BankAccounts'; import * as IOU from '@userActions/IOU'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; +import type {LastPaymentMethod} from '@src/ONYXKEYS'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; -import type {AnchorAlignment, LastPaymentMethod, Report} from '@src/types/onyx'; +import type {AnchorAlignment, Report} from '@src/types/onyx'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; @@ -26,6 +27,8 @@ type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: string) => void; type PaymentType = DeepValueOf; +type EnablePaymentsRoute = typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; + type SettlementButtonOnyxProps = { /** The last payment method used per policy */ nvpLastPaymentMethod?: OnyxEntry; @@ -36,7 +39,7 @@ type SettlementButtonProps = SettlementButtonOnyxProps & { onPress: (paymentType: PaymentType) => void; /** The route to redirect if user does not have a payment method setup */ - enablePaymentsRoute: typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; + enablePaymentsRoute: EnablePaymentsRoute; /** Call the onPress function on main button when Enter key is pressed */ pressOnEnter?: boolean; diff --git a/src/types/onyx/LastPaymentMethod.ts b/src/types/onyx/LastPaymentMethod.ts deleted file mode 100644 index 677a23fa9586..000000000000 --- a/src/types/onyx/LastPaymentMethod.ts +++ /dev/null @@ -1,3 +0,0 @@ -type LastPaymentMethod = Record; - -export default LastPaymentMethod; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index ecc3603e8f8d..4e199e88ce88 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -16,7 +16,6 @@ import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import type {FundList} from './Fund'; import type Fund from './Fund'; import type IOU from './IOU'; -import type LastPaymentMethod from './LastPaymentMethod'; import type Locale from './Locale'; import type {LoginList} from './Login'; import type Login from './Login'; @@ -139,6 +138,5 @@ export type { ReportUserIsTyping, PolicyReportField, RecentlyUsedReportFields, - LastPaymentMethod, AnchorAlignment, }; From c2d9c887fcc609d90324b556d1716640f6547018 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 10 Jan 2024 20:05:55 +0100 Subject: [PATCH 033/138] Fix comments x2 --- src/ONYXKEYS.ts | 6 ++---- src/components/SettlementButton.tsx | 3 +-- src/types/onyx/LastPaymentMethod.ts | 3 +++ src/types/onyx/index.ts | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 src/types/onyx/LastPaymentMethod.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d3c7756b0dee..63eecbea3984 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -391,7 +391,7 @@ type OnyxValues = { [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; [ONYXKEYS.NVP_TRY_FOCUS_MODE]: boolean; [ONYXKEYS.FOCUS_MODE_NOTIFICATION]: boolean; - [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; + [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: OnyxTypes.LastPaymentMethod; [ONYXKEYS.NVP_RECENT_WAYPOINTS]: OnyxTypes.RecentWaypoint[]; [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; @@ -530,7 +530,5 @@ type OnyxValues = { type OnyxKeyValue = OnyxEntry; -type LastPaymentMethod = Record; - export default ONYXKEYS; -export type {OnyxKey, OnyxCollectionKey, OnyxValues, OnyxKeyValue, OnyxFormKey, OnyxKeysMap,LastPaymentMethod}; +export type {OnyxKey, OnyxCollectionKey, OnyxValues, OnyxKeyValue, OnyxFormKey, OnyxKeysMap}; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 1fae611018c1..4a4abea14c70 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -10,11 +10,10 @@ import * as BankAccounts from '@userActions/BankAccounts'; import * as IOU from '@userActions/IOU'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; -import type {LastPaymentMethod} from '@src/ONYXKEYS'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; -import type {AnchorAlignment, Report} from '@src/types/onyx'; +import type {AnchorAlignment, LastPaymentMethod, Report} from '@src/types/onyx'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; diff --git a/src/types/onyx/LastPaymentMethod.ts b/src/types/onyx/LastPaymentMethod.ts new file mode 100644 index 000000000000..677a23fa9586 --- /dev/null +++ b/src/types/onyx/LastPaymentMethod.ts @@ -0,0 +1,3 @@ +type LastPaymentMethod = Record; + +export default LastPaymentMethod; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 4e199e88ce88..ecc3603e8f8d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -16,6 +16,7 @@ import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import type {FundList} from './Fund'; import type Fund from './Fund'; import type IOU from './IOU'; +import type LastPaymentMethod from './LastPaymentMethod'; import type Locale from './Locale'; import type {LoginList} from './Login'; import type Login from './Login'; @@ -138,5 +139,6 @@ export type { ReportUserIsTyping, PolicyReportField, RecentlyUsedReportFields, + LastPaymentMethod, AnchorAlignment, }; From 812dd2f2c6df21ecaf123eb06f45e64048b037b4 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 11 Jan 2024 09:55:47 +0100 Subject: [PATCH 034/138] update commend --- android/app/src/main/res/values/colors.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index b4d8c2181b0b..8d5bfbf4eed7 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,4 +1,5 @@ + #03D47C #FFFFFF #03D47C From 402e85f1786e4b64766d0c060b26531d5387024f Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 11 Jan 2024 10:00:30 +0100 Subject: [PATCH 035/138] add quick fix for nav --- src/pages/LogOutPreviousUserPage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 3ed803cb0b32..a1f5ed035763 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -64,6 +64,8 @@ function LogOutPreviousUserPage(props) { // which is already called when AuthScreens mounts. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { + // temporary until finding clean solution + Navigation.goBack(); Navigation.navigate(exitTo); }); } From b91bc05bd24e8514f1a75493705f0561d20fe72b Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Fri, 12 Jan 2024 22:41:58 +0700 Subject: [PATCH 036/138] Add highlight to active emoji in EmojiDropDown --- src/CONST.ts | 2 ++ src/components/EmojiPicker/EmojiPicker.js | 5 ++++- .../EmojiPicker/EmojiPickerButtonDropdown.js | 19 +++++++++++++------ .../EmojiPicker/EmojiPickerMenu/index.js | 7 +++++-- src/libs/EmojiUtils.ts | 10 ++++++++++ src/libs/actions/EmojiPickerAction.ts | 4 +++- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index b1a6b6895de7..2734a607615e 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1387,6 +1387,8 @@ const CONST = { EMOJI: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, // eslint-disable-next-line max-len, no-misleading-character-class EMOJIS: /[\p{Extended_Pictographic}](\u200D[\p{Extended_Pictographic}]|[\u{1F3FB}-\u{1F3FF}]|[\u{E0020}-\u{E007F}]|\uFE0F|\u20E3)*|[\u{1F1E6}-\u{1F1FF}]{2}|[#*0-9]\uFE0F?\u20E3/gu, + // eslint-disable-next-line max-len, no-misleading-character-class + EMOJI_SKIN_TONES: /[\u{1f3fb}-\u{1f3ff}]/gu, TAX_ID: /^\d{9}$/, NON_NUMERIC: /\D/g, diff --git a/src/components/EmojiPicker/EmojiPicker.js b/src/components/EmojiPicker/EmojiPicker.js index 532eb61a99a9..563a2696fab4 100644 --- a/src/components/EmojiPicker/EmojiPicker.js +++ b/src/components/EmojiPicker/EmojiPicker.js @@ -33,6 +33,7 @@ const EmojiPicker = forwardRef((props, ref) => { const emojiPopoverAnchorRef = useRef(null); const onModalHide = useRef(() => {}); const onEmojiSelected = useRef(() => {}); + const activeEmoji = useRef(); const emojiSearchInput = useRef(); const {isSmallScreenWidth, windowHeight} = useWindowDimensions(); @@ -56,9 +57,10 @@ const EmojiPicker = forwardRef((props, ref) => { * @param {Function} [onWillShow=() => {}] - Run a callback when Popover will show * @param {String} id - Unique id for EmojiPicker */ - const showEmojiPicker = (onModalHideValue, onEmojiSelectedValue, emojiPopoverAnchorValue, anchorOrigin, onWillShow = () => {}, id) => { + const showEmojiPicker = (onModalHideValue, onEmojiSelectedValue, emojiPopoverAnchorValue, anchorOrigin, onWillShow = () => {}, id, activeEmojiValue) => { onModalHide.current = onModalHideValue; onEmojiSelected.current = onEmojiSelectedValue; + activeEmoji.current = activeEmojiValue; emojiPopoverAnchorRef.current = emojiPopoverAnchorValue; const emojiPopoverAnchor = getEmojiPopoverAnchor(); if (emojiPopoverAnchor.current && emojiPopoverAnchor.current.blur) { @@ -184,6 +186,7 @@ const EmojiPicker = forwardRef((props, ref) => { > (emojiSearchInput.current = el)} /> diff --git a/src/components/EmojiPicker/EmojiPickerButtonDropdown.js b/src/components/EmojiPicker/EmojiPickerButtonDropdown.js index bfcb66aeefbb..4d4eae49bf86 100644 --- a/src/components/EmojiPicker/EmojiPickerButtonDropdown.js +++ b/src/components/EmojiPicker/EmojiPickerButtonDropdown.js @@ -29,18 +29,25 @@ function EmojiPickerButtonDropdown(props) { const StyleUtils = useStyleUtils(); const emojiPopoverAnchor = useRef(null); useEffect(() => EmojiPickerAction.resetEmojiPopoverAnchor, []); - const onPress = () => { if (EmojiPickerAction.isEmojiPickerVisible()) { EmojiPickerAction.hideEmojiPicker(); return; } - EmojiPickerAction.showEmojiPicker(props.onModalHide, (emoji) => props.onInputChange(emoji), emojiPopoverAnchor, { - horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, - vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, - shiftVertical: 4, - }); + EmojiPickerAction.showEmojiPicker( + props.onModalHide, + (emoji) => props.onInputChange(emoji), + emojiPopoverAnchor, + { + horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, + vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, + shiftVertical: 4, + }, + () => {}, + undefined, + props.value, + ); }; return ( diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index a723eed446a4..0be9eafdd4a7 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -14,6 +14,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus'; +import * as EmojiUtils from '@libs/EmojiUtils'; import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; @@ -33,7 +34,7 @@ const defaultProps = { const throttleTime = Browser.isMobile() ? 200 : 50; -function EmojiPickerMenu({forwardedRef, onEmojiSelected}) { +function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const {isSmallScreenWidth, windowWidth} = useWindowDimensions(); @@ -344,7 +345,8 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected}) { const emojiCode = types && types[preferredSkinTone] ? types[preferredSkinTone] : code; const isEmojiFocused = index === highlightedIndex && isUsingKeyboardMovement; - const shouldEmojiBeHighlighted = index === highlightedIndex && highlightFirstEmoji; + const shouldEmojiBeHighlighted = + (index === highlightedIndex && highlightFirstEmoji) || (activeEmoji && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); return ( (prevState === index ? -1 : prevState)) } isFocused={isEmojiFocused} + //isHighlighted={true} isHighlighted={shouldEmojiBeHighlighted} /> ); diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index e34fa0b90fc6..b42049cc627d 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -548,6 +548,15 @@ const getEmojiReactionDetails = (emojiName: string, reaction: ReportActionReacti }; }; +/** + * Get base emoji without skintone + * @param emoji emoji string + * @returns emoji without skin tone + */ +const getRemovedSkinToneEmoji = (emoji: string) => { + return emoji.replace(CONST.REGEX.EMOJI_SKIN_TONES, ''); +}; + export { findEmojiByName, findEmojiByCode, @@ -570,4 +579,5 @@ export { getAddedEmojis, isFirstLetterEmoji, hasAccountIDEmojiReacted, + getRemovedSkinToneEmoji, }; diff --git a/src/libs/actions/EmojiPickerAction.ts b/src/libs/actions/EmojiPickerAction.ts index 56a5f34c0b8e..0fc21713c608 100644 --- a/src/libs/actions/EmojiPickerAction.ts +++ b/src/libs/actions/EmojiPickerAction.ts @@ -26,6 +26,7 @@ type EmojiPickerRef = { anchorOrigin?: AnchorOrigin, onWillShow?: OnWillShowPicker, id?: string, + activeEmoji?: string, ) => void; isActive: (id: string) => boolean; clearActive: () => void; @@ -55,12 +56,13 @@ function showEmojiPicker( anchorOrigin?: AnchorOrigin, onWillShow: OnWillShowPicker = () => {}, id?: string, + activeEmoji?: string, ) { if (!emojiPickerRef.current) { return; } - emojiPickerRef.current.showEmojiPicker(onModalHide, onEmojiSelected, emojiPopoverAnchor, anchorOrigin, onWillShow, id); + emojiPickerRef.current.showEmojiPicker(onModalHide, onEmojiSelected, emojiPopoverAnchor, anchorOrigin, onWillShow, id, activeEmoji); } /** From 9698dbf988b7abfa751e514fe7d4de0211fe3735 Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Sat, 13 Jan 2024 10:57:16 +0700 Subject: [PATCH 037/138] resolve lint --- src/components/EmojiPicker/EmojiPicker.js | 1 + src/components/EmojiPicker/EmojiPickerMenu/index.js | 3 +-- src/libs/EmojiUtils.ts | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPicker.js b/src/components/EmojiPicker/EmojiPicker.js index 563a2696fab4..68b74a7aeb15 100644 --- a/src/components/EmojiPicker/EmojiPicker.js +++ b/src/components/EmojiPicker/EmojiPicker.js @@ -56,6 +56,7 @@ const EmojiPicker = forwardRef((props, ref) => { * @param {Object} [anchorOrigin=DEFAULT_ANCHOR_ORIGIN] - Anchor origin for Popover * @param {Function} [onWillShow=() => {}] - Run a callback when Popover will show * @param {String} id - Unique id for EmojiPicker + * @param {String} activeEmojiValue - Selected emoji to be highlighted */ const showEmojiPicker = (onModalHideValue, onEmojiSelectedValue, emojiPopoverAnchorValue, anchorOrigin, onWillShow = () => {}, id, activeEmojiValue) => { onModalHide.current = onModalHideValue; diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index 0be9eafdd4a7..c8ca9c6ac6d1 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -366,12 +366,11 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { setHighlightedIndex((prevState) => (prevState === index ? -1 : prevState)) } isFocused={isEmojiFocused} - //isHighlighted={true} isHighlighted={shouldEmojiBeHighlighted} /> ); }, - [preferredSkinTone, highlightedIndex, isUsingKeyboardMovement, highlightFirstEmoji, singleExecution, translate, onEmojiSelected, isSmallScreenWidth, windowWidth, styles], + [preferredSkinTone, highlightedIndex, isUsingKeyboardMovement, highlightFirstEmoji, singleExecution, translate, onEmojiSelected, isSmallScreenWidth, windowWidth, styles, activeEmoji], ); return ( diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index b42049cc627d..9a1998b35462 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -553,9 +553,7 @@ const getEmojiReactionDetails = (emojiName: string, reaction: ReportActionReacti * @param emoji emoji string * @returns emoji without skin tone */ -const getRemovedSkinToneEmoji = (emoji: string) => { - return emoji.replace(CONST.REGEX.EMOJI_SKIN_TONES, ''); -}; +const getRemovedSkinToneEmoji = (emoji: string) => emoji.replace(CONST.REGEX.EMOJI_SKIN_TONES, ''); export { findEmojiByName, From e2173e13a89785f7250bf7b975b363b11304efbf Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 10:28:58 +0100 Subject: [PATCH 038/138] apply changes to work with rn 73 --- ...mmunity+cli-platform-android+12.3.0.patch} | 34 +++--- ...ve-community+cli-platform-ios+11.3.6.patch | 51 --------- patches/expo+49.0.21.patch | 32 ------ patches/expo+50.0.0-preview.7.patch | 10 ++ patches/expo-modules-autolinking+1.5.1.patch | 100 ------------------ patches/expo-modules-autolinking+1.9.0.patch | 21 ++++ ...2.patch => expo-modules-core+1.11.4.patch} | 12 +-- ...era+2.16.5+001+fix-boost-dependency.patch} | 13 ++- src/pages/LogOutPreviousUserPage.js | 18 +++- 9 files changed, 78 insertions(+), 213 deletions(-) rename patches/{@react-native-community+cli-platform-android+11.3.6.patch => @react-native-community+cli-platform-android+12.3.0.patch} (68%) delete mode 100644 patches/@react-native-community+cli-platform-ios+11.3.6.patch delete mode 100644 patches/expo+49.0.21.patch create mode 100644 patches/expo+50.0.0-preview.7.patch delete mode 100644 patches/expo-modules-autolinking+1.5.1.patch create mode 100644 patches/expo-modules-autolinking+1.9.0.patch rename patches/{expo-modules-core+1.5.12.patch => expo-modules-core+1.11.4.patch} (66%) rename patches/{react-native-vision-camera+2.16.2+001+fix-boost-dependency.patch => react-native-vision-camera+2.16.5+001+fix-boost-dependency.patch} (56%) diff --git a/patches/@react-native-community+cli-platform-android+11.3.6.patch b/patches/@react-native-community+cli-platform-android+12.3.0.patch similarity index 68% rename from patches/@react-native-community+cli-platform-android+11.3.6.patch rename to patches/@react-native-community+cli-platform-android+12.3.0.patch index ddebb53db36d..b6805a4fd93e 100644 --- a/patches/@react-native-community+cli-platform-android+11.3.6.patch +++ b/patches/@react-native-community+cli-platform-android+12.3.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle -index 8a218d5..8deb9c0 100644 +index bbfa7f7..6e024fd 100644 --- a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle +++ b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle @@ -140,6 +140,7 @@ class ReactNativeModules { @@ -10,25 +10,24 @@ index 8a218d5..8deb9c0 100644 private ArrayList> reactNativeModules private ArrayList unstable_reactLegacyComponentNames private HashMap reactNativeModulesBuildVariants -@@ -147,8 +148,13 @@ class ReactNativeModules { +@@ -147,9 +148,10 @@ class ReactNativeModules { + private static String LOG_PREFIX = ":ReactNative:" - ReactNativeModules(Logger logger, File root) { -+ this(logger, root, root) -+ } -+ +- ReactNativeModules(Logger logger, File root) { + ReactNativeModules(Logger logger, File root, File rnRoot) { this.logger = logger this.root = root + this.rnRoot = rnRoot - def (nativeModules, reactNativeModulesBuildVariants, androidProject) = this.getReactNativeConfig() + def (nativeModules, reactNativeModulesBuildVariants, androidProject, reactNativeVersion) = this.getReactNativeConfig() this.reactNativeModules = nativeModules -@@ -413,11 +419,12 @@ class ReactNativeModules { +@@ -414,12 +416,12 @@ class ReactNativeModules { + * * @todo: `fastlane` has been reported to not work too. */ - def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" -+ +- def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" ++ def cliResolveScript = "try {console.log(require('../react-native/node_modules/@react-native-community/cli').bin);} catch (e) {console.log(require('../react-native/node_modules/react-native/cli').bin);}" String[] nodeCommand = ["node", "-e", cliResolveScript] - def cliPath = this.getCommandOutput(nodeCommand, this.root) + def cliPath = this.getCommandOutput(nodeCommand, this.rnRoot) @@ -39,19 +38,18 @@ index 8a218d5..8deb9c0 100644 def json try { -@@ -482,8 +489,14 @@ class ReactNativeModules { - * where build files of an active project are located. +@@ -486,7 +488,13 @@ class ReactNativeModules { */ def projectRoot = rootProject.projectDir + +-def autoModules = new ReactNativeModules(logger, projectRoot) +def autoModules + +if(this.hasProperty('reactNativeProject')){ -+ autoModules = new ReactNativeModules(logger, projectRoot, new File(projectRoot, reactNativeProject)) ++ autoModules = new ReactNativeModules(logger, projectRoot, new File(projectRoot, reactNativeProject)) +} else { -+ autoModules = new ReactNativeModules(logger, projectRoot) ++ autoModules = new ReactNativeModules(logger, projectRoot) +} --def autoModules = new ReactNativeModules(logger, projectRoot) - - /** ----------------------- - * Exported Extensions + def reactNativeVersionRequireNewArchEnabled(autoModules) { + def rnVersion = autoModules.reactNativeVersion diff --git a/patches/@react-native-community+cli-platform-ios+11.3.6.patch b/patches/@react-native-community+cli-platform-ios+11.3.6.patch deleted file mode 100644 index 9c97b8666ef2..000000000000 --- a/patches/@react-native-community+cli-platform-ios+11.3.6.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb -index 1b6eece..914039e 100644 ---- a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb -+++ b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb -@@ -12,7 +12,7 @@ - require 'pathname' - require 'cocoapods' - --def use_native_modules!(config = nil) -+def updateConfig(config = nil) - if (config.is_a? String) - Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.", - [ -@@ -24,7 +24,6 @@ def use_native_modules!(config = nil) - # Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects - cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" - cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip -- - if (!config) - json = [] - -@@ -36,10 +35,29 @@ def use_native_modules!(config = nil) - - config = JSON.parse(json.join("\n")) - end -+end -+ -+def use_native_modules!(config = nil) -+ if (ENV['REACT_NATIVE_DIR']) -+ Dir.chdir(ENV['REACT_NATIVE_DIR']) do -+ config = updateConfig(config) -+ end -+ else -+ config = updateConfig(config) -+ end - - project_root = Pathname.new(config["project"]["ios"]["sourceDir"]) -+ if(ENV["PROJECT_ROOT_DIR"]) -+ project_root = File.join(Dir.pwd, ENV["PROJECT_ROOT_DIR"]) -+ -+ end - - packages = config["dependencies"] -+ -+ if (ENV["NO_FLIPPER"]) -+ packages["react-native-flipper"]["platforms"]["ios"] = nil -+ end -+ - found_pods = [] - - packages.each do |package_name, package| diff --git a/patches/expo+49.0.21.patch b/patches/expo+49.0.21.patch deleted file mode 100644 index 0e246b301c28..000000000000 --- a/patches/expo+49.0.21.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/node_modules/expo/scripts/autolinking.gradle b/node_modules/expo/scripts/autolinking.gradle -index 0505395..08098e0 100644 ---- a/node_modules/expo/scripts/autolinking.gradle -+++ b/node_modules/expo/scripts/autolinking.gradle -@@ -1,2 +1,3 @@ - def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json')"].execute(null, rootDir).text.trim() --apply from: new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); -+ -+apply from: hasProperty("reactNativeProject") ? file('../../expo-modules-autolinking/scripts/android/autolinking_implementation.gradle') : new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); -diff --git a/node_modules/expo/scripts/autolinking.rb b/node_modules/expo/scripts/autolinking.rb -index 0617de5..584364f 100644 ---- a/node_modules/expo/scripts/autolinking.rb -+++ b/node_modules/expo/scripts/autolinking.rb -@@ -2,13 +2,14 @@ require 'json' - require 'pathname' - require 'colored2' # dependency of CocoaPods - --require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/autolinking_manager") --require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/xcode_env_generator") --require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json')"`), "scripts/ios/react_import_patcher") -+AUTOLINKING_PATH = ENV['REACT_NATIVE_DIR'] ? `node --print "require.resolve('#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking/package.json')"` : `node --print "require.resolve('expo-modules-autolinking/package.json')"` -+ -+require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/autolinking_manager") -+require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/xcode_env_generator") -+require File.join(File.dirname(AUTOLINKING_PATH), "scripts/ios/react_import_patcher") - - def use_expo_modules!(options = {}) - # When run from the Podfile, `self` points to Pod::Podfile object -- - if @current_target_definition.autolinking_manager.present? - Pod::UI.message 'Expo modules are already being used in this target definition'.red - return diff --git a/patches/expo+50.0.0-preview.7.patch b/patches/expo+50.0.0-preview.7.patch new file mode 100644 index 000000000000..95157e1d73c6 --- /dev/null +++ b/patches/expo+50.0.0-preview.7.patch @@ -0,0 +1,10 @@ +diff --git a/node_modules/expo/scripts/autolinking.gradle b/node_modules/expo/scripts/autolinking.gradle +index 60d6ef8..3ed90a4 100644 +--- a/node_modules/expo/scripts/autolinking.gradle ++++ b/node_modules/expo/scripts/autolinking.gradle +@@ -1,4 +1,4 @@ + // Resolve `expo` > `expo-modules-autolinking` dependency chain + def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim() +-apply from: new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); + ++apply from: hasProperty("reactNativeProject") ? file('../../expo-modules-autolinking/scripts/android/autolinking_implementation.gradle') : new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); diff --git a/patches/expo-modules-autolinking+1.5.1.patch b/patches/expo-modules-autolinking+1.5.1.patch deleted file mode 100644 index 20fed8608ebd..000000000000 --- a/patches/expo-modules-autolinking+1.5.1.patch +++ /dev/null @@ -1,100 +0,0 @@ -diff --git a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle -index 5f4cd8e..bdbea02 100644 ---- a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle -+++ b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle -@@ -135,6 +135,7 @@ class ExpoAutolinkingManager { - } - - static String exec(String[] commandArgs, File dir) { -+ print(dir) - Process proc = commandArgs.execute(null, dir) - StringBuffer outputStream = new StringBuffer() - proc.waitForProcessOutput(outputStream, System.err) -@@ -142,11 +143,12 @@ class ExpoAutolinkingManager { - } - - static private String[] convertOptionsToCommandArgs(String command, Map options) { -+ def expoModulesPath = options.searchPaths ? "../react-native/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" - String[] args = [ - 'node', - '--no-warnings', - '--eval', -- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', -+ "require(\'${expoModulesPath}\')(process.argv.slice(1))", - '--', - command, - '--platform', -diff --git a/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb b/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb -index d570ad2..b9c5350 100644 ---- a/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb -+++ b/node_modules/expo-modules-autolinking/scripts/ios/autolinking_manager.rb -@@ -26,7 +26,6 @@ module Expo - if has_packages? - return - end -- - global_flags = @options.fetch(:flags, {}) - tests_only = @options.fetch(:testsOnly, false) - include_tests = @options.fetch(:includeTests, false) -@@ -174,11 +173,12 @@ module Expo - end - - private def node_command_args(command_name) -+ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" - eval_command_args = [ - 'node', - '--no-warnings', - '--eval', -- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', -+ "require(\'#{autolinking_path}\')(process.argv.slice(1))", - command_name, - '--platform', - 'ios' -diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb -index bddfa0d..3ae2c6c 100644 ---- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb -+++ b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb -@@ -213,6 +213,7 @@ module Expo - # Generates the support script that is executed by the build script phase. - def self.generate_support_script(autolinking_manager, modules_provider_path) - args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" }.join(' ') -+ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" - - <<~SUPPORT_SCRIPT - #!/usr/bin/env bash -@@ -245,7 +246,6 @@ module Expo - You can set this up quickly by running: - - echo "export NODE_BINARY=\\$(command -v node)" >> .xcode.env -- - in the ios folder of your project. - NODE_NOT_FOUND - -@@ -257,8 +257,7 @@ module Expo - "$NODE_BINARY" "$@" - fi - } -- -- with_node --no-warnings --eval "require(\'expo-modules-autolinking\')(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" -+ with_node --no-warnings --eval "require(\'#{autolinking_path}\')(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" - SUPPORT_SCRIPT - end - -diff --git a/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb b/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb -index 4acf193..b54ea94 100644 ---- a/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb -+++ b/node_modules/expo-modules-autolinking/scripts/ios/react_import_patcher.rb -@@ -10,11 +10,12 @@ module Expo - end - - public def run! -+ autolinking_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo-modules-autolinking" : "expo-modules-autolinking" - args = [ - 'node', - '--no-warnings', - '--eval', -- 'require(\'expo-modules-autolinking\')(process.argv.slice(1))', -+ "require(\'#{autolinking_path}\')(process.argv.slice(1))", - 'patch-react-imports', - '--pods-root', - File.expand_path(@root), diff --git a/patches/expo-modules-autolinking+1.9.0.patch b/patches/expo-modules-autolinking+1.9.0.patch new file mode 100644 index 000000000000..363dd5dc3dab --- /dev/null +++ b/patches/expo-modules-autolinking+1.9.0.patch @@ -0,0 +1,21 @@ +diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb +index c3047a8..6eff107 100644 +--- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb ++++ b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb +@@ -212,6 +212,7 @@ module Expo + + # Generates the support script that is executed by the build script phase. + def self.generate_support_script(autolinking_manager, modules_provider_path) ++ expo_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo" : "expo" + args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" }.join(' ') + + <<~SUPPORT_SCRIPT +@@ -258,7 +259,7 @@ module Expo + fi + } + +- with_node --no-warnings --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" ++ with_node --no-warnings --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'#{expo_path}/package.json\')] }))(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" + SUPPORT_SCRIPT + end + diff --git a/patches/expo-modules-core+1.5.12.patch b/patches/expo-modules-core+1.11.4.patch similarity index 66% rename from patches/expo-modules-core+1.5.12.patch rename to patches/expo-modules-core+1.11.4.patch index 9025a7c42d9f..fe8c5ed7b9cc 100644 --- a/patches/expo-modules-core+1.5.12.patch +++ b/patches/expo-modules-core+1.11.4.patch @@ -1,9 +1,9 @@ diff --git a/node_modules/expo-modules-core/android/build.gradle b/node_modules/expo-modules-core/android/build.gradle -index 8f9e0dc..af5b5d6 100644 +index 3603ffd..1599a69 100644 --- a/node_modules/expo-modules-core/android/build.gradle +++ b/node_modules/expo-modules-core/android/build.gradle -@@ -54,9 +54,10 @@ def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File( - def thirdPartyNdkDir = new File("$buildDir/third-party-ndk") +@@ -53,9 +53,10 @@ def isExpoModulesCoreTests = { + }.call() def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":packages:react-native:ReactAndroid") != null +def FALLBACK_REACT_NATIVE_DIR = hasProperty("reactNativeProject") ? file('../../react-native') : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent @@ -11,6 +11,6 @@ index 8f9e0dc..af5b5d6 100644 ? findProject(":packages:react-native:ReactAndroid").getProjectDir().parent - : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent + : FALLBACK_REACT_NATIVE_DIR - def REACT_NATIVE_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE - ? Paths.get(findProject(":packages:react-native:ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni") - : "${buildDir}/react/jni" + + def reactProperties = new Properties() + file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } diff --git a/patches/react-native-vision-camera+2.16.2+001+fix-boost-dependency.patch b/patches/react-native-vision-camera+2.16.5+001+fix-boost-dependency.patch similarity index 56% rename from patches/react-native-vision-camera+2.16.2+001+fix-boost-dependency.patch rename to patches/react-native-vision-camera+2.16.5+001+fix-boost-dependency.patch index ef4fbf1d5084..3afc4573985d 100644 --- a/patches/react-native-vision-camera+2.16.2+001+fix-boost-dependency.patch +++ b/patches/react-native-vision-camera+2.16.5+001+fix-boost-dependency.patch @@ -1,8 +1,17 @@ diff --git a/node_modules/react-native-vision-camera/android/build.gradle b/node_modules/react-native-vision-camera/android/build.gradle -index d308e15..2d87d8e 100644 +index ddfa243..bafffc3 100644 --- a/node_modules/react-native-vision-camera/android/build.gradle +++ b/node_modules/react-native-vision-camera/android/build.gradle -@@ -347,7 +347,7 @@ if (ENABLE_FRAME_PROCESSORS) { +@@ -334,7 +334,7 @@ if (ENABLE_FRAME_PROCESSORS) { + def thirdPartyVersions = new Properties() + thirdPartyVersions.load(new FileInputStream(thirdPartyVersionsFile)) + +- def BOOST_VERSION = thirdPartyVersions["BOOST_VERSION"] ++ def BOOST_VERSION = thirdPartyVersions["BOOST_VERSION"] ?: "1.83.0" + def boost_file = new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz") + def DOUBLE_CONVERSION_VERSION = thirdPartyVersions["DOUBLE_CONVERSION_VERSION"] + def double_conversion_file = new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz") +@@ -352,7 +352,7 @@ if (ENABLE_FRAME_PROCESSORS) { task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { def transformedVersion = BOOST_VERSION.replace("_", ".") diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 32a98fa47a65..156e01be6ec6 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -9,6 +9,8 @@ import * as SessionUtils from '@libs/SessionUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; +import Navigation from '@libs/Navigation/Navigation'; const propTypes = { /** The details about the account that the user is signing in with */ @@ -59,11 +61,19 @@ function LogOutPreviousUserPage(props) { const shortLivedAuthToken = lodashGet(props, 'route.params.shortLivedAuthToken', ''); Session.signInWithShortLivedAuthToken(email, shortLivedAuthToken); } - }); - // We only want to run this effect once on mount (when the page first loads after transitioning from OldDot) - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [initUrl]); + const exitTo = lodashGet(props, 'route.params.exitTo', ''); + // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, + // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, + // which is already called when AuthScreens mounts. + if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { + Navigation.isNavigationReady().then(() => { + Navigation.goBack(); + Navigation.navigate(exitTo); + }); + } + }); + }, [initUrl, props]); return ; } From fcae238b58cffc976cceafa20ddcaa00aeddcf9c Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 10:38:38 +0100 Subject: [PATCH 039/138] fix nav --- src/pages/LogOutPreviousUserPage.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 156e01be6ec6..a69403d8c916 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -68,8 +68,7 @@ function LogOutPreviousUserPage(props) { // which is already called when AuthScreens mounts. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { - Navigation.goBack(); - Navigation.navigate(exitTo); + Navigation.navigate(exitTo, "FORCED_UP"); }); } }); From 6f91c905b1a12495f8a16eca8190dde7f2f3cb8d Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 10:44:35 +0100 Subject: [PATCH 040/138] fix lint type --- src/libs/InitialUrlContext/index.ts | 2 +- src/pages/LogOutPreviousUserPage.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/InitialUrlContext/index.ts b/src/libs/InitialUrlContext/index.ts index 989f3369585f..a87417fe4cc6 100644 --- a/src/libs/InitialUrlContext/index.ts +++ b/src/libs/InitialUrlContext/index.ts @@ -1,5 +1,5 @@ import {createContext} from 'react'; -import {Route} from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; /** Initial url that will be opened when NewDot is embedded into Hybrid App. */ const InitialUrlContext = createContext(undefined); diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index a69403d8c916..5efe9926e270 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -5,12 +5,12 @@ import {Linking, NativeModules} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InitialUrlContext from '@libs/InitialUrlContext'; +import Navigation from '@libs/Navigation/Navigation'; import * as SessionUtils from '@libs/SessionUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import Navigation from '@libs/Navigation/Navigation'; const propTypes = { /** The details about the account that the user is signing in with */ @@ -68,7 +68,7 @@ function LogOutPreviousUserPage(props) { // which is already called when AuthScreens mounts. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { - Navigation.navigate(exitTo, "FORCED_UP"); + Navigation.navigate(exitTo, 'FORCED_UP'); }); } }); From f6d681cb66cf6df5dbc1fbe068b67b0b5e21c14a Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 11:06:27 +0100 Subject: [PATCH 041/138] fix nav --- src/pages/LogOutPreviousUserPage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 5efe9926e270..801e8352e8e1 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -68,7 +68,9 @@ function LogOutPreviousUserPage(props) { // which is already called when AuthScreens mounts. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { - Navigation.navigate(exitTo, 'FORCED_UP'); + // remove this screen and navigate to exit route + Navigation.goBack() + Navigation.navigate(exitTo); }); } }); From 20cef421721c3bbfe48ef638eb5ea132ccca99db Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 11:14:43 +0100 Subject: [PATCH 042/138] prettier --- src/pages/LogOutPreviousUserPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 801e8352e8e1..e38c41aed29d 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -69,7 +69,7 @@ function LogOutPreviousUserPage(props) { if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { // remove this screen and navigate to exit route - Navigation.goBack() + Navigation.goBack(); Navigation.navigate(exitTo); }); } From af0257b967be6bc46ea5c4a6f4dce23d712680bb Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 11:27:53 +0100 Subject: [PATCH 043/138] adjustments --- .../@oguzhnatly+react-native-image-manipulator+1.0.5.patch | 4 ++-- src/pages/settings/InitialSettingsPage.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch b/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch index eb5ef2da6247..d5a390daf201 100644 --- a/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch +++ b/patches/@oguzhnatly+react-native-image-manipulator+1.0.5.patch @@ -7,13 +7,13 @@ index 3a1a548..fe030bb 100644 android { - compileSdkVersion 28 -+ compileSdkVersion 33 ++ compileSdkVersion 34 buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 -+ targetSdkVersion 33 ++ targetSdkVersion 34 versionCode 1 versionName "1.0" } diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index ffecf9cd2095..e01157b53570 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -294,7 +294,7 @@ function InitialSettingsPage(props) { }, ...defaultMenuItems, ], - (item) => item.translationKey !== 'initialSettingsPage.signOut', + (item) => item.translationKey !== 'initialSettingsPage.signOut' && item.translationKey !== 'initialSettingsPage.goToExpensifyClassic', ); return hybridAppMenuItems; From a41114b54e5d82296fb5b871f8f9d0834da625be Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 13:17:56 +0100 Subject: [PATCH 044/138] fix patches --- .../@react-native+gradle-plugin+0.72.11.patch | 83 ------------------- ...ve-community+cli-platform-ios+12.3.0.patch | 52 ++++++++++++ patches/expo-modules-autolinking+1.9.0.patch | 19 +++++ 3 files changed, 71 insertions(+), 83 deletions(-) delete mode 100644 patches/@react-native+gradle-plugin+0.72.11.patch create mode 100644 patches/@react-native-community+cli-platform-ios+12.3.0.patch diff --git a/patches/@react-native+gradle-plugin+0.72.11.patch b/patches/@react-native+gradle-plugin+0.72.11.patch deleted file mode 100644 index 8609c992b4d6..000000000000 --- a/patches/@react-native+gradle-plugin+0.72.11.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff --git a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt -index 062dcc7..cb400ec 100644 ---- a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt -+++ b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt -@@ -15,6 +15,7 @@ import com.facebook.react.tasks.GenerateCodegenArtifactsTask - import com.facebook.react.tasks.GenerateCodegenSchemaTask - import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFields - import com.facebook.react.utils.AgpConfiguratorUtils.configureDevPorts -+import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries - import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap - import com.facebook.react.utils.DependencyUtils.configureDependencies - import com.facebook.react.utils.DependencyUtils.configureRepositories -@@ -64,6 +65,7 @@ class ReactPlugin : Plugin { - - configureReactNativeNdk(project, extension) - configureBuildConfigFields(project) -+ configureNamespaceForLibraries(project) - configureDevPorts(project) - configureBackwardCompatibilityReactMap(project) - -diff --git a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt -index 3bf0085..59397b4 100644 ---- a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt -+++ b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt -@@ -8,11 +8,17 @@ - package com.facebook.react.utils - - import com.android.build.api.variant.AndroidComponentsExtension -+import com.facebook.react.ReactExtension - import com.facebook.react.utils.ProjectUtils.isHermesEnabled - import com.facebook.react.utils.ProjectUtils.isNewArchEnabled - import org.gradle.api.Action - import org.gradle.api.Project - import org.gradle.api.plugins.AppliedPlugin -+import java.io.File -+import com.android.build.gradle.LibraryExtension -+import javax.xml.parsers.DocumentBuilder -+import javax.xml.parsers.DocumentBuilderFactory -+import org.w3c.dom.Element - - @Suppress("UnstableApiUsage") - internal object AgpConfiguratorUtils { -@@ -49,6 +55,40 @@ internal object AgpConfiguratorUtils { - project.pluginManager.withPlugin("com.android.application", action) - project.pluginManager.withPlugin("com.android.library", action) - } -+ -+ fun configureNamespaceForLibraries(appProject: Project) { -+ appProject.rootProject.allprojects { subproject -> -+ subproject.pluginManager.withPlugin("com.android.library") { -+ subproject.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext -> -+ if(ext.namespace == null){ -+ val android = subproject.extensions.getByType(LibraryExtension::class.java) -+ val manifestFile = android.sourceSets.getByName("main").manifest.srcFile -+ -+ manifestFile.takeIf { it.exists() }?.let { file -> -+ getPackageNameFromManifest(file)?.let { packageName -> -+ ext.namespace = packageName -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ fun getPackageNameFromManifest(manifest: File): String? { -+ val factory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance() -+ val builder: DocumentBuilder = factory.newDocumentBuilder() -+ -+ try { -+ val xmlDocument = builder.parse(manifest) -+ -+ val manifestElement = xmlDocument.getElementsByTagName("manifest").item(0) as? Element -+ val packageName = manifestElement?.getAttribute("package") -+ -+ return if (packageName.isNullOrEmpty()) null else packageName -+ } catch (e: Exception) { -+ return null -+ } -+ } - } - - const val DEFAULT_DEV_SERVER_PORT = "8081" diff --git a/patches/@react-native-community+cli-platform-ios+12.3.0.patch b/patches/@react-native-community+cli-platform-ios+12.3.0.patch new file mode 100644 index 000000000000..cfae504e44fa --- /dev/null +++ b/patches/@react-native-community+cli-platform-ios+12.3.0.patch @@ -0,0 +1,52 @@ +diff --git a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb +index 82f537c..f5e2cda 100644 +--- a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb ++++ b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb +@@ -12,7 +12,7 @@ + require 'pathname' + require 'cocoapods' + +-def use_native_modules!(config = nil) ++def updateConfig(config = nil) + if (config.is_a? String) + Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.", + [ +@@ -24,7 +24,6 @@ def use_native_modules!(config = nil) + # Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects + cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" + cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip +- + if (!config) + json = [] + +@@ -36,10 +35,30 @@ def use_native_modules!(config = nil) + + config = JSON.parse(json.join("\n")) + end ++end ++ ++def use_native_modules!(config = nil) ++ if (ENV['REACT_NATIVE_DIR']) ++ Dir.chdir(ENV['REACT_NATIVE_DIR']) do ++ config = updateConfig(config) ++ end ++ else ++ config = updateConfig(config) ++ end + + project_root = Pathname.new(config["project"]["ios"]["sourceDir"]) + ++ if(ENV["PROJECT_ROOT_DIR"]) ++ project_root = File.join(Dir.pwd, ENV["PROJECT_ROOT_DIR"]) ++ ++ end ++ + packages = config["dependencies"] ++ ++ if (ENV["NO_FLIPPER"]) ++ packages = {**packages, "react-native-flipper" => {"platforms" => {"ios" => nil}}} ++ end ++ + found_pods = [] + + packages.each do |package_name, package| diff --git a/patches/expo-modules-autolinking+1.9.0.patch b/patches/expo-modules-autolinking+1.9.0.patch index 363dd5dc3dab..7b171339efc5 100644 --- a/patches/expo-modules-autolinking+1.9.0.patch +++ b/patches/expo-modules-autolinking+1.9.0.patch @@ -1,3 +1,22 @@ +diff --git a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle +index 92f1fd6..ada01ad 100644 +--- a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle ++++ b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle +@@ -149,12 +149,13 @@ class ExpoAutolinkingManager { + } + + static private String[] convertOptionsToCommandArgs(String command, Map options) { ++ def expoPath = options.searchPaths ? "../react-native/node_modules/expo" : "expo" + String[] args = [ + 'node', + '--no-warnings', + '--eval', + // Resolve the `expo` > `expo-modules-autolinking` chain from the project root +- 'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo\')] }))(process.argv.slice(1))', ++ "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'${expoPath}\')] }))(process.argv.slice(1))", + '--', + command, + '--platform', diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb index c3047a8..6eff107 100644 --- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb From cb27d13570a371ee539f1f170b09c34ed0bc3999 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 16 Jan 2024 13:29:28 +0100 Subject: [PATCH 045/138] fix cli patch --- ...ct-native-community+cli-platform-android+12.3.0.patch | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/patches/@react-native-community+cli-platform-android+12.3.0.patch b/patches/@react-native-community+cli-platform-android+12.3.0.patch index b6805a4fd93e..7289f652232a 100644 --- a/patches/@react-native-community+cli-platform-android+12.3.0.patch +++ b/patches/@react-native-community+cli-platform-android+12.3.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle -index bbfa7f7..6e024fd 100644 +index bbfa7f7..00d14dd 100644 --- a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle +++ b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle @@ -140,6 +140,7 @@ class ReactNativeModules { @@ -22,12 +22,9 @@ index bbfa7f7..6e024fd 100644 def (nativeModules, reactNativeModulesBuildVariants, androidProject, reactNativeVersion) = this.getReactNativeConfig() this.reactNativeModules = nativeModules -@@ -414,12 +416,12 @@ class ReactNativeModules { - * - * @todo: `fastlane` has been reported to not work too. +@@ -416,10 +418,10 @@ class ReactNativeModules { */ -- def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" -+ def cliResolveScript = "try {console.log(require('../react-native/node_modules/@react-native-community/cli').bin);} catch (e) {console.log(require('../react-native/node_modules/react-native/cli').bin);}" + def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" String[] nodeCommand = ["node", "-e", cliResolveScript] - def cliPath = this.getCommandOutput(nodeCommand, this.root) + def cliPath = this.getCommandOutput(nodeCommand, this.rnRoot) From baf50f2b497b32bd730410a3959ae0e7f0d1d645 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 16 Jan 2024 18:35:30 +0100 Subject: [PATCH 046/138] Refactor types --- src/components/ButtonWithDropdownMenu.tsx | 9 ++++++--- src/components/Popover/types.ts | 2 +- src/components/PopoverMenu.tsx | 2 +- src/components/ProcessMoneyRequestHoldMenu.tsx | 2 +- src/components/SettlementButton.tsx | 10 +++++----- src/types/onyx/index.ts | 2 -- src/types/{onyx => utils}/AnchorAlignment.ts | 0 7 files changed, 14 insertions(+), 13 deletions(-) rename src/types/{onyx => utils}/AnchorAlignment.ts (100%) diff --git a/src/components/ButtonWithDropdownMenu.tsx b/src/components/ButtonWithDropdownMenu.tsx index 466c68229a32..011089af8ab9 100644 --- a/src/components/ButtonWithDropdownMenu.tsx +++ b/src/components/ButtonWithDropdownMenu.tsx @@ -9,15 +9,18 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import type {AnchorPosition} from '@styles/index'; import CONST from '@src/CONST'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type IconAsset from '@src/types/utils/IconAsset'; import Button from './Button'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; -import type {AnchorAlignment} from './Popover/types'; import PopoverMenu from './PopoverMenu'; +type PaymentType = DeepValueOf; + type DropdownOption = { - value: string; + value: PaymentType; text: string; icon: IconAsset; iconWidth?: number; @@ -30,7 +33,7 @@ type ButtonWithDropdownMenuProps = { menuHeaderText?: string; /** Callback to execute when the main button is pressed */ - onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: string) => void; + onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: PaymentType) => void; /** Call the onPress function on main button when Enter key is pressed */ pressOnEnter?: boolean; diff --git a/src/components/Popover/types.ts b/src/components/Popover/types.ts index 298c95eeca76..4409e8a7e296 100644 --- a/src/components/Popover/types.ts +++ b/src/components/Popover/types.ts @@ -1,7 +1,7 @@ import type {PopoverAnchorPosition} from '@components/Modal/types'; import type BaseModalProps from '@components/Modal/types'; import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; -import type {AnchorAlignment} from '@src/types/onyx'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; type PopoverDimensions = { width: number; diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 10599330945f..6990a453a931 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -9,7 +9,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import CONST from '@src/CONST'; import type {AnchorPosition} from '@src/styles'; -import type {AnchorAlignment} from '@src/types/onyx'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import type IconAsset from '@src/types/utils/IconAsset'; import MenuItem from './MenuItem'; import PopoverWithMeasuredContent from './PopoverWithMeasuredContent'; diff --git a/src/components/ProcessMoneyRequestHoldMenu.tsx b/src/components/ProcessMoneyRequestHoldMenu.tsx index 1fd37b82afc8..a069bcfa1a07 100644 --- a/src/components/ProcessMoneyRequestHoldMenu.tsx +++ b/src/components/ProcessMoneyRequestHoldMenu.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import type {AnchorAlignment} from '@src/types/onyx'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import Button from './Button'; import HoldMenuSectionList from './HoldMenuSectionList'; import type {PopoverAnchorPosition} from './Modal/types'; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 4a4abea14c70..82da026d4014 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,4 +1,4 @@ -import type {MutableRefObject} from 'react'; +import type {RefObject} from 'react'; import React, {useEffect, useMemo} from 'react'; import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -13,14 +13,15 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; -import type {AnchorAlignment, LastPaymentMethod, Report} from '@src/types/onyx'; +import type {LastPaymentMethod, Report} from '@src/types/onyx'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; -type KYCFlowEvent = GestureResponderEvent | KeyboardEvent; +type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined; type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: string) => void; @@ -211,7 +212,7 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow: TriggerKYCFlow, buttonRef: MutableRefObject) => ( + {(triggerKYCFlow: TriggerKYCFlow, buttonRef: RefObject) => ( selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} - // @ts-expect-error TODO: Remove this once OptionsListUtils (https://github.com/Expensify/App/issues/25065) is migrated to TypeScript. style={style} buttonSize={buttonSize} anchorAlignment={paymentMethodDropdownAnchorAlignment} diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 8b2586db597a..3dd083d47865 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -1,6 +1,5 @@ import type Account from './Account'; import type AccountData from './AccountData'; -import type AnchorAlignment from './AnchorAlignment'; import type {BankAccountList} from './BankAccount'; import type BankAccount from './BankAccount'; import type Beta from './Beta'; @@ -142,5 +141,4 @@ export type { PolicyReportField, RecentlyUsedReportFields, LastPaymentMethod, - AnchorAlignment, }; diff --git a/src/types/onyx/AnchorAlignment.ts b/src/types/utils/AnchorAlignment.ts similarity index 100% rename from src/types/onyx/AnchorAlignment.ts rename to src/types/utils/AnchorAlignment.ts From 2ecaf16e8b9ba9024845c583715b290d7c949953 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Tue, 16 Jan 2024 22:49:22 +0300 Subject: [PATCH 047/138] fix error message display bug on google signin --- src/pages/signin/LoginForm/BaseLoginForm.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 8fcea461eacd..5a6c8aed5050 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -276,13 +276,15 @@ function LoginForm(props) { textContentType="username" id="username" name="username" - onBlur={() => { - if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { - return; - } - firstBlurred.current = true; - validate(login); - }} + onBlur={() => + setTimeout(() => { + if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { + return; + } + firstBlurred.current = true; + validate(login); + }, 500) + } onChangeText={onTextInput} onSubmitEditing={validateAndSubmitForm} autoCapitalize="none" @@ -332,10 +334,10 @@ function LoginForm(props) { - e.preventDefault()}> + - e.preventDefault()}> + From 2e905f70c40b9368674b23b90a5e1cca68ecca47 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 17 Jan 2024 11:36:15 +0100 Subject: [PATCH 048/138] fix nav for smart scan hybrid --- src/pages/LogInWithShortLivedAuthTokenPage.js | 9 ++++++++- src/pages/LogOutPreviousUserPage.js | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.js b/src/pages/LogInWithShortLivedAuthTokenPage.js index 1fe9b67eef16..3be9ad64e8eb 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.js +++ b/src/pages/LogInWithShortLivedAuthTokenPage.js @@ -13,8 +13,11 @@ import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import * as ReportUtils from '@libs/ReportUtils'; import * as Session from '@userActions/Session'; +import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; const propTypes = { /** The parameters needed to authenticate with a short-lived token are in the URL */ @@ -71,7 +74,11 @@ function LogInWithShortLivedAuthTokenPage(props) { const exitTo = lodashGet(props, 'route.params.exitTo', ''); if (exitTo) { Navigation.isNavigationReady().then(() => { - Navigation.navigate(exitTo); + if (exitTo === '/request/new/scan') { + Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID())); + } else { + Navigation.navigate(exitTo); + } }); } // The only dependencies of the effect are based on props.route diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index e38c41aed29d..9438b8663a14 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -6,6 +6,7 @@ import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InitialUrlContext from '@libs/InitialUrlContext'; import Navigation from '@libs/Navigation/Navigation'; +import * as ReportUtils from '@libs/ReportUtils'; import * as SessionUtils from '@libs/SessionUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; @@ -70,7 +71,11 @@ function LogOutPreviousUserPage(props) { Navigation.isNavigationReady().then(() => { // remove this screen and navigate to exit route Navigation.goBack(); - Navigation.navigate(exitTo); + if (exitTo === '/request/new/scan') { + Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID())) + } else { + Navigation.navigate(exitTo); + } }); } }); From a3c1eab307999e0efc6bfd3071c2f05d03b5a5d3 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 11:01:48 +0100 Subject: [PATCH 049/138] clean up --- src/ROUTES.ts | 17 +++++++++++++++-- src/languages/en.ts | 2 +- src/libs/Navigation/Navigation.ts | 19 +++++++++++++++++-- src/pages/LogInWithShortLivedAuthTokenPage.js | 9 +++------ src/pages/LogOutPreviousUserPage.js | 7 ++----- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 37003a09a0cd..69e8f534e395 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -474,7 +474,16 @@ const ROUTES = { PROCESS_MONEY_REQUEST_HOLD: 'hold-request-educational', } as const; -export {getUrlWithBackToParam}; +/** + * Proxy routes can be used to generate a correct url with dynamic values + * + * It will be used by HybridApp, that has no access to methods generating dynamic routes in NewDot + */ +const HYBRID_APP_ROUTES = { + MONEY_REQUEST_CREATE: '/request/new/scan', +} + +export {getUrlWithBackToParam, HYBRID_APP_ROUTES}; export default ROUTES; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -494,4 +503,8 @@ type RouteIsPlainString = IsEqual; */ type Route = RouteIsPlainString extends true ? never : AllRoutes; -export type {Route}; +type HybridAppRoute = { + [K in keyof typeof HYBRID_APP_ROUTES]: ExtractRouteName<(typeof HYBRID_APP_ROUTES)[K]>; +}[keyof typeof HYBRID_APP_ROUTES]; + +export type {Route, HybridAppRoute}; diff --git a/src/languages/en.ts b/src/languages/en.ts index 49749fd79a5a..3be5336c9aa5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -800,7 +800,7 @@ export default { phrase3: 'and', phrase4: 'Privacy', }, - returnToClassic: 'Return to Expensify Classic', + returnToClassic: 'Switch to Expensify Classic', help: 'Help', }, closeAccountPage: { diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 91285821fe9f..083039332215 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -2,10 +2,11 @@ import {findFocusedRoute} from '@react-navigation/core'; import type {EventArg, NavigationContainerEventMap, NavigationState, PartialState} from '@react-navigation/native'; import {CommonActions, getPathFromState, StackActions} from '@react-navigation/native'; import Log from '@libs/Log'; +import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; -import type {Route} from '@src/ROUTES'; -import ROUTES from '@src/ROUTES'; +import type {HybridAppRoute, Route} from '@src/ROUTES'; +import ROUTES, {HYBRID_APP_ROUTES} from '@src/ROUTES'; import {PROTECTED_SCREENS} from '@src/SCREENS'; import originalDismissModal from './dismissModal'; import originalGetTopmostReportActionId from './getTopmostReportActionID'; @@ -67,6 +68,18 @@ function getActiveRouteIndex(stateOrRoute: StateOrRoute, index?: number): number return index; } +/** + * Function that generates dynamic urls from paths passed from OldDot + */ +function parseHybridAppUrl(url: HybridAppRoute | Route): Route { + switch (url) { + case HYBRID_APP_ROUTES.MONEY_REQUEST_CREATE: + return ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()); + default: + return url as Route; + } +} + /** * Gets distance from the path in root navigator. In other words how much screen you have to pop to get to the route with this path. * The search is limited to 5 screens from the top for performance reasons. @@ -134,6 +147,7 @@ function isActiveRoute(routePath: Route): boolean { * @param [type] - Type of action to perform. Currently UP is supported. */ function navigate(route: Route = ROUTES.HOME, type?: string) { + console.log('route', route); if (!canNavigate('navigate', {route})) { // Store intended route if the navigator is not yet available, // we will try again after the NavigationContainer is ready @@ -313,6 +327,7 @@ export default { getRouteNameFromStateEvent, getTopmostReportActionId, waitForProtectedRoutes, + parseHybridAppUrl, }; export {navigationRef}; diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.js b/src/pages/LogInWithShortLivedAuthTokenPage.js index 3be9ad64e8eb..2f937fe50c9a 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.js +++ b/src/pages/LogInWithShortLivedAuthTokenPage.js @@ -1,7 +1,7 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useEffect} from 'react'; -import {View} from 'react-native'; +import {NativeModules, View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import Icon from '@components/Icon'; @@ -74,11 +74,8 @@ function LogInWithShortLivedAuthTokenPage(props) { const exitTo = lodashGet(props, 'route.params.exitTo', ''); if (exitTo) { Navigation.isNavigationReady().then(() => { - if (exitTo === '/request/new/scan') { - Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID())); - } else { - Navigation.navigate(exitTo); - } + const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo + Navigation.navigate(url); }); } // The only dependencies of the effect are based on props.route diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 9438b8663a14..50e584a28c78 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -70,12 +70,9 @@ function LogOutPreviousUserPage(props) { if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { // remove this screen and navigate to exit route + const exitUrl = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo Navigation.goBack(); - if (exitTo === '/request/new/scan') { - Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID())) - } else { - Navigation.navigate(exitTo); - } + Navigation.navigate(exitUrl); }); } }); From ec972f632875fea77a358f411eb703bd0aee21bb Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 11:03:13 +0100 Subject: [PATCH 050/138] remove console.log --- src/libs/Navigation/Navigation.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 083039332215..3f41a38ba221 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -147,7 +147,6 @@ function isActiveRoute(routePath: Route): boolean { * @param [type] - Type of action to perform. Currently UP is supported. */ function navigate(route: Route = ROUTES.HOME, type?: string) { - console.log('route', route); if (!canNavigate('navigate', {route})) { // Store intended route if the navigator is not yet available, // we will try again after the NavigationContainer is ready From c564b5c38f362fa3d2821d3a355e8de3e6956a7d Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 12:29:10 +0100 Subject: [PATCH 051/138] prettier --- src/ROUTES.ts | 2 +- src/pages/LogInWithShortLivedAuthTokenPage.tsx | 2 +- src/pages/LogOutPreviousUserPage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 69e8f534e395..1897661c794d 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -481,7 +481,7 @@ const ROUTES = { */ const HYBRID_APP_ROUTES = { MONEY_REQUEST_CREATE: '/request/new/scan', -} +}; export {getUrlWithBackToParam, HYBRID_APP_ROUTES}; export default ROUTES; diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.tsx b/src/pages/LogInWithShortLivedAuthTokenPage.tsx index c1dd039229ff..55739977f5f3 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.tsx +++ b/src/pages/LogInWithShortLivedAuthTokenPage.tsx @@ -50,7 +50,7 @@ function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedA if (exitTo) { Navigation.isNavigationReady().then(() => { - const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo + const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo; Navigation.navigate(url); }); } diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 50e584a28c78..9bd28f76de31 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -70,7 +70,7 @@ function LogOutPreviousUserPage(props) { if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { // remove this screen and navigate to exit route - const exitUrl = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo + const exitUrl = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo; Navigation.goBack(); Navigation.navigate(exitUrl); }); From cafec680f97ba700f60e7c8279578b524da1263b Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 15:50:21 +0100 Subject: [PATCH 052/138] fiox linter --- src/ROUTES.ts | 6 ++---- src/libs/Navigation/Navigation.ts | 2 +- src/pages/LogInWithShortLivedAuthTokenPage.tsx | 1 - src/pages/LogOutPreviousUserPage.js | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 1897661c794d..dc856f5ca782 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -481,7 +481,7 @@ const ROUTES = { */ const HYBRID_APP_ROUTES = { MONEY_REQUEST_CREATE: '/request/new/scan', -}; +} as const; export {getUrlWithBackToParam, HYBRID_APP_ROUTES}; export default ROUTES; @@ -503,8 +503,6 @@ type RouteIsPlainString = IsEqual; */ type Route = RouteIsPlainString extends true ? never : AllRoutes; -type HybridAppRoute = { - [K in keyof typeof HYBRID_APP_ROUTES]: ExtractRouteName<(typeof HYBRID_APP_ROUTES)[K]>; -}[keyof typeof HYBRID_APP_ROUTES]; +type HybridAppRoute = typeof HYBRID_APP_ROUTES[keyof typeof HYBRID_APP_ROUTES]; export type {Route, HybridAppRoute}; diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 3f41a38ba221..5dfd3c5d145b 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -71,7 +71,7 @@ function getActiveRouteIndex(stateOrRoute: StateOrRoute, index?: number): number /** * Function that generates dynamic urls from paths passed from OldDot */ -function parseHybridAppUrl(url: HybridAppRoute | Route): Route { +function parseHybridAppUrl(url: HybridAppRoute & Route): Route { switch (url) { case HYBRID_APP_ROUTES.MONEY_REQUEST_CREATE: return ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()); diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.tsx b/src/pages/LogInWithShortLivedAuthTokenPage.tsx index 55739977f5f3..cce487a188b7 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.tsx +++ b/src/pages/LogInWithShortLivedAuthTokenPage.tsx @@ -15,7 +15,6 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import type {PublicScreensParamList} from '@libs/Navigation/types'; import * as Session from '@userActions/Session'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type {Account} from '@src/types/onyx'; diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 9bd28f76de31..db0c7a6d806c 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -6,7 +6,6 @@ import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InitialUrlContext from '@libs/InitialUrlContext'; import Navigation from '@libs/Navigation/Navigation'; -import * as ReportUtils from '@libs/ReportUtils'; import * as SessionUtils from '@libs/SessionUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; From 8d79efbb23a375dad0588c389cff5488ea2c80aa Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 15:57:22 +0100 Subject: [PATCH 053/138] fix tsc? --- src/libs/Navigation/Navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 5dfd3c5d145b..3f41a38ba221 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -71,7 +71,7 @@ function getActiveRouteIndex(stateOrRoute: StateOrRoute, index?: number): number /** * Function that generates dynamic urls from paths passed from OldDot */ -function parseHybridAppUrl(url: HybridAppRoute & Route): Route { +function parseHybridAppUrl(url: HybridAppRoute | Route): Route { switch (url) { case HYBRID_APP_ROUTES.MONEY_REQUEST_CREATE: return ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()); From b6b42325d8612a87b5a10aacdffd3f9d3c6481a6 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 18 Jan 2024 16:03:32 +0100 Subject: [PATCH 054/138] one more fix --- src/ROUTES.ts | 2 +- src/libs/Navigation/Navigation.ts | 2 +- src/libs/Navigation/types.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index dc856f5ca782..3269dac6d124 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -503,6 +503,6 @@ type RouteIsPlainString = IsEqual; */ type Route = RouteIsPlainString extends true ? never : AllRoutes; -type HybridAppRoute = typeof HYBRID_APP_ROUTES[keyof typeof HYBRID_APP_ROUTES]; +type HybridAppRoute = (typeof HYBRID_APP_ROUTES)[keyof typeof HYBRID_APP_ROUTES]; export type {Route, HybridAppRoute}; diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 3f41a38ba221..15c2ea289b3d 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -76,7 +76,7 @@ function parseHybridAppUrl(url: HybridAppRoute | Route): Route { case HYBRID_APP_ROUTES.MONEY_REQUEST_CREATE: return ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()); default: - return url as Route; + return url; } } diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 8d227fa6f697..a3470e39b2c0 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -3,7 +3,7 @@ import type {CommonActions, NavigationContainerRefWithCurrent, NavigationHelpers import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type NAVIGATORS from '@src/NAVIGATORS'; -import type {Route as Routes} from '@src/ROUTES'; +import type {HybridAppRoute, Route as Routes} from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; type NavigationRef = NavigationContainerRefWithCurrent; @@ -383,7 +383,7 @@ type PublicScreensParamList = { error?: string; shortLivedAuthToken?: string; shortLivedToken?: string; - exitTo?: Routes; + exitTo?: Routes | HybridAppRoute; }; [SCREENS.VALIDATE_LOGIN]: { accountID: string; From 556b831303bbc594b0c682f1bb993b2623fd0d27 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 19 Jan 2024 01:36:30 +0700 Subject: [PATCH 055/138] set default category only when unset --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index ee2a151c7876..0f535cb60e14 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -121,6 +121,9 @@ function IOURequestStepConfirmation({ '', ); useEffect(() => { + if (!_.isEmpty(transaction.category)) { + return; + } IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); }, [transactionID, defaultCategory]); From d078c1051b3b1cf6d77cbea025f4bbffd757e4d6 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Fri, 19 Jan 2024 19:39:12 +0100 Subject: [PATCH 056/138] Update types PART-1 --- src/components/KYCWall/types.ts | 9 +++------ src/components/SettlementButton.tsx | 5 +++-- src/libs/actions/Policy.ts | 7 +++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index aee5b569cc46..2144dc1a878e 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -5,6 +5,8 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type {Route} from '@src/ROUTES'; import type {Report} from '@src/types/onyx'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; type Source = ValueOf; @@ -14,11 +16,6 @@ type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | type DomRect = Pick; -type AnchorAlignment = { - horizontal: ValueOf; - vertical: ValueOf; -}; - type AnchorPosition = { anchorPositionVertical: number; anchorPositionHorizontal: number; @@ -49,7 +46,7 @@ type KYCWallProps = { chatReportID?: string; /** The IOU/Expense report we are paying */ - iouReport?: OnyxEntry; + iouReport?: OnyxEntry | EmptyObject; /** Where the popover should be positioned relative to the anchor points. */ anchorAlignment?: AnchorAlignment; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 82da026d4014..32dd4ffec7e7 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -12,6 +12,7 @@ import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; import type {LastPaymentMethod, Report} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; @@ -72,10 +73,10 @@ type SettlementButtonProps = SettlementButtonOnyxProps & { buttonSize?: ButtonSizeValue; /** Route for the Add Bank Account screen for a given navigation stack */ - addBankAccountRoute?: string; + addBankAccountRoute?: Route; /** Route for the Add Debit Card screen for a given navigation stack */ - addDebitCardRoute?: string; + addDebitCardRoute?: Route; /** Whether the button should be disabled */ isDisabled?: boolean; diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 263d5fb68529..b6e729d3698e 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -22,6 +22,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetailsList, Policy, PolicyMember, PolicyTags, RecentlyUsedCategories, RecentlyUsedTags, ReimbursementAccount, Report, ReportAction, Transaction} from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import type {CustomUnit} from '@src/types/onyx/Policy'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type AnnounceRoomMembersOnyxData = { @@ -1589,12 +1590,14 @@ function buildOptimisticPolicyRecentlyUsedTags(policyID: string, tag: string): R * * @returns policyID of the workspace we have created */ -function createWorkspaceFromIOUPayment(iouReport: Report): string | undefined { +function createWorkspaceFromIOUPayment(iouReportParam: Report | EmptyObject): string | undefined { // This flow only works for IOU reports - if (!ReportUtils.isIOUReport(iouReport)) { + if (!ReportUtils.isIOUReport(iouReportParam)) { return; } + const iouReport = iouReportParam as Report; + // Generate new variables for the policy const policyID = generatePolicyID(); const workspaceName = generateDefaultWorkspaceName(sessionEmail); From d2f5a1d8c92fa2443dc6e9f7ca4ea91b7aa1643f Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 22 Jan 2024 01:42:49 +0700 Subject: [PATCH 057/138] context approach --- src/components/MenuItem.tsx | 14 +++++-- src/components/MenuItemGroup.js | 35 ---------------- src/components/MenuItemGroup.tsx | 30 ++++++++++++++ .../PersonalDetailsInitialPage.js | 40 +++++++++---------- 4 files changed, 61 insertions(+), 58 deletions(-) delete mode 100644 src/components/MenuItemGroup.js create mode 100644 src/components/MenuItemGroup.tsx diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 334fa9895205..31c07724975a 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -1,7 +1,7 @@ import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import type {ImageContentFit} from 'expo-image'; import type {ForwardedRef, ReactNode} from 'react'; -import React, {forwardRef, useEffect, useMemo, useRef, useState} from 'react'; +import React, {forwardRef, useContext, useEffect, useMemo, useRef, useState} from 'react'; import type {GestureResponderEvent, StyleProp, TextStyle, ViewStyle} from 'react-native'; import {View} from 'react-native'; import type {AnimatedStyle} from 'react-native-reanimated'; @@ -14,6 +14,8 @@ import ControlSelection from '@libs/ControlSelection'; import convertToLTR from '@libs/convertToLTR'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import getButtonState from '@libs/getButtonState'; +// import useWaitForNavigation from '@hooks/useWaitForNavigation'; +import Navigation from '@libs/Navigation/Navigation'; import type {AvatarSource} from '@libs/UserUtils'; import variables from '@styles/variables'; import * as Session from '@userActions/Session'; @@ -29,6 +31,7 @@ import Hoverable from './Hoverable'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import * as defaultWorkspaceAvatars from './Icon/WorkspaceDefaultAvatars'; +import {MenuItemGroupContext} from './MenuItemGroup'; import MultipleAvatars from './MultipleAvatars'; import PressableWithSecondaryInteraction from './PressableWithSecondaryInteraction'; import RenderHTML from './RenderHTML'; @@ -295,6 +298,7 @@ function MenuItem( const {isSmallScreenWidth} = useWindowDimensions(); const [html, setHtml] = useState(''); const titleRef = useRef(''); + const {isExecuting, singleExecution, waitForNavigate} = useContext(MenuItemGroupContext) ?? {}; const isDeleted = style && Array.isArray(style) ? style.includes(styles.offlineFeedback.deleted) : false; const descriptionVerticalMargin = shouldShowDescriptionOnTop ? styles.mb1 : styles.mt1; @@ -370,7 +374,11 @@ function MenuItem( } if (onPress && event) { - onPress(event); + if (!singleExecution || !waitForNavigate) { + onPress(event); + return; + } + singleExecution(waitForNavigate(() => onPress(event))); } }; @@ -394,7 +402,7 @@ function MenuItem( shouldGreyOutWhenDisabled && disabled && styles.buttonOpacityDisabled, ] as StyleProp } - disabled={disabled} + disabled={disabled || isExecuting} ref={ref} role={CONST.ROLE.MENUITEM} accessibilityLabel={title ? title.toString() : ''} diff --git a/src/components/MenuItemGroup.js b/src/components/MenuItemGroup.js deleted file mode 100644 index 4fe5adf989b6..000000000000 --- a/src/components/MenuItemGroup.js +++ /dev/null @@ -1,35 +0,0 @@ -import useSingleExecution from '@hooks/useSingleExecution'; -import PropTypes from 'prop-types'; -import React, {Children, cloneElement} from 'react'; - -const propTypes = { - /* Actual content wrapped by this component */ - children: PropTypes.node.isRequired, - - /** Whether or not to use the single execution hook */ - shouldUseSingleExecution: PropTypes.bool, -}; -const defaultProps = { - shouldUseSingleExecution: true -}; - -function MenuItemGroup(props){ - const {isExecuting, singleExecution} = useSingleExecution(); - const arrayChildren = Children.toArray(props.children); - - return <> - {Children.map(arrayChildren, (child, index) => { - return cloneElement(child,{ - ...child.props, - onPress: props.shouldUseSingleExecution ? singleExecution(child.props.onPress) : child.props.onPress, - disabled: child.props.disabled || isExecuting - }) - })} - -} - -MenuItemGroup.displayName = 'MenuItemGroup'; -MenuItemGroup.propTypes = propTypes; -MenuItemGroup.defaultProps = defaultProps; - -export default MenuItemGroup; \ No newline at end of file diff --git a/src/components/MenuItemGroup.tsx b/src/components/MenuItemGroup.tsx new file mode 100644 index 000000000000..995efc962921 --- /dev/null +++ b/src/components/MenuItemGroup.tsx @@ -0,0 +1,30 @@ +import React, {createContext} from 'react'; +import useSingleExecution from '@hooks/useSingleExecution'; +import type {Action} from '@hooks/useSingleExecution'; +import useWaitForNavigation from '@hooks/useWaitForNavigation'; + +type MenuItemGroupContextProps = { + isExecuting: boolean; + singleExecution: (action?: Action | undefined) => (...params: T) => void; + waitForNavigate: ReturnType; +}; + +const MenuItemGroupContext = createContext(undefined); + +interface MenuItemGroupProps { + /* Actual content wrapped by this component */ + children: React.ReactNode; + + /** Whether or not to use the single execution hook */ + shouldUseSingleExecution: boolean; +} + +const MenuItemGroup: React.FC = ({children}) => { + const {isExecuting, singleExecution} = useSingleExecution(); + const waitForNavigate = useWaitForNavigation(); + + return {children}; +}; + +export {MenuItemGroupContext}; +export default MenuItemGroup; diff --git a/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js b/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js index a35ad78836b8..ee633cbaff1d 100644 --- a/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js +++ b/src/pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage.js @@ -5,6 +5,7 @@ import {ScrollView, View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MenuItemGroup from '@components/MenuItemGroup'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import {withNetwork} from '@components/OnyxProvider'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -17,7 +18,6 @@ import Navigation from '@libs/Navigation/Navigation'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import MenuItemGroup from '@components/MenuItemGroup'; const propTypes = { /* Onyx Props */ @@ -79,25 +79,25 @@ function PersonalDetailsInitialPage(props) { {props.translate('privatePersonalDetails.privateDataMessage')} - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_LEGAL_NAME)} - /> - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH)} - titleStyle={[styles.flex1]} - /> - Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)} - /> + Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_LEGAL_NAME)} + /> + Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH)} + titleStyle={[styles.flex1]} + /> + Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)} + /> From ddffc2531e8c658771d80ff4ea2b6fbc001a1311 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 22 Jan 2024 01:43:36 +0700 Subject: [PATCH 058/138] remove redundant imports --- src/components/MenuItem.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 31c07724975a..e701c9e21c00 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -14,8 +14,6 @@ import ControlSelection from '@libs/ControlSelection'; import convertToLTR from '@libs/convertToLTR'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import getButtonState from '@libs/getButtonState'; -// import useWaitForNavigation from '@hooks/useWaitForNavigation'; -import Navigation from '@libs/Navigation/Navigation'; import type {AvatarSource} from '@libs/UserUtils'; import variables from '@styles/variables'; import * as Session from '@userActions/Session'; From 5b440b7ae7db307cdf559f96064c05341051e8dd Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 22 Jan 2024 01:50:23 +0700 Subject: [PATCH 059/138] fix lint --- src/components/MenuItemGroup.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/MenuItemGroup.tsx b/src/components/MenuItemGroup.tsx index 995efc962921..e8c7a62bf1a6 100644 --- a/src/components/MenuItemGroup.tsx +++ b/src/components/MenuItemGroup.tsx @@ -1,4 +1,4 @@ -import React, {createContext} from 'react'; +import React, {createContext, useMemo} from 'react'; import useSingleExecution from '@hooks/useSingleExecution'; import type {Action} from '@hooks/useSingleExecution'; import useWaitForNavigation from '@hooks/useWaitForNavigation'; @@ -11,20 +11,25 @@ type MenuItemGroupContextProps = { const MenuItemGroupContext = createContext(undefined); -interface MenuItemGroupProps { +type MenuItemGroupProps = { /* Actual content wrapped by this component */ children: React.ReactNode; /** Whether or not to use the single execution hook */ shouldUseSingleExecution: boolean; -} +}; -const MenuItemGroup: React.FC = ({children}) => { +function MenuItemGroup({children, shouldUseSingleExecution = true}: MenuItemGroupProps) { const {isExecuting, singleExecution} = useSingleExecution(); const waitForNavigate = useWaitForNavigation(); - return {children}; -}; + const value = useMemo( + () => (shouldUseSingleExecution ? {isExecuting, singleExecution, waitForNavigate} : undefined), + [shouldUseSingleExecution, isExecuting, singleExecution, waitForNavigate], + ); + + return {children}; +} export {MenuItemGroupContext}; export default MenuItemGroup; From f96ae97de7e196fae79a26b8cdb205c1bb0f360e Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 22 Jan 2024 02:01:12 +0700 Subject: [PATCH 060/138] execute singleExecution --- src/components/MenuItem.tsx | 2 +- src/components/MenuItemGroup.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index e701c9e21c00..f009d3f83939 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -376,7 +376,7 @@ function MenuItem( onPress(event); return; } - singleExecution(waitForNavigate(() => onPress(event))); + singleExecution(waitForNavigate(() => onPress(event)))(); } }; diff --git a/src/components/MenuItemGroup.tsx b/src/components/MenuItemGroup.tsx index e8c7a62bf1a6..8dc8586028d8 100644 --- a/src/components/MenuItemGroup.tsx +++ b/src/components/MenuItemGroup.tsx @@ -16,7 +16,7 @@ type MenuItemGroupProps = { children: React.ReactNode; /** Whether or not to use the single execution hook */ - shouldUseSingleExecution: boolean; + shouldUseSingleExecution?: boolean; }; function MenuItemGroup({children, shouldUseSingleExecution = true}: MenuItemGroupProps) { From ef7ee749731703376bf2c046e62081ca06a9ebeb Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Sun, 21 Jan 2024 22:49:12 +0300 Subject: [PATCH 061/138] add comment --- src/pages/signin/LoginForm/BaseLoginForm.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 5a6c8aed5050..c0f8abee710a 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -277,6 +277,8 @@ function LoginForm(props) { id="username" name="username" onBlur={() => + // This delay is to avoid the validate being called before google iframe is rendered to + // avoid error message appearing after pressing google signin button. setTimeout(() => { if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { return; From 2d7f408065cf2135a9ef7aecccca55dd0d65c69f Mon Sep 17 00:00:00 2001 From: Yauheni Date: Sun, 21 Jan 2024 21:52:18 +0100 Subject: [PATCH 062/138] Update types PART-2 --- src/components/MoneyReportHeader.tsx | 2 -- src/libs/ReportUtils.ts | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index afdc62218f95..88e368a8bbbb 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -127,7 +127,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt {shouldShowSettlementButton && !isSmallScreenWidth && ( ): boolean { * If the report is a policy expense, the route should be for adding bank account for that policy * else since the report is a personal IOU, the route should be for personal bank account. */ -function getBankAccountRoute(report: OnyxEntry): string { +function getBankAccountRoute(report: OnyxEntry): Route { return isPolicyExpenseChat(report) ? ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', report?.policyID) : ROUTES.SETTINGS_ADD_BANK_ACCOUNT; } From 44e688c476bae6216f883c85cd1362566edb1e0a Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 22 Jan 2024 10:12:48 +0100 Subject: [PATCH 063/138] Update types PART-3 --- src/components/KYCWall/BaseKYCWall.tsx | 2 +- src/components/KYCWall/types.ts | 4 ++-- src/components/SettlementButton.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 04c8397bc33b..17e00af3b2ce 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -203,7 +203,7 @@ function KYCWall({ Log.info('[KYC Wallet] User has valid payment method and passed KYC checks or did not need them'); - onSuccessfulKYC(currentSource, iouPaymentType); + onSuccessfulKYC(iouPaymentType, currentSource); }, [ bankAccountList, diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index 2144dc1a878e..7147f86814fa 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -10,7 +10,7 @@ import type {EmptyObject} from '@src/types/utils/EmptyObject'; type Source = ValueOf; -type TransferMethod = ValueOf; +type TransferMethod = ValueOf; type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | 'y'; @@ -61,7 +61,7 @@ type KYCWallProps = { shouldShowPersonalBankAccountOption?: boolean; /** Callback for the end of the onContinue trigger on option selection */ - onSuccessfulKYC: (currentSource?: Source, iouPaymentType?: TransferMethod) => void; + onSuccessfulKYC: (iouPaymentType?: TransferMethod, currentSource?: Source) => void; /** Children to build the KYC */ children: (continueAction: (event: SyntheticEvent, method: TransferMethod) => void, anchorRef: ForwardedRef) => void; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 32dd4ffec7e7..82b9805620cc 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -26,7 +26,7 @@ type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined; type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: string) => void; -type PaymentType = DeepValueOf; +type PaymentType = DeepValueOf; type EnablePaymentsRoute = typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; @@ -37,7 +37,7 @@ type SettlementButtonOnyxProps = { type SettlementButtonProps = SettlementButtonOnyxProps & { /** Callback to execute when this button is pressed. Receives a single payment type argument. */ - onPress: (paymentType: PaymentType) => void; + onPress: (paymentType?: PaymentType) => void; /** The route to redirect if user does not have a payment method setup */ enablePaymentsRoute: EnablePaymentsRoute; From 3fadd8aaff92edff3dbd8ce6194d12e55997bd89 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 22 Jan 2024 10:50:11 +0100 Subject: [PATCH 064/138] Update types PART-4 --- src/components/KYCWall/BaseKYCWall.tsx | 6 +++--- src/components/KYCWall/types.ts | 10 ++++++---- src/components/SettlementButton.tsx | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 17e00af3b2ce..939b87e22376 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -1,7 +1,7 @@ import React, {useCallback, useEffect, useRef, useState} from 'react'; import type {SyntheticEvent} from 'react'; import {Dimensions} from 'react-native'; -import type {EmitterSubscription, NativeTouchEvent} from 'react-native'; +import type {EmitterSubscription, GestureResponderEvent, NativeTouchEvent} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import AddPaymentMethodMenu from '@components/AddPaymentMethodMenu'; @@ -146,7 +146,7 @@ function KYCWall({ * */ const continueAction = useCallback( - (event?: SyntheticEvent, iouPaymentType?: TransferMethod) => { + (event?: GestureResponderEvent | KeyboardEvent | SyntheticEvent, iouPaymentType?: TransferMethod) => { const currentSource = walletTerms?.source ?? source; /** @@ -161,7 +161,7 @@ function KYCWall({ } // Use event target as fallback if anchorRef is null for safety - const targetElement = anchorRef.current ?? (event?.nativeEvent.target as HTMLDivElement); + const targetElement = anchorRef.current ?? ((event as SyntheticEvent)?.nativeEvent.target as HTMLDivElement); transferBalanceButtonRef.current = targetElement; diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index 7147f86814fa..c0b738746985 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -1,16 +1,17 @@ -import type {ForwardedRef, SyntheticEvent} from 'react'; -import type {NativeTouchEvent} from 'react-native'; +import type {ForwardedRef} from 'react'; +import type {GestureResponderEvent} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type {Route} from '@src/ROUTES'; import type {Report} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; type Source = ValueOf; -type TransferMethod = ValueOf; +type TransferMethod = DeepValueOf; type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | 'y'; @@ -64,7 +65,8 @@ type KYCWallProps = { onSuccessfulKYC: (iouPaymentType?: TransferMethod, currentSource?: Source) => void; /** Children to build the KYC */ - children: (continueAction: (event: SyntheticEvent, method: TransferMethod) => void, anchorRef: ForwardedRef) => void; + children: (continueAction: (event?: GestureResponderEvent | KeyboardEvent, method?: TransferMethod) => void, anchorRef: ForwardedRef) => void; + // }; export type {AnchorPosition, KYCWallProps, PaymentMethod, TransferMethod, DomRect}; diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 82b9805620cc..8124509ec4f3 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,4 +1,4 @@ -import type {RefObject} from 'react'; +import type {ForwardedRef, RefObject} from 'react'; import React, {useEffect, useMemo} from 'react'; import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -24,10 +24,10 @@ import KYCWall from './KYCWall'; type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined; -type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: string) => void; - type PaymentType = DeepValueOf; +type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: PaymentType) => void; + type EnablePaymentsRoute = typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; type SettlementButtonOnyxProps = { @@ -213,9 +213,9 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow: TriggerKYCFlow, buttonRef: RefObject) => ( + {(triggerKYCFlow: TriggerKYCFlow, buttonRef: ForwardedRef) => ( } isDisabled={isDisabled} isLoading={isLoading} onPress={(event: KYCFlowEvent, iouPaymentType: PaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} From 907ece0712d4ae652cd6452fea6a10b9193a5778 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 22 Jan 2024 10:51:35 +0100 Subject: [PATCH 065/138] Update types PART-5 --- src/components/KYCWall/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index c0b738746985..ebf9cd3b0a43 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -65,7 +65,7 @@ type KYCWallProps = { onSuccessfulKYC: (iouPaymentType?: TransferMethod, currentSource?: Source) => void; /** Children to build the KYC */ - children: (continueAction: (event?: GestureResponderEvent | KeyboardEvent, method?: TransferMethod) => void, anchorRef: ForwardedRef) => void; + children: (continueAction: (event?: GestureResponderEvent | KeyboardEvent, method?: TransferMethod) => void, anchorRef: ForwardedRef) => void; // }; From 9cb7f8a41b67877a69fd1a1310962538cdfdeb1f Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 22 Jan 2024 10:52:13 +0100 Subject: [PATCH 066/138] Update types PART-6 --- src/components/KYCWall/types.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index ebf9cd3b0a43..d0e5c2e32e2f 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -66,7 +66,6 @@ type KYCWallProps = { /** Children to build the KYC */ children: (continueAction: (event?: GestureResponderEvent | KeyboardEvent, method?: TransferMethod) => void, anchorRef: ForwardedRef) => void; - // }; export type {AnchorPosition, KYCWallProps, PaymentMethod, TransferMethod, DomRect}; From c7925f5820f36f06abd46bd3461f8cac70774355 Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 23 Jan 2024 02:05:19 +0700 Subject: [PATCH 067/138] fix lint --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 0f535cb60e14..029836d0c654 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -125,7 +125,7 @@ function IOURequestStepConfirmation({ return; } IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); - }, [transactionID, defaultCategory]); + }, [transactionID, transaction.category, defaultCategory]); const navigateBack = useCallback(() => { // If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken From 7a620e8d84b4133a0557b954a040a9876224a038 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 23 Jan 2024 10:48:11 +0100 Subject: [PATCH 068/138] patch fix --- .../@react-native-community+cli-platform-android+12.3.0.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/@react-native-community+cli-platform-android+12.3.0.patch b/patches/@react-native-community+cli-platform-android+12.3.0.patch index 7289f652232a..d94baf0f9c6e 100644 --- a/patches/@react-native-community+cli-platform-android+12.3.0.patch +++ b/patches/@react-native-community+cli-platform-android+12.3.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle -index bbfa7f7..00d14dd 100644 +index bbfa7f7..ed53872 100644 --- a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle +++ b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle @@ -140,6 +140,7 @@ class ReactNativeModules { @@ -45,7 +45,7 @@ index bbfa7f7..00d14dd 100644 +if(this.hasProperty('reactNativeProject')){ + autoModules = new ReactNativeModules(logger, projectRoot, new File(projectRoot, reactNativeProject)) +} else { -+ autoModules = new ReactNativeModules(logger, projectRoot) ++ autoModules = new ReactNativeModules(logger, projectRoot, projectRoot) +} def reactNativeVersionRequireNewArchEnabled(autoModules) { From 0068fbf6a58ac1a4193dee45e6e814237c0612b9 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 23 Jan 2024 15:06:37 +0100 Subject: [PATCH 069/138] add required changes --- android/app/src/main/res/values/colors.xml | 2 +- src/App.js | 6 +++--- src/libs/Navigation/AppNavigator/index.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index 8d5bfbf4eed7..94065c5b9d19 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,5 +1,5 @@ - + #03D47C #FFFFFF #03D47C diff --git a/src/App.js b/src/App.js index 87de6a2e160a..4ccb49a6c6cf 100644 --- a/src/App.js +++ b/src/App.js @@ -38,7 +38,7 @@ const propTypes = { }; const defaultProps = { - url: null, + url: undefined, }; // For easier debugging and development, when we are in web we expose Onyx to the window, so you can more easily set data into Onyx @@ -56,11 +56,11 @@ LogBox.ignoreLogs([ const fill = {flex: 1}; -function App(props) { +function App({url}) { useDefaultDragAndDrop(); OnyxUpdateManager(); return ( - + { - if (!NativeModules.HybridAppModule || initUrl === undefined) { + if (!NativeModules.HybridAppModule || !initUrl) { return; } From 752e63fa7e9852eb8b71a63d907eff8a573d31e4 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 24 Jan 2024 09:04:26 +0100 Subject: [PATCH 070/138] rename patches --- ...reanimated+3.5.4.patch => react-native-reanimated+3.6.1.patch} | 0 ...amera+2.16.2.patch => react-native-vision-camera+2.16.5.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename patches/{react-native-reanimated+3.5.4.patch => react-native-reanimated+3.6.1.patch} (100%) rename patches/{react-native-vision-camera+2.16.2.patch => react-native-vision-camera+2.16.5.patch} (100%) diff --git a/patches/react-native-reanimated+3.5.4.patch b/patches/react-native-reanimated+3.6.1.patch similarity index 100% rename from patches/react-native-reanimated+3.5.4.patch rename to patches/react-native-reanimated+3.6.1.patch diff --git a/patches/react-native-vision-camera+2.16.2.patch b/patches/react-native-vision-camera+2.16.5.patch similarity index 100% rename from patches/react-native-vision-camera+2.16.2.patch rename to patches/react-native-vision-camera+2.16.5.patch From 6a8161a267ab1228f8735b0ef4dd557d9a5365ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20M=C3=B3rawski?= Date: Wed, 24 Jan 2024 14:30:14 +0100 Subject: [PATCH 071/138] delete the old component --- src/pages/SearchPage.js | 223 ---------------------------------------- 1 file changed, 223 deletions(-) delete mode 100755 src/pages/SearchPage.js diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js deleted file mode 100755 index c420371f5a65..000000000000 --- a/src/pages/SearchPage.js +++ /dev/null @@ -1,223 +0,0 @@ -import PropTypes from 'prop-types'; -import React, {useCallback, useEffect, useRef, useState} from 'react'; -import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import OptionsSelector from '@components/OptionsSelector'; -import ScreenWrapper from '@components/ScreenWrapper'; -import useLocalize from '@hooks/useLocalize'; -import useNetwork from '@hooks/useNetwork'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; -import Performance from '@libs/Performance'; -import * as ReportUtils from '@libs/ReportUtils'; -import * as Report from '@userActions/Report'; -import Timing from '@userActions/Timing'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import personalDetailsPropType from './personalDetailsPropType'; -import reportPropTypes from './reportPropTypes'; - -const propTypes = { - /* Onyx Props */ - - /** Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), - - /** All of the personal details for everyone */ - personalDetails: PropTypes.objectOf(personalDetailsPropType), - - /** All reports shared with the user */ - reports: PropTypes.objectOf(reportPropTypes), - - /** Whether we are searching for reports in the server */ - isSearchingForReports: PropTypes.bool, - - /** - * The navigation prop passed by the navigator. - * - * This is required because transitionEnd event doesn't trigger in the automated testing environment. - */ - navigation: PropTypes.shape({}), -}; - -const defaultProps = { - betas: [], - personalDetails: {}, - reports: {}, - isSearchingForReports: false, - navigation: {}, -}; - -function SearchPage({betas, personalDetails, reports, isSearchingForReports, navigation}) { - const [searchValue, setSearchValue] = useState(''); - const [searchOptions, setSearchOptions] = useState({ - recentReports: {}, - personalDetails: {}, - userToInvite: {}, - }); - - const {isOffline} = useNetwork(); - const {translate} = useLocalize(); - const themeStyles = useThemeStyles(); - const isMounted = useRef(false); - - const updateOptions = useCallback(() => { - const { - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - } = OptionsListUtils.getSearchOptions(reports, personalDetails, searchValue.trim(), betas); - - setSearchOptions({ - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - }); - }, [reports, personalDetails, searchValue, betas]); - - useEffect(() => { - Timing.start(CONST.TIMING.SEARCH_RENDER); - Performance.markStart(CONST.TIMING.SEARCH_RENDER); - }, []); - - useEffect(() => { - updateOptions(); - }, [reports, personalDetails, betas, updateOptions]); - - useEffect(() => { - if (!isMounted.current) { - isMounted.current = true; - return; - } - - updateOptions(); - // Ignoring the rule intentionally, we want to run the code only when search Value changes to prevent additional runs. - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [searchValue]); - - /** - * Returns the sections needed for the OptionsSelector - * - * @returns {Array} - */ - const getSections = () => { - const sections = []; - let indexOffset = 0; - - if (searchOptions.recentReports.length > 0) { - sections.push({ - data: searchOptions.recentReports, - shouldShow: true, - indexOffset, - }); - indexOffset += searchOptions.recentReports.length; - } - - if (searchOptions.personalDetails.length > 0) { - sections.push({ - data: searchOptions.personalDetails, - shouldShow: true, - indexOffset, - }); - indexOffset += searchOptions.recentReports.length; - } - - if (searchOptions.userToInvite) { - sections.push({ - data: [searchOptions.userToInvite], - shouldShow: true, - indexOffset, - }); - } - - return sections; - }; - - const searchRendered = () => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }; - - const onChangeText = (value = '') => { - Report.searchInServer(searchValue); - setSearchValue(value); - }; - - /** - * Reset the search value and redirect to the selected report - * - * @param {Object} option - */ - const selectReport = (option) => { - if (!option) { - return; - } - if (option.reportID) { - Navigation.dismissModal(option.reportID); - } else { - Report.navigateToAndOpenReport([option.login]); - } - }; - - const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); - const headerMessage = OptionsListUtils.getHeaderMessage( - searchOptions.recentReports.length + searchOptions.personalDetails.length !== 0, - Boolean(searchOptions.userToInvite), - searchValue, - ); - - return ( - - {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( - <> - - - - - - )} - - ); -} - -SearchPage.propTypes = propTypes; -SearchPage.defaultProps = defaultProps; -SearchPage.displayName = 'SearchPage'; -export default withOnyx({ - reports: { - key: ONYXKEYS.COLLECTION.REPORT, - }, - personalDetails: { - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - }, - betas: { - key: ONYXKEYS.BETAS, - }, - isSearchingForReports: { - key: ONYXKEYS.IS_SEARCHING_FOR_REPORTS, - initWithStoredValues: false, - }, -})(SearchPage); From c82dbc35ed0caac73b195339112bff99f65bf102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20M=C3=B3rawski?= Date: Wed, 24 Jan 2024 14:30:51 +0100 Subject: [PATCH 072/138] search debounce and loading indicator added --- .../SelectionList/BaseSelectionList.tsx | 2 ++ src/components/SelectionList/types.ts | 3 +++ src/pages/SearchPage/index.js | 16 ++++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index d97c47c84ee7..2c929d2f4f9c 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -58,6 +58,7 @@ function BaseSelectionList( shouldShowTooltips = true, shouldUseDynamicMaxToRenderPerBatch = false, rightHandSideComponent, + isLoadingNewOptions = false, }: BaseSelectionListProps, inputRef: ForwardedRef, ) { @@ -422,6 +423,7 @@ function BaseSelectionList( spellCheck={false} onSubmitEditing={selectFocusedOption} blurOnSubmit={!!flattenedSections.allOptions.length} + isLoading={isLoadingNewOptions} /> )} diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index a82ddef6febb..222c818dd66d 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -230,6 +230,9 @@ type BaseSelectionListProps = Partial ReactElement) | ReactElement | null; + + /** Whether to show the loading indicator for new options */ + isLoadingNewOptions?: boolean; }; type ItemLayout = { diff --git a/src/pages/SearchPage/index.js b/src/pages/SearchPage/index.js index 211f3622e06c..8a06d54a1f45 100644 --- a/src/pages/SearchPage/index.js +++ b/src/pages/SearchPage/index.js @@ -29,11 +29,15 @@ const propTypes = { /** All reports shared with the user */ reports: PropTypes.objectOf(reportPropTypes), + + /** Whether or not we are searching for reports on the server */ + isSearchingForReports: PropTypes.bool, }; const defaultProps = { betas: [], reports: {}, + isSearchingForReports: false, }; const setPerformanceTimersEnd = () => { @@ -43,7 +47,7 @@ const setPerformanceTimersEnd = () => { const SearchPageFooterInstance = ; -function SearchPage({betas, reports}) { +function SearchPage({betas, reports, isSearchingForReports}) { const [isScreenTransitionEnd, setIsScreenTransitionEnd] = useState(false); const {translate} = useLocalize(); const {isOffline} = useNetwork(); @@ -59,10 +63,9 @@ function SearchPage({betas, reports}) { Performance.markStart(CONST.TIMING.SEARCH_RENDER); }, []); - const onChangeText = (text = '') => { - Report.searchInServer(text); - setSearchValue(text); - }; + useEffect(() => { + Report.searchInServer(debouncedSearchValue.trim()); + }, [debouncedSearchValue]); const { recentReports, @@ -150,13 +153,14 @@ function SearchPage({betas, reports}) { textInputValue={searchValue} textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')} textInputHint={offlineMessage} - onChangeText={onChangeText} + onChangeText={setSearchValue} headerMessage={headerMessage} onLayout={setPerformanceTimersEnd} autoFocus onSelectRow={selectReport} showLoadingPlaceholder={!didScreenTransitionEnd || !isOptionsDataReady} footerContent={SearchPageFooterInstance} + isLoadingNewOptions={isSearchingForReports} /> From 8e934fabeb192e867f80585c5758b4f4995ad9b1 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 24 Jan 2024 17:44:05 +0100 Subject: [PATCH 073/138] Update createWorkspaceFromIOUPayment --- src/libs/actions/Policy.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 2c9dbcee371c..ec9cb6d7cae8 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1612,14 +1612,12 @@ function buildOptimisticPolicyRecentlyUsedTags(policyID: string, tag: string): R * * @returns policyID of the workspace we have created */ -function createWorkspaceFromIOUPayment(iouReportParam: Report | EmptyObject): string | undefined { +function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string | undefined { // This flow only works for IOU reports - if (!ReportUtils.isIOUReport(iouReportParam)) { + if (isEmptyObject(iouReport) || !ReportUtils.isIOUReport(iouReport)) { return; } - const iouReport = iouReportParam as Report; - // Generate new variables for the policy const policyID = generatePolicyID(); const workspaceName = generateDefaultWorkspaceName(sessionEmail); From 9e4975c5b9d1666803728db3f6ca66b704f183ed Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 25 Jan 2024 16:39:54 +0700 Subject: [PATCH 074/138] add feature for native --- .../EmojiPicker/EmojiPickerMenu/index.js | 14 +++++++++++++- .../EmojiPicker/EmojiPickerMenu/index.native.js | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index c8ca9c6ac6d1..f6524fbe9d70 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -370,7 +370,19 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { /> ); }, - [preferredSkinTone, highlightedIndex, isUsingKeyboardMovement, highlightFirstEmoji, singleExecution, translate, onEmojiSelected, isSmallScreenWidth, windowWidth, styles, activeEmoji], + [ + preferredSkinTone, + highlightedIndex, + isUsingKeyboardMovement, + highlightFirstEmoji, + singleExecution, + translate, + onEmojiSelected, + isSmallScreenWidth, + windowWidth, + styles, + activeEmoji, + ], ); return ( diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js index 1463ce736699..02a71aec879e 100644 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js @@ -10,6 +10,7 @@ import useSingleExecution from '@hooks/useSingleExecution'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as EmojiUtils from '@libs/EmojiUtils'; import CONST from '@src/CONST'; import BaseEmojiPickerMenu from './BaseEmojiPickerMenu'; import emojiPickerMenuPropTypes from './emojiPickerMenuPropTypes'; @@ -17,7 +18,7 @@ import useEmojiPickerMenu from './useEmojiPickerMenu'; const propTypes = emojiPickerMenuPropTypes; -function EmojiPickerMenu({onEmojiSelected}) { +function EmojiPickerMenu({onEmojiSelected, activeEmoji}) { const styles = useThemeStyles(); const {windowWidth, isSmallScreenWidth} = useWindowDimensions(); const {translate} = useLocalize(); @@ -94,11 +95,13 @@ function EmojiPickerMenu({onEmojiSelected}) { } const emojiCode = types && types[preferredSkinTone] ? types[preferredSkinTone] : code; + const shouldEmojiBeHighlighted = activeEmoji && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji); return ( onEmojiSelected(emoji, item))} emoji={emojiCode} + isHighlighted={shouldEmojiBeHighlighted} /> ); }, From 3fe1ab1e529e51404150af875b33af457ba63bf7 Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 25 Jan 2024 16:44:49 +0700 Subject: [PATCH 075/138] linting --- src/components/EmojiPicker/EmojiPickerMenu/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js index 02a71aec879e..bfe52220ee3a 100644 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js @@ -105,7 +105,7 @@ function EmojiPickerMenu({onEmojiSelected, activeEmoji}) { /> ); }, - [styles, windowWidth, preferredSkinTone, singleExecution, onEmojiSelected, translate], + [styles, windowWidth, preferredSkinTone, singleExecution, onEmojiSelected, translate, activeEmoji], ); return ( From 9645db7ef36b28137989ad01d8c8ba92ba9b9100 Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 25 Jan 2024 17:30:31 +0700 Subject: [PATCH 076/138] wrap activeEmoji check with boolean --- src/components/EmojiPicker/EmojiPickerMenu/index.js | 2 +- src/components/EmojiPicker/EmojiPickerMenu/index.native.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index f6524fbe9d70..3da605a47a55 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -346,7 +346,7 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { const isEmojiFocused = index === highlightedIndex && isUsingKeyboardMovement; const shouldEmojiBeHighlighted = - (index === highlightedIndex && highlightFirstEmoji) || (activeEmoji && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); + (index === highlightedIndex && highlightFirstEmoji) || (Boolean(activeEmoji) && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); return ( Date: Thu, 25 Jan 2024 19:58:41 +0700 Subject: [PATCH 077/138] prettier --- src/components/EmojiPicker/EmojiPickerMenu/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index 3da605a47a55..d2ff55a22b2f 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -346,7 +346,8 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { const isEmojiFocused = index === highlightedIndex && isUsingKeyboardMovement; const shouldEmojiBeHighlighted = - (index === highlightedIndex && highlightFirstEmoji) || (Boolean(activeEmoji) && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); + (index === highlightedIndex && highlightFirstEmoji) || + (Boolean(activeEmoji) && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); return ( Date: Thu, 25 Jan 2024 16:38:41 +0100 Subject: [PATCH 078/138] Fix ts issue --- src/components/ThreeDotsMenu/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ThreeDotsMenu/index.tsx b/src/components/ThreeDotsMenu/index.tsx index 920b8f9f4130..e087456943ce 100644 --- a/src/components/ThreeDotsMenu/index.tsx +++ b/src/components/ThreeDotsMenu/index.tsx @@ -3,7 +3,6 @@ import type {StyleProp, ViewStyle} from 'react-native'; import {View} from 'react-native'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; -import type {AnchorAlignment} from '@components/Popover/types'; import type {PopoverMenuItem} from '@components/PopoverMenu'; import PopoverMenu from '@components/PopoverMenu'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; @@ -15,6 +14,7 @@ import * as Browser from '@libs/Browser'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import type {AnchorPosition} from '@src/styles'; +import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import type IconAsset from '@src/types/utils/IconAsset'; type ThreeDotsMenuProps = { From 48748d1cbc18d1024f92b1f36866a1d583b40563 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 25 Jan 2024 18:29:08 +0100 Subject: [PATCH 079/138] Fix comments --- src/components/SettlementButton.tsx | 6 +++--- src/libs/ReportUtils.ts | 9 ++++++++- src/libs/actions/Policy.ts | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 8124509ec4f3..7a2a94aff301 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,4 +1,4 @@ -import type {ForwardedRef, RefObject} from 'react'; +import type {RefObject} from 'react'; import React, {useEffect, useMemo} from 'react'; import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -213,12 +213,12 @@ function SettlementButton({ anchorAlignment={kycWallAnchorAlignment} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} > - {(triggerKYCFlow: TriggerKYCFlow, buttonRef: ForwardedRef) => ( + {(triggerKYCFlow, buttonRef) => ( } isDisabled={isDisabled} isLoading={isLoading} - onPress={(event: KYCFlowEvent, iouPaymentType: PaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} + onPress={(event, iouPaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} pressOnEnter={pressOnEnter} options={paymentButtonOptions} style={style} diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 91a558e7ce4e..264cf665f599 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -604,13 +604,19 @@ function isExpenseReport(report: OnyxEntry | EmptyObject): boolean { } /** - * Checks if a report is an IOU report. + * Checks if a report is an IOU report using report or reportID */ function isIOUReport(reportOrID: OnyxEntry | string | EmptyObject): boolean { const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] ?? null : reportOrID; return report?.type === CONST.REPORT.TYPE.IOU; } +/** + * Checks if a report is an IOU report using report + */ +function isIOUReportUsingReport(report: OnyxEntry | EmptyObject): report is Report { + return report?.type === CONST.REPORT.TYPE.IOU; +} /** * Checks if a report is a task report. */ @@ -4812,6 +4818,7 @@ export { doesReportBelongToWorkspace, getChildReportNotificationPreference, isReportFieldOfTypeTitle, + isIOUReportUsingReport, }; export type { diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 86282312bed4..f00b0774d881 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1615,7 +1615,7 @@ function buildOptimisticPolicyRecentlyUsedTags(policyID: string, tag: string): R */ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string | undefined { // This flow only works for IOU reports - if (isEmptyObject(iouReport) || !ReportUtils.isIOUReport(iouReport)) { + if (!ReportUtils.isIOUReportUsingReport(iouReport)) { return; } From e9023f02bee22394fcc06afbafb4e36d5135c6a7 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 26 Jan 2024 12:10:48 +0100 Subject: [PATCH 080/138] limit gyroscope animation and add reduce motion --- src/CONST.ts | 2 ++ src/libs/Accessibility/index.ts | 10 ++++++++++ src/libs/NumberUtils.ts | 14 +------------- .../home/report/AnimatedEmptyStateBackground.tsx | 13 +++++++------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index ff3934c31943..f4a66b8fe1ba 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -46,6 +46,8 @@ const CONST = { IN: 'in', OUT: 'out', }, + // Multiplier for gyroscope animation in order to make it a bit more subtle + ANIMATION_GYROSCOPE_VALUE: 0.65, ARROW_HIDE_DELAY: 3000, API_ATTACHMENT_VALIDATIONS: { diff --git a/src/libs/Accessibility/index.ts b/src/libs/Accessibility/index.ts index 167634acce56..e98b15948023 100644 --- a/src/libs/Accessibility/index.ts +++ b/src/libs/Accessibility/index.ts @@ -18,6 +18,15 @@ const useScreenReaderStatus = (): boolean => { return isScreenReaderEnabled; }; +const useReduceMotionStatus = (): boolean => { + const [isScreenReaderEnabled, setIsScreenReaderEnabled] = useState(false); + useEffect(() => { + AccessibilityInfo.isReduceMotionEnabled().then(enabled => setIsScreenReaderEnabled(enabled)) + }, []); + + return isScreenReaderEnabled; +}; + const getHitSlopForSize = ({x, y}: HitSlop) => { /* according to https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/ the minimum tappable area is 44x44 points */ @@ -49,5 +58,6 @@ const useAutoHitSlop = () => { export default { moveAccessibilityFocus, useScreenReaderStatus, + useReduceMotionStatus, useAutoHitSlop, }; diff --git a/src/libs/NumberUtils.ts b/src/libs/NumberUtils.ts index ddbd42243758..d7eb87a2ed1e 100644 --- a/src/libs/NumberUtils.ts +++ b/src/libs/NumberUtils.ts @@ -47,18 +47,6 @@ function generateHexadecimalValue(num: number): string { return result.join('').toUpperCase(); } -/** - * Clamp a number in a range. - * This is a worklet so it should be used only from UI thread. - - * @returns clamped value between min and max - */ -function clampWorklet(num: number, min: number, max: number): number { - 'worklet'; - - return Math.min(Math.max(num, min), max); -} - /** * Generates a random integer between a and b * It's and equivalent of _.random(a, b) @@ -81,4 +69,4 @@ function parseFloatAnyLocale(value: string): number { return parseFloat(value ? value.replace(',', '.') : value); } -export {rand64, generateHexadecimalValue, generateRandomInt, clampWorklet, parseFloatAnyLocale}; +export {rand64, generateHexadecimalValue, generateRandomInt, parseFloatAnyLocale}; diff --git a/src/pages/home/report/AnimatedEmptyStateBackground.tsx b/src/pages/home/report/AnimatedEmptyStateBackground.tsx index 7e259b7473cf..47edab5457d3 100644 --- a/src/pages/home/report/AnimatedEmptyStateBackground.tsx +++ b/src/pages/home/report/AnimatedEmptyStateBackground.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import Animated, {SensorType, useAnimatedSensor, useAnimatedStyle, useSharedValue, withSpring} from 'react-native-reanimated'; +import Animated, {clamp, SensorType, useAnimatedSensor, useAnimatedStyle, useSharedValue, withSpring} from 'react-native-reanimated'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeIllustrations from '@hooks/useThemeIllustrations'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as NumberUtils from '@libs/NumberUtils'; +import Accessibility from '@libs/Accessibility'; import variables from '@styles/variables'; import CONST from '@src/CONST'; @@ -22,10 +22,11 @@ function AnimatedEmptyStateBackground() { const animatedSensor = useAnimatedSensor(SensorType.GYROSCOPE); const xOffset = useSharedValue(0); const yOffset = useSharedValue(0); + const isReducedMotionEnabled = Accessibility.useReduceMotionStatus(); // Apply data to create style object const animatedStyles = useAnimatedStyle(() => { - if (!isSmallScreenWidth) { + if (!isSmallScreenWidth || isReducedMotionEnabled) { return {}; } /* @@ -34,12 +35,12 @@ function AnimatedEmptyStateBackground() { */ const {x, y} = animatedSensor.sensor.value; // The x vs y here seems wrong but is the way to make it feel right to the user - xOffset.value = NumberUtils.clampWorklet(xOffset.value + y, -IMAGE_OFFSET_X, IMAGE_OFFSET_X); - yOffset.value = NumberUtils.clampWorklet(yOffset.value - x, -IMAGE_OFFSET_Y, IMAGE_OFFSET_Y); + xOffset.value = clamp(xOffset.value + y * CONST.ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_X, IMAGE_OFFSET_X); + yOffset.value = clamp(yOffset.value - x * CONST.ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_Y, IMAGE_OFFSET_Y); return { transform: [{translateX: withSpring(-IMAGE_OFFSET_X - xOffset.value)}, {translateY: withSpring(yOffset.value)}], }; - }, []); + }, [isReducedMotionEnabled]); return ( Date: Fri, 26 Jan 2024 12:23:45 +0100 Subject: [PATCH 081/138] fix prettier --- src/libs/Accessibility/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Accessibility/index.ts b/src/libs/Accessibility/index.ts index e98b15948023..7c7d2a71ad92 100644 --- a/src/libs/Accessibility/index.ts +++ b/src/libs/Accessibility/index.ts @@ -21,7 +21,7 @@ const useScreenReaderStatus = (): boolean => { const useReduceMotionStatus = (): boolean => { const [isScreenReaderEnabled, setIsScreenReaderEnabled] = useState(false); useEffect(() => { - AccessibilityInfo.isReduceMotionEnabled().then(enabled => setIsScreenReaderEnabled(enabled)) + AccessibilityInfo.isReduceMotionEnabled().then((enabled) => setIsScreenReaderEnabled(enabled)); }, []); return isScreenReaderEnabled; From b758b32583faaa374ffcae91be46944642867665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20M=C3=B3rawski?= Date: Fri, 26 Jan 2024 14:36:55 +0100 Subject: [PATCH 082/138] referral cta bottom padding fix --- src/pages/SearchPage/SearchPageFooter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/SearchPage/SearchPageFooter.tsx b/src/pages/SearchPage/SearchPageFooter.tsx index e0ef67ad9ec3..3d5ebfd2c193 100644 --- a/src/pages/SearchPage/SearchPageFooter.tsx +++ b/src/pages/SearchPage/SearchPageFooter.tsx @@ -8,7 +8,7 @@ function SearchPageFooter() { const themeStyles = useThemeStyles(); return ( - + ); From f0f114420272e0db2875b1dc546b826bc2f6e439 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 26 Jan 2024 15:06:29 +0100 Subject: [PATCH 083/138] use useRedusedMotion from reanimated --- src/libs/Accessibility/index.ts | 10 ---------- src/pages/home/report/AnimatedEmptyStateBackground.tsx | 5 ++--- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/libs/Accessibility/index.ts b/src/libs/Accessibility/index.ts index 7c7d2a71ad92..167634acce56 100644 --- a/src/libs/Accessibility/index.ts +++ b/src/libs/Accessibility/index.ts @@ -18,15 +18,6 @@ const useScreenReaderStatus = (): boolean => { return isScreenReaderEnabled; }; -const useReduceMotionStatus = (): boolean => { - const [isScreenReaderEnabled, setIsScreenReaderEnabled] = useState(false); - useEffect(() => { - AccessibilityInfo.isReduceMotionEnabled().then((enabled) => setIsScreenReaderEnabled(enabled)); - }, []); - - return isScreenReaderEnabled; -}; - const getHitSlopForSize = ({x, y}: HitSlop) => { /* according to https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/ the minimum tappable area is 44x44 points */ @@ -58,6 +49,5 @@ const useAutoHitSlop = () => { export default { moveAccessibilityFocus, useScreenReaderStatus, - useReduceMotionStatus, useAutoHitSlop, }; diff --git a/src/pages/home/report/AnimatedEmptyStateBackground.tsx b/src/pages/home/report/AnimatedEmptyStateBackground.tsx index 47edab5457d3..c2ae6ddeb54c 100644 --- a/src/pages/home/report/AnimatedEmptyStateBackground.tsx +++ b/src/pages/home/report/AnimatedEmptyStateBackground.tsx @@ -1,9 +1,8 @@ import React from 'react'; -import Animated, {clamp, SensorType, useAnimatedSensor, useAnimatedStyle, useSharedValue, withSpring} from 'react-native-reanimated'; +import Animated, {clamp, SensorType, useAnimatedSensor, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring} from 'react-native-reanimated'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeIllustrations from '@hooks/useThemeIllustrations'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import Accessibility from '@libs/Accessibility'; import variables from '@styles/variables'; import CONST from '@src/CONST'; @@ -22,7 +21,7 @@ function AnimatedEmptyStateBackground() { const animatedSensor = useAnimatedSensor(SensorType.GYROSCOPE); const xOffset = useSharedValue(0); const yOffset = useSharedValue(0); - const isReducedMotionEnabled = Accessibility.useReduceMotionStatus(); + const isReducedMotionEnabled = useReducedMotion(); // Apply data to create style object const animatedStyles = useAnimatedStyle(() => { From 7fe93d8869167fe7a4dba8e0db101a5451f26990 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 29 Jan 2024 09:39:21 +0100 Subject: [PATCH 084/138] add adjustments --- src/CONST.ts | 2 +- src/pages/home/report/ReportActionItem.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index f4a66b8fe1ba..cbb99833fcce 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -47,7 +47,7 @@ const CONST = { OUT: 'out', }, // Multiplier for gyroscope animation in order to make it a bit more subtle - ANIMATION_GYROSCOPE_VALUE: 0.65, + ANIMATION_GYROSCOPE_VALUE: 0.4, ARROW_HIDE_DELAY: 3000, API_ATTACHMENT_VALIDATIONS: { diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 80fb341a2cf8..3a333576965d 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -619,7 +619,7 @@ function ReportActionItem(props) { if (ReportUtils.isTaskReport(props.report)) { if (ReportUtils.isCanceledTaskReport(props.report, parentReportAction)) { return ( - <> + - + ); } return ( - <> + - + ); } if (ReportUtils.isExpenseReport(props.report) || ReportUtils.isIOUReport(props.report)) { From 56c81389396909c9c63a71d9e0a63a074634b5a8 Mon Sep 17 00:00:00 2001 From: Amarparab2024 <156438377+Amarparab2024@users.noreply.github.com> Date: Tue, 30 Jan 2024 13:54:07 +0530 Subject: [PATCH 085/138] @Amarparab2024 pass shouldEnableMaxHeight as prop --- src/pages/SearchPage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js index c420371f5a65..11b48645b57d 100755 --- a/src/pages/SearchPage.js +++ b/src/pages/SearchPage.js @@ -174,6 +174,7 @@ function SearchPage({betas, personalDetails, reports, isSearchingForReports, nav testID={SearchPage.displayName} onEntryTransitionEnd={updateOptions} navigation={navigation} + shouldEnableMaxHeight > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <> From cfc6291bb64e83a13ac93f4b191a92b6bfe52ea2 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 30 Jan 2024 11:12:03 +0100 Subject: [PATCH 086/138] fix test --- tests/ui/UnreadIndicatorsTest.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ui/UnreadIndicatorsTest.js b/tests/ui/UnreadIndicatorsTest.js index e4d4d877f66b..6da7005bfb77 100644 --- a/tests/ui/UnreadIndicatorsTest.js +++ b/tests/ui/UnreadIndicatorsTest.js @@ -43,6 +43,7 @@ jest.mock('react-native/Libraries/LogBox/LogBox', () => ({ jest.mock('react-native-reanimated', () => ({ ...jest.requireActual('react-native-reanimated/mock'), createAnimatedPropAdapter: jest.fn, + useReducedMotion: jest.fn, })); /** From cad6895caae16fe44aa5882db63942d5034f4ec8 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 30 Jan 2024 15:13:54 +0100 Subject: [PATCH 087/138] test --- tests/perf-test/SignInPage.perf-test.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/perf-test/SignInPage.perf-test.tsx b/tests/perf-test/SignInPage.perf-test.tsx index 80964c3c49cd..7bc08c92b115 100644 --- a/tests/perf-test/SignInPage.perf-test.tsx +++ b/tests/perf-test/SignInPage.perf-test.tsx @@ -29,6 +29,16 @@ jest.mock('../../src/libs/Navigation/Navigation', () => { } as typeof Navigation; }); +jest.mock('../../src/ROUTES', () => { + const actualRoutes = jest.requireActual('../../src/ROUTES'); + return { + ...actualRoutes, + HYBRID_APP_ROUTES: { + MONEY_REQUEST_CREATE: '/request/new/scan', + }, + }; +}); + const mockedNavigate = jest.fn(); jest.mock('@react-navigation/native', () => { const actualNav = jest.requireActual('@react-navigation/native'); From 4c681ef95d6703fd66b58b6489389708c20e16c6 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 30 Jan 2024 16:55:23 +0100 Subject: [PATCH 088/138] test --- tests/perf-test/SignInPage.perf-test.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/perf-test/SignInPage.perf-test.tsx b/tests/perf-test/SignInPage.perf-test.tsx index 7bc08c92b115..94f535ef2afc 100644 --- a/tests/perf-test/SignInPage.perf-test.tsx +++ b/tests/perf-test/SignInPage.perf-test.tsx @@ -29,15 +29,9 @@ jest.mock('../../src/libs/Navigation/Navigation', () => { } as typeof Navigation; }); -jest.mock('../../src/ROUTES', () => { - const actualRoutes = jest.requireActual('../../src/ROUTES'); - return { - ...actualRoutes, - HYBRID_APP_ROUTES: { - MONEY_REQUEST_CREATE: '/request/new/scan', - }, - }; -}); +const HYBRID_APP_ROUTES = { + MONEY_REQUEST_CREATE: '/request/new/scan', +} as const; const mockedNavigate = jest.fn(); jest.mock('@react-navigation/native', () => { From 03e29895bb4a12ce9fd1959895da3191fa82e6a1 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 30 Jan 2024 17:16:48 +0100 Subject: [PATCH 089/138] test --- tests/perf-test/SignInPage.perf-test.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/perf-test/SignInPage.perf-test.tsx b/tests/perf-test/SignInPage.perf-test.tsx index 94f535ef2afc..80964c3c49cd 100644 --- a/tests/perf-test/SignInPage.perf-test.tsx +++ b/tests/perf-test/SignInPage.perf-test.tsx @@ -29,10 +29,6 @@ jest.mock('../../src/libs/Navigation/Navigation', () => { } as typeof Navigation; }); -const HYBRID_APP_ROUTES = { - MONEY_REQUEST_CREATE: '/request/new/scan', -} as const; - const mockedNavigate = jest.fn(); jest.mock('@react-navigation/native', () => { const actualNav = jest.requireActual('@react-navigation/native'); From e9c7742aac218884caaf5e20a1035883b27fb562 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 30 Jan 2024 11:23:00 -0700 Subject: [PATCH 090/138] Add GPS coordinates to smartscanned images --- src/libs/actions/IOU.js | 5 ++++ .../step/IOURequestStepConfirmation.js | 24 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3d6664099866..3890d1d3262a 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1289,6 +1289,7 @@ function updateDistanceRequest(transactionID, transactionThreadReportID, transac * @param {Object} [policy] * @param {Object} [policyTags] * @param {Object} [policyCategories] + * @param {Object} [gpsPoints] */ function requestMoney( report, @@ -1309,6 +1310,7 @@ function requestMoney( policy = undefined, policyTags = undefined, policyCategories = undefined, + gpsPoints = undefined, ) { // If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); @@ -1360,6 +1362,9 @@ function requestMoney( taxCode, taxAmount, billable, + + // This needs to be a string of JSON because of limitations with the fetch() API and nested objects + gpsPoints: gpsPoints ? JSON.stringify(gpsPoints) : undefined, }, onyxData, ); diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 6028a735d132..154ad0198a08 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -18,6 +18,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import compose from '@libs/compose'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import getCurrentPosition from '@libs/getCurrentPosition'; import * as IOUUtils from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -160,7 +161,7 @@ function IOURequestStepConfirmation({ * @param {File} [receiptObj] */ const requestMoney = useCallback( - (selectedParticipants, trimmedComment, receiptObj) => { + (selectedParticipants, trimmedComment, receiptObj, gpsPoints) => { IOU.requestMoney( report, transaction.amount, @@ -180,6 +181,7 @@ function IOURequestStepConfirmation({ policy, policyTags, policyCategories, + gpsPoints, ); }, [report, transaction, transactionTaxCode, transactionTaxAmount, currentUserPersonalDetails.login, currentUserPersonalDetails.accountID, policy, policyTags, policyCategories], @@ -265,7 +267,25 @@ function IOURequestStepConfirmation({ } if (receiptFile) { - requestMoney(selectedParticipants, trimmedComment, receiptFile); + getCurrentPosition( + (successData) => { + requestMoney(selectedParticipants, trimmedComment, receiptFile, { + lat: successData.coords.latitude, + long: successData.coords.longitude, + }); + }, + () => { + // When there is an error, the money can still be requested, it just won't include the GPS coordinates + requestMoney(selectedParticipants, trimmedComment, receiptFile); + }, + { + // It's OK to get a cached location that is up to an hour old because the only accuracy needed is the country the user is in + maximumAge: 1000 * 60 * 60, + + // 15 seconds, don't way too long because the server can always fall back to using the IP address + timeout: 15000, + }, + ); return; } From 141cf89428a21ff85e7ee643d017afa3d831e1b9 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 30 Jan 2024 14:56:09 -0700 Subject: [PATCH 091/138] Add error logging --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 154ad0198a08..edd788f51e90 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -20,6 +20,7 @@ import compose from '@libs/compose'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import getCurrentPosition from '@libs/getCurrentPosition'; import * as IOUUtils from '@libs/IOUUtils'; +import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -274,7 +275,8 @@ function IOURequestStepConfirmation({ long: successData.coords.longitude, }); }, - () => { + (errorData) => { + Log.info('[IOURequestStepConfirmation] getCurrentPosition failed', false, errorData); // When there is an error, the money can still be requested, it just won't include the GPS coordinates requestMoney(selectedParticipants, trimmedComment, receiptFile); }, From bb2886307eb4f2276df271b246a1fabd52bcd04a Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 31 Jan 2024 16:38:02 +0700 Subject: [PATCH 092/138] fix: 34961 --- .../SelectionList/RadioListItem.tsx | 31 ++++---------- src/components/SelectionList/UserListItem.tsx | 31 ++++---------- .../TextWithTooltip/index.native.tsx | 18 ++++++++ src/components/TextWithTooltip/index.tsx | 41 +++++++++++++++++++ src/components/TextWithTooltip/types.ts | 9 ++++ 5 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 src/components/TextWithTooltip/index.native.tsx create mode 100644 src/components/TextWithTooltip/index.tsx create mode 100644 src/components/TextWithTooltip/types.ts diff --git a/src/components/SelectionList/RadioListItem.tsx b/src/components/SelectionList/RadioListItem.tsx index 769eaa80df4b..ca0ae859c3ad 100644 --- a/src/components/SelectionList/RadioListItem.tsx +++ b/src/components/SelectionList/RadioListItem.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import Text from '@components/Text'; -import Tooltip from '@components/Tooltip'; +import TextWithTooltip from '@components/TextWithTooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import type {RadioListItemProps} from './types'; @@ -10,30 +9,18 @@ function RadioListItem({item, showTooltip, textStyles, alternateTextStyles}: Rad return ( - - - {item.text} - - + textStyles={textStyles} + /> {!!item.alternateText && ( - - - {item.alternateText} - - + textStyles={alternateTextStyles} + /> )} ); diff --git a/src/components/SelectionList/UserListItem.tsx b/src/components/SelectionList/UserListItem.tsx index 3c973ad0bbea..11ef03bec33d 100644 --- a/src/components/SelectionList/UserListItem.tsx +++ b/src/components/SelectionList/UserListItem.tsx @@ -1,8 +1,7 @@ import React from 'react'; import {View} from 'react-native'; import SubscriptAvatar from '@components/SubscriptAvatar'; -import Text from '@components/Text'; -import Tooltip from '@components/Tooltip'; +import TextWithTooltip from '@components/TextWithTooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import type {UserListItemProps} from './types'; @@ -18,29 +17,17 @@ function UserListItem({item, textStyles, alternateTextStyles, showTooltip, style /> )} - - - {item.text} - - + textStyles={[textStyles, style]} + /> {!!item.alternateText && ( - - - {item.alternateText} - - + textStyles={[alternateTextStyles, style]} + /> )} {!!item.rightElement && item.rightElement} diff --git a/src/components/TextWithTooltip/index.native.tsx b/src/components/TextWithTooltip/index.native.tsx new file mode 100644 index 000000000000..f8013ae00e4c --- /dev/null +++ b/src/components/TextWithTooltip/index.native.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import Text from '@components/Text'; +import type TextWithTooltipProps from './types'; + +function TextWithTooltip({text, textStyles}: TextWithTooltipProps) { + return ( + + {text} + + ); +} + +TextWithTooltip.displayName = 'TextWithTooltip'; + +export default TextWithTooltip; diff --git a/src/components/TextWithTooltip/index.tsx b/src/components/TextWithTooltip/index.tsx new file mode 100644 index 000000000000..fd202db8de64 --- /dev/null +++ b/src/components/TextWithTooltip/index.tsx @@ -0,0 +1,41 @@ +import React, {useState} from 'react'; +import Text from '@components/Text'; +import Tooltip from '@components/Tooltip'; +import type TextWithTooltipProps from './types'; + +type LayoutChangeEvent = { + target: HTMLElement; +}; + +function TextWithTooltip({text, shouldShowTooltip, textStyles}: TextWithTooltipProps) { + const [showTooltip, setShowTooltip] = useState(false); + + return ( + + { + const target = (e.nativeEvent as unknown as LayoutChangeEvent).target; + if (!shouldShowTooltip) { + return; + } + if (target.scrollWidth > target.offsetWidth) { + setShowTooltip(true); + return; + } + setShowTooltip(false); + }} + > + {text} + + + ); +} + +TextWithTooltip.displayName = 'TextWithTooltip'; + +export default TextWithTooltip; diff --git a/src/components/TextWithTooltip/types.ts b/src/components/TextWithTooltip/types.ts new file mode 100644 index 000000000000..80517b0b2acf --- /dev/null +++ b/src/components/TextWithTooltip/types.ts @@ -0,0 +1,9 @@ +import type {StyleProp, TextStyle} from 'react-native'; + +type TextWithTooltipProps = { + text: string; + shouldShowTooltip: boolean; + textStyles?: StyleProp; +}; + +export default TextWithTooltipProps; From 7e6042dbc70a468a9fdf19bd467500f5a40bdb13 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 31 Jan 2024 12:37:01 +0100 Subject: [PATCH 093/138] rename const money_report --- src/CONST.ts | 2 +- src/styles/utils/index.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 86be7997b25c..0bb24c68928e 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -147,7 +147,7 @@ const CONST = { CONTAINER_MINHEIGHT: 500, VIEW_HEIGHT: 275, }, - MONEY_REPORT: { + MONEY_OR_TASK_REPORT: { SMALL_SCREEN: { IMAGE_HEIGHT: 300, CONTAINER_MINHEIGHT: 280, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index a0f8f52927b9..79e3809108b4 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -699,8 +699,8 @@ function getHorizontalStackedOverlayAvatarStyle(oneAvatarSize: AvatarSize, oneAv /** * Gets the correct size for the empty state background image based on screen dimensions */ -function getReportWelcomeBackgroundImageStyle(isSmallScreenWidth: boolean, isMoneyReport = false): ImageStyle { - const emptyStateBackground = isMoneyReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_REPORT : CONST.EMPTY_STATE_BACKGROUND; +function getReportWelcomeBackgroundImageStyle(isSmallScreenWidth: boolean, isMoneyOrTaskReport = false): ImageStyle { + const emptyStateBackground = isMoneyOrTaskReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_OR_TASK_REPORT : CONST.EMPTY_STATE_BACKGROUND; if (isSmallScreenWidth) { return { @@ -720,8 +720,8 @@ function getReportWelcomeBackgroundImageStyle(isSmallScreenWidth: boolean, isMon /** * Gets the correct top margin size for the chat welcome message based on screen dimensions */ -function getReportWelcomeTopMarginStyle(isSmallScreenWidth: boolean, isMoneyReport = false): ViewStyle { - const emptyStateBackground = isMoneyReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_REPORT : CONST.EMPTY_STATE_BACKGROUND; +function getReportWelcomeTopMarginStyle(isSmallScreenWidth: boolean, isMoneyOrTaskReport = false): ViewStyle { + const emptyStateBackground = isMoneyOrTaskReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_OR_TASK_REPORT : CONST.EMPTY_STATE_BACKGROUND; if (isSmallScreenWidth) { return { marginTop: emptyStateBackground.SMALL_SCREEN.VIEW_HEIGHT, @@ -754,8 +754,8 @@ function getLineHeightStyle(lineHeight: number): TextStyle { /** * Gets the correct size for the empty state container based on screen dimensions */ -function getReportWelcomeContainerStyle(isSmallScreenWidth: boolean, isMoneyReport = false): ViewStyle { - const emptyStateBackground = isMoneyReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_REPORT : CONST.EMPTY_STATE_BACKGROUND; +function getReportWelcomeContainerStyle(isSmallScreenWidth: boolean, isMoneyOrTaskReport = false): ViewStyle { + const emptyStateBackground = isMoneyOrTaskReport ? CONST.EMPTY_STATE_BACKGROUND.MONEY_OR_TASK_REPORT : CONST.EMPTY_STATE_BACKGROUND; if (isSmallScreenWidth) { return { minHeight: emptyStateBackground.SMALL_SCREEN.CONTAINER_MINHEIGHT, From 000d9ab4fb06d169dc7af4f362d7af58d1840218 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 31 Jan 2024 18:25:07 +0100 Subject: [PATCH 094/138] Update types --- src/components/KYCWall/BaseKYCWall.tsx | 10 ++++++---- src/components/KYCWall/types.ts | 14 ++++++-------- src/components/ReportActionItem/ReportPreview.tsx | 3 +-- src/components/SettlementButton.tsx | 15 ++++++--------- src/libs/actions/PaymentMethods.ts | 4 ++-- src/types/onyx/OriginalMessage.ts | 2 +- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 89cceadc0fb0..ab2d217deb0e 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -17,7 +17,9 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {BankAccountList, FundList, ReimbursementAccount, UserWallet, WalletTerms} from '@src/types/onyx'; -import type {AnchorPosition, DomRect, KYCWallProps, PaymentMethod, TransferMethod} from './types'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; +import viewRef from '@src/types/utils/viewRef'; +import type {AnchorPosition, DomRect, KYCWallProps, PaymentMethod} from './types'; // This sets the Horizontal anchor position offset for POPOVER MENU. const POPOVER_MENU_ANCHOR_POSITION_HORIZONTAL_OFFSET = 20; @@ -67,7 +69,7 @@ function KYCWall({ walletTerms, shouldShowPersonalBankAccountOption = false, }: BaseKYCWallProps) { - const anchorRef = useRef(null); + const anchorRef = useRef(null); const transferBalanceButtonRef = useRef(null); const [shouldShowAddPaymentMenu, setShouldShowAddPaymentMenu] = useState(false); @@ -145,7 +147,7 @@ function KYCWall({ * */ const continueAction = useCallback( - (event?: GestureResponderEvent | KeyboardEvent, iouPaymentType?: TransferMethod) => { + (event?: GestureResponderEvent | KeyboardEvent, iouPaymentType?: PaymentMethodType) => { const currentSource = walletTerms?.source ?? source; /** @@ -259,7 +261,7 @@ function KYCWall({ }} shouldShowPersonalBankAccountOption={shouldShowPersonalBankAccountOption} /> - {children(continueAction, anchorRef)} + {children(continueAction, viewRef(anchorRef))} ); } diff --git a/src/components/KYCWall/types.ts b/src/components/KYCWall/types.ts index 1e6aae3299b1..1ee8010574c3 100644 --- a/src/components/KYCWall/types.ts +++ b/src/components/KYCWall/types.ts @@ -1,18 +1,16 @@ -import type {ForwardedRef} from 'react'; -import type {GestureResponderEvent} from 'react-native'; +import type {RefObject} from 'react'; +import type {GestureResponderEvent, View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type {Route} from '@src/ROUTES'; import type {Report} from '@src/types/onyx'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; type Source = ValueOf; -type TransferMethod = DeepValueOf; - type DOMRectProperties = 'top' | 'bottom' | 'left' | 'right' | 'height' | 'x' | 'y'; type DomRect = Pick; @@ -62,10 +60,10 @@ type KYCWallProps = { shouldShowPersonalBankAccountOption?: boolean; /** Callback for the end of the onContinue trigger on option selection */ - onSuccessfulKYC: (iouPaymentType?: TransferMethod, currentSource?: Source) => void; + onSuccessfulKYC: (iouPaymentType?: PaymentMethodType, currentSource?: Source) => void; /** Children to build the KYC */ - children: (continueAction: (event: GestureResponderEvent | KeyboardEvent | undefined, method: TransferMethod) => void, anchorRef: ForwardedRef) => void; + children: (continueAction: (event: GestureResponderEvent | KeyboardEvent | undefined, method: PaymentMethodType) => void, anchorRef: RefObject) => void; }; -export type {AnchorPosition, KYCWallProps, PaymentMethod, TransferMethod, DomRect}; +export type {AnchorPosition, KYCWallProps, PaymentMethod, DomRect}; diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index b2fece085f57..46dbd87e55f1 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -285,12 +285,11 @@ function ReportPreview({ )} {shouldShowSettlementButton && ( chatReport && iouReport && IOU.payMoneyRequest(paymentType, chatReport, iouReport)} + onPress={(paymentType?: PaymentMethodType) => chatReport && iouReport && paymentType && IOU.payMoneyRequest(paymentType, chatReport, iouReport)} enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} addBankAccountRoute={bankAccountRoute} shouldHidePaymentOptions={!shouldShowPayButton} diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 7a2a94aff301..02f51c67c64d 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -1,6 +1,5 @@ -import type {RefObject} from 'react'; import React, {useEffect, useMemo} from 'react'; -import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; +import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; @@ -15,8 +14,8 @@ import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; import type {ButtonSizeValue} from '@src/styles/utils/types'; import type {LastPaymentMethod, Report} from '@src/types/onyx'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import * as Expensicons from './Icon/Expensicons'; @@ -24,9 +23,7 @@ import KYCWall from './KYCWall'; type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined; -type PaymentType = DeepValueOf; - -type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: PaymentType) => void; +type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: PaymentMethodType) => void; type EnablePaymentsRoute = typeof ROUTES.ENABLE_PAYMENTS | typeof ROUTES.IOU_SEND_ENABLE_PAYMENTS | typeof ROUTES.SETTINGS_ENABLE_PAYMENTS; @@ -37,7 +34,7 @@ type SettlementButtonOnyxProps = { type SettlementButtonProps = SettlementButtonOnyxProps & { /** Callback to execute when this button is pressed. Receives a single payment type argument. */ - onPress: (paymentType?: PaymentType) => void; + onPress: (paymentType?: PaymentMethodType) => void; /** The route to redirect if user does not have a payment method setup */ enablePaymentsRoute: EnablePaymentsRoute; @@ -185,7 +182,7 @@ function SettlementButton({ return buttonOptions; }, [currency, formattedAmount, iouReport, nvpLastPaymentMethod, policyID, translate, shouldHidePaymentOptions, shouldShowApproveButton]); - const selectPaymentType = (event: KYCFlowEvent, iouPaymentType: PaymentType, triggerKYCFlow: TriggerKYCFlow) => { + const selectPaymentType = (event: KYCFlowEvent, iouPaymentType: PaymentMethodType, triggerKYCFlow: TriggerKYCFlow) => { if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { triggerKYCFlow(event, iouPaymentType); BankAccounts.setPersonalBankAccountContinueKYCOnSuccess(ROUTES.ENABLE_PAYMENTS); @@ -215,7 +212,7 @@ function SettlementButton({ > {(triggerKYCFlow, buttonRef) => ( } + buttonRef={buttonRef} isDisabled={isDisabled} isLoading={isLoading} onPress={(event, iouPaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)} diff --git a/src/libs/actions/PaymentMethods.ts b/src/libs/actions/PaymentMethods.ts index cbc5778187a1..2199c5768612 100644 --- a/src/libs/actions/PaymentMethods.ts +++ b/src/libs/actions/PaymentMethods.ts @@ -3,7 +3,6 @@ import type {MutableRefObject} from 'react'; import type {GestureResponderEvent} from 'react-native'; import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; -import type {TransferMethod} from '@components/KYCWall/types'; import * as API from '@libs/API'; import type {AddPaymentCardParams, DeletePaymentCardParams, MakeDefaultPaymentMethodParams, PaymentCardParams, TransferWalletBalanceParams} from '@libs/API/parameters'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; @@ -14,11 +13,12 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; import type {BankAccountList, FundList} from '@src/types/onyx'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type PaymentMethod from '@src/types/onyx/PaymentMethod'; import type {FilterMethodPaymentType} from '@src/types/onyx/WalletTransfer'; type KYCWallRef = { - continueAction?: (event?: GestureResponderEvent | KeyboardEvent, iouPaymentType?: TransferMethod) => void; + continueAction?: (event?: GestureResponderEvent | KeyboardEvent, iouPaymentType?: PaymentMethodType) => void; }; /** diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 070b91e2d920..baa5c8d6c904 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -2,7 +2,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -type PaymentMethodType = DeepValueOf; +type PaymentMethodType = DeepValueOf; type ActionName = DeepValueOf; type OriginalMessageActionName = From e82fb3fcc1f6384474e146aa7a31ae92ea61b404 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 31 Jan 2024 18:57:28 +0100 Subject: [PATCH 095/138] test --- tests/perf-test/SignInPage.perf-test.tsx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/perf-test/SignInPage.perf-test.tsx b/tests/perf-test/SignInPage.perf-test.tsx index 80964c3c49cd..dde8596fb2ae 100644 --- a/tests/perf-test/SignInPage.perf-test.tsx +++ b/tests/perf-test/SignInPage.perf-test.tsx @@ -18,17 +18,6 @@ import * as TestHelper from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; -jest.mock('../../src/libs/Navigation/Navigation', () => { - const actualNav = jest.requireActual('../../src/libs/Navigation/Navigation'); - return { - ...actualNav, - navigationRef: { - addListener: () => jest.fn(), - removeListener: () => jest.fn(), - }, - } as typeof Navigation; -}); - const mockedNavigate = jest.fn(); jest.mock('@react-navigation/native', () => { const actualNav = jest.requireActual('@react-navigation/native'); @@ -43,7 +32,10 @@ jest.mock('@react-navigation/native', () => { navigate: jest.fn(), addListener: () => jest.fn(), }), - createNavigationContainerRef: jest.fn(), + createNavigationContainerRef: () => ({ + addListener: () => jest.fn(), + removeListener: () => jest.fn(), + }), } as typeof NativeNavigation; }); From e645f46476a4c6e6a55a8d957fabf69597cd598e Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 1 Feb 2024 11:25:56 +0100 Subject: [PATCH 096/138] Fix lint issue --- src/components/SettlementButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 95218e0783a6..c2a22fa04bfe 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -163,7 +163,7 @@ function SettlementButton({ // To achieve the one tap pay experience we need to choose the correct payment type as default. // If the user has previously chosen a specific payment option or paid for some request or expense, // let's use the last payment method or use default. - const paymentMethod = nvpLastPaymentMethod?.[policyID] || ''; + const paymentMethod = nvpLastPaymentMethod?.[policyID] ?? ''; if (canUseWallet) { buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]); } From 279cf987bf314e41289ebbfa9374471ce9b2cfce Mon Sep 17 00:00:00 2001 From: staszekscp Date: Thu, 1 Feb 2024 12:22:23 +0100 Subject: [PATCH 097/138] update patch --- ... => expo-modules-autolinking+1.10.2.patch} | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) rename patches/{expo-modules-autolinking+1.9.0.patch => expo-modules-autolinking+1.10.2.patch} (66%) diff --git a/patches/expo-modules-autolinking+1.9.0.patch b/patches/expo-modules-autolinking+1.10.2.patch similarity index 66% rename from patches/expo-modules-autolinking+1.9.0.patch rename to patches/expo-modules-autolinking+1.10.2.patch index 7b171339efc5..4b68007ba125 100644 --- a/patches/expo-modules-autolinking+1.9.0.patch +++ b/patches/expo-modules-autolinking+1.10.2.patch @@ -18,23 +18,23 @@ index 92f1fd6..ada01ad 100644 command, '--platform', diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb -index c3047a8..6eff107 100644 +index 5d46f1e..3db7b89 100644 --- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb +++ b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb -@@ -212,6 +212,7 @@ module Expo - - # Generates the support script that is executed by the build script phase. - def self.generate_support_script(autolinking_manager, modules_provider_path) +@@ -215,6 +215,7 @@ module Expo + args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" } + platform = autolinking_manager.platform_name.downcase + package_names = autolinking_manager.packages_to_generate.map { |package| "\"#{package.name}\"" } + expo_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo" : "expo" - args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" }.join(' ') <<~SUPPORT_SCRIPT -@@ -258,7 +259,7 @@ module Expo - fi - } - -- with_node --no-warnings --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" -+ with_node --no-warnings --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'#{expo_path}/package.json\')] }))(process.argv.slice(1))" generate-package-list #{args} --target "#{modules_provider_path}" - SUPPORT_SCRIPT - end + #!/usr/bin/env bash +@@ -262,7 +263,7 @@ module Expo + with_node \\ + --no-warnings \\ +- --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))" \\ ++ --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'#{expo_path}/package.json\')] }))(process.argv.slice(1))" \\ + generate-modules-provider #{args.join(' ')} \\ + --target "#{modules_provider_path}" \\ + --platform "apple" \\ From 87efe2f161d7efbac3fec21050288025d3240a8c Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 1 Feb 2024 21:18:56 +0700 Subject: [PATCH 098/138] run prettier --- src/components/EmojiPicker/EmojiPickerMenu/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index d6a56d44c19f..cfce6b04f859 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -260,7 +260,8 @@ function EmojiPickerMenu({forwardedRef, onEmojiSelected, activeEmoji}) { const emojiCode = types && types[preferredSkinTone] ? types[preferredSkinTone] : code; const isEmojiFocused = index === focusedIndex && isUsingKeyboardMovement; - const shouldEmojiBeHighlighted = index === focusedIndex && highlightEmoji || (Boolean(activeEmoji) && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); + const shouldEmojiBeHighlighted = + (index === focusedIndex && highlightEmoji) || (Boolean(activeEmoji) && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji)); const shouldFirstEmojiBeHighlighted = index === 0 && highlightFirstEmoji; return ( From 53546d7fe370ccdb8eea240ca908d4d32f5abf6b Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Thu, 1 Feb 2024 23:21:58 +0100 Subject: [PATCH 099/138] Hide smartScan fields for Scan requests only --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 0f1c2b27ad2e..22ff297c11ba 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -372,7 +372,7 @@ function IOURequestStepConfirmation({ iouMerchant={transaction.merchant} iouCreated={transaction.created} isDistanceRequest={requestType === CONST.IOU.REQUEST_TYPE.DISTANCE} - shouldShowSmartScanFields={_.isEmpty(lodashGet(transaction, 'receipt.source', ''))} + shouldShowSmartScanFields={requestType !== CONST.IOU.REQUEST_TYPE.SCAN} /> )} From 1296790702833467b0fd7b5f016afb6ab160957b Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 2 Feb 2024 16:56:01 +0700 Subject: [PATCH 100/138] set default category for distance request only --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 029836d0c654..6c3d40dc33ad 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -121,7 +121,7 @@ function IOURequestStepConfirmation({ '', ); useEffect(() => { - if (!_.isEmpty(transaction.category)) { + if (requestType !== CONST.IOU.REQUEST_TYPE.DISTANCE || !_.isEmpty(transaction.category)) { return; } IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); From cbbc7a37cb7903fe7028ba170b86c06d4cdf736b Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 2 Feb 2024 17:01:13 +0700 Subject: [PATCH 101/138] fix lint --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index acd66fb1a3ed..560e87b6d802 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -125,7 +125,7 @@ function IOURequestStepConfirmation({ return; } IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory); - }, [transactionID, transaction.category, defaultCategory]); + }, [transactionID, transaction.category, requestType, defaultCategory]); const navigateBack = useCallback(() => { // If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken From 93964ab66b9ad9b5179e2314d5b33e7ed1f04c85 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 3 Feb 2024 00:04:41 +0800 Subject: [PATCH 102/138] disable keyboard --- src/components/MagicCodeInput.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/MagicCodeInput.tsx b/src/components/MagicCodeInput.tsx index 4a6d87b48e38..30bed888514f 100644 --- a/src/components/MagicCodeInput.tsx +++ b/src/components/MagicCodeInput.tsx @@ -366,6 +366,7 @@ function MagicCodeInput( collapsable={false} > { inputWidth.current = e.nativeEvent.layout.width; }} From ae1665dc6293066d4571e0dfb2b82a9e35777808 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 2 Feb 2024 09:39:09 -0700 Subject: [PATCH 103/138] Update src/pages/iou/request/step/IOURequestStepConfirmation.js Co-authored-by: Ionatan Wiznia --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index edd788f51e90..37186dc28931 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -284,7 +284,7 @@ function IOURequestStepConfirmation({ // It's OK to get a cached location that is up to an hour old because the only accuracy needed is the country the user is in maximumAge: 1000 * 60 * 60, - // 15 seconds, don't way too long because the server can always fall back to using the IP address + // 15 seconds, don't wait too long because the server can always fall back to using the IP address timeout: 15000, }, ); From 1bcc02ec155aac3f83fd157aa1ced07652f30270 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Sat, 3 Feb 2024 12:23:27 +0300 Subject: [PATCH 104/138] update to validate on non-native only --- src/pages/signin/LoginForm/BaseLoginForm.js | 26 +++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 1da92d447c5b..b126219e44db 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -28,6 +28,7 @@ import {parsePhoneNumber} from '@libs/PhoneNumber'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Visibility from '@libs/Visibility'; +import willBlurTextInputOnTapOutside from '@libs/willBlurTextInputOnTapOutside'; import * as CloseAccount from '@userActions/CloseAccount'; import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; import * as Session from '@userActions/Session'; @@ -277,16 +278,21 @@ function LoginForm(props) { id="username" name="username" testID="username" - onBlur={() => - // This delay is to avoid the validate being called before google iframe is rendered to - // avoid error message appearing after pressing google signin button. - setTimeout(() => { - if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { - return; - } - firstBlurred.current = true; - validate(login); - }, 500) + onBlur={ + // As we have only two signin buttons (Apple/Google) other than the text input, + // for natives onBlur is called only when the buttons are pressed and we don't need + // to validate in those case as the user has opted for other signin flow. + willBlurTextInputOnTapOutside() && + (() => + // This delay is to avoid the validate being called before google iframe is rendered to + // avoid error message appearing after pressing google signin button. + setTimeout(() => { + if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { + return; + } + firstBlurred.current = true; + validate(login); + }, 500)) } onChangeText={onTextInput} onSubmitEditing={validateAndSubmitForm} From b87603b72b65d6c34728c6cfae38fe30878f4c84 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 4 Feb 2024 22:57:22 +0700 Subject: [PATCH 105/138] Update src/libs/EmojiUtils.ts Co-authored-by: Getabalew Tesfaye <75031127+getusha@users.noreply.github.com> --- src/libs/EmojiUtils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index 68f0fee94b19..b87f7d0d695f 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -550,7 +550,6 @@ const getEmojiReactionDetails = (emojiName: string, reaction: ReportActionReacti /** * Get base emoji without skintone - * @param emoji emoji string * @returns emoji without skin tone */ const getRemovedSkinToneEmoji = (emoji: string) => emoji.replace(CONST.REGEX.EMOJI_SKIN_TONES, ''); From 61c39c57292a9639b37e8798fb770c53c16a02b2 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 5 Feb 2024 09:26:43 +0100 Subject: [PATCH 106/138] update patch name --- patches/{expo+50.0.0-preview.7.patch => expo+50.0.4.patch} | 0 ...o-modules-core+1.11.4.patch => expo-modules-core+1.11.8.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename patches/{expo+50.0.0-preview.7.patch => expo+50.0.4.patch} (100%) rename patches/{expo-modules-core+1.11.4.patch => expo-modules-core+1.11.8.patch} (100%) diff --git a/patches/expo+50.0.0-preview.7.patch b/patches/expo+50.0.4.patch similarity index 100% rename from patches/expo+50.0.0-preview.7.patch rename to patches/expo+50.0.4.patch diff --git a/patches/expo-modules-core+1.11.4.patch b/patches/expo-modules-core+1.11.8.patch similarity index 100% rename from patches/expo-modules-core+1.11.4.patch rename to patches/expo-modules-core+1.11.8.patch From 89c7dd6cfcd123f8cabdc41ac150a08856758d55 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Sun, 21 Jan 2024 18:27:00 +0100 Subject: [PATCH 107/138] Add testID to HeaderPageLayout.tsx and llustratedHeaderPageLayout.tsx and apply to all instances of IllustratedHeaderPageLayout.tsx --- src/components/HeaderPageLayout.tsx | 6 +++++- src/components/IllustratedHeaderPageLayout.tsx | 6 +++++- src/pages/TeachersUnite/SaveTheWorldPage.tsx | 1 + src/pages/settings/AboutPage/AboutPage.tsx | 1 + src/pages/settings/InitialSettingsPage.js | 1 + src/pages/settings/Preferences/PreferencesPage.js | 1 + src/pages/settings/Profile/LoungeAccessPage.js | 1 + src/pages/settings/Security/SecuritySettingsPage.tsx | 1 + src/pages/settings/Wallet/ActivatePhysicalCardPage.js | 1 + src/pages/settings/Wallet/WalletEmptyState.js | 1 + 10 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/HeaderPageLayout.tsx b/src/components/HeaderPageLayout.tsx index 47b52fa3fcb2..169bd462abea 100644 --- a/src/components/HeaderPageLayout.tsx +++ b/src/components/HeaderPageLayout.tsx @@ -19,6 +19,9 @@ type HeaderPageLayoutProps = ChildrenProps & /** The background color to apply in the upper half of the screen. */ backgroundColor?: string; + /** TestID to apply to the whole section container */ + testID?: string; + /** A fixed footer to display at the bottom of the page. */ footer?: ReactNode; @@ -50,6 +53,7 @@ function HeaderPageLayout({ style, headerContent, shouldShowOfflineIndicatorInWideScreen = false, + testID, ...rest }: HeaderPageLayoutProps) { const theme = useTheme(); @@ -72,7 +76,7 @@ function HeaderPageLayout({ shouldEnablePickerAvoiding={false} includeSafeAreaPaddingBottom={false} offlineIndicatorStyle={[appBGColor]} - testID={HeaderPageLayout.displayName} + testID={testID || HeaderPageLayout.displayName} shouldShowOfflineIndicatorInWideScreen={shouldShowOfflineIndicatorInWideScreen} > {({safeAreaPaddingBottomStyle}) => ( diff --git a/src/components/IllustratedHeaderPageLayout.tsx b/src/components/IllustratedHeaderPageLayout.tsx index c40a4e33e67a..1aecc8cc1b95 100644 --- a/src/components/IllustratedHeaderPageLayout.tsx +++ b/src/components/IllustratedHeaderPageLayout.tsx @@ -16,9 +16,12 @@ type IllustratedHeaderPageLayoutProps = HeaderPageLayoutProps & { /** Overlay content to display on top of animation */ overlayContent?: () => ReactNode; + + /** TestID to apply to the whole section container */ + testID?: string; }; -function IllustratedHeaderPageLayout({backgroundColor, children, illustration, overlayContent, ...rest}: IllustratedHeaderPageLayoutProps) { +function IllustratedHeaderPageLayout({backgroundColor, children, illustration, testID, overlayContent, ...rest}: IllustratedHeaderPageLayoutProps) { const theme = useTheme(); const styles = useThemeStyles(); const shouldLimitHeight = !rest.shouldShowBackButton; @@ -38,6 +41,7 @@ function IllustratedHeaderPageLayout({backgroundColor, children, illustration, o {overlayContent?.()} } + testID={testID} headerContainerStyles={[styles.justifyContentCenter, styles.w100, shouldLimitHeight && styles.centralPaneAnimation]} // eslint-disable-next-line react/jsx-props-no-spreading {...rest} diff --git a/src/pages/TeachersUnite/SaveTheWorldPage.tsx b/src/pages/TeachersUnite/SaveTheWorldPage.tsx index 03df52050ce5..5a6ce4e8f3e9 100644 --- a/src/pages/TeachersUnite/SaveTheWorldPage.tsx +++ b/src/pages/TeachersUnite/SaveTheWorldPage.tsx @@ -23,6 +23,7 @@ function SaveTheWorldPage() { backgroundColor={theme.PAGE_THEMES[SCREENS.SAVE_THE_WORLD.ROOT].backgroundColor} onBackButtonPress={Navigation.goBack} illustration={LottieAnimations.SaveTheWorld} + testID={SaveTheWorldPage.displayName} > {translate('teachersUnitePage.teachersUnite')} diff --git a/src/pages/settings/AboutPage/AboutPage.tsx b/src/pages/settings/AboutPage/AboutPage.tsx index f19c9eb2d534..713e9b8d6016 100644 --- a/src/pages/settings/AboutPage/AboutPage.tsx +++ b/src/pages/settings/AboutPage/AboutPage.tsx @@ -132,6 +132,7 @@ function AboutPage() { backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.ABOUT].backgroundColor} overlayContent={overlayContent} shouldShowOfflineIndicatorInWideScreen + testID= {AboutPage.displayName} > {translate('footer.aboutExpensify')} diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index dfa4262549fc..59e390105f2c 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -347,6 +347,7 @@ function InitialSettingsPage(props) { onBackButtonPress={() => Navigation.closeFullScreen()} backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.ROOT].backgroundColor} childrenContainerStyles={[styles.m0, styles.p0]} + testID={InitialSettingsPage.displayName} > {accountMenuItems} diff --git a/src/pages/settings/Preferences/PreferencesPage.js b/src/pages/settings/Preferences/PreferencesPage.js index da0d87afe932..f95daf8ad7d2 100755 --- a/src/pages/settings/Preferences/PreferencesPage.js +++ b/src/pages/settings/Preferences/PreferencesPage.js @@ -55,6 +55,7 @@ function PreferencesPage(props) { illustration={LottieAnimations.PreferencesDJ} shouldShowBackButton={isSmallScreenWidth} shouldShowOfflineIndicatorInWideScreen + testID={PreferencesPage.displayName} > Navigation.goBack(ROUTES)} illustration={LottieAnimations.ExpensifyLounge} + testID={LoungeAccessPage.displayName} > diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPage.js b/src/pages/settings/Wallet/ActivatePhysicalCardPage.js index bfc8583998b6..947252649cc4 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPage.js +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPage.js @@ -138,6 +138,7 @@ function ActivatePhysicalCardPage({ illustration={LottieAnimations.Magician} scrollViewContainerStyles={[styles.mnh100]} childrenContainerStyles={[styles.flex1]} + testID={ActivatePhysicalCardPage.displayName} > {translate('activateCardPage.pleaseEnterLastFour')} diff --git a/src/pages/settings/Wallet/WalletEmptyState.js b/src/pages/settings/Wallet/WalletEmptyState.js index c26e2947c0ef..c76d8a7e21fd 100644 --- a/src/pages/settings/Wallet/WalletEmptyState.js +++ b/src/pages/settings/Wallet/WalletEmptyState.js @@ -46,6 +46,7 @@ function WalletEmptyState({onAddPaymentMethod}) { shouldShowBackButton={isSmallScreenWidth} shouldShowOfflineIndicatorInWideScreen style={isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection} + testID={WalletEmptyState.displayName} > Date: Mon, 22 Jan 2024 23:32:25 +0100 Subject: [PATCH 108/138] prettier the code --- src/pages/settings/AboutPage/AboutPage.tsx | 2 +- src/pages/settings/Security/SecuritySettingsPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/AboutPage/AboutPage.tsx b/src/pages/settings/AboutPage/AboutPage.tsx index 713e9b8d6016..93948cf0565e 100644 --- a/src/pages/settings/AboutPage/AboutPage.tsx +++ b/src/pages/settings/AboutPage/AboutPage.tsx @@ -132,7 +132,7 @@ function AboutPage() { backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.ABOUT].backgroundColor} overlayContent={overlayContent} shouldShowOfflineIndicatorInWideScreen - testID= {AboutPage.displayName} + testID={AboutPage.displayName} > {translate('footer.aboutExpensify')} diff --git a/src/pages/settings/Security/SecuritySettingsPage.tsx b/src/pages/settings/Security/SecuritySettingsPage.tsx index da42ff4e620f..05c879669e78 100644 --- a/src/pages/settings/Security/SecuritySettingsPage.tsx +++ b/src/pages/settings/Security/SecuritySettingsPage.tsx @@ -53,7 +53,7 @@ function SecuritySettingsPage() { illustration={LottieAnimations.Safe} backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.SECURITY].backgroundColor} shouldShowOfflineIndicatorInWideScreen - testID= {SecuritySettingsPage.displayName} + testID={SecuritySettingsPage.displayName} > From 1a5f5aa1365c76dfdad479d6ab4e078d2acf6895 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Tue, 30 Jan 2024 08:08:25 +0100 Subject: [PATCH 109/138] CR suggestions --- src/components/HeaderPageLayout.tsx | 4 ++-- src/components/IllustratedHeaderPageLayout.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/HeaderPageLayout.tsx b/src/components/HeaderPageLayout.tsx index 169bd462abea..4a857d940a55 100644 --- a/src/components/HeaderPageLayout.tsx +++ b/src/components/HeaderPageLayout.tsx @@ -20,7 +20,7 @@ type HeaderPageLayoutProps = ChildrenProps & backgroundColor?: string; /** TestID to apply to the whole section container */ - testID?: string; + testID: string; /** A fixed footer to display at the bottom of the page. */ footer?: ReactNode; @@ -76,7 +76,7 @@ function HeaderPageLayout({ shouldEnablePickerAvoiding={false} includeSafeAreaPaddingBottom={false} offlineIndicatorStyle={[appBGColor]} - testID={testID || HeaderPageLayout.displayName} + testID={testID} shouldShowOfflineIndicatorInWideScreen={shouldShowOfflineIndicatorInWideScreen} > {({safeAreaPaddingBottomStyle}) => ( diff --git a/src/components/IllustratedHeaderPageLayout.tsx b/src/components/IllustratedHeaderPageLayout.tsx index 1aecc8cc1b95..4a64aa40484f 100644 --- a/src/components/IllustratedHeaderPageLayout.tsx +++ b/src/components/IllustratedHeaderPageLayout.tsx @@ -18,7 +18,7 @@ type IllustratedHeaderPageLayoutProps = HeaderPageLayoutProps & { overlayContent?: () => ReactNode; /** TestID to apply to the whole section container */ - testID?: string; + testID: string; }; function IllustratedHeaderPageLayout({backgroundColor, children, illustration, testID, overlayContent, ...rest}: IllustratedHeaderPageLayoutProps) { From 01fddf9e2c6bda7cbc012e843758c3b95e22d475 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Tue, 30 Jan 2024 08:18:25 +0100 Subject: [PATCH 110/138] fix typecheck errors --- src/pages/ReferralDetailsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/ReferralDetailsPage.tsx b/src/pages/ReferralDetailsPage.tsx index aff6ffd0ab9f..f5a5aef14373 100644 --- a/src/pages/ReferralDetailsPage.tsx +++ b/src/pages/ReferralDetailsPage.tsx @@ -59,6 +59,7 @@ function ReferralDetailsPage({route, account}: ReferralDetailsPageProps) { } headerContainerStyles={[styles.staticHeaderImage, styles.justifyContentEnd]} backgroundColor={theme.PAGE_THEMES[SCREENS.REFERRAL_DETAILS].backgroundColor} + testID={ReferralDetailsPage.displayName} > {contentHeader} {contentBody} From 71d628f2ec311f088a4513ab2b4e0d9db16e9061 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 5 Feb 2024 11:45:28 +0100 Subject: [PATCH 111/138] fix --- src/pages/settings/InitialSettingsPage.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index 65da42fcf907..750e67e54565 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -131,7 +131,7 @@ function InitialSettingsPage(props) { const profileBrickRoadIndicator = UserUtils.getLoginListBrickRoadIndicator(props.loginList); const paymentCardList = props.fundList || {}; - const defaultMenuItems = { + const defaultMenu = { sectionStyle: styles.accountSettingsSectionContainer, sectionTranslationKey: 'initialSettingsPage.account', items: [ @@ -183,7 +183,7 @@ function InitialSettingsPage(props) { ], }; - if (NativeModules.HybridAppModule) { + if (!NativeModules.HybridAppModule) { const hybridAppMenuItems = _.filter( [ { @@ -193,15 +193,15 @@ function InitialSettingsPage(props) { iconRight: Expensicons.NewWindow, action: () => NativeModules.HybridAppModule.closeReactNativeApp(), }, - ...defaultMenuItems, + ...defaultMenu.items, ], (item) => item.translationKey !== 'initialSettingsPage.signOut' && item.translationKey !== 'initialSettingsPage.goToExpensifyClassic', ); - return hybridAppMenuItems; + return {sectionStyle: styles.accountSettingsSectionContainer, sectionTranslationKey: 'initialSettingsPage.account', items: hybridAppMenuItems}; } - return defaultMenuItems; + return defaultMenu; }, [props.bankAccountList, props.fundList, props.loginList, props.userWallet.errors, props.walletTerms.errors, signOut, styles.accountSettingsSectionContainer]); /** From ae20949b622c655f5606648a93bd35b6555788d9 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 5 Feb 2024 11:51:08 +0100 Subject: [PATCH 112/138] fix git statement --- src/pages/settings/InitialSettingsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index 750e67e54565..a8ac8d8aad47 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -183,7 +183,7 @@ function InitialSettingsPage(props) { ], }; - if (!NativeModules.HybridAppModule) { + if (NativeModules.HybridAppModule) { const hybridAppMenuItems = _.filter( [ { From 944a29b6bb9d451a7c01f42bdcdb70af68c9f357 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Mon, 5 Feb 2024 14:52:51 +0300 Subject: [PATCH 113/138] updated based on comments --- src/pages/signin/LoginForm/BaseLoginForm.js | 27 ++++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index b126219e44db..6cbef7da7f3f 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -28,7 +28,7 @@ import {parsePhoneNumber} from '@libs/PhoneNumber'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Visibility from '@libs/Visibility'; -import willBlurTextInputOnTapOutside from '@libs/willBlurTextInputOnTapOutside'; +import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside'; import * as CloseAccount from '@userActions/CloseAccount'; import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; import * as Session from '@userActions/Session'; @@ -92,6 +92,8 @@ const defaultProps = { isInModal: false, }; +const willBlurTextInputOnTapOutside = willBlurTextInputOnTapOutsideFunc(); + function LoginForm(props) { const styles = useThemeStyles(); const input = useRef(); @@ -282,17 +284,18 @@ function LoginForm(props) { // As we have only two signin buttons (Apple/Google) other than the text input, // for natives onBlur is called only when the buttons are pressed and we don't need // to validate in those case as the user has opted for other signin flow. - willBlurTextInputOnTapOutside() && - (() => - // This delay is to avoid the validate being called before google iframe is rendered to - // avoid error message appearing after pressing google signin button. - setTimeout(() => { - if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { - return; - } - firstBlurred.current = true; - validate(login); - }, 500)) + willBlurTextInputOnTapOutside + ? () => + // This delay is to avoid the validate being called before google iframe is rendered to + // avoid error message appearing after pressing google signin button. + setTimeout(() => { + if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) { + return; + } + firstBlurred.current = true; + validate(login); + }, 500) + : undefined } onChangeText={onTextInput} onSubmitEditing={validateAndSubmitForm} From b94b7d9ded24bbcae8cdf5d8575ce75b612f759f Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 5 Feb 2024 15:02:56 +0100 Subject: [PATCH 114/138] ref: move react-navigation mock to TS --- __mocks__/@react-navigation/native/{index.js => index.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename __mocks__/@react-navigation/native/{index.js => index.ts} (69%) diff --git a/__mocks__/@react-navigation/native/index.js b/__mocks__/@react-navigation/native/index.ts similarity index 69% rename from __mocks__/@react-navigation/native/index.js rename to __mocks__/@react-navigation/native/index.ts index 09abd0d02bf9..4d0c63d28fce 100644 --- a/__mocks__/@react-navigation/native/index.js +++ b/__mocks__/@react-navigation/native/index.ts @@ -1,7 +1,7 @@ import {useIsFocused as realUseIsFocused} from '@react-navigation/native'; // We only want this mocked for storybook, not jest -const useIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; +const useIsFocused: () => boolean = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; export * from '@react-navigation/core'; export * from '@react-navigation/native'; From 17b08301631205b41d9fe0f0236b5be29b8dc2fe Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 5 Feb 2024 15:25:28 +0100 Subject: [PATCH 115/138] fix: used better type --- __mocks__/@react-navigation/native/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__mocks__/@react-navigation/native/index.ts b/__mocks__/@react-navigation/native/index.ts index 4d0c63d28fce..aa8067a1c862 100644 --- a/__mocks__/@react-navigation/native/index.ts +++ b/__mocks__/@react-navigation/native/index.ts @@ -1,7 +1,7 @@ import {useIsFocused as realUseIsFocused} from '@react-navigation/native'; // We only want this mocked for storybook, not jest -const useIsFocused: () => boolean = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; +const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; export * from '@react-navigation/core'; export * from '@react-navigation/native'; From 935685cba822fcb48f32f1208c0f05821a74ed85 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Mon, 5 Feb 2024 14:30:53 +0000 Subject: [PATCH 116/138] fix: display iou amount and currency from the last transaction --- src/libs/ReportUtils.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 568ce49ff961..467cedddbb93 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2269,13 +2269,15 @@ function getReportPreviewMessage( }); } + let linkedTransaction; if (!isEmptyObject(reportAction) && shouldConsiderReceiptBeingScanned && reportAction && ReportActionsUtils.isMoneyRequestAction(reportAction)) { - const linkedTransaction = TransactionUtils.getLinkedTransaction(reportAction); + linkedTransaction = TransactionUtils.getLinkedTransaction(reportAction); + } - if (!isEmptyObject(linkedTransaction) && TransactionUtils.hasReceipt(linkedTransaction) && TransactionUtils.isReceiptBeingScanned(linkedTransaction)) { - return Localize.translateLocal('iou.receiptScanning'); - } + if (!isEmptyObject(linkedTransaction) && TransactionUtils.hasReceipt(linkedTransaction) && TransactionUtils.isReceiptBeingScanned(linkedTransaction)) { + return Localize.translateLocal('iou.receiptScanning'); } + const originalMessage = reportAction?.originalMessage as IOUMessage | undefined; // Show Paid preview message if it's settled or if the amount is paid & stuck at receivers end for only chat reports. @@ -2302,14 +2304,17 @@ function getReportPreviewMessage( return Localize.translateLocal('iou.waitingOnBankAccount', {submitterDisplayName}); } - const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID); - const lastActorID = reportAction?.actorAccountID; + let amount = originalMessage?.amount; + let currency = originalMessage?.currency ? originalMessage?.currency : report.currency; + + if (!isEmptyObject(linkedTransaction)) { + amount = TransactionUtils.getAmount(linkedTransaction, isExpenseReport(report)); + currency = TransactionUtils.getCurrency(linkedTransaction); + } // if we have the amount in the originalMessage and lastActorID, we can use that to display the preview message for the latest request - if (originalMessage?.amount !== undefined && lastActorID && !isPreviewMessageForParentChatReport) { - const amount = originalMessage?.amount; - const currency = originalMessage?.currency ?? report.currency ?? ''; + if (amount !== undefined && lastActorID && !isPreviewMessageForParentChatReport) { const amountToDisplay = CurrencyUtils.convertToDisplayString(Math.abs(amount), currency); // We only want to show the actor name in the preview if it's not the current user who took the action @@ -2317,6 +2322,8 @@ function getReportPreviewMessage( return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`; } + const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID); + return Localize.translateLocal(containsNonReimbursable ? 'iou.payerSpentAmount' : 'iou.payerOwesAmount', {payer: payerName ?? '', amount: formattedAmount}); } @@ -4590,6 +4597,7 @@ function getRoom(type: ValueOf, policyID: string) function shouldDisableWelcomeMessage(report: OnyxEntry, policy: OnyxEntry): boolean { return isMoneyRequestReport(report) || isArchivedRoom(report) || !isChatRoom(report) || isChatThread(report) || !PolicyUtils.isPolicyAdmin(policy); } + /** * Checks if report action has error when smart scanning */ From 99d775960d946ad17c9ef95354adebda3663f70c Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Mon, 5 Feb 2024 18:22:23 +0100 Subject: [PATCH 117/138] changing script from anonymous call to script tag and changing target to production --- web/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/index.html b/web/index.html index f0cc320926a7..7b2fbe018111 100644 --- a/web/index.html +++ b/web/index.html @@ -121,16 +121,16 @@ <% if (htmlWebpackPlugin.options.isWeb) { %> - <% if (htmlWebpackPlugin.options.isStaging) { %> + <% if (htmlWebpackPlugin.options.isProduction) { %> - + <% } %> <% } %> - <% if (htmlWebpackPlugin.options.isWeb && htmlWebpackPlugin.options.isStaging) { %> + <% if (htmlWebpackPlugin.options.isWeb && htmlWebpackPlugin.options.isProduction) { %> From b0006f966dfd0f8ebcdc837c5d9aac3716557247 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Mon, 5 Feb 2024 19:50:19 +0100 Subject: [PATCH 118/138] update package.json wth fix to markdown --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 22cb27b81c5d..8860eaa86f39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#c316611781f19815caebfed5540e0faf2a274785", + "@expensify/react-native-live-markdown": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#f0b63f41fa4c09bfa68439da0550b47bafd92fa2", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-getcanonicallocales": "^2.2.0", @@ -3352,8 +3352,8 @@ }, "node_modules/@expensify/react-native-live-markdown": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#c316611781f19815caebfed5540e0faf2a274785", - "integrity": "sha512-yF3oaBhqWQonl12LPELYLsgfmqCsGg2bu15g/h8XzVX3f/nzfPtrWE/ax2lWEIpIjk4/+aEu/VGNKLnlehjTxQ==", + "resolved": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#f0b63f41fa4c09bfa68439da0550b47bafd92fa2", + "integrity": "sha512-F+KypQSN+xYBkrXDomJRTg8Q913lpeWoKCLZIr6+YKqn0P1hrKKRVz2ESLfA/JOD1lHvii6kI9hGKARDGH9O/w==", "license": "MIT", "workspaces": [ "example" diff --git a/package.json b/package.json index 969a07417422..c2378673081a 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#c316611781f19815caebfed5540e0faf2a274785", + "@expensify/react-native-live-markdown": "git+ssh://git@github.com/Expensify/react-native-live-markdown.git#f0b63f41fa4c09bfa68439da0550b47bafd92fa2", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-getcanonicallocales": "^2.2.0", From c34932cb2f7ad51d66aa3fb401e6ce32a6bf08f3 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 5 Feb 2024 13:14:47 -0700 Subject: [PATCH 119/138] Prevent form from being submitted multiple times --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index b21c53c01580..daa653f616ba 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -105,6 +105,7 @@ function IOURequestStepConfirmation({ [transaction.participants, personalDetails], ); const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(report)), [report]); + let formHasBeenSubmitted = false; useEffect(() => { if (!transaction || !transaction.originalCurrency) { @@ -228,6 +229,13 @@ function IOURequestStepConfirmation({ (selectedParticipants) => { const trimmedComment = lodashGet(transaction, 'comment.comment', '').trim(); + // Don't let the form be submitted multiple times while the navigator is waiting to take the user to a different page + if (formHasBeenSubmitted) { + return; + } + + formHasBeenSubmitted = true; + // If we have a receipt let's start the split bill by creating only the action, the transaction, and the group DM if needed if (iouType === CONST.IOU.TYPE.SPLIT && receiptFile) { IOU.startSplitBill( From df02d87b9064ca827e66572a6dc5bb076f3a9355 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 5 Feb 2024 13:50:42 -0700 Subject: [PATCH 120/138] Add GPS points to the types --- src/libs/API/parameters/RequestMoneyParams.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/API/parameters/RequestMoneyParams.ts b/src/libs/API/parameters/RequestMoneyParams.ts index ccafdd692137..983394008ba7 100644 --- a/src/libs/API/parameters/RequestMoneyParams.ts +++ b/src/libs/API/parameters/RequestMoneyParams.ts @@ -24,6 +24,7 @@ type RequestMoneyParams = { taxCode: string; taxAmount: number; billable?: boolean; + gpsPoints?: string; }; export default RequestMoneyParams; From 77be41142b8e0f87e41bc28a83b8f6f9bb4a20f6 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 5 Feb 2024 13:56:46 -0700 Subject: [PATCH 121/138] Use a ref instead of a variable. --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index daa653f616ba..b939e0e725c0 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -1,6 +1,6 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; -import React, {useCallback, useEffect, useMemo, useState} from 'react'; +import React, {useCallback, useEffect, useMemo, useState, useRef} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; @@ -105,7 +105,7 @@ function IOURequestStepConfirmation({ [transaction.participants, personalDetails], ); const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(report)), [report]); - let formHasBeenSubmitted = false; + const formHasBeenSubmitted = useRef(false); useEffect(() => { if (!transaction || !transaction.originalCurrency) { @@ -230,11 +230,11 @@ function IOURequestStepConfirmation({ const trimmedComment = lodashGet(transaction, 'comment.comment', '').trim(); // Don't let the form be submitted multiple times while the navigator is waiting to take the user to a different page - if (formHasBeenSubmitted) { + if (formHasBeenSubmitted.current) { return; } - formHasBeenSubmitted = true; + formHasBeenSubmitted.current = true; // If we have a receipt let's start the split bill by creating only the action, the transaction, and the group DM if needed if (iouType === CONST.IOU.TYPE.SPLIT && receiptFile) { From e83c24a01a31607e5ccf406de8dd09a22c9d7c7e Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 5 Feb 2024 14:04:32 -0700 Subject: [PATCH 122/138] Style --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index b939e0e725c0..be57de687e3a 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -1,6 +1,6 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; -import React, {useCallback, useEffect, useMemo, useState, useRef} from 'react'; +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; From b85a6f93ea253f71e425fe9bc2c2b40d43afb800 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Tue, 6 Feb 2024 05:06:45 +0700 Subject: [PATCH 123/138] Update src/libs/EmojiUtils.ts Co-authored-by: Getabalew Tesfaye <75031127+getusha@users.noreply.github.com> --- src/libs/EmojiUtils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index b87f7d0d695f..730f2a5d3295 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -549,8 +549,7 @@ const getEmojiReactionDetails = (emojiName: string, reaction: ReportActionReacti }; /** - * Get base emoji without skintone - * @returns emoji without skin tone + * Given an emoji code, returns an base emoji code without skin tone */ const getRemovedSkinToneEmoji = (emoji: string) => emoji.replace(CONST.REGEX.EMOJI_SKIN_TONES, ''); From e287420a181fb6d8a7c15dbc5894a54e83222461 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 5 Feb 2024 22:44:15 +0000 Subject: [PATCH 124/138] Update version to 1.4.37-0 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 4 ++-- ios/NewExpensifyTests/Info.plist | 4 ++-- ios/NotificationServiceExtension/Info.plist | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3d43e97888ec..4b1200165252 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -98,8 +98,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001043605 - versionName "1.4.36-5" + versionCode 1001043700 + versionName "1.4.37-0" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 10d5a6e671ef..dc8a515a67db 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.4.36 + 1.4.37 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.36.5 + 1.4.37.0 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 93e4c812d5fc..35c0d2a8c41f 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.4.36 + 1.4.37 CFBundleSignature ???? CFBundleVersion - 1.4.36.5 + 1.4.37.0 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index 4db3327a0c2d..62460fc62d7a 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -11,9 +11,9 @@ CFBundleName $(PRODUCT_NAME) CFBundleShortVersionString - 1.4.36 + 1.4.37 CFBundleVersion - 1.4.36.5 + 1.4.37.0 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index 2a513b3379ce..8f28da66c144 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.36-5", + "version": "1.4.37-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.36-5", + "version": "1.4.37-0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index fb3c9efcfcae..1fef870181ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.36-5", + "version": "1.4.37-0", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From ab1bcb7e51b7882b16b59f86e9bd5178cec46f64 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 5 Feb 2024 22:55:03 +0000 Subject: [PATCH 125/138] Update version to 1.4.37-1 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- ios/NotificationServiceExtension/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4b1200165252..7318b5b6d3ff 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -98,8 +98,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001043700 - versionName "1.4.37-0" + versionCode 1001043701 + versionName "1.4.37-1" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index dc8a515a67db..f8bf6953b9bf 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.37.0 + 1.4.37.1 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 35c0d2a8c41f..cef9024b8744 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.4.37.0 + 1.4.37.1 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index 62460fc62d7a..c1f74b80085d 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 1.4.37 CFBundleVersion - 1.4.37.0 + 1.4.37.1 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index 8f28da66c144..ac335fd12eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.37-0", + "version": "1.4.37-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.37-0", + "version": "1.4.37-1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 1fef870181ae..9cf4ec00727a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.37-0", + "version": "1.4.37-1", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From bc59ba19e2eaf0a178e5fe97b444c2c82b9d54c0 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 6 Feb 2024 15:20:19 +0800 Subject: [PATCH 126/138] clear pending action when fails --- src/libs/actions/IOU.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 569b6b26b728..9b1ffb4433ca 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2808,6 +2808,7 @@ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repor value: { [reportPreviewAction?.reportActionID ?? '']: { ...reportPreviewAction, + pendingAction: null, errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericDeleteFailureMessage'), }, }, From 49413b174db673777a75b2af261b3f65cda495ef Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 6 Feb 2024 08:58:05 +0100 Subject: [PATCH 127/138] Fix ts issues --- src/components/SettlementButton.tsx | 2 +- src/libs/API/parameters/PayMoneyRequestParams.ts | 5 ++--- src/libs/API/parameters/SendMoneyParams.ts | 5 ++--- src/libs/actions/IOU.ts | 6 ++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 8ed25853fcf3..058def7a34ad 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -197,7 +197,7 @@ function SettlementButton({ } if (iouPaymentType === CONST.IOU.REPORT_ACTION_TYPE.APPROVE) { - IOU.approveMoneyRequest(iouReport); + IOU.approveMoneyRequest(iouReport ?? {}); return; } diff --git a/src/libs/API/parameters/PayMoneyRequestParams.ts b/src/libs/API/parameters/PayMoneyRequestParams.ts index 94f62bcca065..edf05b6ce528 100644 --- a/src/libs/API/parameters/PayMoneyRequestParams.ts +++ b/src/libs/API/parameters/PayMoneyRequestParams.ts @@ -1,11 +1,10 @@ -import type CONST from '@src/CONST'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; type PayMoneyRequestParams = { iouReportID: string; chatReportID: string; reportActionID: string; - paymentMethodType: DeepValueOf; + paymentMethodType: PaymentMethodType; }; export default PayMoneyRequestParams; diff --git a/src/libs/API/parameters/SendMoneyParams.ts b/src/libs/API/parameters/SendMoneyParams.ts index c32287d5b4ec..b737ba2ea48b 100644 --- a/src/libs/API/parameters/SendMoneyParams.ts +++ b/src/libs/API/parameters/SendMoneyParams.ts @@ -1,11 +1,10 @@ -import type CONST from '@src/CONST'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; type SendMoneyParams = { iouReportID: string; chatReportID: string; reportActionID: string; - paymentMethodType: DeepValueOf; + paymentMethodType: PaymentMethodType; transactionID: string; newIOUReportDetails: string; createdReportActionID: string; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 569b6b26b728..a7a82e642e62 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -50,10 +50,10 @@ import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import type {Participant, Split} from '@src/types/onyx/IOU'; import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type ReportAction from '@src/types/onyx/ReportAction'; import type {OnyxData} from '@src/types/onyx/Request'; import type {Comment, Receipt, ReceiptSource, TaxRate, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import * as Policy from './Policy'; @@ -63,8 +63,6 @@ type MoneyRequestRoute = StackScreenProps; -type PaymentMethodType = DeepValueOf; - type OneOnOneIOUReport = OnyxTypes.Report | undefined | null; type MoneyRequestInformation = { @@ -3255,7 +3253,7 @@ function sendMoneyWithWallet(report: OnyxTypes.Report, amount: number, currency: Report.notifyNewAction(params.chatReportID, managerID); } -function approveMoneyRequest(expenseReport: OnyxTypes.Report) { +function approveMoneyRequest(expenseReport: OnyxTypes.Report | EmptyObject) { const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null; const optimisticApprovedReportAction = ReportUtils.buildOptimisticApprovedReportAction(expenseReport.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID); From 41460500c9412674ddeaeab3b94484e08ef5f75c Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 6 Feb 2024 09:12:37 +0100 Subject: [PATCH 128/138] Fix ts issues x2 --- src/components/SettlementButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 058def7a34ad..c41edf14b926 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -49,7 +49,7 @@ type SettlementButtonProps = SettlementButtonOnyxProps & { chatReportID?: string; /** The IOU/Expense report we are paying */ - iouReport?: OnyxEntry | EmptyObject; + iouReport?: OnyxEntry | Report | EmptyObject; /** Should we show the payment options? */ shouldHidePaymentOptions?: boolean; From abcf695e1f1b232b3703dae3cad4dfad8fe29132 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 6 Feb 2024 10:16:01 +0100 Subject: [PATCH 129/138] Fix ts issues x3 --- src/components/SettlementButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index c41edf14b926..058def7a34ad 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -49,7 +49,7 @@ type SettlementButtonProps = SettlementButtonOnyxProps & { chatReportID?: string; /** The IOU/Expense report we are paying */ - iouReport?: OnyxEntry | Report | EmptyObject; + iouReport?: OnyxEntry | EmptyObject; /** Should we show the payment options? */ shouldHidePaymentOptions?: boolean; From 7f6464b71b45de412f54819fc85c3978b4419cde Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 6 Feb 2024 11:01:28 +0100 Subject: [PATCH 130/138] commit podfile.lock --- ios/Podfile.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ad1826d1c8e6..d90b48f1fd7b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1178,10 +1178,6 @@ PODS: - React-Core - react-native-launch-arguments (4.0.2): - React - - react-native-live-markdown (0.1.0): - - glog - - RCT-Folly (= 2022.05.16.00) - - React-Core - react-native-netinfo (11.2.1): - React-Core - react-native-pager-view (6.2.2): @@ -1412,6 +1408,10 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core + - RNLiveMarkdown (0.1.0): + - glog + - RCT-Folly (= 2022.05.16.00) + - React-Core - RNLocalize (2.2.6): - React-Core - rnmapbox-maps (10.0.11): @@ -1453,7 +1453,7 @@ PODS: - SDWebImage/Core (~> 5.17) - SocketRocket (0.6.1) - Turf (2.7.0) - - VisionCamera (2.16.2): + - VisionCamera (2.16.5): - React - React-callinvoker - React-Core @@ -1529,7 +1529,6 @@ DEPENDENCIES: - react-native-image-picker (from `../node_modules/react-native-image-picker`) - react-native-key-command (from `../node_modules/react-native-key-command`) - react-native-launch-arguments (from `../node_modules/react-native-launch-arguments`) - - "react-native-live-markdown (from `../node_modules/@expensify/react-native-live-markdown`)" - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-pdf (from `../node_modules/react-native-pdf`) @@ -1574,6 +1573,7 @@ DEPENDENCIES: - RNFS (from `../node_modules/react-native-fs`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - "RNGoogleSignin (from `../node_modules/@react-native-google-signin/google-signin`)" + - "RNLiveMarkdown (from `../node_modules/@expensify/react-native-live-markdown`)" - RNLocalize (from `../node_modules/react-native-localize`) - "rnmapbox-maps (from `../node_modules/@rnmapbox/maps`)" - RNPermissions (from `../node_modules/react-native-permissions`) @@ -1725,8 +1725,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-key-command" react-native-launch-arguments: :path: "../node_modules/react-native-launch-arguments" - react-native-live-markdown: - :path: "../node_modules/@expensify/react-native-live-markdown" react-native-netinfo: :path: "../node_modules/@react-native-community/netinfo" react-native-pager-view: @@ -1815,6 +1813,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-gesture-handler" RNGoogleSignin: :path: "../node_modules/@react-native-google-signin/google-signin" + RNLiveMarkdown: + :path: "../node_modules/@expensify/react-native-live-markdown" RNLocalize: :path: "../node_modules/react-native-localize" rnmapbox-maps: @@ -1922,7 +1922,6 @@ SPEC CHECKSUMS: react-native-image-picker: c33d4e79f0a14a2b66e5065e14946ae63749660b react-native-key-command: 5af6ee30ff4932f78da6a2109017549042932aa5 react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d - react-native-live-markdown: 81ac491b913cb8541a06586adcdc159ab1b86fb5 react-native-netinfo: 8a7fd3f7130ef4ad2fb4276d5c9f8d3f28d2df3d react-native-pager-view: 02a5c4962530f7efc10dd51ee9cdabeff5e6c631 react-native-pdf: b4ca3d37a9a86d9165287741c8b2ef4d8940c00e @@ -1967,6 +1966,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 25b969a1ffc806b9f9ad2e170d4a3b049c6af85e RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 + RNLiveMarkdown: 374e9adef7a46145b6de4a727ca8c814e38ce58a RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa @@ -1980,9 +1980,9 @@ SPEC CHECKSUMS: SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 - VisionCamera: 7d13aae043ffb38b224a0f725d1e23ca9c190fe7 + VisionCamera: fda554d8751e395effcc87749f8b7c198c1031be Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047 PODFILE CHECKSUM: 0ccbb4f2406893c6e9f266dc1e7470dcd72885d2 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 From 46a7474842ed4b7a38be2f7603f769215f2905c9 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 6 Feb 2024 11:39:38 +0100 Subject: [PATCH 131/138] commit podfile.lock --- ios/Podfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d90b48f1fd7b..98a2e0b67160 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1981,8 +1981,8 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: fda554d8751e395effcc87749f8b7c198c1031be - Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047 + Yoga: 13c8ef87792450193e117976337b8527b49e8c03 PODFILE CHECKSUM: 0ccbb4f2406893c6e9f266dc1e7470dcd72885d2 -COCOAPODS: 1.14.3 +COCOAPODS: 1.13.0 From 55ea149fab8084264fc9a1fbc54826cc07a71cf9 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 6 Feb 2024 12:03:29 +0100 Subject: [PATCH 132/138] update podfile.lock --- ios/Podfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 98a2e0b67160..1664c982ce50 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1178,6 +1178,10 @@ PODS: - React-Core - react-native-launch-arguments (4.0.2): - React + - react-native-live-markdown (0.1.0): + - glog + - RCT-Folly (= 2022.05.16.00) + - React-Core - react-native-netinfo (11.2.1): - React-Core - react-native-pager-view (6.2.2): @@ -1408,10 +1412,6 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.0): - - glog - - RCT-Folly (= 2022.05.16.00) - - React-Core - RNLocalize (2.2.6): - React-Core - rnmapbox-maps (10.0.11): @@ -1529,6 +1529,7 @@ DEPENDENCIES: - react-native-image-picker (from `../node_modules/react-native-image-picker`) - react-native-key-command (from `../node_modules/react-native-key-command`) - react-native-launch-arguments (from `../node_modules/react-native-launch-arguments`) + - "react-native-live-markdown (from `../node_modules/@expensify/react-native-live-markdown`)" - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-pdf (from `../node_modules/react-native-pdf`) @@ -1573,7 +1574,6 @@ DEPENDENCIES: - RNFS (from `../node_modules/react-native-fs`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - "RNGoogleSignin (from `../node_modules/@react-native-google-signin/google-signin`)" - - "RNLiveMarkdown (from `../node_modules/@expensify/react-native-live-markdown`)" - RNLocalize (from `../node_modules/react-native-localize`) - "rnmapbox-maps (from `../node_modules/@rnmapbox/maps`)" - RNPermissions (from `../node_modules/react-native-permissions`) @@ -1725,6 +1725,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-key-command" react-native-launch-arguments: :path: "../node_modules/react-native-launch-arguments" + react-native-live-markdown: + :path: "../node_modules/@expensify/react-native-live-markdown" react-native-netinfo: :path: "../node_modules/@react-native-community/netinfo" react-native-pager-view: @@ -1813,8 +1815,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-gesture-handler" RNGoogleSignin: :path: "../node_modules/@react-native-google-signin/google-signin" - RNLiveMarkdown: - :path: "../node_modules/@expensify/react-native-live-markdown" RNLocalize: :path: "../node_modules/react-native-localize" rnmapbox-maps: @@ -1922,6 +1922,7 @@ SPEC CHECKSUMS: react-native-image-picker: c33d4e79f0a14a2b66e5065e14946ae63749660b react-native-key-command: 5af6ee30ff4932f78da6a2109017549042932aa5 react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d + react-native-live-markdown: 81ac491b913cb8541a06586adcdc159ab1b86fb5 react-native-netinfo: 8a7fd3f7130ef4ad2fb4276d5c9f8d3f28d2df3d react-native-pager-view: 02a5c4962530f7efc10dd51ee9cdabeff5e6c631 react-native-pdf: b4ca3d37a9a86d9165287741c8b2ef4d8940c00e @@ -1966,7 +1967,6 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 25b969a1ffc806b9f9ad2e170d4a3b049c6af85e RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 374e9adef7a46145b6de4a727ca8c814e38ce58a RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa From e45d6e0865ccbfd814a7762bf7401938fa494a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20M=C3=B3rawski?= Date: Tue, 6 Feb 2024 12:58:31 +0100 Subject: [PATCH 133/138] simplifying referral CTA dismissing --- src/components/ReferralProgramCTA.tsx | 32 ++- src/pages/SearchPage.js | 227 ---------------------- src/pages/SearchPage/SearchPageFooter.tsx | 37 +--- 3 files changed, 31 insertions(+), 265 deletions(-) delete mode 100755 src/pages/SearchPage.js diff --git a/src/components/ReferralProgramCTA.tsx b/src/components/ReferralProgramCTA.tsx index f1c7539cc6b5..4e0ed1f573f9 100644 --- a/src/components/ReferralProgramCTA.tsx +++ b/src/components/ReferralProgramCTA.tsx @@ -1,32 +1,45 @@ import React from 'react'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as User from '@userActions/User'; import CONST from '@src/CONST'; import Navigation from '@src/libs/Navigation/Navigation'; +import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import type {DismissedReferralBanners} from '@src/types/onyx/Account'; import Icon from './Icon'; import {Close} from './Icon/Expensicons'; import {PressableWithoutFeedback} from './Pressable'; import Text from './Text'; import Tooltip from './Tooltip'; -type ReferralProgramCTAProps = { +type ReferralProgramCTAOnyxProps = { + dismissedReferralBanners: DismissedReferralBanners; +}; + +type ReferralProgramCTAProps = ReferralProgramCTAOnyxProps & { referralContentType: | typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.MONEY_REQUEST | typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT | typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SEND_MONEY | typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND; - - /** Method to trigger when pressing close button of the banner */ - onCloseButtonPress?: () => void; }; -function ReferralProgramCTA({referralContentType, onCloseButtonPress = () => {}}: ReferralProgramCTAProps) { +function ReferralProgramCTA({referralContentType, dismissedReferralBanners}: ReferralProgramCTAProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const theme = useTheme(); + const handleDismissCallToAction = () => { + User.dismissReferralBanner(CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND); + }; + + if (!referralContentType || dismissedReferralBanners[referralContentType]) { + return null; + } + return ( { @@ -47,7 +60,7 @@ function ReferralProgramCTA({referralContentType, onCloseButtonPress = () => {}} { e.preventDefault(); }} @@ -67,4 +80,9 @@ function ReferralProgramCTA({referralContentType, onCloseButtonPress = () => {}} ); } -export default ReferralProgramCTA; +export default withOnyx({ + dismissedReferralBanners: { + key: ONYXKEYS.ACCOUNT, + selector: (data) => data?.dismissedReferralBanners ?? {}, + }, +})(ReferralProgramCTA); diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js deleted file mode 100755 index d8eef6f447ae..000000000000 --- a/src/pages/SearchPage.js +++ /dev/null @@ -1,227 +0,0 @@ -import PropTypes from 'prop-types'; -import React, {useCallback, useEffect, useRef, useState} from 'react'; -import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import OptionsSelector from '@components/OptionsSelector'; -import ScreenWrapper from '@components/ScreenWrapper'; -import useLocalize from '@hooks/useLocalize'; -import useNetwork from '@hooks/useNetwork'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; -import Performance from '@libs/Performance'; -import * as ReportUtils from '@libs/ReportUtils'; -import * as Report from '@userActions/Report'; -import Timing from '@userActions/Timing'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import personalDetailsPropType from './personalDetailsPropType'; -import reportPropTypes from './reportPropTypes'; - -const propTypes = { - /* Onyx Props */ - - /** Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), - - /** All of the personal details for everyone */ - personalDetails: PropTypes.objectOf(personalDetailsPropType), - - /** All reports shared with the user */ - reports: PropTypes.objectOf(reportPropTypes), - - /** Whether we are searching for reports in the server */ - isSearchingForReports: PropTypes.bool, - - /** - * The navigation prop passed by the navigator. - * - * This is required because transitionEnd event doesn't trigger in the automated testing environment. - */ - navigation: PropTypes.shape({}), -}; - -const defaultProps = { - betas: [], - personalDetails: {}, - reports: {}, - isSearchingForReports: false, - navigation: {}, -}; - -function SearchPage({betas, personalDetails, reports, isSearchingForReports, navigation}) { - const [searchValue, setSearchValue] = useState(''); - const [searchOptions, setSearchOptions] = useState({ - recentReports: {}, - personalDetails: {}, - userToInvite: {}, - }); - - const {isOffline} = useNetwork(); - const {translate} = useLocalize(); - const themeStyles = useThemeStyles(); - const isMounted = useRef(false); - - const updateOptions = useCallback(() => { - const { - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - } = OptionsListUtils.getSearchOptions(reports, personalDetails, searchValue.trim(), betas); - - setSearchOptions({ - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - }); - }, [reports, personalDetails, searchValue, betas]); - - useEffect(() => { - Timing.start(CONST.TIMING.SEARCH_RENDER); - Performance.markStart(CONST.TIMING.SEARCH_RENDER); - }, []); - - useEffect(() => { - updateOptions(); - }, [reports, personalDetails, betas, updateOptions]); - - useEffect(() => { - if (!isMounted.current) { - isMounted.current = true; - return; - } - - updateOptions(); - // Ignoring the rule intentionally, we want to run the code only when search Value changes to prevent additional runs. - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [searchValue]); - - /** - * Returns the sections needed for the OptionsSelector - * - * @returns {Array} - */ - const getSections = () => { - const sections = []; - let indexOffset = 0; - - if (searchOptions.recentReports.length > 0) { - sections.push({ - data: searchOptions.recentReports, - shouldShow: true, - indexOffset, - }); - indexOffset += searchOptions.recentReports.length; - } - - if (searchOptions.personalDetails.length > 0) { - sections.push({ - data: searchOptions.personalDetails, - shouldShow: true, - indexOffset, - }); - indexOffset += searchOptions.recentReports.length; - } - - if (searchOptions.userToInvite) { - sections.push({ - data: [searchOptions.userToInvite], - shouldShow: true, - indexOffset, - }); - } - - return sections; - }; - - const searchRendered = () => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }; - - const onChangeText = (value = '') => { - Report.searchInServer(searchValue); - setSearchValue(value); - }; - - /** - * Reset the search value and redirect to the selected report - * - * @param {Object} option - */ - const selectReport = (option) => { - if (!option) { - return; - } - if (option.reportID) { - Navigation.dismissModal(option.reportID); - } else { - Report.navigateToAndOpenReport([option.login]); - } - }; - - const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); - const headerMessage = OptionsListUtils.getHeaderMessage( - searchOptions.recentReports.length + searchOptions.personalDetails.length !== 0, - Boolean(searchOptions.userToInvite), - searchValue, - ); - - return ( - - {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( - <> - - - - - - )} - - ); -} - -SearchPage.propTypes = propTypes; -SearchPage.defaultProps = defaultProps; -SearchPage.displayName = 'SearchPage'; -export default withOnyx({ - reports: { - key: ONYXKEYS.COLLECTION.REPORT, - }, - personalDetails: { - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - }, - betas: { - key: ONYXKEYS.BETAS, - }, - isSearchingForReports: { - key: ONYXKEYS.IS_SEARCHING_FOR_REPORTS, - initWithStoredValues: false, - }, -})(SearchPage); diff --git a/src/pages/SearchPage/SearchPageFooter.tsx b/src/pages/SearchPage/SearchPageFooter.tsx index fcc04d8bc5af..3d5ebfd2c193 100644 --- a/src/pages/SearchPage/SearchPageFooter.tsx +++ b/src/pages/SearchPage/SearchPageFooter.tsx @@ -1,44 +1,19 @@ -import React, {useState} from 'react'; +import React from 'react'; import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; import ReferralProgramCTA from '@components/ReferralProgramCTA'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as User from '@userActions/User'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {DismissedReferralBanners} from '@src/types/onyx/Account'; -type SearchPageFooterOnyxProps = { - dismissedReferralBanners: DismissedReferralBanners; -}; -function SearchPageFooter({dismissedReferralBanners}: SearchPageFooterOnyxProps) { - const [shouldShowReferralCTA, setShouldShowReferralCTA] = useState(!dismissedReferralBanners[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]); +function SearchPageFooter() { const themeStyles = useThemeStyles(); - const closeCallToActionBanner = () => { - setShouldShowReferralCTA(false); - User.dismissReferralBanner(CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND); - }; - return ( - <> - {shouldShowReferralCTA && ( - - - - )} - + + + ); } SearchPageFooter.displayName = 'SearchPageFooter'; -export default withOnyx({ - dismissedReferralBanners: { - key: ONYXKEYS.ACCOUNT, - selector: (data) => data?.dismissedReferralBanners ?? {}, - }, -})(SearchPageFooter); +export default SearchPageFooter; From 2c3185c3f2c409289db361f86bc440e5c8b9cb54 Mon Sep 17 00:00:00 2001 From: someone-here Date: Tue, 6 Feb 2024 19:33:56 +0530 Subject: [PATCH 134/138] Fix header for room description --- src/components/DisplayNames/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DisplayNames/index.tsx b/src/components/DisplayNames/index.tsx index 28e4d131d6de..8031842cc56e 100644 --- a/src/components/DisplayNames/index.tsx +++ b/src/components/DisplayNames/index.tsx @@ -26,6 +26,7 @@ function DisplayNames({fullTitle, tooltipEnabled, textStyles, numberOfLines, sho fullTitle={title} textStyles={textStyles} numberOfLines={numberOfLines} + renderAdditionalText={renderAdditionalText} /> ); } From 582ee3f2dc04db0caeb7b0342b1b556e39404153 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Tue, 6 Feb 2024 15:24:57 +0000 Subject: [PATCH 135/138] Update version to 1.4.37-2 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- ios/NotificationServiceExtension/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7318b5b6d3ff..e179b59f4b30 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -98,8 +98,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001043701 - versionName "1.4.37-1" + versionCode 1001043702 + versionName "1.4.37-2" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index f8bf6953b9bf..b529bbbcd100 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.37.1 + 1.4.37.2 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index cef9024b8744..af5704061df2 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.4.37.1 + 1.4.37.2 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index c1f74b80085d..8209491d19ff 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 1.4.37 CFBundleVersion - 1.4.37.1 + 1.4.37.2 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index ac335fd12eb2..3420537495cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.37-1", + "version": "1.4.37-2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.37-1", + "version": "1.4.37-2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 9cf4ec00727a..df55afd56e40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.37-1", + "version": "1.4.37-2", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From b19b85744b5627bf87181eb9be65c1ec813922a4 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 6 Feb 2024 17:11:25 +0100 Subject: [PATCH 136/138] Fix crash on iOS if requestAmount is 0 --- src/components/ReportActionItem/MoneyRequestPreview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestPreview.tsx b/src/components/ReportActionItem/MoneyRequestPreview.tsx index f321c63375d0..70a313c77e9e 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview.tsx @@ -321,7 +321,7 @@ function MoneyRequestPreview({ {shouldShowDescription && } {shouldShowMerchant && {merchantOrDescription}} - {isBillSplit && participantAccountIDs.length > 0 && requestAmount && requestAmount > 0 && ( + {isBillSplit && participantAccountIDs.length > 0 && !!requestAmount && requestAmount > 0 && ( {translate('iou.amountEach', { amount: CurrencyUtils.convertToDisplayString( From cadc4967bf9d94884e5e0e31c0fb2eeb531b28c2 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 6 Feb 2024 11:43:11 -0500 Subject: [PATCH 137/138] fix lint on main --- src/components/MenuItem.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 0bf649b54a6e..4d7089fb24bd 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -384,7 +384,11 @@ function MenuItem( onPress(event); return; } - singleExecution(waitForNavigate(() => onPress(event)))(); + singleExecution( + waitForNavigate(() => { + onPress(event); + }), + )(); } }; From 3199e7e225f1469f10c2447c158d5e04f42b1945 Mon Sep 17 00:00:00 2001 From: Filip Solecki Date: Tue, 6 Feb 2024 18:15:48 +0100 Subject: [PATCH 138/138] Fix after regression --- src/pages/ShareCodePage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/ShareCodePage.tsx b/src/pages/ShareCodePage.tsx index 831f0eb8f1d8..dcfb9f6861bf 100644 --- a/src/pages/ShareCodePage.tsx +++ b/src/pages/ShareCodePage.tsx @@ -109,7 +109,8 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP isAnonymousAction title={translate('common.download')} icon={Expensicons.Download} - onPress={qrCodeRef.current?.download} + // eslint-disable-next-line @typescript-eslint/no-misused-promises + onPress={() => qrCodeRef.current?.download?.()} /> )}