correct issues
This commit is contained in:
@@ -202,18 +202,18 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
|
||||
|
||||
if (editableData.maxParticipants < groupDetails.totalParticipants) {
|
||||
Alert.alert('Invalid Input', `Max participants cannot be less than the current count (${groupDetails.totalParticipants}).`);
|
||||
ToastAndroid.show(`Max participants cannot be less than the current count (${groupDetails.totalParticipants}).`, ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
setSaving(true);
|
||||
try {
|
||||
await apiCall(`${BASE_URL}fund/groups/${groupDetails.id}/edit`, 'PUT', editableData);
|
||||
Alert.alert('Success', 'Group has been updated.');
|
||||
ToastAndroid.show('Group has been updated.', ToastAndroid.SHORT);
|
||||
setEditingCard(null);
|
||||
await fetchGroupDetails();
|
||||
} catch (e: any) {
|
||||
Alert.alert('Save Error', e.message || 'An unexpected error occurred.');
|
||||
ToastAndroid.show(e.message || 'An unexpected error occurred.', ToastAndroid.SHORT);
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
@@ -241,11 +241,11 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
setStarting(true);
|
||||
try {
|
||||
await apiCall(`${BASE_URL}fund/group/start?groupId=${groupDetails.id}`, 'GET');
|
||||
Alert.alert('Success', 'Group has been started successfully.');
|
||||
ToastAndroid.show('Group has been started successfully.', ToastAndroid.SHORT);
|
||||
await fetchGroupDetails();
|
||||
navigation.goBack()
|
||||
} catch (e: any) {
|
||||
Alert.alert('Start Error', e.message || 'An unexpected error occurred.');
|
||||
ToastAndroid.show(e.message || 'An unexpected error occurred.', ToastAndroid.SHORT);
|
||||
} finally {
|
||||
setStarting(false);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
|
||||
if (inviteLink) {
|
||||
Clipboard.setString(inviteLink);
|
||||
Alert.alert('Copied!', 'Invitation link copied to clipboard.');
|
||||
ToastAndroid.show('Invitation link copied to clipboard.', ToastAndroid.SHORT);
|
||||
await Share.share({
|
||||
message: `Join my group on CircleCollect! ${inviteLink}`,
|
||||
url: inviteLink,
|
||||
@@ -277,7 +277,7 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
throw new Error('Could not generate invitation link.');
|
||||
}
|
||||
} catch (error: any) {
|
||||
Alert.alert('Error', error.message || 'Failed to generate invitation.');
|
||||
ToastAndroid.show(error.message || 'Failed to generate invitation.', ToastAndroid.SHORT);
|
||||
} finally {
|
||||
setInviting(false);
|
||||
}
|
||||
@@ -380,30 +380,18 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
const canStartGroup = groupDetails.status === 'APPROVED' && groupDetails.totalParticipants >= groupDetails.minParticipants;
|
||||
|
||||
console.log(" myu status : ", groupDetails.status)
|
||||
// const pickImage = () => {
|
||||
// launchImageLibrary({ mediaType: "photo", quality: 0.5 }, (response) => {
|
||||
// if (response.didCancel) return;
|
||||
// if (response.errorCode) {
|
||||
// Alert.alert("Error", response.errorMessage || "Something went wrong");
|
||||
// } else if (response.assets && response.assets.length > 0) {
|
||||
// const selectedImage = response.assets[0];
|
||||
// console.log(selectedImage?.uri)
|
||||
// setSelectedImage(selectedImage?.uri)
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
|
||||
const pickImage = () => {
|
||||
launchImageLibrary({ mediaType: "photo", quality: 0.5 }, (response) => {
|
||||
if (response.didCancel) return;
|
||||
|
||||
if (response.errorCode) {
|
||||
Alert.alert("Error", response.errorMessage || "Something went wrong");
|
||||
ToastAndroid.show(response.errorMessage || "Something went wrong", ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.assets || response.assets.length === 0) {
|
||||
Alert.alert("Error", "No image selected");
|
||||
ToastAndroid.show("No image selected", ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -423,7 +411,7 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
|
||||
// Additional validation for required fields
|
||||
if (!selectedImage.uri) {
|
||||
Alert.alert("Error", "Invalid image file");
|
||||
ToastAndroid.show("Invalid image file", ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,13 +430,13 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
try {
|
||||
const credentials = await Keychain.getGenericPassword();
|
||||
if (!credentials) {
|
||||
Alert.alert("Error", "You are not logged in");
|
||||
ToastAndroid.show('You are not logged in', ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
const token = credentials.password;
|
||||
|
||||
if (!selectedImage) {
|
||||
Alert.alert("Error", "Please select an image first");
|
||||
ToastAndroid.show("Please select an image first", ToastAndroid.SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -487,7 +475,6 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
||||
|
||||
} catch (error: any) {
|
||||
console.error("❌ Error updating group image:", error);
|
||||
// Alert.alert("Error", error.message || "Could not update group image");
|
||||
} finally {
|
||||
setImageUpdating(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user