Skip to content
Open
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
15 changes: 6 additions & 9 deletions example/flutter_example/lib/view_model/view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:mindbox/mindbox.dart';
import 'package:permission_handler/permission_handler.dart';

class ViewModel {

//https://developers.mindbox.ru/docs/%D0%BC%D0%B5%D1%82%D0%BE%D0%B4%D1%8B-flutter-sdk
static syncOperation() {
Mindbox.instance.executeSyncOperation(
Expand Down Expand Up @@ -34,17 +33,14 @@ class ViewModel {
//used for send action "notification center was opened"
static asyncOperationNCOpen() {
Mindbox.instance.executeAsyncOperation(
operationSystemName: "mobileapp.NCOpen",
operationBody: {}
);
operationSystemName: "mobileapp.NCOpen", operationBody: {});
}

//used for send action "click on push from notification center"
static asyncOperationNCPushOpen(String pushName, String pushDate) {
Mindbox.instance.executeAsyncOperation(
operationSystemName: "mobileapp.NCPushOpen",
operationBody: getPushOpenOperationBody(pushName, pushDate)
);
operationBody: getPushOpenOperationBody(pushName, pushDate));
}

static getSDKVersion(Function complition) {
Expand All @@ -70,8 +66,8 @@ class ViewModel {
var status = await Permission.notification.status;
if (!status.isGranted) {
status = await Permission.notification.request();
Mindbox.instance.updateNotificationPermissionStatus(
granted: status.isGranted);
Mindbox.instance
.updateNotificationPermissionStatus(granted: status.isGranted);
}
}

Expand Down Expand Up @@ -103,7 +99,8 @@ class ViewModel {
}
}

static Map<String, dynamic> getPushOpenOperationBody(String pushName, String pushDate) {
static Map<String, dynamic> getPushOpenOperationBody(
String pushName, String pushDate) {
return {
"data": {
"customerAction": {
Expand Down
5 changes: 5 additions & 0 deletions mindbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.14.3

* Upgrade native Android SDK dependency to v2.14.4.
* Upgrade native iOS SDK dependency to v2.14.4.

## 2.14.2

* Upgrade native Android SDK dependency to v2.14.3.
Expand Down
24 changes: 14 additions & 10 deletions mindbox/lib/mindbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,24 @@ class Mindbox {
MindboxPlatform.instance.registerInAppCallbacks(inAppCallbacks: callbacks);
}

/// Updates the notification permission status.
/// This method is kept for backward compatibility. The `granted` argument is ignored.
///
/// The [granted] parameter specifies whether the permission for notifications
/// has been granted:
///
/// - `true` indicates that the user has granted permission.
/// - `false` indicates that the user has denied permission.
/// The SDK reads the current system authorization status and, if it differs
/// from the last known value, sends an update to the backend.
@Deprecated('Use `refreshNotificationPermissionStatus` instead')
void updateNotificationPermissionStatus({required bool granted}) {
MindboxPlatform.instance.refreshNotificationPermissionStatus();
}

/// Checks the current system authorization status for push notifications
/// and reports any changes to Mindbox.
///
/// Example usage:
/// ```dart
/// Mindbox.instance.updateNotificationPermissionStatus(granted: true);
void updateNotificationPermissionStatus({required bool granted}) {
MindboxPlatform.instance
.updateNotificationPermissionStatus(granted: granted);
/// Mindbox.instance.refreshNotificationPermissionStatus();
/// ```
void refreshNotificationPermissionStatus() {
MindboxPlatform.instance.refreshNotificationPermissionStatus();
}

/// Writes a log message to the native Mindbox logging system.
Expand Down
8 changes: 4 additions & 4 deletions mindbox/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mindbox
description: Flutter Mindbox SDK. Plugin wrapper over of Mindbox iOS/Android SDK.
version: 2.14.2
version: 2.14.3
homepage: https://mindbox.cloud/
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox
documentation: https://developers.mindbox.ru/docs/flutter-sdk-integration
Expand All @@ -20,9 +20,9 @@ flutter:
dependencies:
flutter:
sdk: flutter
mindbox_android: ^2.14.2
mindbox_ios: ^2.14.2
mindbox_platform_interface: ^2.14.2
mindbox_android: ^2.14.3
mindbox_ios: ^2.14.3
mindbox_platform_interface: ^2.14.3

dev_dependencies:
flutter_test:
Expand Down
4 changes: 4 additions & 0 deletions mindbox_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.14.3

* Upgrade native Android SDK dependency to v2.14.4.

## 2.14.2

* Upgrade native Android SDK dependency to v2.14.3.
Expand Down
2 changes: 1 addition & 1 deletion mindbox_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'cloud.mindbox:mobile-sdk:2.14.3'
api 'cloud.mindbox:mobile-sdk:2.14.4'
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class MindboxAndroidPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, Ne
}
}
}
"updateNotificationPermissionStatus" -> {

"refreshNotificationPermissionStatus" -> {
Mindbox.updateNotificationPermissionStatus(context = context)
}

Expand Down
4 changes: 2 additions & 2 deletions mindbox_android/lib/src/mindbox_android_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class MindboxAndroidPlatform extends MindboxPlatform {

// Method for to send notification permission status
@override
void updateNotificationPermissionStatus({required bool granted}) {
_methodHandler.updateNotificationPermissionStatus(granted: granted);
void refreshNotificationPermissionStatus() {
_methodHandler.refreshNotificationPermissionStatus();
}

@override
Expand Down
4 changes: 2 additions & 2 deletions mindbox_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mindbox_android
description: The implementation of 'mindbox' plugin for the Android platform.
version: 2.14.2
version: 2.14.3
homepage: https://mindbox.cloud/
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_android

Expand All @@ -19,7 +19,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
mindbox_platform_interface: ^2.14.2
mindbox_platform_interface: ^2.14.3

dev_dependencies:
flutter_test:
Expand Down
4 changes: 4 additions & 0 deletions mindbox_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.14.3

* Upgrade native iOS SDK dependency to v2.14.4.

## 2.14.2

* Upgrade native iOS SDK dependency to v2.14.3.
Expand Down
8 changes: 3 additions & 5 deletions mindbox_ios/ios/Classes/SwiftMindboxIosPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,9 @@ public class SwiftMindboxIosPlugin: NSObject, FlutterPlugin {
} else {
Mindbox.logger.log(level: .info, message: "Use default callback")
}
case "updateNotificationPermissionStatus":
guard let granted = call.arguments as? Bool else {
return
}
Mindbox.shared.notificationsRequestAuthorization(granted: granted)

case "refreshNotificationPermissionStatus":
Mindbox.shared.refreshNotificationPermissionStatus()

case "writeNativeLog":
guard let args = call.arguments as? [Any], args.count >= 2 else {
Expand Down
6 changes: 3 additions & 3 deletions mindbox_ios/ios/mindbox_ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'mindbox_ios'
s.version = '2.14.3'
s.version = '2.14.4'
s.summary = 'Mindbox Flutter SDK'
s.description = <<-DESC
The implementation of 'mindbox' plugin for the iOS platform
Expand All @@ -15,8 +15,8 @@ The implementation of 'mindbox' plugin for the iOS platform
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'Mindbox', '2.14.3'
s.dependency 'MindboxNotifications', '2.14.3'
s.dependency 'Mindbox', '2.14.4'
s.dependency 'MindboxNotifications', '2.14.4'
s.platform = :ios, '12.0'

# Flutter.framework does not contain a i386 slice.
Expand Down
4 changes: 2 additions & 2 deletions mindbox_ios/lib/src/mindbox_ios_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class MindboxIosPlatform extends MindboxPlatform {

// Method for to send notification permission status
@override
void updateNotificationPermissionStatus({required bool granted}) {
_methodHandler.updateNotificationPermissionStatus(granted: granted);
void refreshNotificationPermissionStatus() {
_methodHandler.refreshNotificationPermissionStatus();
}

/// Writes a log message to the native Mindbox logging system.
Expand Down
4 changes: 2 additions & 2 deletions mindbox_ios/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mindbox_ios
description: The implementation of 'mindbox' plugin for the iOS platform.
version: 2.14.2
version: 2.14.3
homepage: https://mindbox.cloud/
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_ios

Expand All @@ -18,7 +18,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
mindbox_platform_interface: ^2.14.2
mindbox_platform_interface: ^2.14.3

dev_dependencies:
flutter_test:
Expand Down
5 changes: 5 additions & 0 deletions mindbox_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.14.3

* Upgrade native Android SDK dependency to v2.14.4.
* Upgrade native iOS SDK dependency to v2.14.4.

## 2.14.2

* Upgrade native Android SDK dependency to v2.14.3.
Expand Down
5 changes: 2 additions & 3 deletions mindbox_platform_interface/lib/src/mindbox_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ abstract class MindboxPlatform {
'setLogLevel() has not been implemented.');

/// Method for sending notification permission status
void updateNotificationPermissionStatus({required bool granted}) =>
throw UnimplementedError(
'updateNotificationPermissionStatus() has not been implemented');
void refreshNotificationPermissionStatus() => throw UnimplementedError(
'refreshNotificationPermissionStatus() has not been implemented');

/// Writes a log message to the native Mindbox logging system.
void writeNativeLog({required String message, required LogLevel logLevel}) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class MindboxMethodHandler {
}

/// Method for sending notification permission status
void updateNotificationPermissionStatus({required bool granted}) async {
await channel.invokeMethod('updateNotificationPermissionStatus', granted);
void refreshNotificationPermissionStatus() async {
await channel.invokeMethod('refreshNotificationPermissionStatus');
}

/// Method for registers a list of InAppCallback instances to handle clicks
Expand Down
2 changes: 1 addition & 1 deletion mindbox_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mindbox_platform_interface
description: Mindbox platform interface.
version: 2.14.2
version: 2.14.3
homepage: https://mindbox.cloud/
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_platform_interface

Expand Down