-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The existing Objective-C class to request an App Store review (SKStoreReviewController) is deprecated in Xcode 16+, and it doesn't even work on the corresponding OS versions. The replacement API is Swift-only, but luckily it's a very simple API (just a static method), so it's possible to bind it manually. This required a few other changes/improvements: * Add support for Swift code in our runtime. * Just to keep the changes to a minimum, bump the min OS version for legacy code to match the .NET min OS versions. This is because our build logic uses the legacy min versions when compiling native code (a more involved fix would be to update all the build logic to build native code to use the .NET min OS versions, but that's not the point of this PR, so I took the easy route). Fixes #10659. I've tested the method locally, and it seems to work fine, but I've still marked it as experimental for now. There are no unit tests because calling the method will put up a dialog, which won't work correctly in unit tests. Fixes #21410. Fixes #10659.
- Loading branch information
1 parent
071a98a
commit a198a87
Showing
13 changed files
with
192 additions
and
23 deletions.
There are no files selected for viewing
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
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,29 @@ | ||
#if os(macOS) | ||
import AppKit | ||
#endif | ||
import Foundation | ||
import StoreKit | ||
#if !os(macOS) | ||
import UIKit | ||
#endif | ||
|
||
@objc(XamarinSwiftFunctions) | ||
public class XamarinSwiftFunctions : NSObject { | ||
#if os(macOS) | ||
@MainActor | ||
@objc(requestReview:) | ||
@available(macOS 13, *) | ||
public static func StoreKit_RequestReview(scene: NSViewController) | ||
{ | ||
AppStore.requestReview(in: scene) | ||
} | ||
#elseif !os(tvOS) | ||
@MainActor | ||
@objc(requestReview:) | ||
@available(iOS 16, macCatalyst 16, *) | ||
public static func StoreKit_RequestReview(scene: UIWindowScene) | ||
{ | ||
AppStore.requestReview(in: scene) | ||
} | ||
#endif | ||
} |
Oops, something went wrong.