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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ jobs:
# Extract to Carthage/Build to maintain compatibility with project paths
mkdir -p Carthage/Build
unzip -q Airship.dotnet.xcframeworks.zip
mv dotnet-xcframeworks/*.xcframework Carthage/Build/
rm -rf dotnet-xcframeworks Airship.dotnet.xcframeworks.zip
mv xcframeworks/*.xcframework Carthage/Build/
rm -rf xcframeworks Airship.dotnet.xcframeworks.zip

# Verify frameworks exist
echo "Downloaded xcframeworks:"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ jobs:
# Extract to Carthage/Build to maintain compatibility with project paths
mkdir -p Carthage/Build
unzip -q Airship.dotnet.xcframeworks.zip
mv dotnet-xcframeworks/*.xcframework Carthage/Build/
rm -rf dotnet-xcframeworks Airship.dotnet.xcframeworks.zip
mv xcframeworks/*.xcframework Carthage/Build/
rm -rf xcframeworks Airship.dotnet.xcframeworks.zip

# Verify frameworks exist
echo "Downloaded xcframeworks:"
Expand Down
2 changes: 2 additions & 0 deletions AirshipWrapper/AirshipWrapper/AWAirshipWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@class UAAnalytics;
@class UAPrivacyManager;
@class UAPreferenceCenter;
@class UAPermissionsManager;
@class NSError;

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -29,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) UAAnalytics *analytics;
@property (nonatomic, readonly) UAPrivacyManager *privacyManager;
@property (nonatomic, readonly) UAPreferenceCenter *preferenceCenter;
@property (nonatomic, readonly) UAPermissionsManager *permissionsManager;

#pragma mark - Method Wrappers

Expand Down
4 changes: 4 additions & 0 deletions AirshipWrapper/AirshipWrapper/AWAirshipWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
return [UAirship preferenceCenter];
}

- (UAPermissionsManager *)permissionsManager {
return [UAirship permissionsManager];
}

#pragma mark - Method Wrappers

+ (void)getMessages:(void(^)(NSArray<UAMessageCenterMessage *> *))completion {
Expand All @@ -87,7 +91,7 @@
@try {
SEL basicAuthSelector = @selector(basicAuthString);
if ([userObject respondsToSelector:basicAuthSelector]) {
NSString *authString = [userObject performSelector:basicAuthSelector];

Check warning on line 94 in AirshipWrapper/AirshipWrapper/AWAirshipWrapper.m

View workflow job for this annotation

GitHub Actions / ci

performSelector may cause a leak because its selector is unknown [-Warc-performSelector-leaks***

Check warning on line 94 in AirshipWrapper/AirshipWrapper/AWAirshipWrapper.m

View workflow job for this annotation

GitHub Actions / ci

performSelector may cause a leak because its selector is unknown [-Warc-performSelector-leaks***
completion(authString);
} else {
NSLog(@"UAMessageCenterUser doesn't respond to basicAuthString selector");
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "urbanairship/ios-library" == 20.1.1
github "urbanairship/ios-library" == 20.2.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "urbanairship/ios-library" "20.1.1"
github "urbanairship/ios-library" "20.2.0"
4 changes: 4 additions & 0 deletions DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ Note that `crossPlatformVersion` should be bumped according to the native SDK ve

Revision numbers can be used to make minor updates to previously released NuGet packages, in cases where no updates to the native SDK versions are needed. If any revision properties are set to a value greater than zero, the revision number will be added to the NuGet package version as a 4th segment (`MAJOR.MINOR.PATCH.REVISION`). A revision number of zero will be ignored, resulting in a 3-segment package version (`MAJOR.MINOR.PATCH`).

### Releasing

Run `./scripts/update_version.sh <version>` to bump the .NET library version. Use `-p <proxy_version>` to also update native SDK versions.

### Documentation

Doxygen is used to generate documentation from the .NET sources, via the `./gradlew docs:build` task. HTML documentation is output to the `docs/build/html` directory and archived to a versioned `.tar.gz` file in the `docs/build` dir.
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<!-- Versions -->
<PropertyGroup>
<!-- Airship native SDK versions -->
<AirshipAndroidVersion>20.1.1</AirshipAndroidVersion>
<AirshipAndroidNugetVersion>20.1.1</AirshipAndroidNugetVersion>
<AirshipAndroidVersion>20.2.0</AirshipAndroidVersion>
<AirshipAndroidNugetVersion>20.2.0</AirshipAndroidNugetVersion>

<AirshipIosVersion>20.1.1</AirshipIosVersion>
<AirshipIosNugetVersion>20.1.1</AirshipIosNugetVersion>
<AirshipIosVersion>20.2.0</AirshipIosVersion>
<AirshipIosNugetVersion>20.2.0</AirshipIosNugetVersion>

<!-- Airship.Net version -->
<AirshipCrossPlatformVersion>21.0.0</AirshipCrossPlatformVersion>
<AirshipCrossPlatformNugetVersion>21.0.0</AirshipCrossPlatformNugetVersion>
<AirshipCrossPlatformVersion>21.1.0</AirshipCrossPlatformVersion>
<AirshipCrossPlatformNugetVersion>21.1.0</AirshipCrossPlatformNugetVersion>
</PropertyGroup>

<!-- Nuget packaging metadata -->
Expand Down
9 changes: 9 additions & 0 deletions MauiSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public App()
AirshipDotNet.Airship.Instance.OnDeepLinkReceived += OnDeepLinkReceived;

AirshipDotNet.Airship.Instance.OnMessageCenterDisplay += OnMessageCenterDisplay;

AirshipDotNet.Airship.MessageCenter.OnMessagesUpdated += OnMessagesUpdated;
}

private void OnDeepLinkReceived(object sender, DeepLinkEventArgs e)
Expand Down Expand Up @@ -56,5 +58,12 @@ private void OnMessageCenterDisplay(object sender, MessageCenterEventArgs e)
Console.WriteLine("Ready to display message center message" + e.MessageId);
}

private async void OnMessagesUpdated(object sender, EventArgs e)
{
// Fetch counts when inbox is updated (e.g., to update a badge)
var unreadCount = await AirshipDotNet.Airship.MessageCenter.GetUnreadCount();
var totalCount = await AirshipDotNet.Airship.MessageCenter.GetCount();
Console.WriteLine($"Message center updated: {unreadCount} unread of {totalCount} total");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary just nice to have I think, let's us know when something is broken more easily for these APIs

}
}

19 changes: 17 additions & 2 deletions MauiSample/HomePageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,24 @@ private static async void PerformOnChannelIdClicked()
}
}

private static void PerformOnEnablePushButtonClicked()
private static async void PerformOnEnablePushButtonClicked()
{
AirshipDotNet.Airship.Push.UserNotificationsEnabled = true;
try
{
// Enable push notifications with fallback to system settings if permission was denied
var args = new EnableUserPushNotificationsArgs(PromptPermissionFallback.SystemSettings);
var enabled = await AirshipDotNet.Airship.Push.EnableUserNotifications(args);

// Check the current notification permission status
var status = await AirshipDotNet.Airship.Push.GetPushNotificationStatus();

Console.WriteLine($"Push notifications enabled: {enabled}");
Console.WriteLine($"Permission status: {status.NotificationPermissionStatus}, Opt-in: {status.IsOptIn}");
}
catch (Exception ex)
{
Console.WriteLine($"Error enabling push notifications: {ex.Message}");
}
}

private static async void PerformOnMessageCenterButtonClicked()
Expand Down
5 changes: 5 additions & 0 deletions MauiSample/MessageCenterPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ private async Task RefreshAsync()
try
{
var messages = await AirshipDotNet.Airship.MessageCenter.GetMessages();

// Example: Filter or style messages based on read status
var unreadCount = messages.Count(m => !m.IsRead);
Console.WriteLine($"Loaded {messages.Count} messages ({unreadCount} unread)");

listView.ItemsSource = messages;
refreshView.IsRefreshing = false;
}
Expand Down
8 changes: 4 additions & 4 deletions airship.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Airship native SDK versions
iosVersion = 20.1.1
androidVersion = 20.1.1
iosVersion = 20.2.0
androidVersion = 20.2.0

# Airship.Net cross-platform version
crossPlatformVersion = 21.0.0
crossPlatformVersion = 21.1.0

# Filename of the iOS SDK zip file
iosFrameworkZip = Airship-iOS-SDK-20.1.1.zip
iosFrameworkZip = Airship-iOS-SDK-20.2.0.zip

# NuGet package revision numbers
# If > 0, the revision number will be added to the versions
Expand Down
44 changes: 22 additions & 22 deletions binderator/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,88 +17,88 @@
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-adm",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.Adm",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-automation",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.Automation",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-core",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.Core",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-fcm",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.Fcm",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-feature-flag",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.FeatureFlag",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-layout",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.Layout",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-live-update",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.LiveUpdate",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-message-center",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.MessageCenter",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-message-center-core",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.MessageCenterCore",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-preference-center",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.PreferenceCenter",
"dependencyOnly": false
},
{
"groupId": "com.urbanairship.android",
"artifactId": "urbanairship-preference-center-core",
"version": "20.1.1",
"nugetVersion": "20.1.1",
"version": "20.2.0",
"nugetVersion": "20.2.0",
"nugetId": "Airship.Net.Android.PreferenceCenterCore",
"dependencyOnly": false
},
Expand Down
85 changes: 74 additions & 11 deletions scripts/update_version.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,94 @@
#!/bin/bash -ex
#!/bin/bash
set -e

SCRIPT_DIRECTORY="$(dirname "$0")"
ROOT_PATH=$SCRIPT_DIRECTORY/../
ROOT_PATH="$SCRIPT_DIRECTORY/.."

# The version supplied as first argument
VERSION=$1
VERSION=""
PROXY_VERSION=""

if [ -z "$1" ]; then
echo "No version supplied"
echo "Usage: $0 <version>"
echo "Example: $0 20.1.0"
usage() {
echo "Usage: $0 <version> [-p <proxy_version>]"
echo ""
echo "Updates the Airship .NET library version."
echo ""
echo "Arguments:"
echo " <version> The .NET library version (e.g., 20.2.1)"
echo ""
echo "Options:"
echo " -p <proxy_version> Also update the native SDK versions (iOS and Android)"
echo " to the specified proxy/SDK version (e.g., 19.1.0)"
echo ""
echo "Examples:"
echo " $0 20.2.1 # Update .NET lib version only"
echo " $0 20.2.1 -p 19.1.0 # Update .NET lib and native SDK versions"
exit 1
}

# Parse arguments
if [ -z "$1" ]; then
usage
fi

VERSION=$1
shift

while getopts "p:" opt; do
case $opt in
p)
PROXY_VERSION=$OPTARG
;;
*)
usage
;;
esac
done

echo "Updating Airship .NET library version to $VERSION"

# Update crossPlatformVersion in airship.properties
sed -i '' "s/^crossPlatformVersion = .*/crossPlatformVersion = $VERSION/g" "$ROOT_PATH/airship.properties"

