Skip to content

Commit 6b3b316

Browse files
Merge pull request #41 from mindbox-cloud/release/2.5.0-rc
Release/2.5.0 rc
2 parents 3610d80 + 3f072d9 commit 6b3b316

30 files changed

+376
-111
lines changed

mindbox/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.5.0-rc
2+
3+
This version of the SDK includes support for in-app messages. You will now be able to personalize your app by showing users appropriate campaigns based on their actions in the app, on the website, or purchases in retail stores.
4+
You can now launch in-app notifications for users from a certain city, region, or country or exclude the segment of users who should not see the in-app notification.
5+
You can also display in-app notifications when an API is called in your app. Display the message in a specific place in the app or when a user performs a specific action. Learn more in the guide.
6+
7+
Also in this release we added logging of important events in the sdk.
8+
19
## 2.2.0
210

311
* Fix issue when using Firebase onBackgroundMessage handler breaks android part of plugin

mindbox/lib/mindbox.dart

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export 'package:mindbox_platform_interface/mindbox_platform_interface.dart'
1010
MindboxNetworkError,
1111
MindboxInternalError,
1212
MindboxValidationError,
13-
MindboxServerError;
13+
MindboxServerError, LogLevel;
1414

1515
/// Basic Mindbox API.
1616
class Mindbox {
@@ -64,11 +64,30 @@ class Mindbox {
6464
MindboxPlatform.instance.getToken(callback: callback);
6565
}
6666

67+
/// Method for managing sdk logging
68+
void setLogLevel({required LogLevel logLevel}) {
69+
MindboxPlatform.instance.setLogLevel(logLevel: logLevel);
70+
}
71+
6772
/// Method for handling push-notification click.
6873
///
6974
/// Returns link from push-notification to callback.
70-
void onPushClickReceived(Function(String link, String payload) callback) {
71-
MindboxPlatform.instance.onPushClickReceived(callback: callback);
75+
void onPushClickReceived(PushClickHandler handler) {
76+
MindboxPlatform.instance.onPushClickReceived(handler: handler);
77+
}
78+
79+
/// Method for handling In-app click.
80+
///
81+
/// Returns id, redirectUrl and payload from In-app to callback.
82+
void onInAppClickRecieved(InAppClickHandler handler) {
83+
MindboxPlatform.instance.onInAppClickRecieved(handler: handler);
84+
}
85+
86+
/// Method for handling In-app dismiss.
87+
///
88+
/// Returns id when In-app dismiss to callback.
89+
void onInAppDismissed(InAppDismissedHandler handler) {
90+
MindboxPlatform.instance.onInAppismissed(handler: handler);
7291
}
7392

7493
/// Method for register a custom event.

mindbox/pubspec.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: mindbox
22
description: Flutter Mindbox SDK. Plugin wrapper over of Mindbox iOS/Android SDK.
3-
version: 2.2.0
3+
version: 2.5.0-rc
44
homepage: https://mindbox.cloud/
5-
repository: https://github.com/mindbox-moscow/flutter-sdk/tree/master/mindbox
5+
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox
6+
documentation: https://developers.mindbox.ru/docs/flutter-sdk-integration
67

78
environment:
89
sdk: ">=2.12.0 <3.0.0"
@@ -19,11 +20,11 @@ flutter:
1920
dependencies:
2021
flutter:
2122
sdk: flutter
22-
mindbox_android: ^2.2.0
23-
mindbox_ios: ^2.1.3
24-
mindbox_platform_interface: ^2.1.1
23+
mindbox_android: ^2.5.0-rc
24+
mindbox_ios: ^2.5.0-rc
25+
mindbox_platform_interface: ^2.2.0
2526

2627
dev_dependencies:
2728
flutter_test:
2829
sdk: flutter
29-
flutter_lints: ^2.0.1
30+
flutter_lints: ^2.0.1

mindbox/test/mindbox_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ class StubMindboxPlatform extends MindboxPlatform {
103103

104104
@override
105105
void onPushClickReceived({
106-
required Function(String url, String payload) callback,
106+
required PushClickHandler handler,
107107
}) {
108-
callback('dummy-url', 'dummy-payload');
108+
handler('dummy-url', 'dummy-payload');
109109
}
110110
}

mindbox_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.5.0-rc
2+
3+
* Upgrade native SDK dependency to v2.5.0.
4+
* Add new methods for In-app functionality support
5+
16
## 2.2.0
27

38
* Fix issue when using Firebase onBackgroundMessage handler breaks plugin

mindbox_android/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ android {
4949

5050
dependencies {
5151
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
52-
implementation 'cloud.mindbox:mobile-sdk:2.1.10'
52+
implementation 'cloud.mindbox:mobile-sdk:2.5.0'
5353
}

mindbox_android/android/src/main/kotlin/cloud/mindbox/mindbox_android/MindboxAndroidPlugin.kt

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import android.os.Looper
77
import androidx.annotation.NonNull
88
import cloud.mindbox.mobile_sdk.Mindbox
99
import cloud.mindbox.mobile_sdk.MindboxConfiguration
10+
import cloud.mindbox.mobile_sdk.inapp.presentation.InAppCallback
11+
import cloud.mindbox.mobile_sdk.logger.Level
1012
import io.flutter.embedding.engine.plugins.FlutterPlugin
1113
import io.flutter.embedding.engine.plugins.activity.ActivityAware
1214
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
@@ -22,24 +24,28 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, Ne
2224
private var binding: ActivityPluginBinding? = null
2325
private var deviceUuidSubscription: String? = null
2426
private var tokenSubscription: String? = null
25-
lateinit var channel: MethodChannel
27+
private lateinit var channel: MethodChannel
2628

27-
companion object {
28-
@Deprecated(
29-
"Push clicks are processed inside the library now. This method will be removed in future release." +
30-
" Please abort changes you make following points 3.3 and 5 of Mindbox API intructions",
31-
level = DeprecationLevel.WARNING
32-
)
33-
fun pushClicked(link: String, payload: String) {
29+
inner class InAppCallbackImpl : InAppCallback {
30+
override fun onInAppClick(id: String, redirectUrl: String, payload: String) {
31+
Handler(Looper.getMainLooper()).post {
32+
channel.invokeMethod("onInAppClick", listOf(id, redirectUrl, payload))
33+
}
34+
}
35+
36+
override fun onInAppDismissed(id: String) {
37+
Handler(Looper.getMainLooper()).post {
38+
channel.invokeMethod("onInAppDismissed", id)
39+
}
3440
}
3541
}
3642

37-
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
43+
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
3844
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "mindbox.cloud/flutter-sdk")
3945
channel.setMethodCallHandler(this)
4046
}
4147

42-
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
48+
override fun onMethodCall(call: MethodCall, result: Result) {
4349
when (call.method) {
4450
"getSdkVersion" -> {
4551
result.success(Mindbox.getSdkVersion())
@@ -60,6 +66,7 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, Ne
6066
.shouldCreateCustomer(shouldCreateCustomer)
6167
.build()
6268
Mindbox.init(context, config, listOf())
69+
Mindbox.registerInAppCallback(InAppCallbackImpl())
6370
result.success("initialized")
6471
} else {
6572
result.error("-1", "Initialization error", "Wrong argument type")
@@ -107,13 +114,24 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, Ne
107114
})
108115
}
109116
}
117+
"setLogLevel" -> {
118+
if(call.arguments is Int)
119+
{
120+
val logIndex: Int = call.arguments as Int
121+
val logLevel : Level = Level.values()[logIndex]
122+
Mindbox.setLogLevel(logLevel)
123+
result.success(0)
124+
} else {
125+
result.error("-1", "Initialization error", "Wrong argument type")
126+
}
127+
}
110128
else -> {
111129
result.notImplemented()
112130
}
113131
}
114132
}
115133

