diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.cs.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.cs.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.cs.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.de.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.de.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.de.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.en.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.en.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.en.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.es.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.es.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.es.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.fr.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.fr.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.fr.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.it.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.it.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.it.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ja.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ja.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ja.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ko.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ko.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ko.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pl.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pl.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pl.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pt-BR.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pt-BR.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.pt-BR.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ru.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ru.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.ru.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.tr.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.tr.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.tr.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json new file mode 100644 index 000000000000..13f5043cb6c2 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json @@ -0,0 +1,9 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/template.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/template.json new file mode 100644 index 000000000000..f4a50160bb18 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/.template.config/template.json @@ -0,0 +1,51 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Microsoft", + "classifications": [ "iOS", "Mobile" ], + "groupIdentity": "Microsoft.iOS.iOSNotificationContentExtension", + "identity": "Microsoft.iOS.iOSNotificationContentExtension.CSharp", + "name": "iOS Notification Content Extension", + "description": "A project for creating a Notification Content Extension for a .NET iOS application", + "shortName": "ios-notification-content-extension", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "iOSNotificationContentExtension1", + "sources": [ + { + "source": "./", + "target": "./" + } + ], + "preferNameDirectory": true, + "primaryOutputs": [ + { "path": "iOSNotificationContentExtension1.csproj" } + ], + "postActions": [{ + "id": "addProjectReference", + "actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C", + "description": "Add project reference in main app's project file", + "sourceName": "iOSNotificationContentExtension1.csproj", + "applyFileRenamesToManualInstructions": true, + "manualInstructions": [{ + "text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n" + }] + }], + "symbols": { + "bundleId": { + "type": "parameter", + "description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "datatype": "string", + "replaces": "com.companyname.iOSApp1" + }, + "minOSVersion": { + "type": "parameter", + "description": "Overrides SupportedOSPlatformVersion in the project file", + "replaces": "minOSVersion", + "datatype": "string", + "defaultValue": "13.0" + } + }, + "defaultName": "iOSNotificationContentExtension1" +} diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/Info.plist b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/Info.plist new file mode 100644 index 000000000000..f4d76214ba34 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDisplayName + iOSNotificationContentExtension1 + CFBundleName + iOSNotificationContentExtension1 + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + NSExtension + + NSExtensionAttributes + + UNNotificationExtensionCategory + myNotificationCategory + UNNotificationExtensionInitialContentSizeRatio + 1 + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.usernotifications.content-extension + + + diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/MainInterface.storyboard b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/MainInterface.storyboard new file mode 100644 index 000000000000..d56db208791a --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/MainInterface.storyboard @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/NotificationViewController.cs b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/NotificationViewController.cs new file mode 100644 index 000000000000..55ce10c53222 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/NotificationViewController.cs @@ -0,0 +1,52 @@ +using System; + +using Foundation; +using ObjCRuntime; +using UIKit; +using UserNotifications; +using UserNotificationsUI; + +namespace NotificationContentExtension { + [Register ("NotificationViewController")] + public class NotificationViewController : UIViewController, IUNNotificationContentExtension { + const int LabelHeight = 88; + UILabel? notificationLabel; + + protected NotificationViewController (NativeHandle handle) : base (handle) + { + // Note: this .ctor should not contain any initialization logic, + // it only exists so that the OS can instantiate an instance of this class. + } + + public override void ViewDidLoad () + { + base.ViewDidLoad (); + + // Do any required initialization here + + View!.BackgroundColor = UIColor.Clear; + + notificationLabel = new UILabel () { + TranslatesAutoresizingMaskIntoConstraints = false, + Lines = 0, + TextAlignment = UITextAlignment.Center, + }; + View.AddSubview (notificationLabel); + + notificationLabel.TopAnchor.ConstraintEqualTo (View.TopAnchor).Active = true; + notificationLabel.LeadingAnchor.ConstraintEqualTo (View.LeadingAnchor).Active = true; + notificationLabel.TrailingAnchor.ConstraintEqualTo (View.TrailingAnchor).Active = true; + notificationLabel.HeightAnchor.ConstraintEqualTo (LabelHeight).Active = true; + } + + public void DidReceiveNotification (UNNotification notification) + { + if (notificationLabel is not null) { + notificationLabel.Text = + $"➡️ {notification.Request.Content.Title}\n" + + $"↪️ {notification.Request.Content.Subtitle}\n" + + $"⏩ {notification.Request.Content.Body}"; + } + } + } +} diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/iOSNotificationContentExtension1.csproj b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/iOSNotificationContentExtension1.csproj new file mode 100644 index 000000000000..f7e2995a0622 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-content-extension/csharp/iOSNotificationContentExtension1.csproj @@ -0,0 +1,19 @@ + + + net9.0-ios + Library + iOSNotificationContentExtension1 + enable + true + minOSVersion + True + + + com.companyname.iOSApp1.notificationcontentextension + + + + + + + diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.cs.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.cs.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.cs.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.de.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.de.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.de.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.en.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.en.json new file mode 100644 index 000000000000..3ccd7c5f10ab --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.en.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.es.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.es.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.es.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.fr.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.fr.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.fr.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.it.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.it.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.it.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ja.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ja.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ja.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ko.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ko.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ko.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pl.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pl.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pl.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pt-BR.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pt-BR.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.pt-BR.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ru.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ru.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.ru.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.tr.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.tr.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.tr.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hans.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json new file mode 100644 index 000000000000..f6e40b31c0bd --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/localize/templatestrings.zh-Hant.json @@ -0,0 +1,10 @@ +{ + "author": "Microsoft", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "postActions/addProjectReference/description": "Add project reference in main app's project file", + "postActions/addProjectReference/manualInstructions/default/text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n", + "symbols/bundleId/description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "symbols/minOSVersion/description": "Overrides SupportedOSPlatformVersion in the project file", + "symbols/extensionClassName/description": "The name of the notification service extension class" +} \ No newline at end of file diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/template.json b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/template.json new file mode 100644 index 000000000000..a06d8310337e --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/.template.config/template.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Microsoft", + "classifications": [ "iOS", "Mobile" ], + "groupIdentity": "Microsoft.iOS.iOSNotificationServiceExtension", + "identity": "Microsoft.iOS.iOSNotificationServiceExtension.CSharp", + "name": "iOS Notification Service Extension", + "description": "A project for creating a Notification Service Extension for a .NET iOS application", + "shortName": "ios-notification-service-extension", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "iOSNotificationServiceExtension1", + "sources": [ + { + "source": "./", + "target": "./" + } + ], + "preferNameDirectory": true, + "primaryOutputs": [ + { "path": "iOSNotificationServiceExtension1.csproj" } + ], + "postActions": [{ + "id": "addProjectReference", + "actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C", + "description": "Add project reference in main app's project file", + "sourceName": "iOSNotificationServiceExtension1.csproj", + "applyFileRenamesToManualInstructions": true, + "manualInstructions": [{ + "text": "The final step is to add a reference to this newly created project in the main app's project file, like this:\n\n\t\n\t\t\n\t\t\ttrue\n\t\t\n\t\n" + }] + }], + "symbols": { + "bundleId": { + "type": "parameter", + "description": "The bundle identifier (CFBundleIdentifier from the Info.plist, or ApplicationId from the project file) for the parent iOS project", + "datatype": "string", + "replaces": "com.companyname.iOSApp1" + }, + "minOSVersion": { + "type": "parameter", + "description": "Overrides SupportedOSPlatformVersion in the project file", + "replaces": "minOSVersion", + "datatype": "string", + "defaultValue": "13.0" + }, + "extensionClassName": { + "type": "parameter", + "description": "The name of the notification service extension class", + "replaces": "NotificationServiceClass", + "datatype": "string", + "defaultValue": "NotificationService" + } + }, + "defaultName": "iOSNotificationServiceExtension1" +} diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/Info.plist b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/Info.plist new file mode 100644 index 000000000000..c085edb60558 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/Info.plist @@ -0,0 +1,27 @@ + + + + + CFBundleDisplayName + iOSNotificationServiceExtension1 + CFBundleName + iOSNotificationServiceExtension1 + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + NSExtension + + NSExtensionPointIdentifier + com.apple.usernotifications.service + NSExtensionPrincipalClass + NotificationServiceClass + + UIBackgroundModes + + remote-notification + + + diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/NotificationServiceClass.cs b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/NotificationServiceClass.cs new file mode 100644 index 000000000000..8006bff99ca0 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/NotificationServiceClass.cs @@ -0,0 +1,37 @@ +using System; + +using Foundation; +using ObjCRuntime; +using UIKit; +using UserNotifications; + +namespace NotificationServiceExtension { + [Register ("NotificationServiceClass")] + public class NotificationServiceClass : UNNotificationServiceExtension { + protected NotificationServiceClass (NativeHandle handle) : base (handle) + { + // Note: this .ctor should not contain any initialization logic, + // it only exists so that the OS can instantiate an instance of this class. + } + + public override void DidReceiveNotificationRequest (UNNotificationRequest request, Action contentHandler) + { + // Called when the OS receives a notification that can be muteated + + // Create a mutable copy of the notification + var mutableRequest = (UNMutableNotificationContent) request.Content.MutableCopy (); + + // Modify the notification content here... + mutableRequest.Title = $"[modified] {mutableRequest.Title}"; + + // Call the contentHandler callback to let the OS know about the modified notification. + contentHandler (mutableRequest); + } + + public override void TimeWillExpire () + { + // Called just before the extension will be terminated by the system. + // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. + } + } +} diff --git a/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/iOSNotificationServiceExtension1.csproj b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/iOSNotificationServiceExtension1.csproj new file mode 100644 index 000000000000..1a80a8f32dd7 --- /dev/null +++ b/dotnet/Templates/Microsoft.iOS.Templates/ios-notification-service-extension/csharp/iOSNotificationServiceExtension1.csproj @@ -0,0 +1,19 @@ + + + net9.0-ios + Library + iOSNotificationServiceExtension1 + enable + true + minOSVersion + True + + + com.companyname.iOSApp1.notificationserviceextension + + + + + + + diff --git a/tests/dotnet/UnitTests/TemplateTest.cs b/tests/dotnet/UnitTests/TemplateTest.cs index 5785b0f4f757..36087b942ecd 100644 --- a/tests/dotnet/UnitTests/TemplateTest.cs +++ b/tests/dotnet/UnitTests/TemplateTest.cs @@ -102,6 +102,8 @@ public enum TemplateType { new TemplateInfo (ApplePlatform.iOS, "ioslib", TemplateLanguage.CSharp), new TemplateInfo (ApplePlatform.iOS, "ioslib", TemplateLanguage.VisualBasic), new TemplateInfo (ApplePlatform.iOS, "iosbinding", TemplateLanguage.CSharp), + new TemplateInfo (ApplePlatform.iOS, "ios-notification-content-extension", TemplateLanguage.CSharp), + new TemplateInfo (ApplePlatform.iOS, "ios-notification-service-extension", TemplateLanguage.CSharp), new TemplateInfo (ApplePlatform.TVOS, "tvos", TemplateLanguage.CSharp), new TemplateInfo (ApplePlatform.TVOS, "tvos", TemplateLanguage.VisualBasic),