Skip to content

Commit 4d7f015

Browse files
authored
[StoreKit] Fix all availability attributes in this framework. (#22690)
* Add/adjust availability attributes. * Remove !.NET availability attributes / code. This is a step towards fixing #21185.
1 parent af6a66f commit 4d7f015

File tree

8 files changed

+9
-87
lines changed

8 files changed

+9
-87
lines changed

src/StoreKit/Enums.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ public enum SKError : long {
5454
// iOS 10.3
5555
/// <summary>To be added.</summary>
5656
CloudServiceRevoked,
57-
#if !NET
58-
[Obsolete ("Use 'SKError.CloudServiceRevoked' instead.")]
59-
Revoked = CloudServiceRevoked,
60-
#endif
6157
// iOS 12.2
6258
/// <summary>To be added.</summary>
6359
PrivacyAcknowledgementRequired,

src/StoreKit/NativeMethods.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
namespace StoreKit {
88

99
partial class SKReceiptRefreshRequest {
10-
#if NET
1110
/// <summary>To be added.</summary>
1211
/// <remarks>To be added.</remarks>
1312
[SupportedOSPlatform ("ios")]
1413
[SupportedOSPlatform ("macos")]
1514
[SupportedOSPlatform ("maccatalyst")]
1615
[SupportedOSPlatform ("tvos")]
17-
#endif
1816
[DllImport (Constants.StoreKitLibrary, EntryPoint = "SKTerminateForInvalidReceipt")]
1917
static extern public void TerminateForInvalidReceipt ();
2018
}

src/StoreKit/SKAdNetworkCompat.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/StoreKit/SKReceiptProperty.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
namespace StoreKit {
2323
/// <summary>Defines test properties for the <format type="text/html"><a href="https://docs.microsoft.com/en-us/search/index?search=C:StoreKit.SKReceiptRefreshRequest(Foundation.NSDictionary)&amp;scope=Xamarin" title="C:StoreKit.SKReceiptRefreshRequest(Foundation.NSDictionary)">C:StoreKit.SKReceiptRefreshRequest(Foundation.NSDictionary)</a></format> constructor.</summary>
2424
/// <remarks>To be added.</remarks>
25+
[SupportedOSPlatform ("maccatalyst")]
26+
[SupportedOSPlatform ("ios")]
27+
[SupportedOSPlatform ("macos")]
28+
[SupportedOSPlatform ("tvos")]
29+
[ObsoletedOSPlatform ("ios18.0")]
30+
[ObsoletedOSPlatform ("maccatalyst18.0")]
31+
[ObsoletedOSPlatform ("macos15.0")]
32+
[ObsoletedOSPlatform ("tvos18.0")]
2533
public partial class SKReceiptProperties : DictionaryContainer {
2634
#if !COREBUILD
2735
/// <summary>To be added.</summary>

src/frameworks.sources

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,6 @@ STOREKIT_CORE_SOURCES = \
16931693

16941694
STOREKIT_SOURCES = \
16951695
StoreKit/NativeMethods.cs \
1696-
StoreKit/SKAdNetworkCompat.cs \
16971696
StoreKit/SKCloudServiceSetupOptions.cs \
16981697
StoreKit/SKPayment.cs \
16991698
StoreKit/SwiftAPI.cs \

src/storekit.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
#endif
2727
using System;
2828

29-
#if !NET
30-
using NativeHandle = System.IntPtr;
31-
#endif
32-
3329
#nullable enable
3430

3531
namespace StoreKit {
@@ -167,9 +163,7 @@ partial interface SKDownload {
167163
[Deprecated (PlatformName.TvOS, 18, 0 /* Apple's replacement requires Swift */ )]
168164
[MacCatalyst (13, 1)]
169165
[BaseType (typeof (NSObject))]
170-
#if NET
171166
[DisableDefaultCtor]
172-
#endif
173167
partial interface SKPayment : NSMutableCopying {
174168
[Static]
175169
[Export ("paymentWithProduct:")]
@@ -214,9 +208,7 @@ partial interface SKPayment : NSMutableCopying {
214208
[Deprecated (PlatformName.TvOS, 18, 0 /* Apple's replacement requires Swift */ )]
215209
[MacCatalyst (13, 1)]
216210
[BaseType (typeof (SKPayment))]
217-
#if NET
218211
[DisableDefaultCtor]
219-
#endif
220212
interface SKMutablePayment {
221213
[Static]
222214
[Export ("paymentWithProduct:")]
@@ -388,25 +380,14 @@ interface SKProduct {
388380
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'IsDownloadable' instead.")]
389381
[Export ("downloadable")]
390382
bool Downloadable { get; }
391-
#elif !NET
392-
[NoMac]
393-
[Obsolete ("Use 'IsDownloadable' instead.")]
394-
bool Downloadable {
395-
[Wrap ("IsDownloadable")]
396-
get;
397-
}
398383
#endif
399384

400385
[MacCatalyst (13, 1)]
401386
[Export ("isDownloadable")]
402387
bool IsDownloadable { get; }
403388

404389
[NoiOS]
405-
#if NET
406390
[NoTV]
407-
#else
408-
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'DownloadContentLengths' instead.")]
409-
#endif
410391
[Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'DownloadContentLengths' instead.")]
411392
[NoMacCatalyst]
412393
[Export ("contentLengths")]
@@ -765,13 +746,6 @@ interface SKProductsRequestDelegate {
765746
Delegates = new string [] { "WeakDelegate" },
766747
Events = new Type [] { typeof (SKStoreProductViewControllerDelegate) })]
767748
interface SKStoreProductViewController {
768-
#if !NET
769-
// SKStoreProductViewController is an OS View Controller which can't be customized
770-
[Export ("initWithNibName:bundle:")]
771-
[PostGet ("NibBundle")]
772-
NativeHandle Constructor ([NullAllowed] string nibName, [NullAllowed] NSBundle bundle);
773-
#endif
774-
775749
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
776750
NSObject WeakDelegate { get; set; }
777751

@@ -1533,12 +1507,7 @@ interface ISKPaymentQueueDelegate { }
15331507
[Deprecated (PlatformName.TvOS, 18, 0 /* Apple's replacement requires Swift */ )]
15341508
[iOS (13, 0)]
15351509
[MacCatalyst (13, 1)]
1536-
#if NET
15371510
[Protocol, Model]
1538-
#else
1539-
[Protocol]
1540-
[Model (AutoGeneratedName = true)]
1541-
#endif
15421511
[BaseType (typeof (NSObject))]
15431512
interface SKPaymentQueueDelegate {
15441513
[Export ("paymentQueue:shouldContinueTransaction:inStorefront:")]
@@ -1695,11 +1664,7 @@ interface ISKOverlayDelegate { }
16951664

16961665
[NoTV, NoMac, iOS (14, 0)]
16971666
[MacCatalyst (14, 0)]
1698-
#if NET
16991667
[Protocol, Model]
1700-
#else
1701-
[Protocol, Model (AutoGeneratedName = true)]
1702-
#endif
17031668
[BaseType (typeof (NSObject))]
17041669
interface SKOverlayDelegate {
17051670
[Export ("storeOverlay:didFailToLoadWithError:")]

tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ public partial class ApiAvailabilityTest {
3939
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_2' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
4040
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_3' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
4141
"/src/GameController/GCExtendedGamepadSnapshot.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'GCExtendedGamepadSnapShotDataV100' is obsoleted on: 'ios' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'maccatalyst' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'macOS/OSX' 10.14.4 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'tvos' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
42-
"/src/StoreKit/SKReceiptProperty.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. '_SKReceiptProperty.IsExpired' is obsoleted on: 'ios' 18.0 and later, 'maccatalyst' 18.0 and later, 'macOS/OSX' 15.0 and later, 'tvos' 18.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
43-
"/src/StoreKit/SKReceiptProperty.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. '_SKReceiptProperty.IsRevoked' is obsoleted on: 'ios' 18.0 and later, 'maccatalyst' 18.0 and later, 'macOS/OSX' 15.0 and later, 'tvos' 18.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
44-
"/src/StoreKit/SKReceiptProperty.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. '_SKReceiptProperty.IsVolumePurchase' is obsoleted on: 'ios' 18.0 and later, 'maccatalyst' 18.0 and later, 'macOS/OSX' 15.0 and later, 'tvos' 18.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
4542
"/src/System.Net.Http/CFNetworkHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CFHTTPStream.GetResponseHeader()' is obsoleted on: 'ios' 9.0 and later (Use 'NSUrlSession'.), 'maccatalyst' 9.0 and later (Use 'NSUrlSession'.), 'macOS/OSX' 10.11 and later (Use 'NSUrlSession'.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
4643
"/src/System.Net.Http/CFNetworkHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CFHTTPStream.SetProxy(CFProxySettings)' is obsoleted on: 'ios' 9.0 and later (Use 'NSUrlSession'.), 'maccatalyst' 9.0 and later (Use 'NSUrlSession'.), 'macOS/OSX' 10.11 and later (Use 'NSUrlSession'.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
4744
"/src/System.Net.Http/CFNetworkHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CFHTTPStream.ShouldAutoredirect' is obsoleted on: 'ios' 9.0 and later (Use 'NSUrlSession'.), 'maccatalyst' 9.0 and later (Use 'NSUrlSession'.), 'macOS/OSX' 10.11 and later (Use 'NSUrlSession'.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",

tests/cecil-tests/ApiAvailabilityTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void Warnings ()
6969
} finally {
7070
Console.WriteLine ($"There's a total of {totalWarnings} warnings.");
7171
}
72-
Assert.AreEqual (351, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed.
72+
Assert.AreEqual (327, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed.
7373
}
7474

7575
public record ObsoletedFailure : IComparable {

0 commit comments

Comments
 (0)