Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v18.6.0 #49

Merged
merged 14 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DerivedData
*.xcuserstate
project.xcworkspace
.xcode.env.local
**/.xcode.env.local

# Android/IJ
#
Expand All @@ -43,7 +44,7 @@ android.iml

# Cocoapods
#
example/ios/Pods
**/Pods/

# Sitekey config
example/.env
Expand Down Expand Up @@ -83,3 +84,11 @@ android/keystores/debug.keystore

# generated by bob
lib/

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
426 changes: 213 additions & 213 deletions .yarn/releases/yarn-3.6.1.cjs → .yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
nodeLinker: node-modules
checksumBehavior: update

nmHoistingLimits: workspaces

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-3.6.4.cjs
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 18.6.0
Upgrade iOS SDK to 18.6.0 and Android SDK to 18.6.1

## 18.5.1
Upgrade iOS and Android SDK to 18.5.1

Expand Down
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ and

Add the package to your React Native project:

`npx yarn add @google-cloud/recaptcha-enterprise-react-native`
```bash
npx yarn add @google-cloud/recaptcha-enterprise-react-native
```

If using VSCode install eslint:

`https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint`

You may need to use an older JDK:

`export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-19-latest/Contents/Home`
```bash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-19-latest/Contents/Home
```

## Podfile

Expand All @@ -43,7 +47,7 @@ Podfile:

## Basic usage

```
```typescript
import { execute, initClient, RecaptchaAction, } from '@google-cloud/recaptcha-enterprise-react-native';

const [initResult, setInitResult] = React.useState<string | undefined>();
Expand All @@ -55,7 +59,7 @@ const [token, setToken] = React.useState<string | undefined>();

Init:

```
```typescript
initClient(siteKey ?? 'SITEKEY', 10000)
.then(setInitResult('ok'))
.catch((error) => {
Expand All @@ -65,7 +69,7 @@ initClient(siteKey ?? 'SITEKEY', 10000)

Execute:

```
```typescript
execute(RecaptchaAction.LOGIN(), 10000)
.then((token) => {
setExecuteResult(token);
Expand All @@ -75,35 +79,27 @@ execute(RecaptchaAction.LOGIN(), 10000)
})
```

## Example App

Follow guidance at [Example App](example/README.md).

## Common Problems:

* `error: include of non-modular header inside framework module 'RecaptchaEnterprise.Recaptcha'`
### `error: include of non-modular header inside framework module 'RecaptchaEnterprise.Recaptcha'`

Use static linking in pods, for instance: `USE_FRAMEWORKS=static pod install` or
`use_frameworks! :linkage => :static` in your Podfile.

* `fatal error: 'FlipperKit/FlipperClient.h' file not found #import
### `fatal error: 'FlipperKit/FlipperClient.h' file not found #import
<FlipperKit/FlipperClient.h>`

Flipper is not yet compatible with static linkage, so disable flipper in your
Podfile: `flipper_config = FlipperConfiguration.disabled`

## Example App
### SDK Location Not found

Install prerequisites:
Run the following command in the terminal:

npx yarn install && cd example && npx yarn install && cd ios && pod install

### Run sample app:

cd example && npx react-native run-android

cd example && npx react-native run-ios

### Running Integration Tests

brew tap wix/brew && brew install applesimutils

cd example && npx detox build --configuration ios.sim.debug && npx detox test --configuration ios.sim.debug

cd example && npx detox build --configuration android.emu.debug && npx detox test --configuration android.emu.debug
```bash
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
```
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RecaptchaEnterpriseReactNative_kotlinVersion"]
Expand All @@ -24,7 +24,7 @@
}

dependencies {
classpath "com.android.tools.build:gradle:7.2.1"
classpath "com.android.tools.build:gradle:8.6.1"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down Expand Up @@ -106,6 +106,6 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.android.recaptcha:recaptcha:18.5.1'
implementation 'com.google.android.recaptcha:recaptcha:18.6.1'
}

Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class RecaptchaEnterpriseReactNativeModule(reactContext: ReactApplicationContext
}
}

@ReactMethod
fun fetchClient(siteKey: String) {
GlobalScope.launch {
recaptchaClient = Recaptcha.fetchClient(application, siteKey)
}
}

@ReactMethod
fun initClient(siteKey: String, arguments: ReadableMap, promise: Promise) {
GlobalScope.launch {
Expand Down
21 changes: 14 additions & 7 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Podfile:

## Basic usage

```
```typescript
import { execute, initClient, RecaptchaAction, } from '@google-cloud/recaptcha-enterprise-react-native';

const [initResult, setInitResult] = React.useState<string | undefined>();
Expand All @@ -47,7 +47,7 @@ const [token, setToken] = React.useState<string | undefined>();

Init:

```
```typescript
initClient(siteKey ?? 'SITEKEY', 10000)
.then(setInitResult('ok'))
.catch((error) => {
Expand All @@ -57,7 +57,7 @@ initClient(siteKey ?? 'SITEKEY', 10000)

Execute:

```
```typescript
execute(RecaptchaAction.LOGIN(), 10000)
.then((token) => {
setExecuteResult(token);
Expand All @@ -80,22 +80,29 @@ Use static linking in pods, for instance: `USE_FRAMEWORKS=static pod install` or
Flipper is not yet compatible with static linkage, so disable flipper in your
Podfile: `flipper_config = FlipperConfiguration.disabled`

## Example App
## Installing

Install prerequisites:
From the repository root, install prerequisites running the command:

```bash
npx yarn install && cd example && npx yarn install && cd ios && pod install
```

### Run sample app:

cd example && npx react-native run-android
```bash
cd example && npm run start
```

cd example && npx react-native run-ios
When the `Metro` server start either press `i` for iOS and `a` for Android.

### Running Integration Tests

```bash
brew tap wix/brew && brew install applesimutils

cd example && npx detox build --configuration ios.sim.debug && npx detox test --configuration ios.sim.debug

cd example && npx detox build --configuration android.emu.debug && npx detox test --configuration android.emu.debug
```

7 changes: 4 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
Expand Down Expand Up @@ -65,6 +65,9 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

/* Autolinking */
autolinkLibrariesWithApp()
}

/**
Expand Down Expand Up @@ -125,7 +128,6 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
Expand All @@ -135,5 +137,4 @@ dependencies {
androidTestImplementation('com.wix:detox:+')
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MainApplication : Application(), ReactApplication {
}

override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
Expand All @@ -40,6 +40,5 @@ class MainApplication : Application(), ReactApplication {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
android:insetTop="@dimen/abc_edit_text_inset_top_material">

<selector>
<!--
Expand Down
10 changes: 5 additions & 5 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
}
repositories {
google()
Expand All @@ -42,4 +42,4 @@ allprojects {
url("$rootDir/../node_modules/detox/Detox-android")
}
}
}
}
2 changes: 0 additions & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading
Loading