SumSubstance / react-native-mobilesdk-module

3 stars 5 forks source link

Expo Compatibility #11

Open josefelbez opened 8 months ago

josefelbez commented 8 months ago

Hi, any plans to provide expo compatibility out of the box?

Since expo is becoming the to go option nowadays would be good to have something like a config plugin to use with expo

Ref: https://docs.expo.dev/config-plugins/introduction/

Also, are you open source friendly? As could I assign it to myself and open a pr for that?

0mitch commented 8 months ago

Would also be very interested in this as I'm trying to integrate SumSub into an Expo app as well.

jvfalco1 commented 7 months ago

@0mitch did you managed to do it? is it possible?

ricp commented 3 months ago

I am also interested in the solution, if there is one.

akeeee commented 3 months ago

It can be done, but it might be a little tricky.

For web, you can follow this guide: https://docs.sumsub.com/docs/get-started-with-web-sdk#react-integration

For native, you can follow this guide: https://docs.sumsub.com/docs/react-native-module. You’ll need to use expo-build-properties to configure the dependencies required by Sumsub. expo-build-properties documentation.

For usage of the camera, microphone, photo library, and geolocation, you can use plugins like expo-camera Expo Camera documentation.

Here’s some example:

{
  "plugins": [
    [
      "expo-build-properties",
      {
        "android": {
          "extraMavenRepos": [
            {
              "url": "https://maven.sumsub.com/repository/maven-public/"
            }
          ]
        },
        "ios": {
          "extraPods": [
            {
              "source": "https://github.com/SumSubstance/Specs.git",
              "name": "IdensicMobileSDK",
              "version": "1.32.0"
            }
          ]
        }
      }
    ],
    [
      "expo-camera",
      {
        "cameraPermission": "Allow apps to access your camera",
        "microphonePermission": "Allow apps to access your microphone",
        "recordAudioAndroid": true
      }
    ]
  ]
}
ricp commented 3 months ago

Thanks! I will try this 👍

felipecornejo1 commented 3 months ago

It can be done, but it might be a little tricky.

For web, you can follow this guide: https://docs.sumsub.com/docs/get-started-with-web-sdk#react-integration

For native, you can follow this guide: https://docs.sumsub.com/docs/react-native-module. You’ll need to use expo-build-properties to configure the dependencies required by Sumsub. expo-build-properties documentation.

For usage of the camera, microphone, photo library, and geolocation, you can use plugins like expo-camera Expo Camera documentation.

Here’s some example:

{
  "plugins": [
    [
      "expo-build-properties",
      {
        "android": {
          "extraMavenRepos": [
            {
              "url": "https://maven.sumsub.com/repository/maven-public/"
            }
          ]
        },
        "ios": {
          "extraPods": [
            {
              "source": "https://github.com/SumSubstance/Specs.git",
              "name": "IdensicMobileSDK",
              "version": "1.32.0"
            }
          ]
        }
      }
    ],
    [
      "expo-camera",
      {
        "cameraPermission": "Allow apps to access your camera",
        "microphonePermission": "Allow apps to access your microphone",
        "recordAudioAndroid": true
      }
    ]
  ]
}

I tried all of this, but I'm getting this error when trying to build with expo run:android

     Duplicate class org.bouncycastle.x509.X509V2CRLGenerator$ExtCRLException found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.X509V3CertificateGenerator found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.extension.AuthorityKeyIdentifierStructure found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.extension.X509ExtensionUtil found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.util.LDAPStoreHelper found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.util.StreamParser found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)
     Duplicate class org.bouncycastle.x509.util.StreamParsingException found in modules jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70) and jetified-bcprov-jdk18on-1.71 (org.bouncycastle:bcprov-jdk18on:1.71)

     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 50s
783 actionable tasks: 324 executed, 443 from cache, 16 up-to-date
The Daemon will expire after the build after running out of JVM Metaspace.
The project memory settings are likely not configured or are configured to an insufficient value.
The daemon will restart for the next build, which may increase subsequent build times.
These settings can be adjusted by setting 'org.gradle.jvmargs' in 'gradle.properties'.
The currently configured max heap space is '2 GiB' and the configured max metaspace is '512 MiB'.
For more information on how to set these values, please refer to https://docs.gradle.org/8.3/userguide/build_environment.html#sec:configuring_jvm_memory in the Gradle documentation.
To disable this warning, set 'org.gradle.daemon.performance.disable-logging=true'.
Daemon will be stopped at the end of the build after running out of JVM Metaspace

the step it fails at is :app:checkDebugDuplicateClasses

anyone else went through the same?

jvfalco1 commented 2 months ago

Anyone figured out something about this topic?

felipecornejo1 commented 2 months ago

Anyone figured out something about this topic?

We ended up redirecting to a web app and then back to mobile app because we couldn't solve this quickly. We're waiting for some solution so we can migrate to the mobile SDK

akeeee commented 2 days ago

Update for Expo SDK 52.

For Expo SDK 52, I configured the following in app.json, so you don't need to configure the permissions manually:

 "plugins": [
       [
        "expo-build-properties",
        {
          "android": {
            "usesCleartextTraffic": true,
            "extraMavenRepos": [
              {
                "url": "https://maven.sumsub.com/repository/maven-public/"
              }
            ]
          },
          "ios": {
            "extraPods": [
              {
                "source": "https://github.com/SumSubstance/Specs.git",
                "name": "IdensicMobileSDK",
                "version": "1.33.1"
              }
            ]
          }
        }
      ],
]

Hope this helps!