Merge pull request #3620 from BlueWallet/macfix

FIX: macOS alignment and Camera crash fix
This commit is contained in:
GLaDOS 2021-08-19 22:17:57 +01:00 committed by GitHub
commit d5d589b906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 3 deletions

View File

@ -300,6 +300,7 @@ const ScanQRCode = () => {
<StatusBar hidden />
{isFocused && cameraStatus !== RNCamera.Constants.CameraStatus.NOT_AUTHORIZED && (
<RNCamera
autoFocus
captureAudio={false}
androidCameraPermissionOptions={{
title: loc.send.permission_camera_title,

View File

@ -5,7 +5,7 @@ import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import PropTypes from 'prop-types';
import { useIsFocused, useTheme } from '@react-navigation/native';
import { BlueHeaderDefaultMain, BlueSpacing20 } from '../../BlueComponents';
import { BlueHeaderDefaultMain } from '../../BlueComponents';
import WalletsCarousel from '../../components/WalletsCarousel';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
@ -69,7 +69,6 @@ const DrawerList = props => {
return (
<>
<BlueHeaderDefaultMain leftText={loc.wallets.list_title} onNewWalletPress={onNewWalletPress} isDrawerList />
<BlueSpacing20 />
</>
);
};
@ -89,7 +88,7 @@ const DrawerList = props => {
);
return (
<DrawerContentScrollView {...props}>
<DrawerContentScrollView {...props} contentInsetAdjustmentBehavior="automatic" automaticallyAdjustContentInsets>
<View styles={[styles.root, stylesHook.root]}>
<StatusBar barStyle="default" />
{renderWalletsCarousel}

View File

@ -383,6 +383,8 @@ const WalletsList = () => {
<StatusBar barStyle={colorScheme === 'dark' ? 'light-content' : 'dark-content'} backgroundColor="transparent" translucent />
<View style={[styles.walletsListWrapper, stylesHook.walletsListWrapper]}>
<SectionList
contentInsetAdjustmentBehavior="automatic"
automaticallyAdjustContentInsets
onRefresh={onRefresh}
refreshing={isLoading}
renderItem={renderSectionItem}

View File

@ -0,0 +1,60 @@
--- RNCamera.m2 2021-08-19 15:53:16.000000000 -0400
+++ RNCamera.m 2021-08-19 15:53:33.000000000 -0400
@@ -599,57 +599,9 @@
}
- (void)applyDefaultWhiteBalance {
- AVCaptureDevice *device = [self.videoCaptureDeviceInput device];
- [self lockDevice:device andApplySettings:^{
- if (self.whiteBalance == RNCameraWhiteBalanceAuto || ![device isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeLocked]) {
- if (self.whiteBalance != RNCameraWhiteBalanceAuto) {
- RCTLogWarn(@"%s: locked whitebalance mode ist note supported. Fallback to continuous auto white balance mode", __func__);
- }
- [device setWhiteBalanceMode:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance];
- } else {
- AVCaptureWhiteBalanceTemperatureAndTintValues temperatureAndTint = {
- .temperature = [RNCameraUtils temperatureForWhiteBalance:self.whiteBalance],
- .tint = 0,
- };
- AVCaptureWhiteBalanceGains rgbGains = [device deviceWhiteBalanceGainsForTemperatureAndTintValues:temperatureAndTint];
-
- @try{
- [device setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:rgbGains completionHandler:nil];
- }
- @catch(NSException *exception){
- RCTLogError(@"Failed to set white balance: %@", exception);
- }
- }
- }];
}
- (void)applyCustomWhiteBalance {
- AVCaptureDevice *device = [self.videoCaptureDeviceInput device];
- [self lockDevice:device andApplySettings:^{
- if (![device isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeLocked]) {
- RCTLogWarn(@"%s: locked whitebalance mode ist note supported. Fallback to continuous auto white balance mode", __func__);
- [device setWhiteBalanceMode:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance];
- } else {
- AVCaptureWhiteBalanceTemperatureAndTintValues temperatureAndTint = {
- .temperature = self.customWhiteBalanceSettings.temperature,
- .tint = self.customWhiteBalanceSettings.tint,
- };
- AVCaptureWhiteBalanceGains rgbGains = [device deviceWhiteBalanceGainsForTemperatureAndTintValues:temperatureAndTint];
- CGFloat redGain = rgbGains.redGain + self.customWhiteBalanceSettings.redGainOffset;
- CGFloat greenGain = rgbGains.greenGain + self.customWhiteBalanceSettings.greenGainOffset;
- CGFloat blueGain = rgbGains.blueGain + self.customWhiteBalanceSettings.blueGainOffset;
-
- rgbGains.redGain = MAX(1.0f, MIN(device.maxWhiteBalanceGain, redGain));
- rgbGains.greenGain = MAX(1.0f, MIN(device.maxWhiteBalanceGain, greenGain));
- rgbGains.blueGain = MAX(1.0f, MIN(device.maxWhiteBalanceGain, blueGain));
-
- @try{
- [device setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:rgbGains completionHandler:nil];
- } @catch(NSException *exception){
- RCTLogError(@"Failed to set custom white balance: %@", exception);
- }
- }
- }];
}

View File

@ -9,6 +9,8 @@ echo "Applying patch for react-native-xcode.sh"
sed -i '' 's/--platform "$BUNDLE_PLATFORM"/--platform "ios"/g' ./node_modules/react-native/scripts/react-native-xcode.sh
echo "Applying patch for RCTCameraManager.m"
patch node_modules/react-native-camera/ios/RCT/RCTCameraManager.m scripts/maccatalystpatches/RCTCameraManagerDiff
echo "Applying patch for RNCamera.m"
patch node_modules/react-native-camera/ios/RN/RNCamera.m scripts/maccatalystpatches/RNCamera.patch
echo "Deleting torrific.js content"
echo > blue_modules/torrific.js
echo ""