Set up CI with Azure Pipelines (#7)
* Set up CI with Azure Pipelines * Updating samples and adding XML Docs
|
@ -1,3 +1,5 @@
|
|||
[![Build Status](https://dev.azure.com/devdiv/DevDiv/_apis/build/status/Azure.azure-notificationhubs-xamarin?repoName=Azure%2Fazure-notificationhubs-xamarin&branchName=master)](https://dev.azure.com/devdiv/DevDiv/_build/latest?definitionId=13458&repoName=Azure%2Fazure-notificationhubs-xamarin&branchName=master)
|
||||
|
||||
# Azure Notification Hubs for Xamarin
|
||||
|
||||
This repository contains the Azure Notification Hubs sample library and sample application for Xamarin Forms, Xamarin for Apple (Xamarin.iOS, Xamarin.TVOS, Xamarin.Mac) and Xamarin.Android. This sample project creates a unified wrapper over the [AzureMessaging Xamarin Components](https://github.com/xamarin/XamarinComponents/tree/master/XPlat/AzureMessaging) for both iOS and Android with a Forms app as well as native applications.
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
variables:
|
||||
# job parameters
|
||||
masterBranchName: 'master'
|
||||
submodules: false
|
||||
# job software version parameters
|
||||
macosImage: 'macos-latest'
|
||||
netcoreVersion: '3.1.100'
|
||||
apiToolsVersion: '1.3.1'
|
||||
monoVersion: 'Latest'
|
||||
xcodeVersion: '11.6'
|
||||
cake: '0.38.4'
|
||||
# build parameters
|
||||
cakeTarget: 'ci'
|
||||
cakeFile: 'src/bindings/build.cake'
|
||||
cakeExtraArgs: ''
|
||||
artifactsPath: 'src/bindings/output'
|
||||
# build parameters
|
||||
buildType: 'basic'
|
||||
verbosity: 'normal'
|
||||
configuration: 'Release'
|
||||
RunPoliCheck: 'false'
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: xamarin-templates
|
||||
type: github
|
||||
name: xamarin/yaml-templates
|
||||
endpoint: xamarin
|
||||
|
||||
jobs:
|
||||
- job: build_native
|
||||
displayName: Build Azure Notification Hubs Native Bindings
|
||||
pool:
|
||||
vmImage: $(macosImage)
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: $(submodules)
|
||||
# before the build starts, make sure the tooling is as expected
|
||||
- bash: 'sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(monoVersion)'
|
||||
displayName: 'Switch to the latest Xamarin SDK'
|
||||
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(xcodeVersion).app;sudo xcode-select --switch /Applications/Xcode_$(xcodeVersion).app/Contents/Developer
|
||||
displayName: 'Switch to the latest Xcode'
|
||||
- bash: echo '##vso[task.setvariable variable=PATH;]'$PATH:$HOME/.dotnet/tools
|
||||
displayName: 'Add ~/.dotnet/tools to the PATH environment variable'
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Switch to the correct version of the .NET Core SDK'
|
||||
inputs:
|
||||
version: $(netcoreVersion)
|
||||
includePreviewVersions: false
|
||||
- pwsh: |
|
||||
dotnet tool install -g api-tools --version $(apiToolsVersion)
|
||||
dotnet tool install -g cake.tool --version $(cake)
|
||||
displayName: 'Install required .NET Core global tools'
|
||||
- task: NuGetToolInstaller@1
|
||||
inputs:
|
||||
checkLatest: true
|
||||
displayName: 'Download the latest nuget.exe'
|
||||
# determine the last successful build for "master" branch
|
||||
- pwsh: |
|
||||
# determine the "master" branch
|
||||
$masterBranch = "$(masterBranchName)"
|
||||
$encodedBranch = [Uri]::EscapeDataString("refs/heads/$masterBranch")
|
||||
Write-Host "Master branch: $masterBranch"
|
||||
# determine the "current" branch
|
||||
$branch = "$(Build.SourceBranch)"
|
||||
if ("$env:SYSTEM_PULLREQUEST_TARGETBRANCH") {
|
||||
$branch = "$env:SYSTEM_PULLREQUEST_TARGETBRANCH"
|
||||
}
|
||||
if ($branch.StartsWith("refs/heads/")) {
|
||||
$branch = $branch.Substring(11)
|
||||
Write-Host "Current branch: $branch"
|
||||
}
|
||||
if ($branch.StartsWith("refs/tags/")) {
|
||||
$branch = $branch.Substring(10)
|
||||
Write-Host "Current tag: $branch"
|
||||
}
|
||||
if (($branch -eq $masterBranch) -and ("$(System.PullRequest.IsFork)" -eq "False")) {
|
||||
Write-Host "Branch is master, fetching last successful build commit..."
|
||||
$url = "$(System.TeamFoundationCollectionUri)$(System.TeamProjectId)/_apis/build/builds/?definitions=$(System.DefinitionId)&branchName=$encodedBranch&statusFilter=completed&resultFilter=succeeded&api-version=5.0"
|
||||
Write-Host "URL for last successful master build: $url"
|
||||
$json = Invoke-RestMethod -Uri $url -Headers @{
|
||||
Authorization = "Bearer $(System.AccessToken)"
|
||||
}
|
||||
Write-Host "JSON response:"
|
||||
Write-Host "$json"
|
||||
$lastSuccessfulBuildCommit = try { $json.value[0].sourceVersion; } catch { $null }
|
||||
}
|
||||
if ($lastSuccessfulBuildCommit) {
|
||||
Write-Host "Last successful commit found: $lastSuccessfulBuildCommit"
|
||||
} else {
|
||||
$lastSuccessfulBuildCommit = "origin/$masterBranch"
|
||||
Write-Host "No previously successful build found, using $lastSuccessfulBuildCommit."
|
||||
}
|
||||
Write-Host "##vso[task.setvariable variable=GitLastSuccessfulCommit]$lastSuccessfulBuildCommit"
|
||||
displayName: 'Find the last successful commit'
|
||||
- pwsh: |
|
||||
dotnet cake $(cakeFile) $(cakeExtraArgs)`
|
||||
--gitpreviouscommit="$(GitLastSuccessfulCommit)" `
|
||||
--gitcommit="$(Build.SourceVersion)" `
|
||||
--gitbranch="$(Build.SourceBranch)" `
|
||||
--target="$(cakeTarget)" `
|
||||
--configuration="$(configuration)" `
|
||||
--verbosity="$(verbosity)"
|
||||
displayName: 'Run build'
|
||||
env:
|
||||
JavaSdkDirectory: $(JAVA_HOME)
|
||||
RepositoryCommit: $(Build.SourceVersion)
|
||||
RepositoryBranch: $(Build.SourceBranchName)
|
||||
RepositoryUrl: $(Build.Repository.Uri)
|
||||
RepositoryType: "git"
|
||||
# after the build is complete
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish artifacts'
|
||||
inputs:
|
||||
PathToPublish: $(artifactsPath)
|
||||
ArtifactName: nuget
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish platform artifacts'
|
||||
condition: always()
|
||||
inputs:
|
||||
PathToPublish: $(artifactsPath)
|
||||
ArtifactName: output-$(System.JobName)
|
||||
# run any required checks
|
||||
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
||||
- task: ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Run component detection'
|
||||
condition: and(always(), eq('refs/heads/$(masterBranchName)', variables['Build.SourceBranch']))
|
||||
inputs:
|
||||
scanType: 'Register'
|
||||
verbosity: 'Verbose'
|
||||
alertWarningLevel: 'High'
|
||||
|
||||
- job: build_xamarin_forms
|
||||
displayName: Build Azure Notification Hubs Xamarn Forms SDK
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: $(submodules)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .Net Core sdk'
|
||||
inputs:
|
||||
version: $(netcoreVersion)
|
||||
includePreviewVersions: false
|
||||
- task: MSBuild@1
|
||||
displayName: Build Solution
|
||||
inputs:
|
||||
solution: src/Microsoft.Azure.NotificationHubs.Client/Microsoft.Azure.NotificationHubs.Client.csproj
|
||||
configuration: Release
|
||||
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
|
||||
- task: MSBuild@1
|
||||
displayName: Pack NuGets
|
||||
inputs:
|
||||
solution: src/Microsoft.Azure.NotificationHubs.Client/Microsoft.Azure.NotificationHubs.Client.csproj
|
||||
configuration: Release
|
||||
msbuildArguments: '/t:Pack /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
|
||||
# publish the packages
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Unsigned NuGets'
|
||||
inputs:
|
||||
artifactName: nuget
|
||||
pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget'
|
||||
# make sure we are following the rules, but only on the main build
|
||||
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
|
||||
displayName: Component Detection - Log
|
||||
inputs:
|
||||
scanType: LogOnly
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
||||
displayName: Component Detection - Report
|
||||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
|
||||
condition: eq(variables['RunPoliCheck'], 'true')
|
||||
displayName: 'PoliCheck'
|
||||
inputs:
|
||||
targetType: F
|
||||
|
||||
# only sign the packages when running on Windows, and using the private server which has the certificates
|
||||
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
||||
- job: signing
|
||||
displayName: Signing NuGets
|
||||
dependsOn: [ build_xamarin_forms, build_native ]
|
||||
pool:
|
||||
name: VSEng-XamarinCustom
|
||||
demands:
|
||||
- corpnet
|
||||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
|
||||
steps:
|
||||
# don't checkout code and sign the packages
|
||||
- checkout: none
|
||||
- template: sign-artifacts.yml@xamarin-templates
|
||||
parameters:
|
||||
targetFolder: '$(Build.ArtifactStagingDirectory)/signed'
|
||||
# publish the signed packages
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Signed NuGets'
|
||||
inputs:
|
||||
artifactName: nuget-signed
|
||||
pathToPublish: '$(Build.ArtifactStagingDirectory)/signed'
|
|
@ -1,19 +0,0 @@
|
|||
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");
|
|
@ -1,13 +0,0 @@
|
|||
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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using WindowsAzure.Messaging.NotificationHubs;
|
||||
|
||||
namespace NHubSampleXamarinAndroid
|
||||
{
|
||||
public class InstallationSavedListener : Java.Lang.Object, IInstallationAdapterListener
|
||||
{
|
||||
public InstallationSavedListener()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnInstallationSaved(Installation installation)
|
||||
{
|
||||
Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
<?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>
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
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
|
|
@ -1,18 +0,0 @@
|
|||
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}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?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="16" 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>
|
|
@ -1,26 +0,0 @@
|
|||
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")]
|
|
@ -1,44 +0,0 @@
|
|||
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.
|
|
@ -1,8 +0,0 @@
|
|||
<?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>
|
|
@ -1,4 +0,0 @@
|
|||
<?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>
|
|
@ -1,4 +0,0 @@
|
|||
<?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>
|
|
@ -1,5 +0,0 @@
|
|||
<?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,5 +0,0 @@
|
|||
<?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 |
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#2c3e50</color>
|
||||
<color name="colorPrimaryDark">#1B3147</color>
|
||||
<color name="colorAccent">#3498db</color>
|
||||
</resources>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#2C3E50</color>
|
||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<string name="app_name">NHubSampleXamarinAndroid</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
</resources>
|
|
@ -1,16 +0,0 @@
|
|||
<?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>
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
{
|
||||
"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 |
|
@ -1,10 +0,0 @@
|
|||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -1,67 +0,0 @@
|
|||
<?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>
|
|
@ -1,12 +0,0 @@
|
|||
using WindowsAzure.Messaging.NotificationHubs;
|
||||
|
||||
namespace NHubSampleXamariniOS
|
||||
{
|
||||
public class InstallationEnrichmentDelegate : MSInstallationEnrichmentDelegate
|
||||
{
|
||||
public override void WillEnrichInstallation(MSNotificationHub notificationHub, MSInstallation installation)
|
||||
{
|
||||
installation.AddTag("platform_Xamarin");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
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}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?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>
|
|
@ -1,15 +0,0 @@
|
|||
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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?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>
|
|
@ -1,144 +0,0 @@
|
|||
<?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>
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
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
|
|
@ -1,25 +0,0 @@
|
|||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
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")]
|
|
@ -1,43 +0,0 @@
|
|||
<?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>
|
|
@ -1,60 +0,0 @@
|
|||
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.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
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.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
// 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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,7 +1,14 @@
|
|||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents a way to enrich the current installation before it is sent to the back-end.
|
||||
/// </summary>
|
||||
public interface IInstallationEnrichmentAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Enriches an installation before being sent to the back-end.
|
||||
/// </summary>
|
||||
/// <param name="installation">The installation to enrich.</param>
|
||||
void EnrichInstallation(Installation installation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,17 @@
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents an adapter to allows the user to save the installation on the back-end and report back either success or failure.
|
||||
/// </summary>
|
||||
public interface IInstallationManagementAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Saves an installation to a back-end. To finish the call, one must invoke onSuccess for success or onError for failure.
|
||||
/// </summary>
|
||||
/// <param name="installation">The installation to save the back-end.</param>
|
||||
/// <param name="onSuccess">The success action to invoke upon successful save.</param>
|
||||
/// <param name="onError">The failure action to invoke when a save has failed.</param>
|
||||
void SaveInstallation(Installation installation, Action<Installation> onSuccess, Action<Exception> onError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,34 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents an Azure Notification Hubs Installation.
|
||||
/// </summary>
|
||||
public class Installation
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID for the installation.
|
||||
/// </summary>
|
||||
public string InstallationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The PNS specific push channel for the installation.
|
||||
/// </summary>
|
||||
public string PushChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The expiration time for the installation.
|
||||
/// </summary>
|
||||
public DateTime? ExpirationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The tags for the installation.
|
||||
/// </summary>
|
||||
public ICollection<string> Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The templates for the installation.
|
||||
/// </summary>
|
||||
public IDictionary<string, InstallationTemplate> Templates { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// The EventArgs for when an installation save has failed.
|
||||
/// </summary>
|
||||
public class InstallationSaveFailedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The exception from saving the installation.
|
||||
/// </summary>
|
||||
public Exception Exception { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// The EventArgs for when an installation has been saved successfully.
|
||||
/// </summary>
|
||||
public class InstallationSavedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The installation that was saved to the backend.
|
||||
/// </summary>
|
||||
public Installation Installation { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,24 @@
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// The Installation Template for Installations.
|
||||
/// </summary>
|
||||
public class InstallationTemplate
|
||||
{
|
||||
/// <summary>
|
||||
/// The body of the template.
|
||||
/// </summary>
|
||||
public string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The tags for the template.
|
||||
/// </summary>
|
||||
public IList<string> Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The headers for the template.
|
||||
/// </summary>
|
||||
public IDictionary<string, string> Headers { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) OR $(TargetFramework.StartsWith('Xamarin.TVOS')) OR $(TargetFramework.StartsWith('Xamarin.Mac')) ">
|
||||
<!-- Add Xamarin iOS bindings -->
|
||||
<PackageReference Include="Xamarin.Azure.NotificationHubs.iOS" Version="3.0.1" />
|
||||
<PackageReference Include="Xamarin.Azure.NotificationHubs.iOS" Version="3.0.2" />
|
||||
|
||||
<!-- iOS files have ios.cs -->
|
||||
<Compile Include="**\*.ios.cs" />
|
||||
|
|
|
@ -3,13 +3,24 @@ using WindowsAzure.Messaging.NotificationHubs;
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// An implementation of the MSNotificationHubDelegate to intercept messages from APNS.
|
||||
/// </summary>
|
||||
public class NotificationHubMessageDelegate : MSNotificationHubDelegate
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when a push notification has been received with the notification hub and message.
|
||||
/// </summary>
|
||||
/// <param name="notificationHub">The current NotificationHub instance.</param>
|
||||
/// <param name="message">The message from APNS.</param>
|
||||
public override void DidReceivePushNotification(MSNotificationHub notificationHub, MSNotificationHubMessage message)
|
||||
{
|
||||
OnNotificationMessageReceivedAction?.Invoke(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An action to invoke when a message is received via DidReceivePushNotification.
|
||||
/// </summary>
|
||||
public Action<MSNotificationHubMessage> OnNotificationMessageReceivedAction { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,24 @@ using WindowsAzure.Messaging.NotificationHubs;
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation of a NotificationListener for Android to receive messages.
|
||||
/// </summary>
|
||||
public class NotificationListener : Java.Lang.Object, INotificationListener
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a push notification has been received with the context and message.
|
||||
/// </summary>
|
||||
/// <param name="context">The Android context.</param>
|
||||
/// <param name="message">The message containing the properties.</param>
|
||||
public void OnPushNotificationReceived(Context context, INotificationMessage message)
|
||||
{
|
||||
OnNotificationMessageReceivedAction?.Invoke(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The action to invoke when a message is received.
|
||||
/// </summary>
|
||||
public Action<INotificationMessage> OnNotificationMessageReceivedAction;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,24 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Microsoft.Azure.NotificationHubs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// The EventArgs received when a push notification has been received.
|
||||
/// </summary>
|
||||
public class NotificationMessageReceivedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The title of the push notification.
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The body of the push notification.
|
||||
/// </summary>
|
||||
public string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The data from the push notification.
|
||||
/// </summary>
|
||||
public IDictionary<string, string> Data { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<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>
|
||||
<PackageVersion>3.0.2</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
|
||||
|
|