Skip to content
Merged
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
1 change: 1 addition & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Flutter Plugin Changelog

## Version 10.3.0 - May 1, 2025
Minor release that updates the Android SDK to 19.6.2 and the iOS SDK to 19.3.1 and fixes an Embedded View bug.

### Changes
- Updated Android SDK to [19.6.2](https://github.com/urbanairship/android-library/releases/tag/19.6.2)
- Updated iOS SDK to [19.3.1](https://github.com/urbanairship/ios-library/releases/tag/19.3.1)
- Added support for JSON attributes
- Added new method `Airship.channel.waitForChannelId()` that waits for the channel ID to be created
Comment thread
crow marked this conversation as resolved.
- Fixed bug in `Airship.inApp.isEmbeddedAvailableStream` that disrupted gated rendering of Embedded Views

## Version 10.2.0 - March 27, 2025

Minor release that updates the Android SDK to 19.4.0 and the iOS SDK to 19.1.1
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 = '13.3.0'
ext.airship_framework_proxy_version = '14.2.1'


repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class AirshipPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {

// Channel
"channel#getChannelId" -> result.resolve(scope, call) { proxy.channel.getChannelId() }
"channel#waitForChannelId" -> result.resolve(scope, call) { proxy.channel.waitForChannelId() }
"channel#addTags" -> result.resolve(scope, call) {
call.stringList().forEach {
proxy.channel.addTag(it)
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 = "10.2.0"
const val AIRSHIP_PLUGIN_VERSION = "10.3.0"
}
}
1 change: 1 addition & 0 deletions example/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
//
// Generated file. Do not edit.
//

import PackageDescription

let package = Package(
name: "FlutterGeneratedPluginSwiftPackage",
platforms: [
.iOS("16.1")
],
products: [
.library(name: "FlutterGeneratedPluginSwiftPackage", type: .static, targets: ["FlutterGeneratedPluginSwiftPackage"])
],
dependencies: [
.package(name: "airship_flutter", path: "/Users/david.crow/source/airship-flutter/ios/airship_flutter")
],
targets: [
.target(
name: "FlutterGeneratedPluginSwiftPackage",
dependencies: [
.product(name: "airship-flutter", package: "airship_flutter")
]
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//
// Generated file. Do not edit.
//

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ios/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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="10.2.0"
AIRSHIP_FLUTTER_VERSION="10.3.0"

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
Expand All @@ -19,7 +19,7 @@ Airship flutter plugin.
s.source_files = 'airship_flutter/Sources/airship_flutter/**/*'
s.dependency 'Flutter'
s.ios.deployment_target = "15.0"
s.dependency "AirshipFrameworkProxy", "13.3.0"
s.dependency "AirshipFrameworkProxy", "14.2.1"
s.swift_version = "5.0.0"
s.resource_bundles = {'airship_flutter_privacy' => ['airship_flutter/Sources/airship_flutter/PrivacyInfo.xcprivacy']}
end
Expand Down
8 changes: 4 additions & 4 deletions ios/airship_flutter/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ios/airship_flutter/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
.library( name: "airship-flutter", targets: ["airship_flutter"])
],
dependencies: [
.package(url: "https://github.com/urbanairship/airship-mobile-framework-proxy.git", from: "13.0.0")
.package(url: "https://github.com/urbanairship/airship-mobile-framework-proxy.git", from: "14.2.1")
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public class AirshipPlugin: NSObject, FlutterPlugin {
case "channel#getChannelId":
return try AirshipProxy.shared.channel.channelID

case "channel#waitForChannelId":
return try await AirshipProxy.shared.channel.waitForChannelID()

case "channel#addTags":
try AirshipProxy.shared.channel.addTags(
try call.requireStringArrayArg()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation

class AirshipPluginVersion {
static let pluginVersion = "10.2.0"
static let pluginVersion = "10.3.0"
}
8 changes: 8 additions & 0 deletions lib/src/airship_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ class AirshipChannel {
return await _module.channel.invokeMethod('channel#getChannelId');
}

/// Returns the channel ID. If the channel ID is not yet created the function it will wait for it before returning. After
/// the channel ID is created, this method functions the same as `identifier`.
///
/// @returns A future with the channel ID.
Future<String> waitForChannelId() async {
return await _module.channel.invokeMethod('channel#waitForChannelId');
}

/// Creates a [SubscriptionListEditor] to modify the subscription lists associated with the channel.
SubscriptionListEditor editSubscriptionLists() {
return SubscriptionListEditor("channel#editSubscriptionLists", _module.channel);
Expand Down
17 changes: 12 additions & 5 deletions lib/src/airship_embedded_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,24 @@ class AirshipEmbeddedViewState extends State<AirshipEmbeddedView>
with AutomaticKeepAliveClientMixin<AirshipEmbeddedView> {
late MethodChannel _channel;
late Stream<bool> _readyStream;
late final StreamSubscription<bool> _readySubscription;

bool? _isEmbeddedAvailable;

@override
void initState() {
super.initState();

// Get seed value once
_isEmbeddedAvailable =
Airship.inApp.isEmbeddedAvailable(embeddedId: widget.embeddedId);

// Then listen for changes
_readyStream =
Airship.inApp.isEmbeddedAvailableStream(embeddedId: widget.embeddedId);
_readyStream.listen((isEmbeddedAvailable) {
if (mounted) {
setState(() {
_isEmbeddedAvailable = isEmbeddedAvailable;
});
_readySubscription = _readyStream.listen((v) {
if (mounted && v != _isEmbeddedAvailable) {
setState(() => _isEmbeddedAvailable = v);
}
});
}
Expand Down Expand Up @@ -161,6 +167,7 @@ class AirshipEmbeddedViewState extends State<AirshipEmbeddedView>

@override
void dispose() {
_readySubscription.cancel();
_channel.setMethodCallHandler(null);
super.dispose();
}
Expand Down
42 changes: 40 additions & 2 deletions lib/src/attribute_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class AttributeEditor {
static const ATTRIBUTE_OPERATION_SET = "set";
static const ATTRIBUTE_OPERATION_VALUE = "value";
static const ATTRIBUTE_OPERATION_VALUE_TYPE = "type";
static const ATTRIBUTE_OPERATION_INSTANCE_ID = "instance_id";
static const ATTRIBUTE_OPERATION_EXPIRATION_MS = "expiration_milliseconds";

final MethodChannel channel;

Expand All @@ -18,8 +20,7 @@ class AttributeEditor {
/// The attribute operation list.
final List<Map<String, dynamic>> operations;

AttributeEditor(this.type, this.channel)
: operations = [];
AttributeEditor(this.type, this.channel) : operations = [];

/// Removes an attribute.
void removeAttribute(String name) {
Expand Down Expand Up @@ -59,6 +60,43 @@ class AttributeEditor {
});
}

/// Adds a JSON attribute.
///
/// @param name The attribute name.
/// @param instanceId The instance ID.
/// @param json The json value.
/// @param expiration Optional expiration date.
void setJsonAttribute(
String name, String instanceId, Map<String, dynamic> json,
[DateTime? expiration]) {
final operation = {
ATTRIBUTE_OPERATION_TYPE: ATTRIBUTE_OPERATION_SET,
ATTRIBUTE_OPERATION_KEY: name,
ATTRIBUTE_OPERATION_INSTANCE_ID: instanceId,
ATTRIBUTE_OPERATION_VALUE: json,
ATTRIBUTE_OPERATION_VALUE_TYPE: "json"
};

if (expiration != null) {
operation[ATTRIBUTE_OPERATION_EXPIRATION_MS] =
expiration.millisecondsSinceEpoch;
}

operations.add(operation);
}

/// Removes a JSON attribute.
///
/// @param name The attribute name.
/// @param instanceId The instance ID.
void removeJsonAttribute(String name, String instanceId) {
operations.add({
ATTRIBUTE_OPERATION_TYPE: ATTRIBUTE_OPERATION_REMOVE,
ATTRIBUTE_OPERATION_KEY: name,
ATTRIBUTE_OPERATION_INSTANCE_ID: instanceId
});
}

/// Applies the attribute operations.
Future<void> apply() async {
return await channel.invokeMethod(type, operations);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: airship_flutter
description: "Cross-platform plugin interface for the native Airship iOS and Android SDKs. Simplifies adding Airship to Flutter apps."
version: 10.2.0
version: 10.3.0
homepage: https://www.airship.com/
repository: https://github.com/urbanairship/airship-flutter
issue_tracker: https://github.com/urbanairship/airship-flutter/issues
Expand Down