116-
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
134+
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
117135
channel.setMethodCallHandler(null)
118136
}
119137

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

mindbox_android/lib/src/mindbox_android_platform.dart

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,30 @@ class MindboxAndroidPlatform extends MindboxPlatform {
3737
_methodHandler.getToken(callback: callback);
3838
}
3939

40+
/// Method for managing sdk logging
41+
@override
42+
void setLogLevel({required LogLevel logLevel}) {
43+
_methodHandler.setLogLevel(logLevel: logLevel);
44+
}
45+
4046
/// Returns link from push to callback.
4147
@override
4248
void onPushClickReceived({
43-
required Function(String link, String payload) callback,
49+
required PushClickHandler handler,
4450
}) {
45-
_methodHandler.handlePushClick(callback: callback);
51+
_methodHandler.handlePushClick(handler: handler);
52+
}
53+
54+
/// Returns id, redirectUrl and payload from In-app to callback.
55+
@override
56+
void onInAppClickRecieved({required InAppClickHandler handler}) {
57+
_methodHandler.handleInAppClick(handler: handler);
58+
}
59+
60+
/// Returns id from In-app to callback.
61+
@override
62+
void onInAppismissed({required InAppDismissedHandler handler}) {
63+
_methodHandler.handleInAppDismiss(handler: handler);
4664
}
4765

4866
/// Method for register a custom event.

mindbox_android/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: mindbox_android
22
description: The implementation of 'mindbox' plugin for the Android platform.
3-
version: 2.2.0
3+
version: 2.5.0-rc
44
homepage: https://mindbox.cloud/
5-
repository: https://github.com/mindbox-moscow/flutter-sdk/tree/master/mindbox_android
5+
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_android
66

77
environment:
88
sdk: ">=2.12.0 <3.0.0"
@@ -19,9 +19,9 @@ flutter:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
mindbox_platform_interface: ^2.1.1
22+
mindbox_platform_interface: ^2.2.0
2323

2424
dev_dependencies:
2525
flutter_test:
2626
sdk: flutter
27-
flutter_lints: ^2.0.1
27+
flutter_lints: ^2.0.1

0 commit comments

Comments
 (0)