Skip to content

Commit

Permalink
Remove iOS 12 version check (#33460)
Browse files Browse the repository at this point in the history
Summary:
I removed the code checking iOS 12 availability because the iOS minimum deployment target is now iOS 12.4 after these commits (982ca30, c71e6ef).

My previous pull requests regarding iOS 11
* [Remove iOS 11 version check by ken0nek · Pull Request #32151 · facebook/react-native](#32151)
* [Remove iOS 11 availability check by ken0nek · Pull Request #32488 · facebook/react-native](#32488)
* [Remove iOS 11 deprecation warnings around SafeArea by ken0nek · Pull Request #32851 · facebook/react-native](#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: #33460

Reviewed By: NickGerleman

Differential Revision: D35021632

Pulled By: javache

fbshipit-source-id: bf85d44874a2c10cb345d33df7c9e4789312a7cd
  • Loading branch information
ken0nek authored and facebook-github-bot committed Jun 27, 2023
1 parent a60d880 commit 04d1de5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 43 deletions.
11 changes: 2 additions & 9 deletions packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTEventEmitter.h>
#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>

@interface RCTLinkingManager : RCTEventEmitter

Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,8 @@ + (BOOL)application:(UIApplication *)application

+ (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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ - (void)setSelectionStart:(NSInteger)start selectionEnd:(NSInteger)end

- (void)setTextContentType:(NSString *)type
{
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
static dispatch_once_t onceToken;
static NSDictionary<NSString *, NSString *> *contentTypeMap;

Expand Down Expand Up @@ -263,21 +262,14 @@ - (void)setTextContentType:(NSString *)type
@"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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,8 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)] ?: @"";
Expand Down

0 comments on commit 04d1de5

Please sign in to comment.