Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App update 2.0.2 #856

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
07aff18
sample tree project id added
shyambhongle Oct 24, 2024
d96fb06
Edit option on Intervention Preview
shyambhongle Oct 24, 2024
7582caa
minor
shyambhongle Oct 24, 2024
35dcd7e
Icons updated
shyambhongle Oct 28, 2024
495db85
Merge pull request #855 from Plant-for-the-Planet-org/feature/edit
shyambhongle Oct 30, 2024
8e70768
build number upgraded
shyambhongle Dec 19, 2024
483fda5
validation and minor bug fixes
shyambhongle Dec 20, 2024
28315d6
Adaptive icon upgraded android
shyambhongle Dec 20, 2024
1be77b3
Zip package upgraded to latest
shyambhongle Dec 24, 2024
bcaebf8
Metadata changes
shyambhongle Dec 26, 2024
404fd76
Meta data key issue fix
shyambhongle Dec 26, 2024
91a89f9
Dropdown condition handled
shyambhongle Dec 26, 2024
abff22f
Merge branch 'bugfix/xcode-build-fix' into feature/translation
shyambhongle Dec 29, 2024
2920706
maplibre ios build fix
shyambhongle Dec 29, 2024
a51c797
patch removed(maplibre old version)
shyambhongle Dec 29, 2024
d19ab92
app.json updated for ios deployement target
shyambhongle Dec 30, 2024
d3de20f
Merge pull request #864 from Plant-for-the-Planet-org/bugfix/xcode-bu…
shyambhongle Dec 30, 2024
d3c65dc
Merge pull request #861 from Plant-for-the-Planet-org/hotfix/validation
shyambhongle Dec 30, 2024
0568d87
Missing Translations added
shyambhongle Dec 30, 2024
0a9f41e
Removed Unwanted GPS call
shyambhongle Dec 30, 2024
20a08d8
better error handling
shyambhongle Dec 30, 2024
d83223e
minor fix
shyambhongle Dec 31, 2024
d4164f3
Merge branch 'develop' into feature/translation
shyambhongle Dec 31, 2024
7c6faa2
build version incremeated
shyambhongle Dec 31, 2024
1f5a469
Image caching implemented
shyambhongle Dec 31, 2024
876e86e
Merge pull request #866 from Plant-for-the-Planet-org/feature/transla…
shyambhongle Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 3 additions & 9 deletions src/components/sidebar/SidebarHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Popover from 'react-native-popover-view'