# Update version references in documentation
# Update SharedAssemblyInfo.Common.cs
sed -i '' "s/\[assembly: UACrossPlatformVersion (\"[^\"]*\")\]/[assembly: UACrossPlatformVersion (\"$VERSION\")]/g" "$ROOT_PATH/src/SharedAssemblyInfo.Common.cs"

# Update Airship.Version in iOS Airship.cs
sed -i '' "s/public static string Version => \"[^\"]*\";/public static string Version => \"$VERSION\";/g" "$ROOT_PATH/src/Airship.Net/Platforms/iOS/Airship.cs"

# Update Airship.Version in Android Airship.cs
sed -i '' "s/public static string Version => \"[^\"]*\";/public static string Version => \"$VERSION\";/g" "$ROOT_PATH/src/Airship.Net/Platforms/Android/Airship.cs"

# Update version references in README.md
sed -i '' "s/\(Airship\.Net[^:]*:\s*\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1$VERSION/g" "$ROOT_PATH/README.md" 2>/dev/null || true

# Update version in CLAUDE.md if it exists
if [ -f "$ROOT_PATH/CLAUDE.md" ]; then
sed -i '' "s/\(crossPlatformVersion[^0-9]*\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1$VERSION/g" "$ROOT_PATH/CLAUDE.md"
fi

