Skip to content

Commit

Permalink
Refactor const variables to Class AppConstants
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoSMarques committed Mar 18, 2024
1 parent 3e9ad00 commit 1de0355
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 6 additions & 0 deletions lib/src/constants.dart
@@ -0,0 +1,6 @@
class AppConstants {
AppConstants._internal();
static const PLUGIN_VERSION = "7.2.0";
static const MESSAGE_CHANNEL = 'flutter_branch_sdk/message';
static const EVENT_CHANNEL = 'flutter_branch_sdk/event';
}
13 changes: 4 additions & 9 deletions lib/src/flutter_branch_sdk_method_channel.dart
Expand Up @@ -2,20 +2,17 @@ import 'dart:io';

import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_branch_sdk/src/constants.dart';

import 'flutter_branch_sdk_platform_interface.dart';
import 'objects/app_tracking_transparency.dart';
import 'objects/branch_universal_object.dart';

/// An implementation of [FlutterBranchSdkPlatform] that uses method channels.
class FlutterBranchSdkMethodChannel implements FlutterBranchSdkPlatform {
static const PLUGIN_VERSION = "7.1.0";
static const MESSAGE_CHANNEL = 'flutter_branch_sdk/message';
static const EVENT_CHANNEL = 'flutter_branch_sdk/event';

/// The method channel used to interact with the native platform.
final messageChannel = const MethodChannel(MESSAGE_CHANNEL);
final eventChannel = const EventChannel(EVENT_CHANNEL);
final messageChannel = const MethodChannel(AppConstants.MESSAGE_CHANNEL);
final eventChannel = const EventChannel(AppConstants.EVENT_CHANNEL);

static Stream<Map<dynamic, dynamic>>? _initSessionStream;
static bool isInitialized = false;
Expand All @@ -33,7 +30,7 @@ class FlutterBranchSdkMethodChannel implements FlutterBranchSdkPlatform {
return;
}
await messageChannel.invokeMethod('init', {
'version': PLUGIN_VERSION,
'version': AppConstants.PLUGIN_VERSION,
'useTestKey': useTestKey,
'enableLogging': enableLogging,
'disableTracking': disableTracking
Expand All @@ -52,8 +49,6 @@ class FlutterBranchSdkMethodChannel implements FlutterBranchSdkPlatform {
///Add key value pairs to all requests
@override
void setRequestMetadata(String key, String value) {
//assert(!isInitialized,
// 'Call `setRequestMetadata` before `FlutterBranchSdk.init()` method');
messageChannel
.invokeMethod('setRequestMetadata', {'key': key, 'value': value});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/flutter_branch_sdk_web.dart
Expand Up @@ -47,7 +47,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform {
static bool _userIdentified = false;
static bool isInitialized = false;

///Listen click em Branch Deeplinks
///Listen click em Branch DeepLinks
@Deprecated('Use `listSession')
@override
Stream<Map<dynamic, dynamic>> initSession() {
Expand Down

0 comments on commit 1de0355

Please sign in to comment.