Moving Xamarin Component Bindings to Repo (#6)

This commit is contained in:
Matthew Podwysocki 2020-08-10 11:19:16 -04:00 коммит произвёл GitHub
Родитель eb0cc2be8f
Коммит 3574e4c950
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
85 изменённых файлов: 11366 добавлений и 0 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -404,3 +404,7 @@ MigrationBackup/
# Secret Files
google-services.json
# Rest of Bindings
externals
output

Просмотреть файл

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

Просмотреть файл

@ -0,0 +1,13 @@
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamarinAndroid
{
public class InstallationEnrichmentVisitor : Java.Lang.Object, IInstallationVisitor
{
public void VisitInstallation(Installation installation)
{
// Add a sample tag
installation.AddTag("platform_XamarinAndroid");
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
using System;
using Java.Lang;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamarinAndroid
{
public class InstallationSaveFailedListener : Java.Lang.Object, IInstallationAdapterErrorListener
{
public InstallationSaveFailedListener()
{
}
public void OnInstallationSaveError(Java.Lang.Exception javaException)
{
var exception = Throwable.FromException(javaException);
Console.WriteLine($"Save installation failed with exception: {exception.Message}");
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
using System;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamarinAndroid
{
public class InstallationSavedListener : Java.Lang.Object, IInstallationAdapterListener
{
public void OnInstallationSaved(Installation installation)
{
Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}");
}
}
}

Просмотреть файл

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using Android.App;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V7.App;
using Android.Views;
using WindowsAzure.Messaging.NotificationHubs;
using Xamarin.Essentials;
namespace NHubSampleXamarinAndroid
{
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true)]
public class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
SetContentView(Resource.Layout.activity_main);
// Read the connections and hub name from somewhere
var connectionString = "";
var hubName = "";
// Set listener for receiving messages
NotificationHub.SetListener(new SampleNotificationListener());
// Set an enrichment visitor
NotificationHub.UseVisitor(new InstallationEnrichmentVisitor());
// Set listener for installation save success and failure
NotificationHub.SetInstallationSavedListener(new InstallationSavedListener());
NotificationHub.SetInstallationSaveFailureListener(new InstallationSaveFailedListener());
// Initialize with hub name and connection string
NotificationHub.Initialize(Application, hubName, connectionString);
// Add a tag
NotificationHub.AddTag("target_XamarinAndroid");
Android.Support.V7.Widget.Toolbar toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(toolbar);
FloatingActionButton fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
fab.Click += FabOnClick;
}
public void AddTags()
{
var language = Resources.Configuration.Locales.Get(0).Language;
var countryCode = Resources.Configuration.Locales.Get(0).Country;
var languageTag = $"language_{language}";
var countryCodeTag = $"country_{countryCode}";
NotificationHub.AddTags(new [] { languageTag, countryCodeTag });
}
public void AddTemplate()
{
var language = Resources.Configuration.Locales.Get(0).Language;
var countryCode = Resources.Configuration.Locales.Get(0).Country;
var languageTag = $"language_{language}";
var countryCodeTag = $"country_{countryCode}";
var body = "{\"data\":{\"message\":\"$(message)\"}}";
var template = new InstallationTemplate();
template.Body = body;
template.AddTags(new[] { languageTag, countryCodeTag });
NotificationHub.SetTemplate("template1", template);
}
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.menu_main, menu);
return true;
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
int id = item.ItemId;
if (id == Resource.Id.action_settings)
{
return true;
}
return base.OnOptionsItemSelected(item);
}
private void FabOnClick(object sender, EventArgs eventArgs)
{
View view = (View)sender;
Snackbar.Make(view, "Replace with your own action", Snackbar.LengthLong)
.SetAction("Action", (View.IOnClickListener)null).Show();
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}

Просмотреть файл

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{84dd83c5-0fe3-4294-9419-09e7c8ba324f}</TemplateGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NHubSampleXamarinAndroid</RootNamespace>
<AssemblyName>NHubSampleXamarinAndroid</AssemblyName>
<FileAlignment>512</FileAlignment>
<Deterministic>True</Deterministic>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NotificationListener.cs" />
<Compile Include="InstallationSavedListener.cs" />
<Compile Include="InstallationSaveFailedListener.cs" />
<Compile Include="InstallationEnrichmentVisitor.cs" />
<Compile Include="SampleInstallationAdapter.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\activity_main.xml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\content_main.xml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\values\dimens.xml" />
<AndroidResource Include="Resources\values\ic_launcher_background.xml" />
<AndroidResource Include="Resources\values\strings.xml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\menu\menu_main.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Compat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.UI" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Fragment" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Media.Compat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="117.2.1-preview02" />
<PackageReference Include="Xamarin.Azure.NotificationHubs.Android" Version="1.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<GoogleServicesJson Include="Properties\google-services.json" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,17 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHubSampleXamarinAndroid", "NHubSampleXamarinAndroid.csproj", "{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,18 @@
using System;
using Android.Content;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamarinAndroid
{
public class SampleNotificationListener : Java.Lang.Object, INotificationListener
{
public SampleNotificationListener()
{
}
public void OnPushNotificationReceived(Context context, INotificationMessage message)
{
Console.WriteLine($"Message received with title {message.Title} and body {message.Body}");
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.microsoft.nhubsamplexamarinandroid">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Просмотреть файл

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NHubSampleXamarinAndroid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NHubSampleXamarinAndroid")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.xml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.xml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.xml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

9078
samples/bindings/NHubSampleXamarinAndroid/Resources/Resource.designer.cs сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:showIn="@layout/activity_main">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="Hello World!" />
</RelativeLayout>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools">
<item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never" />
</menu>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 958 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 11 KiB

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#2c3e50</color>
<color name="colorPrimaryDark">#1B3147</color>
<color name="colorAccent">#3498db</color>
</resources>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2C3E50</color>
</resources>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">NHubSampleXamarinAndroid</string>
<string name="action_settings">Settings</string>
</resources>

Просмотреть файл

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

Просмотреть файл

@ -0,0 +1,18 @@

using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamarinAndroid
{
public class SampleInstallationAdapter : Java.Lang.Object, IInstallationAdapter
{
public void SaveInstallation(Installation installation,
IInstallationAdapterListener installationAdapterListener,
IInstallationAdapterErrorListener installationAdapterErrorListener)
{
// Save to your own backend
// Call if successfully saved
installationAdapterListener.OnInstallationSaved(installation);
}
}
}

Просмотреть файл

@ -0,0 +1,99 @@
using System;
using Foundation;
using UIKit;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamariniOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register("AppDelegate")]
public class AppDelegate : UIResponder, IUIApplicationDelegate
{
[Export("window")]
public UIWindow Window { get; set; }
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Get settings from the DevSettings plist
var path = NSBundle.MainBundle.PathForResource("DevSettings", "plist");
var configValues = NSDictionary.FromFile(path);
// Read from the plist
var connectionString = configValues.ObjectForKey(new NSString("ConnectionString"));
var hubName = configValues.ObjectForKey(new NSString("HubName"));
if (connectionString == null || hubName == null)
{
Console.WriteLine("Connection String and Hub Name missing");
return false;
}
// Set a listener for messages
MSNotificationHub.SetDelegate(new NotificationDelegate());
// Set a listener for lifecycle management
MSNotificationHub.SetLifecycleDelegate(new InstallationLifecycleDelegate());
// Start the SDK
MSNotificationHub.Start(connectionString.ToString(), hubName.ToString());
// Add some tags
AddTags();
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
public void AddTags()
{
var language = NSBundle.MainBundle.PreferredLocalizations[0];
var countryCode = NSLocale.CurrentLocale.CountryCode;
var languageTag = $"language_{language}";
var countryCodeTag = $"country_{countryCode}";
MSNotificationHub.AddTag(languageTag);
MSNotificationHub.AddTag(countryCodeTag);
}
public void AddTemplate()
{
var language = NSBundle.MainBundle.PreferredLocalizations[0];
var countryCode = NSLocale.CurrentLocale.CountryCode;
var languageTag = $"language_{language}";
var countryCodeTag = $"country_{countryCode}";
var body = "{\"aps\": {\"alert\": \"$(message)\"}}";
var template = new MSInstallationTemplate();
template.Body = body;
template.AddTag(languageTag);
template.AddTag(countryCodeTag);
MSNotificationHub.SetTemplate(template, key: "template1");
}
// UISceneSession Lifecycle
[Export("application:configurationForConnectingSceneSession:options:")]
public UISceneConfiguration GetConfiguration(UIApplication application, UISceneSession connectingSceneSession, UISceneConnectionOptions options)
{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration.Create("Default Configuration", connectingSceneSession.Role);
}
[Export("application:didDiscardSceneSessions:")]
public void DidDiscardSceneSessions(UIApplication application, NSSet<UISceneSession> sceneSessions)
{
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after `FinishedLaunching`.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
{
"images": [
{
"scale": "2x",
"size": "20x20",
"idiom": "iphone",
"filename": "Icon40.png"
},
{
"scale": "3x",
"size": "20x20",
"idiom": "iphone",
"filename": "Icon60.png"
},
{
"scale": "2x",
"size": "29x29",
"idiom": "iphone",
"filename": "Icon58.png"
},
{
"scale": "3x",
"size": "29x29",
"idiom": "iphone",
"filename": "Icon87.png"
},
{
"scale": "2x",
"size": "40x40",
"idiom": "iphone",
"filename": "Icon80.png"
},
{
"scale": "3x",
"size": "40x40",
"idiom": "iphone",
"filename": "Icon120.png"
},
{
"scale": "2x",
"size": "60x60",
"idiom": "iphone",
"filename": "Icon120.png"
},
{
"scale": "3x",
"size": "60x60",
"idiom": "iphone",
"filename": "Icon180.png"
},
{
"scale": "1x",
"size": "20x20",
"idiom": "ipad",
"filename": "Icon20.png"
},
{
"scale": "2x",
"size": "20x20",
"idiom": "ipad",
"filename": "Icon40.png"
},
{
"scale": "1x",
"size": "29x29",
"idiom": "ipad",
"filename": "Icon29.png"
},
{
"scale": "2x",
"size": "29x29",
"idiom": "ipad",
"filename": "Icon58.png"
},
{
"scale": "1x",
"size": "40x40",
"idiom": "ipad",
"filename": "Icon40.png"
},
{
"scale": "2x",
"size": "40x40",
"idiom": "ipad",
"filename": "Icon80.png"
},
{
"scale": "1x",
"size": "76x76",
"idiom": "ipad",
"filename": "Icon76.png"
},
{
"scale": "2x",
"size": "76x76",
"idiom": "ipad",
"filename": "Icon152.png"
},
{
"scale": "2x",
"size": "83.5x83.5",
"idiom": "ipad",
"filename": "Icon167.png"
},
{
"scale": "1x",
"size": "1024x1024",
"idiom": "ios-marketing",
"filename": "Icon1024.png"
}
],
"properties": {},
"info": {
"version": 1,
"author": "xcode"
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 69 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 845 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ConnectionString</key>
<string></string>
<key>HubName</key>
<string></string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>NHubSampleXamariniOS</string>
<key>CFBundleIdentifier</key>
<string>com.microsoft.NHubSampleXamariniOS</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>MinimumOSVersion</key>
<string>13.5</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,12 @@
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamariniOS
{
public class InstallationEnrichmentDelegate : MSInstallationEnrichmentDelegate
{
public override void WillEnrichInstallation(MSNotificationHub notificationHub, MSInstallation installation)
{
installation.AddTag("platform_Xamarin");
}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
using System;
using Foundation;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamariniOS
{
public class InstallationLifecycleDelegate : MSInstallationLifecycleDelegate
{
public InstallationLifecycleDelegate()
{
}
public override void DidFailToSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation, NSError error)
{
Console.WriteLine($"Save installation failed with exception: {error.LocalizedDescription}");
}
public override void DidSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation)
{
Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}");
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
using ObjCRuntime;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamariniOS
{
public class InstallationManagementDelegate : MSInstallationManagementDelegate
{
public override void WillDeleteInstallation(MSNotificationHub notificationHub, string installationId, NullableCompletionHandler completionHandler)
{
completionHandler(null);
}
public override void WillUpsertInstallation(MSNotificationHub notificationHub, MSInstallation installation, NullableCompletionHandler completionHandler)
{
// Save the installation to your own backend
// Finish with a completion with error if one occurred, else null
completionHandler(null);
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS" />
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
</objects>
<point key="canvasLocation" x="53" y="375" />
</scene>
</scenes>
</document>

Просмотреть файл

@ -0,0 +1,15 @@
using UIKit;
namespace NHubSampleXamariniOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{4359D883-0988-4645-B32C-851CF637E8BA}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{edc1b0fa-90cd-4038-8fad-98fe74adb368}</TemplateGuid>
<OutputType>Exe</OutputType>
<RootNamespace>NHubSampleXamariniOS</RootNamespace>
<AssemblyName>NHubSampleXamariniOS</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xamarin.Azure.NotificationHubs.iOS" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="DevSettings.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="SceneDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
<Compile Include="NotificationDelegate.cs" />
<Compile Include="InstallationLifecycleDelegate.cs" />
<Compile Include="InstallationEnrichmentDelegate.cs" />
<Compile Include="InstallationManagementDelegate.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHubSampleXamariniOS", "NHubSampleXamariniOS.csproj", "{4359D883-0988-4645-B32C-851CF637E8BA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4359D883-0988-4645-B32C-851CF637E8BA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{4359D883-0988-4645-B32C-851CF637E8BA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{4359D883-0988-4645-B32C-851CF637E8BA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{4359D883-0988-4645-B32C-851CF637E8BA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{4359D883-0988-4645-B32C-851CF637E8BA}.Debug|iPhone.ActiveCfg = Debug|iPhone
{4359D883-0988-4645-B32C-851CF637E8BA}.Debug|iPhone.Build.0 = Debug|iPhone
{4359D883-0988-4645-B32C-851CF637E8BA}.Release|iPhone.ActiveCfg = Release|iPhone
{4359D883-0988-4645-B32C-851CF637E8BA}.Release|iPhone.Build.0 = Release|iPhone
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,25 @@
using System;
using UIKit;
using WindowsAzure.Messaging.NotificationHubs;
namespace NHubSampleXamariniOS
{
public class NotificationDelegate : MSNotificationHubDelegate
{
public NotificationDelegate()
{
}
public override void DidReceivePushNotification(MSNotificationHub notificationHub, MSNotificationHubMessage message)
{
if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Background)
{
Console.WriteLine($"Message received in the background with title {message.Title} and body {message.Body}");
}
else
{
Console.WriteLine($"Message received in the foreground with title {message.Title} and body {message.Body}");
}
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NHubSampleXamariniOS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NHubSampleXamariniOS")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" />
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" />
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" />
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" />
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480" />
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2017 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21" />
<fontDescription key="fontDescription" type="system" pointSize="17" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NHubSampleXamariniOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43" />
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" />
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" />
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" />
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" />
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" />
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" />
</constraints>
<nil key="simulatedStatusBarMetrics" />
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" />
<point key="canvasLocation" x="548" y="455" />
</view>
</objects>
</document>

Просмотреть файл

@ -0,0 +1,60 @@
using System;
using Foundation;
using UIKit;
namespace NewSingleViewTemplate
{
[Register("SceneDelegate")]
public class SceneDelegate : UIResponder, IUIWindowSceneDelegate
{
[Export("window")]
public UIWindow Window { get; set; }
[Export("scene:willConnectToSession:options:")]
public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions)
{
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).
}
[Export("sceneDidDisconnect:")]
public void DidDisconnect(UIScene scene)
{
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see UIApplicationDelegate `DidDiscardSceneSessions` instead).
}
[Export("sceneDidBecomeActive:")]
public void DidBecomeActive(UIScene scene)
{
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
[Export("sceneWillResignActive:")]
public void WillResignActive(UIScene scene)
{
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
[Export("sceneWillEnterForeground:")]
public void WillEnterForeground(UIScene scene)
{
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
[Export("sceneDidEnterBackground:")]
public void DidEnterBackground(UIScene scene)
{
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
}

Просмотреть файл

@ -0,0 +1,25 @@
using Foundation;
using System;
using UIKit;
namespace NHubSampleXamariniOS
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}

18
samples/bindings/NHubSampleXamariniOS/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,18 @@
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
namespace NHubSampleXamariniOS
{
[Register("ViewController")]
partial class ViewController
{
}
}

Просмотреть файл

@ -0,0 +1,48 @@
Additions allow you to add arbitrary C# to the generated classes
before they are compiled. This can be helpful for providing convenience
methods or adding pure C# classes.
== Adding Methods to Generated Classes ==
Let's say the library being bound has a Rectangle class with a constructor
that takes an x and y position, and a width and length size. It will look like
this:
public partial class Rectangle
{
public Rectangle (int x, int y, int width, int height)
{
// JNI bindings
}
}
Imagine we want to add a constructor to this class that takes a Point and
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
with a partial class containing our new method:
public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}
At compile time, the additions class will be added to the generated class
and the final assembly will a Rectangle class with both constructors.
== Adding C# Classes ==
Another thing that can be done is adding fully C# managed classes to the
generated library. In the above example, let's assume that there isn't a
Point class available in Java or our library. The one we create doesn't need
to interact with Java, so we'll create it like a normal class in C#.
By adding a Point.cs file with this class, it will end up in the binding library:
public class Point
{
public int X { get; set; }
public int Y { get; set; }
}

Просмотреть файл

@ -0,0 +1,37 @@
This directory is for Android .jars.
There are 3 types of jars that are supported:
== Input Jar and Embedded Jar ==
This is the jar that bindings should be generated for.
For example, if you were binding the Google Maps library, this would
be Google's "maps.jar".
The difference between EmbeddedJar and InputJar is, EmbeddedJar is to be
embedded in the resulting dll as EmbeddedResource, while InputJar is not.
There are couple of reasons you wouldn't like to embed the target jar
in your dll (the ones that could be internally loaded by <uses-library>
feature e.g. maps.jar, or you cannot embed jars that are under some
proprietary license).
Set the build action for these jars in the properties page to "InputJar".
== Reference Jar and Embedded Reference Jar ==
These are jars that are referenced by the input jar. C# bindings will
not be created for these jars. These jars will be used to resolve
types used by the input jar.
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
based on the Target Framework selected.
Set the build action for these jars in the properties page to "ReferenceJar".
"EmbeddedJar" works like "ReferenceJar", but like "EmbeddedJar", it is
embedded in your dll. But at application build time, they are not included
in the final apk, like ReferenceJar files.

Просмотреть файл

@ -0,0 +1,18 @@
<enum-field-mappings>
<!--
This example converts the constants Fragment_id, Fragment_name,
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
to an enum called Android.Support.V4.App.FragmentTagType with values
Id, Name, and Tag.
<mapping clr-enum-type="Android.Support.V4.App.FragmentTagType" jni-class="android/support/v4/app/FragmentActivity$FragmentTag">
<field clr-name="Id" jni-name="Fragment_id" value="1" />
<field clr-name="Name" jni-name="Fragment_name" value="0" />
<field clr-name="Tag" jni-name="Fragment_tag" value="2" />
</type>
Notes:
- An optional "bitfield" attribute marks the enum type with [Flags].
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
-->
</enum-field-mappings>

Просмотреть файл

@ -0,0 +1,18 @@
<enum-method-mappings>
<!--
This example changes the Java method:
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
to be:
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
when bound in C#.
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
</mapping>
Notes:
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
- To change the type of the return value, use "return" as the parameter name.
- The parameter names will be p0, p1, ... unless you provide JavaDoc file in the project.
-->
</enum-method-mappings>

Просмотреть файл

@ -0,0 +1,78 @@
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->
<attr path="api/package[@name='com.microsoft.windowsazure.messaging']" name="managedName">WindowsAzure.Messaging</attr>
<attr path="api/package[@name='com.microsoft.windowsazure.messaging.notificationhubs']" name="managedName">WindowsAzure.Messaging.NotificationHubs</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging.notificationhubs']/interface[@name='NotificationListener']/method[@name='onPushNotificationReceived' and count(parameter)=2 and parameter[1][@type='android.content.Context'] and parameter[2][@type='com.microsoft.windowsazure.messaging.notificationhubs.NotificationMessage']]/parameter[1]" name="managedName">context</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging.notificationhubs']/interface[@name='NotificationListener']/method[@name='onPushNotificationReceived' and count(parameter)=2 and parameter[1][@type='android.content.Context'] and parameter[2][@type='com.microsoft.windowsazure.messaging.notificationhubs.NotificationMessage']]/parameter[2]" name="managedName">message</attr>
<remove-node path="/api/package[@name='com.microsoft.windowsazure.messaging.notificationhubs.http']/class[not(starts-with(@name, 'ServiceCall') or @name = 'HttpResponse' or @name = 'HttpException' or @name = 'HttpClient')]" />
<!-- Auto Generated naming adjustments using class-parse -->
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">registrationDescription</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmNativeRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">templateRegistrationDescription</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='AdmTemplateRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>-->
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">registrationDescription</attr>
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduNativeRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">templateRegistrationDescription</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='BaiduTemplateRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>-->
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKey' and count(parameter)=3 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String']]/parameter[1]" name="managedName">endPoint</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKey' and count(parameter)=3 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String']]/parameter[2]" name="managedName">keyName</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKey' and count(parameter)=3 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String']]/parameter[3]" name="managedName">accessSecret</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKeyWithFullAccess' and count(parameter)=2 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String']]/parameter[1]" name="managedName">endPoint</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKeyWithFullAccess' and count(parameter)=2 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String']]/parameter[2]" name="managedName">fullAccessSecret</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKeyWithListenAccess' and count(parameter)=2 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String']]/parameter[1]" name="managedName">endPoint</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='ConnectionString']/method[@name='createUsingSharedAccessKeyWithListenAccess' and count(parameter)=2 and parameter[1][@type='java.net.URI'] and parameter[2][@type='java.lang.String']]/parameter[2]" name="managedName">listenAccessSecret</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmNativeRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">registrationDescription</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmNativeRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmTemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">templateRegistrationDescription</attr>-->
<!-- <attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='GcmTemplateRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>-->
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='register' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String...']]/parameter[1]" name="managedName">pnsHandle</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='register' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String...']]/parameter[2]" name="managedName">tags</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaidu' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String...']]/parameter[1]" name="managedName">userId</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaidu' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String...']]/parameter[2]" name="managedName">channelId</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaidu' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String...']]/parameter[3]" name="managedName">tags</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaiduTemplate' and count(parameter)=5 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='java.lang.String...']]/parameter[1]" name="managedName">userId</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaiduTemplate' and count(parameter)=5 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='java.lang.String...']]/parameter[2]" name="managedName">channelId</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaiduTemplate' and count(parameter)=5 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='java.lang.String...']]/parameter[3]" name="managedName">templateName</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaiduTemplate' and count(parameter)=5 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='java.lang.String...']]/parameter[4]" name="managedName">template</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerBaiduTemplate' and count(parameter)=5 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='java.lang.String...']]/parameter[5]" name="managedName">tags</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerTemplate' and count(parameter)=4 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String...']]/parameter[1]" name="managedName">pnsHandle</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerTemplate' and count(parameter)=4 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String...']]/parameter[2]" name="managedName">templateName</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerTemplate' and count(parameter)=4 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String...']]/parameter[3]" name="managedName">template</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='registerTemplate' and count(parameter)=4 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String...']]/parameter[4]" name="managedName">tags</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='setConnectionString' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">connectionString</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='setNotificationHubPath' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">notificationHubPath</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='unregisterAll' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">pnsHandle</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='NotificationHub']/method[@name='unregisterTemplate' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">templateName</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='PnsSpecificRegistrationFactory']/method[@name='createNativeRegistration' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">notificationHubPath</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='PnsSpecificRegistrationFactory']/method[@name='createTemplateRegistration' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">notificationHubPath</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='PnsSpecificRegistrationFactory']/method[@name='isTemplateRegistration' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">xml</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='PnsSpecificRegistrationFactory']/method[@name='setRegistrationType' and count(parameter)=1 and parameter[1][@type='com.microsoft.windowsazure.messaging.Registration.RegistrationType']]/parameter[1]" name="managedName">type</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">registrationDescription</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendNodeWithValue' and count(parameter)=4 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendNodeWithValue' and count(parameter)=4 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String']]/parameter[2]" name="managedName">targetElement</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendNodeWithValue' and count(parameter)=4 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String']]/parameter[3]" name="managedName">nodeName</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendNodeWithValue' and count(parameter)=4 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String']]/parameter[4]" name="managedName">value</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendTagsNode' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='appendTagsNode' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">registrationDescription</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='getNodeValue' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Element'] and parameter[2][@type='java.lang.String']]/parameter[1]" name="managedName">element</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='getNodeValue' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Element'] and parameter[2][@type='java.lang.String']]/parameter[2]" name="managedName">node</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='Registration.RegistrationType']/method[@name='valueOf' and count(parameter)=1 and parameter[1][@type='java.lang.String']]/parameter[1]" name="managedName">val</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='TemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">doc</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='TemplateRegistration']/method[@name='appendCustomPayload' and count(parameter)=2 and parameter[1][@type='org.w3c.dom.Document'] and parameter[2][@type='org.w3c.dom.Element']]/parameter[2]" name="managedName">templateRegistrationDescription</attr>
<attr path="/api/package[@name='com.microsoft.windowsazure.messaging']/class[@name='TemplateRegistration']/method[@name='loadCustomXmlData' and count(parameter)=1 and parameter[1][@type='org.w3c.dom.Element']]/parameter[1]" name="managedName">payloadNode</attr>
</metadata>