echo "Version updated to $VERSION"
echo "✓ Updated .NET library version to $VERSION"

# Update native SDK versions if -p flag was provided
if [ -n "$PROXY_VERSION" ]; then
echo ""
echo "Updating native SDK versions to $PROXY_VERSION"

# Update iosVersion in airship.properties
sed -i '' "s/^iosVersion = .*/iosVersion = $PROXY_VERSION/g" "$ROOT_PATH/airship.properties"

# Update androidVersion in airship.properties
sed -i '' "s/^androidVersion = .*/androidVersion = $PROXY_VERSION/g" "$ROOT_PATH/airship.properties"

# Update iosFrameworkZip in airship.properties
sed -i '' "s/^iosFrameworkZip = .*/iosFrameworkZip = Airship-iOS-SDK-$PROXY_VERSION.zip/g" "$ROOT_PATH/airship.properties"

echo "✓ Updated iOS SDK version to $PROXY_VERSION"
echo "✓ Updated Android SDK version to $PROXY_VERSION"
echo "✓ Updated iOS framework zip to Airship-iOS-SDK-$PROXY_VERSION.zip"
fi

echo ""
echo "Don't forget to:"
echo " 1. Update CHANGELOG.md with release notes"
echo " 2. Run ./gradlew build to sync versions"
echo " 3. Commit the changes"
echo " 3. Commit the changes"
5 changes: 5 additions & 0 deletions src/Airship.Net/IAirshipMessageCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,10 @@ public interface IAirshipMessageCenter
/// Add/remove the Message Center display listener.
/// </summary>
public event EventHandler<MessageCenterEventArgs> OnMessageCenterDisplay;

/// <summary>
/// Add/remove the Message Center updated listener.
/// </summary>
public event EventHandler<EventArgs> OnMessagesUpdated;
}
}
Loading
Loading