Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/Intents/INSaveProfileInCarIntent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// INSaveProfileInCarIntent Extensions
//
// Authors:
// Alex Soto <alexsoto@microsoft.com>
//
// Copyright 2016 Xamarin Inc. All rights reserved.
//

#if XAMCORE_2_0 && IOS

using XamCore.Foundation;
using XamCore.Intents;
using XamCore.ObjCRuntime;
using XamCore.UIKit;

namespace XamCore.Intents {
public partial class INSaveProfileInCarIntent {

public INSaveProfileInCarIntent (NSNumber profileNumber, string profileLabel)
{
// Apple created this change in 10,2
if (UIDevice.CurrentDevice.CheckSystemVersion (10, 2))
InitializeHandle (InitWithProfileNumberName (profileNumber, profileLabel));
else
InitializeHandle (InitWithProfileNumberLabel (profileNumber, profileLabel));
}
}
}
#endif
11 changes: 11 additions & 0 deletions src/Intents/INSetProfileInCarIntent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,27 @@
using XamCore.Foundation;
using XamCore.Intents;
using XamCore.ObjCRuntime;
using XamCore.UIKit;

namespace XamCore.Intents {

public partial class INSetProfileInCarIntent {

[DesignatedInitializer]
public INSetProfileInCarIntent (NSNumber profileNumber, string profileLabel, bool? defaultProfile) :
this (profileNumber, profileLabel, defaultProfile.HasValue ? new NSNumber (defaultProfile.Value) : null)
{
}

protected INSetProfileInCarIntent (NSNumber profileNumber, string profileLabel, NSNumber defaultProfile)
{
// Apple created this change in 10,2
if (UIDevice.CurrentDevice.CheckSystemVersion (10, 2))
InitializeHandle (InitWithProfileNumberName (profileNumber, profileLabel, defaultProfile));
else
InitializeHandle (InitWithProfileNumberLabel (profileNumber, profileLabel, defaultProfile));
}

// if/when we update the generator to allow this pattern we can move this back
// into bindings and making them virtual (not a breaking change)

Expand Down
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ INTENTS_SOURCES = \
Intents/INSetProfileInCarIntent.cs \
Intents/INSetSeatSettingsInCarIntent.cs \
Intents/INStartWorkoutIntent.cs \
Intents/INSaveProfileInCarIntent.cs \

# JavaScriptCore

Expand Down
Loading