[photos] Add nullability to (generated and manual) bindings (#14861)

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
This commit is contained in:
TJ Lambert 2022-05-03 10:50:14 -05:00 коммит произвёл GitHub
Родитель 0de0a2fd39
Коммит 86a312d86e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 24 добавлений и 9 удалений

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

@ -1,3 +1,5 @@
#nullable enable
#if !MONOMAC
using System;

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

@ -6,6 +6,8 @@
// Authors:
// Miguel de Icaza (miguel@xamarin.com)
#nullable enable
using System;
using Foundation;

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

@ -1,3 +1,5 @@
#nullable enable
using System;
namespace Photos {

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

@ -1,6 +1,8 @@
// Copyright 2016 Xamarin Inc. All rights reserved.
// Copyright 2019 Microsoft Corporation
#nullable enable
using System;
using CoreImage;
using Foundation;
@ -34,7 +36,7 @@ namespace Photos {
public partial class PHLivePhotoEditingContext {
[Obsolete ("Use 'FrameProcessor2' instead.", true)]
public virtual PHLivePhotoFrameProcessingBlock FrameProcessor { get; set; }
public virtual PHLivePhotoFrameProcessingBlock? FrameProcessor { get; set; }
}
#if MONOMAC
@ -42,14 +44,14 @@ namespace Photos {
[Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")]
[Unavailable (PlatformName.MacOSX)]
public static PHFetchResult FetchMoments (PHFetchOptions options)
public static PHFetchResult? FetchMoments (PHFetchOptions options)
{
return null;
}
[Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")]
[Unavailable (PlatformName.MacOSX)]
public static PHFetchResult FetchMoments (PHCollectionList momentList, PHFetchOptions options)
public static PHFetchResult? FetchMoments (PHCollectionList momentList, PHFetchOptions options)
{
return null;
}
@ -59,14 +61,14 @@ namespace Photos {
[Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")]
[Unavailable (PlatformName.MacOSX)]
public static PHFetchResult FetchMomentLists (PHCollectionListSubtype subType, PHFetchOptions options)
public static PHFetchResult? FetchMomentLists (PHCollectionListSubtype subType, PHFetchOptions options)
{
return null;
}
[Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")]
[Unavailable (PlatformName.MacOSX)]
public static PHFetchResult FetchMomentLists (PHCollectionListSubtype subType, PHAssetCollection moment, PHFetchOptions options)
public static PHFetchResult? FetchMomentLists (PHCollectionListSubtype subType, PHAssetCollection moment, PHFetchOptions options)
{
return null;
}
@ -75,7 +77,7 @@ namespace Photos {
public partial class PHContentEditingInput {
[Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")]
[Unavailable (PlatformName.MacOSX, message: "Use 'AudiovisualAsset' instead.")]
public virtual AVFoundation.AVAsset AvAsset {
public virtual AVFoundation.AVAsset? AvAsset {
get { return AudiovisualAsset; }
}
}

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

@ -1,3 +1,5 @@
#nullable enable
using ObjCRuntime;
using Foundation;
using System;

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

@ -1,5 +1,7 @@
// Copyright 2015 Xamarin Inc
#nullable enable
using System;
using Foundation;

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

@ -6,6 +6,9 @@
//
// Copyright 2014 Xamarin Inc
//
#nullable enable
using ObjCRuntime;
using Foundation;
using System;
@ -39,10 +42,10 @@ namespace Photos
public void UnregisterChangeObserver (object registeredToken)
{
if (!(registeredToken is __phlib_observer))
if (registeredToken is __phlib_observer observer)
UnregisterChangeObserver (observer);
else
throw new ArgumentException ("registeredToken should be a value returned by RegisterChangeObserver(PHChange)");
UnregisterChangeObserver (registeredToken as __phlib_observer);
}
}
}