Minor stylistic changes

This commit is contained in:
Lior Halphon
2024-06-28 16:54:20 +03:00
parent 3bf94d281a
commit d42aad2b84

View File

@@ -258,8 +258,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
} }
// Use a discovery session to gather the capture devices (all back cameras as well as the front camera) // Use a discovery session to gather the capture devices (all back cameras as well as the front camera)
AVCaptureDeviceDiscoverySession *cameraDiscoverySession = [AVCaptureDeviceDiscoverySession AVCaptureDeviceDiscoverySession *cameraDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:deviceTypes
discoverySessionWithDeviceTypes:deviceTypes
mediaType:AVMediaTypeVideo mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified]; position:AVCaptureDevicePositionUnspecified];
_allCaptureDevices = cameraDiscoverySession.devices; _allCaptureDevices = cameraDiscoverySession.devices;
@@ -743,7 +742,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
_backgroundView.bounds.size.height - 8 - insets.bottom - 32, _backgroundView.bounds.size.height - 8 - insets.bottom - 32,
32, 32,
32); 32);
if (_changeCameraButton != nil) { if (_changeCameraButton) {
_changeCameraButton.frame = CGRectMake(insets.left + 8, _changeCameraButton.frame = CGRectMake(insets.left + 8,
_backgroundView.bounds.size.height - 8 - insets.bottom - 32 - 32 - 8, _backgroundView.bounds.size.height - 8 - insets.bottom - 32 - 32 - 8,
32, 32,
@@ -1250,13 +1249,15 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
_cameraPositionButton.alpha = 1; _cameraPositionButton.alpha = 1;
}]; }];
} }
if (_changeCameraButton != nil) { if (_changeCameraButton) {
// The change camera button is only available when we are using a capture device on the back of the device // The change camera button is only available when we are using a capture device on the back of the device
int changeCameraButtonAlpha = (_cameraPosition == AVCaptureDevicePositionFront) ? 0 : 1; double changeCameraButtonAlpha = (_cameraPosition == AVCaptureDevicePositionFront) ? 0 : 1;
if (changeCameraButtonAlpha != _changeCameraButton.alpha) {
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
_changeCameraButton.alpha = changeCameraButtonAlpha; _changeCameraButton.alpha = changeCameraButtonAlpha;
}]; }];
} }
}
_disableCameraTimer = [NSTimer scheduledTimerWithTimeInterval:1 _disableCameraTimer = [NSTimer scheduledTimerWithTimeInterval:1
repeats:false repeats:false
@@ -1266,13 +1267,11 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
_cameraPositionButton.alpha = 0; _cameraPositionButton.alpha = 0;
}]; }];
} }
if (_changeCameraButton != nil) {
if (_changeCameraButton.alpha) { if (_changeCameraButton.alpha) {
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
_changeCameraButton.alpha = 0; _changeCameraButton.alpha = 0;
}]; }];
} }
}
dispatch_async(_cameraQueue, ^{ dispatch_async(_cameraQueue, ^{
[_cameraSession stopRunning]; [_cameraSession stopRunning];
_cameraSession = nil; _cameraSession = nil;