Skip to content

Commit 60837b5

Browse files
2 parents 71c2d3d + 3e9a674 commit 60837b5

28 files changed

+660
-310
lines changed

.github/workflows/analyze_and_test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: analyze_and_test
22

33
on:
44
pull_request:
5-
branches: [ master ]
5+
branches: [ develop ]
66

77
jobs:
88

@@ -28,4 +28,3 @@ jobs:
2828
- run: cd ${{ matrix.package }} && flutter pub get
2929
- run: cd ${{ matrix.package }} && flutter analyze
3030
- run: cd ${{ matrix.package }} && flutter test
31-

.github/workflows/publish.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,7 @@ on:
66
- master
77

88
jobs:
9-
10-
flutter_test:
11-
name: ${{ matrix.package }} running analyze and tests
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
package:
16-
- 'mindbox'
17-
- 'mindbox_android'
18-
- 'mindbox_ios'
19-
- 'mindbox_platform_interface'
20-
fail-fast: false
21-
steps:
22-
- uses: actions/checkout@v2
23-
- uses: actions/setup-java@v1
24-
with:
25-
java-version: "12.x"
26-
- uses: subosito/flutter-action@v1
27-
with:
28-
channel: "stable"
29-
- run: cd ${{ matrix.package }} && flutter pub get
30-
- run: cd ${{ matrix.package }} && flutter analyze
31-
- run: cd ${{ matrix.package }} && flutter test
32-
339
publish:
34-
needs: [flutter_test]
3510
timeout-minutes: 4
3611
runs-on: ubuntu-latest
3712
name: ${{ matrix.package }} publishing

mindbox/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.2.0
2+
3+
* Add execute async operation.
4+
5+
16
## 0.1.0
27

38
* Initial release.

mindbox/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Pub Version](https://img.shields.io/pub/v/mindbox?color=blue)](https://pub.dev/packages/mindbox)
2+
13
This plugin is a wrapper over the native Mindbox([iOS](https://github.com/mindbox-moscow/ios-sdk),
24
[Android](https://github.com/mindbox-moscow/android-sdk)) libraries that allows to
35
receive and handle push notifications.
@@ -74,4 +76,13 @@ Mindbox.instance.getDeviceUUID((uuid) {
7476
_deviceUUID = uuid;
7577
});
7678
});
79+
```
80+
81+
### Execute async operation
82+
83+
```dart
84+
Mindbox.instance.executeAsyncOperation(
85+
operationSystemName: 'operationName',
86+
operationBody: {},
87+
);
7788
```

mindbox/lib/mindbox.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,15 @@ class Mindbox {
6161
void onPushClickReceived(Function(String link) callback) {
6262
MindboxPlatform.instance.onPushClickReceived(callback: callback);
6363
}
64+
65+
/// Method for register a custom event.
66+
void executeAsyncOperation({
67+
required String operationSystemName,
68+
required Map<String, dynamic> operationBody,
69+
}) async {
70+
MindboxPlatform.instance.executeAsyncOperation(
71+
operationSystemName: operationSystemName,
72+
operationBody: operationBody,
73+
);
74+
}
6475
}

mindbox/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mindbox
22
description: Flutter Mindbox SDK.
3-
version: 0.1.0
3+
version: 0.2.0
44
homepage: https://mindbox.cloud/
55
repository: https://github.com/mindbox-moscow/flutter-sdk/tree/master/mindbox
66

@@ -19,9 +19,9 @@ flutter:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
mindbox_android: ^0.1.0
23-
mindbox_ios: ^0.1.0
24-
mindbox_platform_interface: ^0.1.0
22+
mindbox_android: ^0.2.0
23+
mindbox_ios: ^0.2.0
24+
mindbox_platform_interface: ^0.2.0
2525

2626
dev_dependencies:
2727
flutter_test:

mindbox_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.2.0
2+
3+
* Add execute async operation.
4+
5+
16
## 0.1.0
27

38
* Initial release.

mindbox_android/android/build.gradle

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

4949
dependencies {
5050
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
51-
implementation "cloud.mindbox:mobile-sdk:1.2.0"
51+
implementation 'cloud.mindbox:mobile-sdk:1.2.3'
5252
}

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

Lines changed: 8 additions & 1 deletion
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.models.MindboxError
11+
import cloud.mindbox.mobile_sdk.models.operation.response.OperationResponse
1012
import io.flutter.Log
1113

1214
import io.flutter.embedding.engine.plugins.FlutterPlugin
@@ -57,7 +59,6 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
5759
.shouldCreateCustomer(shouldCreateCustomer)
5860
.build()
5961
try {
60-
// Android SDK validation doesn't work
6162
Mindbox.init(context, config)
6263
result.success("initialized")
6364
} catch (e: Exception) {
@@ -77,6 +78,12 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
7778
result.success(token)
7879
}
7980
}
81+
"executeAsyncOperation" -> {
82+
if (call.arguments is List<*>) {
83+
val args = call.arguments as List<*>
84+
Mindbox.executeAsyncOperation(context, args[0] as String, args[1] as String)
85+
}
86+
}
8087
else -> {
8188
result.notImplemented()
8289
}

mindbox_android/lib/src/mindbox_android_platform.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,16 @@ class MindboxAndroidPlatform extends MindboxPlatform {
3939
void onPushClickReceived({required Function(String link) callback}) {
4040
_methodHandler.handlePushClick(callback: callback);
4141
}
42+
43+
/// Method for register a custom event.
44+
@override
45+
Future<void> executeAsyncOperation({
46+
required String operationSystemName,
47+
required Map<String, dynamic> operationBody,
48+
}) async {
49+
_methodHandler.executeAsyncOperation(
50+
operationSystemName: operationSystemName,
51+
operationBody: operationBody,
52+
);
53+
}
4254
}

0 commit comments

Comments
 (0)