Skip to content

Commit 259f44e

Browse files
authored
Merge pull request #35 from urbanairship/add-OnMessagesUpdated
Release 21.1.0
2 parents c534c78 + e2f117e commit 259f44e

33 files changed

+1002
-83
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ jobs:
107107
# Extract to Carthage/Build to maintain compatibility with project paths
108108
mkdir -p Carthage/Build
109109
unzip -q Airship.dotnet.xcframeworks.zip
110-
mv dotnet-xcframeworks/*.xcframework Carthage/Build/
111-
rm -rf dotnet-xcframeworks Airship.dotnet.xcframeworks.zip
110+
mv xcframeworks/*.xcframework Carthage/Build/
111+
rm -rf xcframeworks Airship.dotnet.xcframeworks.zip
112112
113113
# Verify frameworks exist
114114
echo "Downloaded xcframeworks:"

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ jobs:
8989
# Extract to Carthage/Build to maintain compatibility with project paths
9090
mkdir -p Carthage/Build
9191
unzip -q Airship.dotnet.xcframeworks.zip
92-
mv dotnet-xcframeworks/*.xcframework Carthage/Build/
93-
rm -rf dotnet-xcframeworks Airship.dotnet.xcframeworks.zip
92+
mv xcframeworks/*.xcframework Carthage/Build/
93+
rm -rf xcframeworks Airship.dotnet.xcframeworks.zip
9494
9595
# Verify frameworks exist
9696
echo "Downloaded xcframeworks:"

AirshipWrapper/AirshipWrapper/AWAirshipWrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
@class UAAnalytics;
1111
@class UAPrivacyManager;
1212
@class UAPreferenceCenter;
13+
@class UAPermissionsManager;
1314
@class NSError;
1415

1516
NS_ASSUME_NONNULL_BEGIN
@@ -29,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
2930
@property (nonatomic, readonly) UAAnalytics *analytics;
3031
@property (nonatomic, readonly) UAPrivacyManager *privacyManager;
3132
@property (nonatomic, readonly) UAPreferenceCenter *preferenceCenter;
33+
@property (nonatomic, readonly) UAPermissionsManager *permissionsManager;
3234

3335
#pragma mark - Method Wrappers
3436

AirshipWrapper/AirshipWrapper/AWAirshipWrapper.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ - (UAPreferenceCenter *)preferenceCenter {
6262
return [UAirship preferenceCenter];
6363
}
6464

65+
- (UAPermissionsManager *)permissionsManager {
66+
return [UAirship permissionsManager];
67+
}
68+
6569
#pragma mark - Method Wrappers
6670

6771
+ (void)getMessages:(void(^)(NSArray<UAMessageCenterMessage *> *))completion {

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "urbanairship/ios-library" == 20.1.1
1+
github "urbanairship/ios-library" == 20.2.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "urbanairship/ios-library" "20.1.1"
1+
github "urbanairship/ios-library" "20.2.0"

DEV_README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ Note that `crossPlatformVersion` should be bumped according to the native SDK ve
9797

9898
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`).
9999

100+
### Releasing
101+
102+
Run `./scripts/update_version.sh <version>` to bump the .NET library version. Use `-p <proxy_version>` to also update native SDK versions.
103+
100104
### Documentation
101105

102106
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.

Directory.Build.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<!-- Versions -->
66
<PropertyGroup>
77
<!-- Airship native SDK versions -->
8-
<AirshipAndroidVersion>20.1.1</AirshipAndroidVersion>
9-
<AirshipAndroidNugetVersion>20.1.1</AirshipAndroidNugetVersion>
8+
<AirshipAndroidVersion>20.2.0</AirshipAndroidVersion>
9+
<AirshipAndroidNugetVersion>20.2.0</AirshipAndroidNugetVersion>
1010

11-
<AirshipIosVersion>20.1.1</AirshipIosVersion>
12-
<AirshipIosNugetVersion>20.1.1</AirshipIosNugetVersion>
11+
<AirshipIosVersion>20.2.0</AirshipIosVersion>
12+
<AirshipIosNugetVersion>20.2.0</AirshipIosNugetVersion>
1313

1414
<!-- Airship.Net version -->
15-
<AirshipCrossPlatformVersion>21.0.0</AirshipCrossPlatformVersion>
16-
<AirshipCrossPlatformNugetVersion>21.0.0</AirshipCrossPlatformNugetVersion>
15+
<AirshipCrossPlatformVersion>21.1.0</AirshipCrossPlatformVersion>
16+
<AirshipCrossPlatformNugetVersion>21.1.0</AirshipCrossPlatformNugetVersion>
1717
</PropertyGroup>
1818

1919
<!-- Nuget packaging metadata -->

MauiSample/App.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public App()
1616
AirshipDotNet.Airship.Instance.OnDeepLinkReceived += OnDeepLinkReceived;
1717

1818
AirshipDotNet.Airship.Instance.OnMessageCenterDisplay += OnMessageCenterDisplay;
19+
20+
AirshipDotNet.Airship.MessageCenter.OnMessagesUpdated += OnMessagesUpdated;
1921
}
2022

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

61+
private async void OnMessagesUpdated(object sender, EventArgs e)
62+
{
63+
// Fetch counts when inbox is updated (e.g., to update a badge)
64+
var unreadCount = await AirshipDotNet.Airship.MessageCenter.GetUnreadCount();
65+
var totalCount = await AirshipDotNet.Airship.MessageCenter.GetCount();
66+
Console.WriteLine($"Message center updated: {unreadCount} unread of {totalCount} total");
67+
}
5968
}
6069

MauiSample/HomePageViewModel.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,24 @@ private static async void PerformOnChannelIdClicked()
105105
}
106106
}
107107

108-
private static void PerformOnEnablePushButtonClicked()
108+
private static async void PerformOnEnablePushButtonClicked()
109109
{
110-
AirshipDotNet.Airship.Push.UserNotificationsEnabled = true;
110+
try
111+
{
112+
// Enable push notifications with fallback to system settings if permission was denied
113+
var args = new EnableUserPushNotificationsArgs(PromptPermissionFallback.SystemSettings);
114+
var enabled = await AirshipDotNet.Airship.Push.EnableUserNotifications(args);
115+
116+
// Check the current notification permission status
117+
var status = await AirshipDotNet.Airship.Push.GetPushNotificationStatus();
118+
119+
Console.WriteLine($"Push notifications enabled: {enabled}");
120+
Console.WriteLine($"Permission status: {status.NotificationPermissionStatus}, Opt-in: {status.IsOptIn}");
121+
}
122+
catch (Exception ex)
123+
{
124+
Console.WriteLine($"Error enabling push notifications: {ex.Message}");
125+
}
111126
}
112127

113128
private static async void PerformOnMessageCenterButtonClicked()

0 commit comments

Comments
 (0)