const SidebarHeader = () => {
const { image, displayName, email, type } = useSelector(
const { image, displayName, email } = useSelector(
(state: RootState) => state.userState,
)
const [popupVisible, setPopupVisible] = useState(false)
Expand All @@ -26,10 +26,6 @@ const SidebarHeader = () => {
openWebView(`https://web.plant-for-the-planet.org/en/profile/edit`);
}

const deleteHandler = () => {
openWebView(`https://web.plant-for-the-planet.org/en/profile/delete-account`);
}


const togglePopup = () => {
setPopupVisible((prev) => !prev)
Expand All @@ -41,7 +37,7 @@ const SidebarHeader = () => {
isVisible={popupVisible}
backgroundStyle={{ opacity: 0 }}
popoverStyle={{

backgroundColor:Colors.LIGHT_PRIMARY,
}}
onRequestClose={togglePopup}
from={(
Expand All @@ -53,8 +49,6 @@ const SidebarHeader = () => {
<Pressable
style={styles.lgtBtn}
onPress={editHandler}><Text style={styles.menuLabel}>Edit</Text></Pressable>
{type !== 'tpo' && <><View style={{ width: '90%', backgroundColor: 'lightgray', height: 1 }} />
<Pressable onPress={deleteHandler} style={styles.lgtBtn}><Text style={styles.deleteLable}>Delete</Text></Pressable></>}
</View>
</Popover>
}
Expand Down Expand Up @@ -105,7 +99,7 @@ const styles = StyleSheet.create({
alignItems: "center",
borderWidth: 0.5,
borderColor: Colors.PALE_WHITE,
backgroundColor: Colors.WHITE,
backgroundColor: Colors.LIGHT_PRIMARY,
shadowColor: Colors.PALE_WHITE,
shadowOffset: { width: 2, height: 2 },
shadowOpacity: 0.6,
Expand Down
61 changes: 55 additions & 6 deletions src/screens/InterventionPreviewView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActivityIndicator, ScrollView, StyleSheet, Text, View , TouchableOpacity} from 'react-native'
import { ActivityIndicator, ScrollView, StyleSheet, Text, View, TouchableOpacity } from 'react-native'
import React, { useEffect, useRef, useState } from 'react'
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
import { StackNavigationProp } from '@react-navigation/stack'
Expand All @@ -17,6 +17,7 @@ import {
} from 'src/utils/helpers/interventionFormHelper'
import useInterventionManagement from 'src/hooks/realm/useInterventionManagement'
import { Colors, Typography } from 'src/utils/constants'
import PenIcon from 'assets/images/svg/PenIcon.svg'
import SampleTreePreviewList from 'src/components/previewIntervention/SampleTreePreviewList'
import bbox from '@turf/bbox'
import { updateMapBounds } from 'src/store/slice/mapBoundSlice'
Expand All @@ -35,6 +36,7 @@ import i18next from 'i18next'
import { useToast } from 'react-native-toast-notifications'
import { getDeviceDetails } from 'src/utils/helpers/appHelper/getAdditionalData'
import InterventionMetaData from 'src/components/previewIntervention/InterventionMetaData'
import DeleteModal from 'src/components/common/DeleteModal'

const InterventionPreviewView = () => {
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>()
Expand All @@ -45,19 +47,36 @@ const InterventionPreviewView = () => {
const realm = useRealm()
const route = useRoute<RouteProp<RootStackParamList, 'InterventionPreview'>>()
const interventionID = route.params?.interventionId ?? "";
const [editModal, setEditModal] = useState(null)

const [highlightedTree, setHighlightedTree] = useState('')

const { addNewLog } = useLogManagement()
const InterventionData = useObject<InterventionData>(
RealmSchema.Intervention, interventionID
)
const { saveIntervention, updateInterventionMetaData } = useInterventionManagement()
const { saveIntervention, updateInterventionMetaData, resetIntervention } = useInterventionManagement()
const dispatch = useDispatch()

const scrollViewRef = useRef(null); // Reference for the ScrollView
const childRefs = useRef([]);

const handleEdit = async (item: InterventionData) => {
setEditModal(null)
await resetIntervention(item.intervention_id)
dispatch(updateNewIntervention())
}

const closeAllModals = () => {
setEditModal(null)
}


const openEditModal = (item: InterventionData) => {
const obj = JSON.parse(JSON.stringify(item))
setEditModal(obj)
}

useEffect(() => {
setLoading(false)
checkIsTree()
Expand Down Expand Up @@ -187,12 +206,24 @@ const InterventionPreviewView = () => {


const renderRightContainer = () => {
if (InterventionData.is_complete && InterventionData.status === 'PENDING_DATA_UPLOAD') {
return (
<View style={styles.rightWrapper}>
<TouchableOpacity style={styles.editWrapper} onPress={()=>{openEditModal(InterventionData)}}>
<Text style={styles.editText}>Edit</Text>
<PenIcon width={30} height={30} />
</TouchableOpacity>
</View>
)
}

if (InterventionData.is_complete && InterventionData.status !== 'SYNCED') {
return <TouchableOpacity style={[styles.syncContainer]} onPress={moveToHome}>
<UnsyncIcon width={20} height={20} />
<Text style={styles.label}>Sync Now</Text>
</TouchableOpacity>
}

if (InterventionData.status === 'SYNCED') {
return <View style={styles.syncContainer}>
<SyncIcon width={20} height={20} />
Expand All @@ -205,6 +236,7 @@ const InterventionPreviewView = () => {

return (
<SafeAreaView style={styles.container} edges={['top']}>
<DeleteModal isVisible={editModal !== null} toggleModal={setEditModal} removeFavSpecie={handleEdit} headerLabel={'Edit Intervention'} noteLabel={'Do you want to edit intervention.'} primeLabel={'Edit'} secondaryLabel={'Cancel'} extra={editModal} secondaryHandler={closeAllModals} />
<ScrollView
decelerationRate='normal'
style={styles.scrollWrapper} bounces={false} showsVerticalScrollIndicator={false} ref={scrollViewRef}>
Expand All @@ -224,7 +256,7 @@ const InterventionPreviewView = () => {
passRefs={(ref, index) => (childRefs.current[index] = ref)}
/>
)}
{InterventionData.meta_data !== '{}' && <InterventionMetaData data={InterventionData.meta_data}/>}
{InterventionData.meta_data !== '{}' && <InterventionMetaData data={InterventionData.meta_data} />}
<InterventionAdditionalData data={[...InterventionData.form_data, ...InterventionData.additional_data]} id={InterventionData.intervention_id} canEdit={InterventionData.status === 'INITIALIZED'} />
<ExportGeoJSONButton details={InterventionData} type='intervention' />
{InterventionData.status !== 'SYNCED' && <Text style={styles.versionNote}>{i18next.t("label.collected_using")}{InterventionData.is_legacy ? '1.0.8' : Application.nativeApplicationVersion}</Text>}
Expand Down Expand Up @@ -286,8 +318,25 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
backgroundColor: Colors.NEW_PRIMARY + '1A',
marginRight: '5%',
borderRadius: 10
borderRadius: 10,
marginRight:'5%'
},
editWrapper: {
height: 50,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
borderRadius: 10,
paddingLeft: 20,
backgroundColor: Colors.BACKDROP_COLOR
},
editText: {
fontFamily: Typography.FONT_FAMILY_SEMI_BOLD,
fontSize: 20,
color: Colors.TEXT_COLOR
},
rightWrapper: {
flexDirection: 'row',
marginRight: '5%'
}
})
4 changes: 2 additions & 2 deletions src/utils/helpers/syncHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ export const convertTreeToBody = (i: InterventionData, d: SampleTree, uType: str
return { pData: null, message: "Please assign a project to intervention", fixRequired: "PROJECT_ID_MISSING", error: "" }
}

if (uType === 'tpo' && d.project_id) {
postData.plantProject = d.project_id
if (uType === 'tpo' && i.project_id) {
postData.plantProject = i.project_id
}

if (uType === 'tpo' && i.site_id && i.site_id !== 'other') {
Expand Down