Skip to content

Commit

Permalink
get rid of unnecessary self dereference in RCTDevLoadingView (#37455)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37455

Changelog: [Internal]

these are not needed

Reviewed By: sammy-SC

Differential Revision: D45757478

fbshipit-source-id: b7c228639ade40cbfcf638ac3abd858476b47bbf
  • Loading branch information
philIip authored and facebook-github-bot committed May 17, 2023
1 parent 840e2b9 commit a310217
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/react-native/React/CoreModules/RCTDevLoadingView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ + (BOOL)requiresMainQueueSetup

- (void)clearInitialMessageDelay
{
if (self->_initialMessageBlock != nil) {
dispatch_block_cancel(self->_initialMessageBlock);
self->_initialMessageBlock = nil;
if (_initialMessageBlock != nil) {
dispatch_block_cancel(_initialMessageBlock);
_initialMessageBlock = nil;
}
}

- (void)showInitialMessageDelayed:(void (^)())initialMessage
{
self->_initialMessageBlock = dispatch_block_create(static_cast<dispatch_block_flags_t>(0), initialMessage);
_initialMessageBlock = dispatch_block_create(static_cast<dispatch_block_flags_t>(0), initialMessage);

// We delay the initial loading message to prevent flashing it
// when loading progress starts quickly. To do that, we
Expand All @@ -85,7 +85,7 @@ - (void)showInitialMessageDelayed:(void (^)())initialMessage

- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor
{
if (!RCTDevLoadingViewGetEnabled() || self->_hiding) {
if (!RCTDevLoadingViewGetEnabled() || _hiding) {
return;
}

Expand Down Expand Up @@ -152,7 +152,7 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
[self clearInitialMessageDelay];

dispatch_async(dispatch_get_main_queue(), ^{
self->_hiding = true;
self->_hiding = YES;
const NSTimeInterval MIN_PRESENTED_TIME = 0.6;
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate];
NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime);
Expand All @@ -174,11 +174,11 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(

- (void)showProgressMessage:(NSString *)message
{
if (self->_window != nil) {
if (_window != nil) {
// This is an optimization. Since the progress can come in quickly,
// we want to do the minimum amount of work to update the UI,
// which is to only update the label text.
self->_label.text = message;
_label.text = message;
return;
}

Expand Down

0 comments on commit a310217

Please sign in to comment.