[TVMLKit] Work around Apple breaking API for enum values in TVElementUpdateType. (#5849)

* [TVMLKit] Work around Apple breaking API for enum values in TVElementUpdateType.

Reference: https://trello.com/c/Eyox7vlH/118-41123682-tvelementupdatetype-enum-values-changed
Reference: rdar://41123682 (closed as by design)

* Use this workaround even after XAMCORE_4_0.

Apple's breaking changes don't disappear in XAMCORE_4_0.

* Fix compiler warnings and Export attribute location.
This commit is contained in:
Rolf Bjarne Kvinge 2019-04-09 16:48:18 +02:00 коммит произвёл GitHub
Родитель 8792992b79
Коммит 0e8423e2dd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 43 добавлений и 1 удалений

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

@ -1,6 +1,7 @@
using System;
using Foundation;
using ObjCRuntime;
using UIKit;
namespace TVMLKit {
@ -16,6 +17,39 @@ namespace TVMLKit {
public bool IsDispatched { get; set; }
public bool IsCancelled { get; set; }
#endif
}
public partial class TVViewElement {
#if !COREBUILD
public virtual TVElementUpdateType UpdateType {
[Export ("updateType")]
get {
var value = _UpdateType;
switch ((long) value) {
case 2:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Styles;
} else {
return TVElementUpdateType.Children;
}
case 3:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Children;
} else {
return TVElementUpdateType.Self;
}
case 4:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Self;
} else {
return TVElementUpdateType.Styles;
}
default:
return value;
}
}
}
#endif
}
}

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

@ -86,10 +86,17 @@ namespace TVMLKit {
public enum TVElementUpdateType : long {
None,
Subtree,
#if XAMCORE_4_0
[TV (10,0)]
Styles,
Children,
Self,
#else
Children,
Self,
[TV (10,0)]
Styles,
#endif
}
[TV (9,0)]
@ -819,8 +826,9 @@ namespace TVMLKit {
set;
}
[Internal][Sealed]
[Export ("updateType")]
TVElementUpdateType UpdateType { get; }
TVElementUpdateType _UpdateType { get; }
[Export ("resetProperty:")]
void Reset (TVElementResettableProperty resettableProperty);