-
Notifications
You must be signed in to change notification settings - Fork 25
fix(ios): update deprecated SKStoreReviewController usage #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Would it make sense to also take into consideration deprecation note from https://developer.apple.com/documentation/storekit/skstorereviewcontroller for iOS17+ ? |
Co-authored-by: Avi Leavitt <[email protected]>
Yes, i have taken that into account |
ios/Plugin/InAppReview.swift
Outdated
} else if #available(iOS 14.0, *) { | ||
if let windowScene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { | ||
SKStoreReviewController.requestReview(in: windowScene) | ||
} | ||
} else { | ||
SKStoreReviewController.requestReview() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if #available(iOS 14.0, *) { | |
if let windowScene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { | |
SKStoreReviewController.requestReview(in: windowScene) | |
} | |
} else { | |
SKStoreReviewController.requestReview() | |
} | |
} else { | |
if let windowScene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { | |
SKStoreReviewController.requestReview(in: windowScene) | |
} | |
} |
The plugin only supports iOS 14+ now, so the last else can be removed.
And you can also use a single if let windowScene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene
before the if instead of duplicating it for each case since the code is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i agree, thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you address the second part of the comment?
Co-authored-by: jcesarmobile <[email protected]>
ios/Plugin/InAppReview.swift
Outdated
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the duplicated new line at the end of the file
closes #64