Просмотреть файл

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
<PropertyGroup>
<TargetFramework>MonoAndroid90</TargetFramework>
<IsBindingProject>true</IsBindingProject>
<AssemblyName>Xamarin.Azure.NotificationHubs.Android</AssemblyName>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseIntermediateDesignerFile>True</AndroidUseIntermediateDesignerFile>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidClassParser>class-parse</AndroidClassParser>
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<RootNamespace>WindowsAzure.Messaging</RootNamespace>
<AssemblyName>Xamarin.Azure.NotificationHubs.Android</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<PackageId>Xamarin.Azure.NotificationHubs.Android</PackageId>
<Title>Azure Notification Hubs for Xamarin.Android</Title>
<PackageDescription>Xamarin.Android Bindings for Azure Notification Hubs.</PackageDescription>
<Authors>Microsoft</Authors>
<Owners>Microsoft</Owners>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/xamarin/XamarinComponents/master/XPlat/AzureMessaging/component/icons/aznh-icon-128x128.png</PackageIconUrl>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=864958</PackageProjectUrl>
<PackageLicenseUrl>https://go.microsoft.com/fwlink/?linkid=864960</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageVersion>1.0.1</PackageVersion>
</PropertyGroup>
<ItemGroup>
<LibraryProjectZip Include="..\externals\notificationhubs.aar">
<Link>Jars\notificationhubs.aar</Link>
</LibraryProjectZip>
<None Include="..\..\External-Dependency-Info.txt" Pack="True" PackagePath="THIRD-PARTY-NOTICES.txt" />
<TransformFile Include="Transforms\*.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" PrivateAssets="None" />
<PackageReference Include="Xamarin.Firebase.Messaging" Version="71.1740.4" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Azure.NotificationHubs.Android", "Xamarin.Azure.NotificationHubs.Android.csproj", "{94785639-56A7-4292-81F9-51BD5E2A403C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|Any CPU.Build.0 = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Debug|iPhone.Build.0 = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|iPhone.ActiveCfg = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Release|iPhone.Build.0 = Release|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{94785639-56A7-4292-81F9-51BD5E2A403C}.AppStore|iPhone.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = AzureMessagingSampleAndroid\AzureMessagingSampleAndroid.csproj
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,17 @@
**Xamarin is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may require or install dependencies which are governed by additional licenses.**
Note: This component depends on [Microsoft Azure Notification Hubs](https://github.com/Azure/azure-notificationhubs), which is subject to the [Microsoft Azure Notification Hubs License](https://github.com/Azure/azure-notificationhubs/blob/master/LICENSE.txt)
### Xamarin Component for Microsoft Azure Notification Hubs
**The MIT License (MIT)**
Copyright (c) .NET Foundation Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20160601

152
src/bindings/build.cake Normal file
Просмотреть файл

@ -0,0 +1,152 @@
var TARGET = Argument ("t", Argument ("target", "ci"));
var IOS_VERSION = "3.0.1";
var IOS_NUGET_VERSION = "3.0.1";
var IOS_URL = $"https://github.com/Azure/azure-notificationhubs-ios/releases/download/{IOS_VERSION}/WindowsAzureMessaging-SDK-Apple-{IOS_VERSION}.zip";
var ANDROID_VERSION = "1.0.1";
var ANDROID_NUGET_VERSION = "1.0.1";
var ANDROID_URL = string.Format ("https://dl.bintray.com/microsoftazuremobile/SDK/com/microsoft/azure/notification-hubs-android-sdk/{0}/notification-hubs-android-sdk-{0}.aar", ANDROID_VERSION);
Task("libs-ios")
.WithCriteria(IsRunningOnUnix())
.IsDependentOn("externals-ios")
.Does (() =>
{
MSBuild("./iOS/Xamarin.Azure.NotificationHubs.iOS/Xamarin.Azure.NotificationHubs.iOS.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.Targets.Clear();
c.Targets.Add("Rebuild");
c.Properties.Add("DesignTimeBuild", new [] { "false" });
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = "./output/libs-ios.binlog"
};
});
});
Task("libs-android")
.IsDependentOn("externals-android")
.Does (() =>
{
MSBuild("./Android/Xamarin.Azure.NotificationHubs.Android/Xamarin.Azure.NotificationHubs.Android.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.Targets.Clear();
c.Targets.Add("Rebuild");
c.Properties.Add("DesignTimeBuild", new [] { "false" });
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = "./output/libs-android.binlog"
};
});
});
Task("nuget-ios")
.WithCriteria(IsRunningOnUnix())
.IsDependentOn("libs-ios")
.Does (() =>
{
MSBuild ("./iOS/Xamarin.Azure.NotificationHubs.iOS/Xamarin.Azure.NotificationHubs.iOS.sln", c => {
c.Configuration = "Release";
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = "./output/nuget-ios.binlog"
};
});
});
Task("nuget-android")
.IsDependentOn("libs-android")
.Does (() =>
{
MSBuild ("./Android/Xamarin.Azure.NotificationHubs.Android/Xamarin.Azure.NotificationHubs.Android.sln", c => {
c.Configuration = "Release";
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = "./output/nuget-android.binlog"
};
});
});
Task("ci")
.IsDependentOn("nuget");
Task ("externals-ios")
.WithCriteria(IsRunningOnUnix())
.WithCriteria (!FileExists ("./iOS/externals/sdk.zip"))
.Does (() =>
{
EnsureDirectoryExists ("./iOS/externals");
DownloadFile (IOS_URL, "./iOS/externals/sdk.zip");
Unzip ("./iOS/externals/sdk.zip", "./iOS/externals");
CreateDirectory("./iOS/externals/iOS");
CreateDirectory("./iOS/externals/macOS");
CreateDirectory("./iOS/externals/tvOS");
CopyFile(
"./iOS/externals/WindowsAzureMessaging-SDK-Apple/iOS/WindowsAzureMessaging.framework/WindowsAzureMessaging",
"./iOS/externals/iOS/WindowsAzureMessaging.a");
CopyFile(
"./iOS/externals/WindowsAzureMessaging-SDK-Apple/macOS/WindowsAzureMessaging.framework/WindowsAzureMessaging",
"./iOS/externals/macOS/WindowsAzureMessaging.a");
CopyFile(
"./iOS/externals/WindowsAzureMessaging-SDK-Apple/tvOS/WindowsAzureMessaging.framework/WindowsAzureMessaging",
"./iOS/externals/tvOS/WindowsAzureMessaging.a");
XmlPoke("./iOS/Xamarin.Azure.NotificationHubs.iOS/Xamarin.Azure.NotificationHubs.iOS.csproj", "/Project/PropertyGroup/PackageVersion", IOS_NUGET_VERSION);
});
Task ("externals-android")
.WithCriteria (!FileExists ("./externals/Android/notificationhubs.aar"))
.Does (() =>
{
EnsureDirectoryExists ("./Android/externals");
Information($"Downloading from {ANDROID_URL}");
DownloadFile (ANDROID_URL, "./Android/externals/notificationhubs.aar");
XmlPoke("./Android/Xamarin.Azure.NotificationHubs.Android/Xamarin.Azure.NotificationHubs.Android.csproj", "/Project/PropertyGroup/PackageVersion", ANDROID_NUGET_VERSION);
});
Task ("externals")
.IsDependentOn ("externals-ios")
.IsDependentOn ("externals-android");
Task ("nuget")
.IsDependentOn ("nuget-ios")
.IsDependentOn ("nuget-android");
Task ("libs")
.IsDependentOn ("libs-ios")
.IsDependentOn ("libs-android");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./Android/externals"))
DeleteDirectory ("./Android/externals", true);
if (DirectoryExists ("./iOS/externals"))
DeleteDirectory ("./iOS/externals", true);
});
RunTarget (TARGET);

