@@ -256,14 +256,21 @@ static UpDownBytes getUpDownBytes()
256256 }
257257 else
258258 {
259- upDiff = (upDownBytes.outputBytes - prevOutputBytes) / UPDATE_INTERVAL;
260- downDiff = (upDownBytes.inputBytes - prevInputBytes) / UPDATE_INTERVAL;
259+ if (upDownBytes.outputBytes > prevOutputBytes)
260+ upDiff = upDownBytes.outputBytes - prevOutputBytes;
261+ else
262+ upDiff = 0 ;
263+
264+ if (upDownBytes.inputBytes > prevInputBytes)
265+ downDiff = upDownBytes.inputBytes - prevInputBytes;
266+ else
267+ downDiff = 0 ;
261268 }
262269
263270 prevOutputBytes = upDownBytes.outputBytes ;
264271 prevInputBytes = upDownBytes.inputBytes ;
265272
266- if (!SHOW_ALWAYS && (( upDiff < 2 * KILOBYTES && downDiff < 2 * KILOBYTES) || (upDiff > 500 * MEGABYTES && downDiff > 500 * MEGABYTES) ))
273+ if (!SHOW_ALWAYS && (upDiff < 2 * KILOBYTES && downDiff < 2 * KILOBYTES))
267274 {
268275 shouldUpdateSpeedLabel = NO ;
269276 return nil ;
@@ -722,7 +729,18 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
722729 _windowHostingController = [[objc_getClass (" SBSAccessibilityWindowHostingController" ) alloc ] init ];
723730 unsigned int _contextId = [self .window _contextId ];
724731 double windowLevel = [self .window windowLevel ];
725- [_windowHostingController registerWindowWithContextID: _contextId atLevel: windowLevel];
732+
733+ #pragma clang diagnostic push
734+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
735+ // [_windowHostingController registerWindowWithContextID:_contextId atLevel:windowLevel];
736+ NSMethodSignature *signature = [NSMethodSignature signatureWithObjCTypes: " v@:Id" ];
737+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: signature];
738+ [invocation setTarget: _windowHostingController];
739+ [invocation setSelector: NSSelectorFromString (@" registerWindowWithContextID:atLevel:" )];
740+ [invocation setArgument: &_contextId atIndex: 2 ];
741+ [invocation setArgument: &windowLevel atIndex: 3 ];
742+ [invocation invoke ];
743+ #pragma clang diagnostic pop
726744
727745 return YES ;
728746}
@@ -1023,6 +1041,7 @@ - (void)updateViewConstraints
10231041 [NSLayoutConstraint deactivateConstraints: _constraints];
10241042 [_constraints removeAllObjects ];
10251043
1044+ BOOL isPad = ([[UIDevice currentDevice ] userInterfaceIdiom ] == UIUserInterfaceIdiomPad);
10261045 UILayoutGuide *layoutGuide = self.view .safeAreaLayoutGuide ;
10271046
10281047 if (_orientation == UIInterfaceOrientationLandscapeLeft || _orientation == UIInterfaceOrientationLandscapeRight)
@@ -1032,7 +1051,7 @@ - (void)updateViewConstraints
10321051 [_contentView.trailingAnchor constraintEqualToAnchor: self .view.trailingAnchor constant: (layoutGuide.layoutFrame.origin.y > 1 ) ? -20 : -4 ],
10331052 ]];
10341053
1035- [_constraints addObject: [_contentView.topAnchor constraintEqualToAnchor: self .view.topAnchor constant: 10 ]];
1054+ [_constraints addObject: [_contentView.topAnchor constraintEqualToAnchor: self .view.topAnchor constant: (isPad ? 30 : 10 ) ]];
10361055 }
10371056 else
10381057 {
@@ -1044,7 +1063,7 @@ - (void)updateViewConstraints
10441063 if (layoutGuide.layoutFrame .origin .y > 1 )
10451064 [_constraints addObject: [_contentView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor constant: -10 ]];
10461065 else
1047- [_constraints addObject: [_contentView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor constant: 20 ]];
1066+ [_constraints addObject: [_contentView.topAnchor constraintEqualToAnchor: layoutGuide.topAnchor constant: (isPad ? 30 : 20 ) ]];
10481067 }
10491068
10501069 [_constraints addObjectsFromArray: @[
0 commit comments