Remove iOS 12 version check (#33460)

Summary:
I removed the code checking iOS 12 availability because the iOS minimum deployment target is now iOS 12.4 after these commits (https://github.com/facebook/react-native/commit/982ca30de079d7e80bd0b50365d58b9048fb628f, https://github.com/facebook/react-native/commit/c71e6efbcd2b95faee327d9763d321488120bc5e).

My previous pull requests regarding iOS 11
* [Remove iOS 11 version check by ken0nek · Pull Request https://github.com/facebook/react-native/issues/32151 · facebook/react-native](https://github.com/facebook/react-native/pull/32151)
* [Remove iOS 11 availability check by ken0nek · Pull Request https://github.com/facebook/react-native/issues/32488 · facebook/react-native](https://github.com/facebook/react-native/pull/32488)
* [Remove iOS 11 deprecation warnings around SafeArea by ken0nek · Pull Request https://github.com/facebook/react-native/issues/32851 · facebook/react-native](https://github.com/facebook/react-native/pull/32851)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Changed] - Remove iOS 12 availability check

Pull Request resolved: https://github.com/facebook/react-native/pull/33460

Reviewed By: NickGerleman

Differential Revision: D35021632

Pulled By: javache

fbshipit-source-id: bf85d44874a2c10cb345d33df7c9e4789312a7cd
This commit is contained in:
Ken Tominaga
2023-06-27 11:51:00 -07:00
committed by Facebook GitHub Bot
parent a60d88053c
commit 04d1de5896
5 changed files with 12 additions and 44 deletions
@@ -5,11 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
#import <UIKit/UIUserActivity.h>
#endif
#import <React/RCTEventEmitter.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIUserActivity.h>
@interface RCTLinkingManager : RCTEventEmitter
@@ -24,11 +22,6 @@
+ (BOOL)application:(nonnull UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler;
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler;
#endif
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler;
@end
@@ -72,14 +72,8 @@ RCT_EXPORT_MODULE()
+ (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler
{
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler
{
#endif
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSDictionary *payload = @{@"url" : userActivity.webpageURL.absoluteString};
[[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification object:self userInfo:payload];
@@ -231,7 +231,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
- (void)setTextContentType:(NSString *)type
{
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
static dispatch_once_t onceToken;
static NSDictionary<NSString *, NSString *> *contentTypeMap;
@@ -263,21 +262,14 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
@"telephoneNumber" : UITextContentTypeTelephoneNumber,
@"username" : UITextContentTypeUsername,
@"password" : UITextContentTypePassword,
@"newPassword" : UITextContentTypeNewPassword,
@"oneTimeCode" : UITextContentTypeOneTimeCode,
};
NSDictionary<NSString *, NSString *> *iOS12extras =
@{@"newPassword" : UITextContentTypeNewPassword, @"oneTimeCode" : UITextContentTypeOneTimeCode};
NSMutableDictionary<NSString *, NSString *> *iOS12baseMap = [contentTypeMap mutableCopy];
[iOS12baseMap addEntriesFromDictionary:iOS12extras];
contentTypeMap = [iOS12baseMap copy];
});
// Setting textContentType to an empty string will disable any
// default behaviour, like the autofill bar for password inputs
self.backedTextInputView.textContentType = contentTypeMap[type] ?: type;
#endif
}
- (void)setPasswordRules:(NSString *)descriptor
@@ -182,10 +182,8 @@ using namespace facebook::react;
}
if (newTextInputProps.traits.smartInsertDelete != oldTextInputProps.traits.smartInsertDelete) {
if (@available(iOS 11.0, *)) {
_backedTextInputView.smartInsertDeleteType =
RCTUITextSmartInsertDeleteTypeFromOptionalBool(newTextInputProps.traits.smartInsertDelete);
}
_backedTextInputView.smartInsertDeleteType =
RCTUITextSmartInsertDeleteTypeFromOptionalBool(newTextInputProps.traits.smartInsertDelete);
}
// Traits `blurOnSubmit`, `clearTextOnFocus`, and `selectTextOnFocus` were omitted intentionally here
@@ -43,11 +43,7 @@ void RCTCopyBackedTextInput(
toTextInput.secureTextEntry = fromTextInput.secureTextEntry;
toTextInput.keyboardType = fromTextInput.keyboardType;
toTextInput.textContentType = fromTextInput.textContentType;
if (@available(iOS 11.0, *)) {
toTextInput.smartInsertDeleteType = fromTextInput.smartInsertDeleteType;
}
toTextInput.smartInsertDeleteType = fromTextInput.smartInsertDeleteType;
toTextInput.passwordRules = fromTextInput.passwordRules;
[toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO];
@@ -185,7 +181,7 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType)
static NSDictionary<NSString *, NSString *> *contentTypeMap;
dispatch_once(&onceToken, ^{
NSMutableDictionary<NSString *, NSString *> *mutableContentTypeMap = [@{
contentTypeMap = @{
@"" : @"",
@"none" : @"",
@"URL" : UITextContentTypeURL,
@@ -213,14 +209,9 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType)
@"telephoneNumber" : UITextContentTypeTelephoneNumber,
@"username" : UITextContentTypeUsername,
@"password" : UITextContentTypePassword,
} mutableCopy];
[mutableContentTypeMap addEntriesFromDictionary:@{
@"newPassword" : UITextContentTypeNewPassword,
@"oneTimeCode" : UITextContentTypeOneTimeCode
}];
contentTypeMap = [mutableContentTypeMap copy];
@"oneTimeCode" : UITextContentTypeOneTimeCode,
};
});
return contentTypeMap[RCTNSStringFromString(contentType)] ?: @"";