Просмотреть файл

@ -0,0 +1,26 @@
{
"Registrations":[
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://github.com/Azure/azure-notificationhubs-ios.git",
"commitHash": "e4cf0b765f88448ee0d1298a34f1ef73764ee54e"
},
"nugetId" : "Xamarin.Azure.NotificationHubs.iOS"
}
},
{
"Component": {
"Type": "Maven",
"Maven": {
"ArtifactId": "notification-hubs-android-sdk",
"GroupId": "com.microsoft.azure",
"Version": "1.0.0-preview2"
},
"nugetId" : "Xamarin.Azure.NotificationHubs.Android"
}
}
],
"Version": 1
}

Просмотреть файл

@ -0,0 +1,359 @@
using System;
using ObjCRuntime;
using Foundation;
#if !__MACOS__
namespace WindowsAzure.Messaging
{
public delegate void ErrorCallback(NSError error);
[BaseType (typeof (NSObject))]
public partial interface SBConnectionString
{
[Static, Export ("stringWithEndpoint:issuer:issuerSecret:")]
string CreateByIssuer (NSUrl endpoint, string issuer, string secret);
[Static, Export ("stringWithEndpoint:fullAccessSecret:")]
string CreateFullAccess (NSUrl endpoint, string fullAccessSecret);
[Static, Export ("stringWithEndpoint:listenAccessSecret:")]
string CreateListenAccess (NSUrl endpoint, string listenAccessSecret);
[Static, Export ("stringWithEndpoint:sharedAccessKeyName:accessSecret:")]
string CreateByKeyName (NSUrl endpoint, string keyName, string secret);
}
[BaseType (typeof (NSObject))]
public partial interface SBLocalStorage
{
[Export ("deviceToken")]
string DeviceToken { get;set; }
[Export ("isRefreshNeeded")]
bool IsRefreshNeeded { get; set; }
[Export ("initWithNotificationHubPath:")]
IntPtr Constructor (string notificationHubPath);
[Export ("refreshFinishedWithDeviceToken:")]
void RefreshFinished (string newDeviceToken);
[Export ("getStoredRegistrationEntryWithRegistrationName:")]
StoredRegistrationEntry GetStoredRegistrationEntry (string registrationName);
[Export ("updateWithRegistrationName:registration:")]
void Update (string registrationName, SBRegistration registration);
[Export ("updateWithRegistrationName:registrationId:eTag:deviceToken:")]
void Update (string registrationName, string registrationId, string eTag, string deviceToken);
[Export ("updateWithRegistrationName:")]
void Update (string registrationName);
[Export ("updateWithRegistration:")]
void Update (SBRegistration registration);
[Export ("deleteWithRegistrationName:")]
void Delete (string registrationName);
[Export ("deleteAllRegistrations")]
void DeleteAllRegistrations ();
}
[BaseType (typeof (NSObject))]
public partial interface SBNotificationHub
{
[Static, Export ("version")]
string Version { get; }
[Export ("initWithConnectionString:notificationHubPath:")]
IntPtr Constructor (string connectionString, string notificationHubPath);
[Export ("registerNativeWithDeviceToken:tags:completion:"), Async]
void RegisterNative (NSData deviceToken, [NullAllowed]NSSet tags, ErrorCallback errorCallback);
[Export ("registerTemplateWithDeviceToken:name:jsonBodyTemplate:expiryTemplate:tags:completion:"), Async]
void RegisterTemplate (NSData deviceToken, string name, string jsonBodyTemplate, string expiryTemplate, NSSet tags, ErrorCallback errorCallback);
[Export ("unregisterNativeWithCompletion:"), Async]
void UnregisterNative (ErrorCallback errorCallback);
[Export ("unregisterTemplateWithName:completion:"), Async]
void UnregisterTemplate (string name, ErrorCallback errorCallback);
[Export ("unregisterAllWithDeviceToken:completion:"), Async]
void UnregisterAll (NSData deviceToken, ErrorCallback errorCallback);
[Export ("registerNativeWithDeviceToken:tags:error:")]
bool RegisterNative (NSData deviceToken, [NullAllowed]NSSet tags, out NSError error);
[Export ("registerTemplateWithDeviceToken:name:jsonBodyTemplate:expiryTemplate:tags:error:")]
bool RegisterTemplate (NSData deviceToken, string templateName, string jsonBodyTemplate, string expiryTemplate, [NullAllowed]NSSet tags, out NSError error);
[Export ("unregisterNativeWithError:")]
bool UnregisterNative (out NSError error);
[Export ("unregisterTemplateWithName:error:")]
bool UnregisterTemplate (string name, out NSError error);
[Export ("unregisterAllWithDeviceToken:error:")]
bool UnregisterAll (NSData deviceToken, out NSError error);
}
[BaseType (typeof (NSObject))]
public partial interface SBRegistration
{
[Export ("ETag")]
string ETag { get;set; }
[Export ("expiresAt")]
NSDate ExpiresAt { get;set; }
[Export ("tags")]
NSSet Tags { get;set; }
[Export ("registrationId")]
string RegistrationId { get;set; }
[Export ("deviceToken")]
string DeviceToken { get;set; }
[Static, Export ("Name")]
string Name ();
[Static, Export ("payloadWithDeviceToken:tags:")]
string Payload (string deviceToken, NSSet tags);
}
[BaseType (typeof (NSObject))]
public partial interface StoredRegistrationEntry
{
[Export ("RegistrationName")]
string RegistrationName { get;set; }
[Export ("RegistrationId")]
string RegistrationId { get;set; }
[Export ("ETag")]
string ETag { get;set; }
[Export ("initWithString:")]
IntPtr Constructor (string str);
[Export ("toString")]
string AsString ();
}
[BaseType (typeof (NSObject))]
public partial interface SBTokenProvider
{
[Export ("timeToExpireinMins")]
int TimeToExpireInMin { get;set; }
[Export ("setTokenWithRequest:completion:")]
void SetToken (NSMutableUrlRequest request, ErrorCallback errorCallback);
[Export ("setTokenWithRequest:error:")]
bool SetToken (NSMutableUrlRequest request, out NSError error);
}
}
#endif
namespace WindowsAzure.Messaging.NotificationHubs
{
[BaseType(typeof(NSObject))]
public partial interface MSNotificationHub
{
[Static, Export("startWithConnectionString:hubName:")]
void Start(string connectionString, string hubName);
[Static, Export("startWithInstallationManagement:")]
void Start(MSInstallationManagementDelegate managementDelegate);
[Static, Export("didRegisterForRemoteNotificationsWithDeviceToken:")]
void DidRegisterForRemoteNotifications(NSData deviceToken);
[Static, Export("didFailToRegisterForRemoteNotificationsWithError:")]
void DidFailToRegisterForRemoteNotifications(NSError error);
[Static, Export("didReceiveRemoteNotification:")]
void DidReceiveRemoteNotification(NSDictionary userInfo);
[Static, Export("setDelegate:")]
void SetDelegate([NullAllowed] MSNotificationHubDelegate hubDelegate);
[Static, Export("setEnrichmentDelegate:")]
void SetEnrichmentDelegate([NullAllowed] MSInstallationEnrichmentDelegate enrichmentDelegate);
[Static, Export("setLifecycleDelegate:")]
void SetLifecycleDelegate([NullAllowed] MSInstallationLifecycleDelegate lifecycleDelegate);
[Static, Export("isEnabled")]
bool IsEnabled();
[Static, Export("setEnabled:")]
bool SetEnabled(bool isEnabled);
[Static, Export("getPushChannel")]
string GetPushChannel();
[Static, Export("getInstallationId")]
string GetInstallationId();
[Static, Export("willSaveInstallation")]
void WillSaveInstallation();
[Static, Export("addTag:")]
bool AddTag(string tag);
[Static, Export("addTags:")]
bool AddTags(NSArray<NSString> tags);
[Static, Export("removeTag:")]
bool RemoveTag(string tag);
[Static, Export("removeTags:")]
bool RemoveTags(NSArray<NSString> tags);
[Static, Export("getTags")]
NSArray<NSString> GetTags();
[Static, Export("clearTags")]
void ClearTags();
[Static, Export("setTemplate:forKey:")]
bool SetTemplate(MSInstallationTemplate template, string key);
[Static, Export("removeTemplateForKey:")]
bool RemoveTemplate(string key);
[Static, Export("getTemplateForKey:")]
MSInstallationTemplate GetTemplate(string key);
}
[Protocol, Model]
[BaseType(typeof(NSObject))]
public interface MSNotificationHubDelegate
{
[Abstract, Export("notificationHub:didReceivePushNotification:")]
void DidReceivePushNotification(MSNotificationHub notificationHub, MSNotificationHubMessage message);
}
[Protocol, Model]
[BaseType(typeof(NSObject))]
public interface MSInstallationEnrichmentDelegate
{
[Abstract, Export("notificationHub:willEnrichInstallation:")]
void WillEnrichInstallation(MSNotificationHub notificationHub, MSInstallation installation);
}
public delegate void NullableCompletionHandler([NullAllowed] NSError error);
[Protocol, Model]
[BaseType(typeof(NSObject))]
public interface MSInstallationManagementDelegate
{
[Abstract, Export("notificationHub:willUpsertInstallation:completionHandler:")]
void WillUpsertInstallation(MSNotificationHub notificationHub, MSInstallation installation, NullableCompletionHandler completionHandler);
}
[Protocol, Model]
[BaseType(typeof(NSObject))]
public interface MSInstallationLifecycleDelegate
{
[Abstract, Export("notificationHub:didSaveInstallation:")]
void DidSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation);
[Abstract, Export("notificationHub:didFailToSaveInstallation:withError:")]
void DidFailToSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation, NSError error);
}
[BaseType(typeof(NSObject))]
public partial interface MSNotificationHubMessage
{
[Export("title")]
string Title { get; }
[Export("body")]
string Body { get; }
[Export("userInfo")]
NSDictionary<NSString, NSString> UserInfo { get; }
}
[Protocol]
public interface MSChangeTracking
{
[Abstract, Export("isDirty")]
bool IsDirty();
}
[Protocol]
public interface MSTaggable
{
[Abstract, Export("tags")]
NSSet<NSString> Tags { get; }
[Abstract, Export("addTag:")]
bool AddTag(string tag);
[Abstract, Export("addTags:")]
bool AddTags(NSArray<NSString> tags);
[Abstract, Export("removeTag:")]
bool RemoveTag(string tag);
[Abstract, Export("removeTags:")]
bool RemoveTags(NSArray<NSString> tags);
[Abstract, Export("clearTags")]
void ClearTags();
}
[BaseType(typeof(NSObject))]
public partial interface MSInstallation : MSTaggable, MSChangeTracking
{
[Export("installationId")]
string InstallationId { get; set; }
[Export("pushChannel")]
string PushChannel { get; set; }
[Export("expirationTime")]
NSDate ExpirationTime { get; set; }
[Export("templates")]
NSDictionary<NSString, MSInstallationTemplate> Templates { get; }
[Export("setTemplate:forKey:")]
bool SetTemplate(MSInstallationTemplate template, string key);
[Export("removeTemplateForKey:")]
bool RemoveTemplate(string key);
[Export("getTemplateForKey:")]
MSInstallationTemplate GetTemplate(string key);
[Export("toJsonData")]
NSData ToJsonData();
}
[BaseType(typeof(NSObject))]
public partial interface MSInstallationTemplate : INativeObject, MSTaggable, MSChangeTracking
{
[Export("body")]
string Body { get; set; }
[Export("headers")]
NSDictionary<NSString, NSString> Headers { get; }
[Export("setHeaderValue:forKey:")]
void SetHeader(string value, string key);
[Export("removeHeaderValueForKey:")]
void RemoveHeader(string key);
[Export("getHeaderValueForKey:")]
string GetHeader(string key);
}
}

