Commit 86522242 authored by santhosh's avatar santhosh
Browse files

image upload

parent 0e157d68
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
Showing with 107 additions and 36 deletions
+107 -36
...@@ -122,6 +122,7 @@ def enableHermes = project.ext.react.get("enableHermes", false); ...@@ -122,6 +122,7 @@ def enableHermes = project.ext.react.get("enableHermes", false);
android { android {
compileSdkVersion 31 compileSdkVersion 31
buildToolsVersion "27.0.3"
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
...@@ -131,6 +132,7 @@ android { ...@@ -131,6 +132,7 @@ android {
configurations.all { configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' } resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
} }
vectorDrawables.useSupportLibrary = true
applicationId "com.agile24x7" applicationId "com.agile24x7"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.agile24x7"> package="com.agile24x7">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application <application
......
...@@ -29,9 +29,9 @@ allprojects { ...@@ -29,9 +29,9 @@ allprojects {
// Android JSC is installed from npm // Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist") url("$rootDir/../node_modules/jsc-android/dist")
} }
google() google()
jcenter() jcenter()
maven { url 'https://www.jitpack.io' } maven { url 'https://www.jitpack.io' }
maven { url 'https://maven.google.com' }
} }
} }
...@@ -13339,6 +13339,11 @@ ...@@ -13339,6 +13339,11 @@
} }
} }
}, },
"react-native-image-crop-picker": {
"version": "0.37.2",
"resolved": "https://registry.npmjs.org/react-native-image-crop-picker/-/react-native-image-crop-picker-0.37.2.tgz",
"integrity": "sha512-YwZXW21Km8+3tSt0smTaLVgY4398c0/OJcpcH6EP0JDOt1BNNxl/R8m6qdvnwdXdIoa0CCnMVW6TL9IN5ia9OA=="
},
"react-native-indicators": { "react-native-indicators": {
"version": "0.17.0", "version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-native-indicators/-/react-native-indicators-0.17.0.tgz", "resolved": "https://registry.npmjs.org/react-native-indicators/-/react-native-indicators-0.17.0.tgz",
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"react-native-dropdown-picker": "^4.0.4", "react-native-dropdown-picker": "^4.0.4",
"react-native-events-calendar": "^1.0.8", "react-native-events-calendar": "^1.0.8",
"react-native-gesture-handler": "^1.9.0", "react-native-gesture-handler": "^1.9.0",
"react-native-image-crop-picker": "^0.37.2",
"react-native-indicators": "^0.17.0", "react-native-indicators": "^0.17.0",
"react-native-keyboard-aware-scroll-view": "^0.9.3", "react-native-keyboard-aware-scroll-view": "^0.9.3",
"react-native-material-textfield": "git+https://github.com/javarahulsharma/react-native-material-textfield.git", "react-native-material-textfield": "git+https://github.com/javarahulsharma/react-native-material-textfield.git",
......
...@@ -31,6 +31,7 @@ import NetInfo from '@react-native-community/netinfo'; ...@@ -31,6 +31,7 @@ import NetInfo from '@react-native-community/netinfo';
import { API } from "../WebServices/RestClient"; import { API } from "../WebServices/RestClient";
import log from '../LogFile/Log'; import log from '../LogFile/Log';
import { EMPLOYEEID } from './Header'; import { EMPLOYEEID } from './Header';
import ImagePicker from 'react-native-image-crop-picker';
export default class TaskChat extends Component { export default class TaskChat extends Component {
...@@ -239,7 +240,7 @@ export default class TaskChat extends Component { ...@@ -239,7 +240,7 @@ export default class TaskChat extends Component {
} }
//Concat List of Group Members //Concat List of Group Members
details = details + "," + h[i-1]; details = details + "," + h[i - 1];
console.warn("Details" + details) console.warn("Details" + details)
this.setState({ this.setState({
groupList: details.replace("Admin(admin),", "") groupList: details.replace("Admin(admin),", "")
...@@ -517,7 +518,7 @@ export default class TaskChat extends Component { ...@@ -517,7 +518,7 @@ export default class TaskChat extends Component {
console.warn(responseJson) console.warn(responseJson)
if (responseJson.status === 'True') { if (responseJson.status === 'True') {
console.warn(responseJson); // alert("messages" + JSON.stringify(responseJson));
this.setState({ this.setState({
dataSource: responseJson.data, dataSource: responseJson.data,
}); });
...@@ -624,41 +625,85 @@ export default class TaskChat extends Component { ...@@ -624,41 +625,85 @@ export default class TaskChat extends Component {
const userToken = response[1][1]; const userToken = response[1][1];
AsyncStorage.getItem("projectId", (err, res) => { AsyncStorage.getItem("projectId", (err, res) => {
const projectId = res; const projectId = res;
this.setState({ itemPressedDisabled: true }) this.setState({ itemPressedDisabled: true })
fetch(API + 'user_story_chat.php', { fetch(API + 'user_story_chat.php', {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
action: 'send', action: 'send',
groupId: groupId, groupId: groupId,
corp_code: cropcode, corp_code: cropcode,
message: message, message: message,
messagedBy: userToken, messagedBy: userToken,
groupName: this.state.groupName, groupName: this.state.groupName,
groupEmail: groupEmail, groupEmail: groupEmail,
projectId: projectId, projectId: projectId,
}) })
}).then((response) => response.json()) }).then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
this.getMessages(); this.getMessages();
this.setState({ this.setState({
message: '', message: '',
itemPressedDisabled: false , itemPressedDisabled: false,
});
//message:this.state.message=''
}).catch((error) => {
console.error(error);
log("Error", "send message error");
}); });
//message:this.state.message='' });
}).catch((error) => {
console.error(error);
log("Error", "send message error");
});
});
}); });
} }
uploadFile(mediaType) {
ImagePicker.openPicker({
width: 300,
height: 400,
cropping: true
})
.then((image) => {
console.log('received image', image);
this.setState({
image: {
uri: image.path,
width: image.width,
height: image.height,
mime: image.mime,
},
images: null,
});
fetch(API + 'user_story_details1.php',
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'uri',
corp_code: image.uri,
groupId: image.mime
})
})
})
.catch((e) => {
console.log(e);
Alert.alert(e.message ? e.message : e);
});
};
renderDate = (date) => { renderDate = (date) => {
return ( return (
<Text style={styles.time}> <Text style={styles.time}>
...@@ -690,7 +735,7 @@ export default class TaskChat extends Component { ...@@ -690,7 +735,7 @@ export default class TaskChat extends Component {
<Icon name="arrow-left" size={20} style={{ color: '#fff', paddingTop: 15 }} <Icon name="arrow-left" size={20} style={{ color: '#fff', paddingTop: 15 }}
onPress={() => onPress={() =>
this.props.navigation.goBack()} /> this.props.navigation.goBack()} />
<Body style={{ paddingLeft: 10}}> <Body style={{ paddingLeft: 10 }}>
<Title>{this.state.groupName}</Title> <Title>{this.state.groupName}</Title>
<Text style={{ fontSize: 10 }}>{this.state.groupList}</Text> <Text style={{ fontSize: 10 }}>{this.state.groupList}</Text>
</Body> </Body>
...@@ -721,7 +766,10 @@ export default class TaskChat extends Component { ...@@ -721,7 +766,10 @@ export default class TaskChat extends Component {
<View style={[styles.item, itemStyle]}> <View style={[styles.item, itemStyle]}>
<View style={{ padding: 5, }}> <View style={{ padding: 5, }}>
{itemStyle === styles.itemOut ? left : right} {itemStyle === styles.itemOut ? left : right}
<Text>{item.message}</Text>
<Image source={{uri:item.path}} style={item.path.length !== 0 ? styles.imageview : styles.msgview} />
{item.path.length !== 0 ? null : <Text>{item.message}</Text>}
{!inMessage && this.renderDate(item.messagedTime)} {!inMessage && this.renderDate(item.messagedTime)}
{inMessage && this.renderDate(item.messagedTime)} {inMessage && this.renderDate(item.messagedTime)}
</View> </View>
...@@ -744,6 +792,10 @@ export default class TaskChat extends Component { ...@@ -744,6 +792,10 @@ export default class TaskChat extends Component {
value={this.state.message} /> value={this.state.message} />
</View> </View>
<TouchableOpacity onPress={() => { this.uploadFile() }}>
<Text>upload file</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.btnSend} disabled={this.state.itemPressedDisabled} onPress={() => { this.sendMessageText() }}> <TouchableOpacity style={styles.btnSend} disabled={this.state.itemPressedDisabled} onPress={() => { this.sendMessageText() }}>
{/* <Image source={{uri:"https://png.icons8.com/small/75/ffffff/filled-sent.png"}} style={styles.iconSend} /> */} {/* <Image source={{uri:"https://png.icons8.com/small/75/ffffff/filled-sent.png"}} style={styles.iconSend} /> */}
<Image source={require('../Images/sent.png')} style={styles.iconSend} /> <Image source={require('../Images/sent.png')} style={styles.iconSend} />
...@@ -801,6 +853,14 @@ const styles = StyleSheet.create({ ...@@ -801,6 +853,14 @@ const styles = StyleSheet.create({
alignItems: 'baseline', alignItems: 'baseline',
}, },
imageview:{
width: 350,
resizeMode: 'contain', height: 200,
},
msgview:{
width: 0, height: 0
},
inputs: { inputs: {
height: 40, height: 40,
marginLeft: 16, marginLeft: 16,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment