Skip to content

Commit

Permalink
Merge pull request #223 from urbanairship/release-8.0.0
Browse files Browse the repository at this point in the history
Release 8.0.0
  • Loading branch information
crow authored Oct 25, 2024
2 parents 701885e + 32b8c5c commit 23ef113
Show file tree
Hide file tree
Showing 17 changed files with 112 additions and 115 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Flutter Plugin Changelog

## Version 8.0.0 - October 24, 2024

Major version that makes it easier to include Airship in a hybrid app. The only breaking change is when extending the AirshipPluginExtender protocol on java there is a new extendConfig(Contex, AirshipConfigOptions.Builder) method to implement. Most application will not be affected.

### Changes

- Added new methods to the plugin extender to make hybrid app integrations easier

## Version 7.9.0 - October 20, 2024

Minor version release with several new features including: iOS Live Activities, Android Live Updates, Message Center improvements, and iOS notification service extension support in the iOS example project.
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
ext.kotlin_version = '1.9.0'
ext.coroutine_version = '1.5.2'
ext.datastore_preferences_version = '1.1.1'
ext.airship_framework_proxy_version = '10.1.1'
ext.airship_framework_proxy_version = '11.0.0'


repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package com.airship.flutter

class AirshipPluginVersion {
companion object {
const val AIRSHIP_PLUGIN_VERSION = "7.9.0"
const val AIRSHIP_PLUGIN_VERSION = "8.0.0"
}
}
3 changes: 3 additions & 0 deletions ios/Classes/AirshipAutopilot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class AirshipAutopilot: NSObject {
@MainActor @objc
public func onLoad(launchOptions: [UIApplication.LaunchOptionsKey : Any]?) {
self.launchOptions = launchOptions
/// Set Airship Proxy Delegate on Airship Autopilot
AirshipProxy.shared.delegate = self

try? AirshipProxy.shared.attemptTakeOff(launchOptions: launchOptions)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/AirshipPluginVersion.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation

class AirshipPluginVersion {
static let pluginVersion = "7.9.0"
static let pluginVersion = "8.0.0"
}
4 changes: 2 additions & 2 deletions ios/airship_flutter.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

AIRSHIP_FLUTTER_VERSION="7.9.0"
AIRSHIP_FLUTTER_VERSION="8.0.0"

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
Expand All @@ -20,6 +20,6 @@ Airship flutter plugin.
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.ios.deployment_target = "14.0"
s.dependency "AirshipFrameworkProxy", "10.1.1"
s.dependency "AirshipFrameworkProxy", "11.0.0"
end

97 changes: 41 additions & 56 deletions lib/src/airship_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'feature.dart';
import 'airship_utils.dart';

class AirshipConfig {

/// Default environment.
final ConfigEnvironment? defaultEnvironment;

Expand Down Expand Up @@ -54,24 +53,25 @@ class AirshipConfig {
/// Android config.
final AndroidConfig? androidConfig;

AirshipConfig({this.defaultEnvironment,
this.developmentEnvironment,
this.productionEnvironment,
this.site,
this.inProduction,
this.urlAllowList,
this.urlAllowListScopeOpenUrl,
this.urlAllowListScopeJavaScriptInterface,
this.isChannelCreationDelayEnabled,
this.initialConfigUrl,
this.enabledFeatures,
this.isChannelCaptureEnabled,
this.suppressAllowListError,
this.autoPauseInAppAutomationOnLaunch,
this.iosConfig,
this.androidConfig});

Map<String, dynamic> toJson() {
AirshipConfig(
{this.defaultEnvironment,
this.developmentEnvironment,
this.productionEnvironment,
this.site,
this.inProduction,
this.urlAllowList,
this.urlAllowListScopeOpenUrl,
this.urlAllowListScopeJavaScriptInterface,
this.isChannelCreationDelayEnabled,
this.initialConfigUrl,
this.enabledFeatures,
this.isChannelCaptureEnabled,
this.suppressAllowListError,
this.autoPauseInAppAutomationOnLaunch,
this.iosConfig,
this.androidConfig});

Map<String, Object?> toJson() {
return {
"default": defaultEnvironment?._toJson(),
"development": developmentEnvironment?._toJson(),
Expand All @@ -80,11 +80,13 @@ class AirshipConfig {
"inProduction": inProduction,
"urlAllowList": urlAllowList,
"urlAllowListScopeOpenUrl": urlAllowListScopeOpenUrl,
"urlAllowListScopeJavaScriptInterface": urlAllowListScopeJavaScriptInterface,
"urlAllowListScopeJavaScriptInterface":
urlAllowListScopeJavaScriptInterface,
"isChannelCreationDelayEnabled": isChannelCreationDelayEnabled,
"initialConfigUrl": initialConfigUrl,
"enabledFeatures": enabledFeatures == null ? null : AirshipUtils
.toFeatureStringList(enabledFeatures!),
"enabledFeatures": enabledFeatures == null
? null
: AirshipUtils.toFeatureStringList(enabledFeatures!),
"isChannelCaptureEnabled": isChannelCaptureEnabled,
"autoPauseInAppAutomationOnLaunch": autoPauseInAppAutomationOnLaunch,
"ios": iosConfig?._toJson(),
Expand All @@ -94,15 +96,15 @@ class AirshipConfig {
}

class ConfigEnvironment {

final String appKey;
final String appSecret;
final LogLevel? logLevel;
final IOSEnvironment? ios;

ConfigEnvironment({required this.appKey, required this.appSecret, this.logLevel, this.ios});
ConfigEnvironment(
{required this.appKey, required this.appSecret, this.logLevel, this.ios});

Map<String, dynamic> _toJson() {
Map<String, Object?> _toJson() {
return {
"appKey": appKey,
"appSecret": appSecret,
Expand All @@ -117,42 +119,25 @@ class IOSEnvironment {

IOSEnvironment({this.logPrivacyLevel});

Map<String, dynamic> _toJson() {
return {
"logPrivacyLevel": logPrivacyLevel?.name
};
Map<String, Object?> _toJson() {
return {"logPrivacyLevel": logPrivacyLevel?.name};
}
}

enum AirshipLogPrivacyLevel {
private,
public
}
enum AirshipLogPrivacyLevel { private, public }

enum LogLevel {
verbose,
debug,
info,
warning,
error,
none
}
enum LogLevel { verbose, debug, info, warning, error, none }

enum Site {
us,
eu
}
enum Site { us, eu }

class IOSConfig {
/// iTunes ID for rate app and App Store deep links.
final String? iTunesId;

IOSConfig({this.iTunesId});

Map<String, dynamic> _toJson() {
return {
"iTunesId": iTunesId
};
Map<String, Object?> _toJson() {
return {"iTunesId": iTunesId};
}
}

Expand All @@ -166,10 +151,10 @@ class AndroidConfig {
/// Notification config.
final AndroidNotificationConfig? notificationConfig;

AndroidConfig({this.appStoreUri, this.fcmFirebaseAppName,
this.notificationConfig});
AndroidConfig(
{this.appStoreUri, this.fcmFirebaseAppName, this.notificationConfig});

Map<String, dynamic> _toJson() {
Map<String, Object?> _toJson() {
return {
"appStoreUri": appStoreUri,
"fcmFirebaseAppName": fcmFirebaseAppName,
Expand All @@ -191,15 +176,15 @@ class AndroidNotificationConfig {
/// The accent color. Must be a hex value #AARRGGBB.
final String? accentColor;

AndroidNotificationConfig({this.icon, this.largeIcon, this.defaultChannelId,
this.accentColor});
AndroidNotificationConfig(
{this.icon, this.largeIcon, this.defaultChannelId, this.accentColor});

Map<String, dynamic> _toJson() {
Map<String, Object?> _toJson() {
return {
"icon": icon,
"largeIcon": largeIcon,
"defaultChannelId": defaultChannelId,
"accentColor": accentColor
};
}
}
}
6 changes: 3 additions & 3 deletions lib/src/airship_embedded_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class AirshipEmbeddedViewState extends State<AirshipEmbeddedView>
UiKitView(
viewType: 'com.airship.flutter/EmbeddedView',
onPlatformViewCreated: _onPlatformViewCreated,
creationParams: <String, dynamic>{
creationParams: <String, Object?>{
'embeddedId': widget.embeddedId,
},
creationParamsCodec: const StandardMessageCodec(),
Expand Down Expand Up @@ -135,7 +135,7 @@ class AirshipEmbeddedViewState extends State<AirshipEmbeddedView>
id: params.id,
viewType: 'com.airship.flutter/EmbeddedView',
layoutDirection: TextDirection.ltr,
creationParams: <String, dynamic>{
creationParams: <String, Object?>{
'embeddedId': widget.embeddedId,
},
creationParamsCodec: const StandardMessageCodec(),
Expand All @@ -151,7 +151,7 @@ class AirshipEmbeddedViewState extends State<AirshipEmbeddedView>
return wrapWithLayoutBuilder(AndroidView(
viewType: 'com.airship.flutter/EmbeddedView',
onPlatformViewCreated: _onPlatformViewCreated,
creationParams: <String, dynamic>{
creationParams: <String, Object?>{
'embeddedId': widget.embeddedId,
},
creationParamsCodec: const StandardMessageCodec(),
Expand Down
23 changes: 12 additions & 11 deletions lib/src/airship_feature_flag_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ import 'dart:convert';

/// Feature flag manager
class AirshipFeatureFlagManager {

final AirshipModule _module;

AirshipFeatureFlagManager(AirshipModule module) : _module = module;

/// Gets and evaluates a feature flag with the given [name].
Future<FeatureFlag> flag(String name) async {
var featureFlag = await _module.channel.invokeMethod("featureFlagManager#flag", name);
var featureFlag =
await _module.channel.invokeMethod("featureFlagManager#flag", name);
return FeatureFlag._fromJson(featureFlag);
}

/// Tracks interaction with feature flag
/// Tracks interaction with feature flag
Future<void> trackInteraction(FeatureFlag flag) async {
return await _module.channel.invokeMethod("featureFlagManager#trackInteraction", flag.toJSON());
return await _module.channel
.invokeMethod("featureFlagManager#trackInteraction", flag.toJSON());
}
}


/// Airship feature flag object.
class FeatureFlag {
static const IS_ELIGIBLE = "isEligible";
Expand All @@ -38,17 +38,18 @@ class FeatureFlag {
final bool exists;

/// Optional variables associated with the flag.
final Map<String, dynamic>? variables;
final Map<String, Object?>? variables;

const FeatureFlag._internal(this.original, this.isEligible, this.exists, this.variables);
const FeatureFlag._internal(
this.original, this.isEligible, this.exists, this.variables);

static FeatureFlag _fromJson(dynamic json) {
var isEligible = json[IS_ELIGIBLE];
var exists = json[EXISTS];

Map<String, dynamic>? variables;
Map<String, Object?>? variables;
if (json[VARIABLES] != null) {
variables = Map<String, dynamic>.from(json[VARIABLES]);
variables = Map<String, Object?>.from(json[VARIABLES]);
}

var original = json[ORIGINAL];
Expand All @@ -57,7 +58,7 @@ class FeatureFlag {
}

String toJSON() {
final Map<String, dynamic> data = {
final Map<String, Object?> data = {
IS_ELIGIBLE: isEligible,
EXISTS: exists,
VARIABLES: variables,
Expand All @@ -70,4 +71,4 @@ class FeatureFlag {
String toString() {
return "FeatureFlag($ORIGINAL=$original, $IS_ELIGIBLE=$isEligible, $EXISTS=$exists, $VARIABLES=$variables)";
}
}
}
11 changes: 2 additions & 9 deletions lib/src/airship_live_update_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@ class AirshipLiveUpdateManager {
Future<List<LiveUpdate>> list(LiveUpdateListRequest request) async {
var response =
await _module.channel.invokeMethod('liveUpdate#list', request.toJson());
return (response as List<dynamic>)
.map((e) => LiveUpdate.fromJson(e as Map<String, dynamic>))
return (response as List<Object?>)
.map((e) => LiveUpdate.fromJson(e as Map<String, Object?>))
.toList();
}

/// Lists all Live Updates.
/// @returns A Future with the result.
// Future<List<LiveUpdate>> listAll() async {
// var response = await _module.channel.invokeMethod('liveUpdate#listAll');
// return (response as List<dynamic>)
// .map((e) => LiveUpdate.fromJson(e as Map<String, dynamic>))
// .toList();
// }

Future<List<LiveUpdate>> listAll() async {
try {
final result = await _module.channel.invokeMethod('liveUpdate#listAll');
Expand Down
2 changes: 1 addition & 1 deletion lib/src/airship_push.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AirshipPush {
/// Returns a Future with the permission result. The result may be null if the operation fails.
Future<bool?> enableUserNotifications(
{EnableUserPushNotificationsArgs? options}) async {
final Map<String, dynamic> arguments = options?.toJson() ?? {};
final Map<String, Object?> arguments = options?.toJson() ?? {};
return await _module.channel
.invokeMethod('push#enableUserNotifications', arguments);
}
Expand Down
12 changes: 9 additions & 3 deletions lib/src/custom_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ class CustomEvent {
final String? interactionType;

/// The event properties.
final Map<String, dynamic>? properties;
final Map<String, Object?>? properties;

CustomEvent({required this.name, this.value, this.transactionId, this.interactionId, this.interactionType, this.properties});
CustomEvent(
{required this.name,
this.value,
this.transactionId,
this.interactionId,
this.interactionType,
this.properties});

Map<String, dynamic> toJSON() {
Map<String, Object?> toJSON() {
return {
EVENT_NAME: name,
EVENT_VALUE: value,
Expand Down
Loading

0 comments on commit 23ef113

Please sign in to comment.