Просмотреть файл

@ -0,0 +1,10 @@
using System;
namespace WindowsAzure.Messaging
{
}
namespace WindowsAzure.Messaging.NotificationHubs
{
}

Просмотреть файл

@ -0,0 +1,82 @@
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
<PropertyGroup>
<TargetFrameworks>Xamarin.iOS10;Xamarin.TVOS10;Xamarin.Mac20</TargetFrameworks>
<IsBindingProject>true</IsBindingProject>
<RootNamespace>WindowsAzure.Messaging</RootNamespace>
<AssemblyName>Xamarin.Azure.NotificationHubs.iOS</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<PackageId>Xamarin.Azure.NotificationHubs.iOS</PackageId>
<Title>Azure Notification Hubs for Xamarin.iOS, Xamarin.Mac and Xamarin.TVOS</Title>
<PackageDescription>Xamarin.iOS, Xamarin.Mac and Xamarin.TVOS Bindings for Azure Notification Hubs.</PackageDescription>
<Authors>Microsoft</Authors>
<Owners>Microsoft</Owners>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/xamarin/XamarinComponents/master/XPlat/AzureMessaging/component/icons/aznh-icon-128x128.png</PackageIconUrl>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=864962</PackageProjectUrl>
<PackageLicenseUrl>https://go.microsoft.com/fwlink/?linkid=865062</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageVersion>3.0.1</PackageVersion>
</PropertyGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.TVOS')) ">
<Reference Include="Xamarin.TVOS" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.Mac')) ">
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<NativeReference Include="..\externals\iOS\WindowsAzureMessaging.a">
<Kind>Static</Kind>
<SmartLink>false</SmartLink>
<Frameworks>Security SystemConfiguration Foundation UIKit</Frameworks>
<WeakFrameworks>UserNotifications</WeakFrameworks>
</NativeReference>
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.TVOS')) ">
<NativeReference Include="..\externals\tvOS\WindowsAzureMessaging.a">
<Kind>Static</Kind>
<SmartLink>false</SmartLink>
<Frameworks>Security SystemConfiguration Foundation UIKit</Frameworks>
<WeakFrameworks>UserNotifications</WeakFrameworks>
</NativeReference>
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.Mac')) ">
<NativeReference Include="..\externals\macOS\WindowsAzureMessaging.a">
<Kind>Static</Kind>
<SmartLink>false</SmartLink>
<Frameworks>Security SystemConfiguration Foundation AppKit</Frameworks>
<WeakFrameworks>UserNotifications</WeakFrameworks>
</NativeReference>
</ItemGroup>
<ItemGroup>
<Compile Remove="StructsAndEnums.cs" />
<Compile Remove="ApiDefinition.cs" />
</ItemGroup>
<ItemGroup>
<ObjcBindingCoreSource Include="StructsAndEnums.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true'" />
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true'" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,58 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29230.54
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Azure.NotificationHubs.iOS", "Xamarin.Azure.NotificationHubs.iOS.csproj", "{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
Ad-Hoc|iPhone = Ad-Hoc|iPhone
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
AppStore|Any CPU = AppStore|Any CPU
AppStore|iPhone = AppStore|iPhone
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|Any CPU.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|iPhone.Build.0 = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|iPhone.Build.0 = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|Any CPU.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|iPhone.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|iPhone.Build.0 = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{99ECFF92-CA4E-4473-ADFC-5D7F3ABBC4C6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FDE3FEA-4F23-4592-88F1-12CEDB8DDEED}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = AzureMessagingSampleAndroid\AzureMessagingSampleAndroid.csproj
EndGlobalSection
EndGlobal