diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..33e9388 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# https://help.github.com/en/articles/about-code-owners + +* @frankus @LuqKhan @PoornimaApptentive \ No newline at end of file diff --git a/.scripts/changes.md b/.scripts/changes.md index a6aefb0..5829e0c 100644 --- a/.scripts/changes.md +++ b/.scripts/changes.md @@ -1,2 +1,6 @@ -- Apptentive Android SDK: 6.1.0 -- Apptentive iOS SDK: 6.2.2 +- Apptentive Android SDK: 6.5.0 +- Apptentive iOS SDK: 6.5.0 + +#### Bugs Fixed: + +- Fixed an issue where calling register multiple times would hang on Android builds diff --git a/CHANGELOG.md b/CHANGELOG.md index 6626acc..b8b770d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 2023-11-17 - v6.2.2 + +- Apptentive Android SDK: 6.5.0 +- Apptentive iOS SDK: 6.5.0 + +#### Bugs Fixed: + +- Fixed an issue where calling register multiple times would hang on Android builds + # 2023-08-02 - v6.1.2 - Apptentive Android SDK: 6.1.0 diff --git a/android/build.gradle b/android/build.gradle index ffd8461..e3e5b59 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -37,6 +37,6 @@ android { } dependencies { - implementation 'com.apptentive:apptentive-kit-android:6.1.0' + implementation 'com.apptentive:apptentive-kit-android:6.5.0' testImplementation 'junit:junit:4.13.2' } diff --git a/android/src/main/kotlin/com/apptentive/apptentive_flutter/ApptentiveFlutterPlugin.kt b/android/src/main/kotlin/com/apptentive/apptentive_flutter/ApptentiveFlutterPlugin.kt index ebb22df..46caac2 100644 --- a/android/src/main/kotlin/com/apptentive/apptentive_flutter/ApptentiveFlutterPlugin.kt +++ b/android/src/main/kotlin/com/apptentive/apptentive_flutter/ApptentiveFlutterPlugin.kt @@ -108,6 +108,7 @@ class ApptentiveFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware "registerListeners" -> registerListeners(result) "unregisterListeners" -> unregisterListeners(result) "sendAttachmentText" -> sendAttachmentText(call, result) + "isSDKRegistered" -> isSDKRegistered(result) "handleRequestPushPermissions" -> { /* Only iOS. */ } else -> result.notImplemented() } @@ -119,13 +120,17 @@ class ApptentiveFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware private fun register(call: MethodCall, result: Result) { val configuration = unpackConfiguration(call.argument("configuration")!!) try { - Apptentive.register(application, configuration) { registerResult -> - if (registerResult is RegisterResult.Success) { - isApptentiveRegistered = true - Log.d(LogTag("Flutter"), "register ApptentiveActivityInfoCallback") - Apptentive.registerApptentiveActivityInfoCallback(activityInfo) + if (Apptentive.isRegistered()) { + result.error(ERROR_CODE, "Apptentive instance is already registered.", null) + } else { + Apptentive.register(application, configuration) { registerResult -> + if (registerResult is RegisterResult.Success) { + isApptentiveRegistered = true + Log.d(LogTag("Flutter"), "register ApptentiveActivityInfoCallback") + Apptentive.registerApptentiveActivityInfoCallback(activityInfo) + } + result.success(registerResult is RegisterResult.Success) } - result.success(registerResult is RegisterResult.Success) } } catch (e: Exception) { result.error(ERROR_CODE, "Failed to register Apptentive instance.", e.toString()) @@ -310,6 +315,14 @@ class ApptentiveFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware } } + private fun isSDKRegistered(result: Result) { + try { + result.success(Apptentive.isRegistered()) + } catch (e: Exception) { + result.error(ERROR_CODE, "Failed to check if Apptentive SDK is registered.", e.toString()) + } + } + private fun getUnreadMessageCount(result: Result) { try { val unreadMessages: Int = Apptentive.getUnreadMessageCount() diff --git a/ios/apptentive_flutter.podspec b/ios/apptentive_flutter.podspec index fe0f411..6e04498 100644 --- a/ios/apptentive_flutter.podspec +++ b/ios/apptentive_flutter.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'apptentive_flutter' - s.version = "6.1.2" + s.version = "6.2.2" s.summary = 'Apptentive SDK for Flutter' s.description = <<-DESC Apptentive SDK for Flutter @@ -12,8 +12,8 @@ Apptentive SDK for Flutter s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'ApptentiveKit', '~> 6.2.2' - s.platform = :ios, '11.0' + s.dependency 'ApptentiveKit', '6.5.0' + s.platform = :ios, '13.0' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } diff --git a/lib/apptentive_flutter.dart b/lib/apptentive_flutter.dart index a79a29d..69802ca 100644 --- a/lib/apptentive_flutter.dart +++ b/lib/apptentive_flutter.dart @@ -21,7 +21,7 @@ class ApptentiveConfiguration { this.shouldEncryptStorage = false, this.shouldSanitizeLogMessages = true, this.distributionName = "Flutter", - this.distributionVersion = "6.1.2", + this.distributionVersion = "6.2.2", this.ratingInteractionThrottleLength = 604800000, // 1 week this.customAppStoreURL }); @@ -193,6 +193,11 @@ class ApptentiveFlutter { return successful; } + static Future isSDKRegistered() async { + final bool registered = await _channel.invokeMethod('isSDKRegistered', {}); + return registered; + } + // Pack the Apptentive Configuration into a map object static Map _packConfiguration(ApptentiveConfiguration configuration) { return { diff --git a/pubspec.yaml b/pubspec.yaml index e9f9710..545aeee 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,22 +1,18 @@ name: apptentive_flutter description: Apptentive SDK for Flutter -version: 6.1.2 +version: 6.2.2 repository: https://github.com/apptentive/apptentive-flutter issue_tracker: https://github.com/apptentive/apptentive-flutter/issues documentation: https://learn.apptentive.com/knowledge-base/apptentive-sdk-flutter-plugin-guide/ - environment: sdk: ">=2.12.0 <3.0.0" flutter: ">=1.20.0" - dependencies: flutter: sdk: flutter - dev_dependencies: flutter_test: sdk: flutter - flutter: plugin: platforms: