Skip to content

Commit

Permalink
Merge pull request #1 from autyzm-pg/fix/huawei_camera_recording
Browse files Browse the repository at this point in the history
huawei fixes
  • Loading branch information
lukaszGnychBright authored Dec 4, 2024
2 parents 9475417 + c1bd3b4 commit 0561bad
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
patch_counter:
description: "App version patch counter"
required: true
default: "4"
default: "6"

jobs:
Build_and_Deploy:
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
"react": "18.2.0",
"react-i18next": "^14.0.5",
"react-native": "0.73.4",
"react-native-audio-recorder-player": "^3.6.7",
"react-native-audio-recorder-player": "^3.6.12",
"react-native-config": "^1.5.1",
"react-native-document-picker": "^9.1.1",
"react-native-draggable-flatlist": "^4.0.1",
"react-native-elements": "^3.4.3",
"react-native-fast-image": "^8.6.3",
"react-native-floating-action": "^1.22.0",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.15.0",
Expand Down Expand Up @@ -81,5 +80,6 @@
},
"engines": {
"node": ">=18"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
48 changes: 39 additions & 9 deletions screens/planItemActivity/imagePicker/ImagePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {FormikProps} from 'formik';
import React, {FC, useState} from 'react';
import {StyleSheet, View} from 'react-native';
import {Image} from 'react-native-elements';
import {Image, StyleSheet, View} from 'react-native';
import RNFS from 'react-native-fs';
import { useEffect } from 'react';

import {Icon, ModalTrigger} from '../../../components';
import {i18n} from '../../../locale';
Expand Down Expand Up @@ -52,16 +53,45 @@ export const ImagePicker: FC<Props> = ({
setImageUri('');
};

const renderImage = () => {

const [base64ImageUri, setBase64ImageUri] = useState<string | null>(null);

useEffect(() => {
if (imageUri) {
return <Image source={{uri: imageUri}} style={styles.image} resizeMode={'contain'}/>;
RNFS.readFile(imageUri, 'base64')
.then(base64String => {
const base64Uri = `data:image/jpeg;base64,${base64String}`;
// console.log('Base64 image URI:', base64Uri);
setBase64ImageUri(base64Uri);
})
.catch(error => {
console.error('Error reading image file:', error);
});
}
return (<View style={{height: 412, width: 412, justifyContent: 'center'}}>
<Icon name="add-a-photo" type="material" size={250} color={palette.textInputPlaceholder}/>
</View>);
};

}, [imageUri]);

const renderImage = () => {
console.log('Rendering image with URI:', imageUri);
if (base64ImageUri) {
return (
<Image
source={{ uri: base64ImageUri }}
style={styles.image}
resizeMode="contain"
onError={(error) => {
console.error('Error loading image:', error);
console.log('Image URI:', imageUri);
}}
onLoad={() => console.log('Image loaded successfully')}
/>
);
}
return (
<View style={{ height: 412, width: 412, justifyContent: 'center' }}>
<Icon name="add-a-photo" type="material" size={250} color={palette.textInputPlaceholder} />
</View>
);
};
return (
<View style={styles.container}>
<ModalTrigger
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6106,7 +6106,7 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-audio-recorder-player@^3.6.7:
react-native-audio-recorder-player@^3.6.12:
version "3.6.12"
resolved "https://registry.yarnpkg.com/react-native-audio-recorder-player/-/react-native-audio-recorder-player-3.6.12.tgz#edc3aa271534a4ce6bc4b32ff2b0ece555b35498"
integrity sha512-/pnZxPA2jvQ9K7oDtrjcAjc/hn124swi451Q/i1Z6yesDVqupE38moNm12HgY1IVupdUCjeiZVqPoShcE0N8mw==
Expand Down Expand Up @@ -6146,11 +6146,6 @@ react-native-elements@^3.4.3:
react-native-ratings "8.0.4"
react-native-size-matters "^0.3.1"

react-native-fast-image@^8.6.3:
version "8.6.3"
resolved "https://registry.yarnpkg.com/react-native-fast-image/-/react-native-fast-image-8.6.3.tgz#6edc3f9190092a909d636d93eecbcc54a8822255"
integrity sha512-Sdw4ESidXCXOmQ9EcYguNY2swyoWmx53kym2zRsvi+VeFCHEdkO+WG1DK+6W81juot40bbfLNhkc63QnWtesNg==

react-native-floating-action@^1.22.0:
version "1.22.0"
resolved "https://registry.yarnpkg.com/react-native-floating-action/-/react-native-floating-action-1.22.0.tgz#7ec476f320e16855ad4077a3a9f36511d1718a52"
Expand Down

0 comments on commit 0561bad

Please sign in to comment.