forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Identical to PR2475 who suffered from a fatal git issue :( [1] xamarin#2475
- Loading branch information
Showing
12 changed files
with
361 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using XamCore.Foundation; | ||
using XamCore.ObjCRuntime; | ||
|
||
namespace XamCore.PassKit { | ||
|
||
public partial class PKContactFieldsExtensions { | ||
|
||
static public PKContactFields GetValue (NSSet set) | ||
{ | ||
var fields = PKContactFields.None; | ||
if (set == null) | ||
return fields; | ||
|
||
foreach (PKContactFields value in Enum.GetValues (typeof (PKContactFields))) { | ||
var constant = value.GetConstant (); | ||
// None does not have an associated native value and Contains would throw an ANE | ||
if ((constant != null) && set.Contains (constant)) | ||
fields |= value; | ||
} | ||
return fields; | ||
} | ||
|
||
static public NSSet GetSet (PKContactFields values) | ||
{ | ||
var set = new NSMutableSet (); | ||
if (values == PKContactFields.None) | ||
return set; | ||
|
||
foreach (PKContactFields value in Enum.GetValues (typeof (PKContactFields))) { | ||
if (values.HasFlag (value)) { | ||
var constant = value.GetConstant (); | ||
// None does not have an associated native value and Contains would throw an ANE | ||
if (constant != null) | ||
set.Add (constant); | ||
} | ||
} | ||
return set; | ||
} | ||
} | ||
|
||
public partial class PKPaymentRequest { | ||
|
||
[Watch (4,0)][iOS (11,0)] | ||
public PKContactFields RequiredBillingContactFields { | ||
get { return PKContactFieldsExtensions.GetValue (WeakRequiredBillingContactFields); } | ||
set { WeakRequiredBillingContactFields = PKContactFieldsExtensions.GetSet (value); } | ||
} | ||
|
||
[Watch (4,0)][iOS (11,0)] | ||
public PKContactFields RequiredShippingContactFields { | ||
get { return PKContactFieldsExtensions.GetValue (WeakRequiredShippingContactFields); } | ||
set { WeakRequiredShippingContactFields = PKContactFieldsExtensions.GetSet (value); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.