Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/native-sdk-4-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fingerprint_flutter": minor
---

Android and iOS: use native Fingerprint SDK 4.2.x. It collects new signals and improves performance. On Android, it also returns an error instead of crashing when SDK initialization fails.
2 changes: 1 addition & 1 deletion android/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stopgap for gaps in Fingerprint Android SDK 4.1.x consumer rules. Remove once the SDK ships them.
# Stopgap for gaps in Fingerprint Android SDK 4.1.x and 4.2.x consumer rules. Remove once the SDK ships them.
# https://developer.android.com/build/shrink-code#configuration-files

# The SDK references Play Services location without depending on it. R8 fails with "Missing class".
Expand Down
2 changes: 1 addition & 1 deletion android/fingerprint.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Patch releases only, same as iOS in ios/fingerprint_flutter/Package.swift.
// Take each native minor on purpose.
ext.fingerprint_native_sdk_version = "[4.1.0, 4.2.0)"
ext.fingerprint_native_sdk_version = "[4.2.0, 4.3.0)"

task printFingerprintNativeSDKVersion {
doLast {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fingerprint.flutter

import android.content.Context
import com.fingerprint.android.ApiKeyRequired
import com.fingerprint.android.ApiKeyNotFound
import com.fingerprint.android.Failed
import com.fingerprint.android.Fingerprint
import com.fingerprint.android.FingerprintResponse
Expand All @@ -19,12 +19,14 @@ class FingerprintHostApiImplTest {
@Test
fun mapsErrorTypesByInstanceNotSimpleName() {
val cases = listOf(
ApiKeyRequired("e1", "msg") to "public_api_key_required",
// Some SDK error classes throw IllegalAccessError when created on the
// desktop JVM (works on ART). The SDK obfuscator breaks their static
// initializer, and which classes it breaks changes with each release.
// These load on SDK 4.1.0 and 4.2.0.
ApiKeyNotFound("e1", "msg") to "public_api_key_not_found",
Failed("e2", "fail") to "failed",
RequestTimeout("e3", "timeout") to "request_read_timeout",
NetworkUnavailableError() to "network_error",
// NetworkError is left out: its obfuscated static initializer in SDK 4.1.0
// throws IllegalAccessError on the desktop JVM (works on ART).
)
for ((nativeError, expectedCode) in cases) {
val api = hostApi { _, _ ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package com.fingerprint.flutter

import com.fingerprint.android.ApiKeyRequired
import com.fingerprint.android.ApiKeyNotFound
import com.fingerprint.android.StateNotReady
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test

// Error types here must load on the desktop JVM, see FingerprintHostApiImplTest.
class FingerprintNativeErrorTest {
@Test
fun stripsUnknownEventIdAndDescription() {
val flutterError = toFlutterError(ApiKeyRequired("Unknown", "Unknown"))
assertEquals("public_api_key_required", flutterError.code)
val flutterError = toFlutterError(ApiKeyNotFound("Unknown", "Unknown"))
assertEquals("public_api_key_not_found", flutterError.code)
assertNull(flutterError.message)
assertNull(flutterError.details)
}

@Test
fun keepsRealEventIdInDetails() {
val flutterError = toFlutterError(ApiKeyRequired("evt-123", "need key"))
assertEquals("public_api_key_required", flutterError.code)
val flutterError = toFlutterError(ApiKeyNotFound("evt-123", "need key"))
assertEquals("public_api_key_not_found", flutterError.code)
assertEquals("need key", flutterError.message)
assertEquals("evt-123", flutterError.details)
}
Expand Down
2 changes: 1 addition & 1 deletion ios/fingerprint_flutter/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
// pulled from users once a floating range allows it. Take each minor
// on purpose. Example: 2.8.0 caused App Store rejections.
// https://github.com/fingerprintjs/flutter/issues/92
.package(url: "https://github.com/fingerprintjs/fingerprint-ios", .upToNextMinor(from: "4.1.0"))
.package(url: "https://github.com/fingerprintjs/fingerprint-ios", .upToNextMinor(from: "4.2.0"))
],
targets: [
.target(
Expand Down
Loading