Bläddra i källkod

finished being able to access your landmarks from the profile page

aidan 1 år sedan
förälder
incheckning
8392f26dcc

+ 1 - 1
android/app/build.gradle

@@ -140,7 +140,7 @@ android {
         applicationId 'com.clicknpush.mobile'
         minSdkVersion rootProject.ext.minSdkVersion
         targetSdkVersion rootProject.ext.targetSdkVersion
-        versionCode 39
+        versionCode 41
         versionName "0.0.16"
     }
     splits {

+ 6 - 1
android/gradle.properties

@@ -40,4 +40,9 @@ expo.webp.enabled=true
 # Disabled by default because iOS doesn't support animated webp
 expo.webp.animated=false
 
-android.kotlinVersion=1.6.10
+android.kotlinVersion=1.6.10
+
+MYAPP_RELEASE_STORE_FILE=release.keystore
+MYAPP_RELEASE_KEY_ALIAS=QGNkbW9zcy9jbnAtbW9iaWxl
+MYAPP_RELEASE_STORE_PASSWORD=fef58ba01a1d4fd2a36783cc60ef70f9
+MYAPP_RELEASE_KEY_PASSWORD=fef58ba01a1d4fd2a36783cc60ef70f9

+ 1 - 3
app.json

@@ -43,9 +43,7 @@
     "web": {
       "favicon": "./assets/favicon.png"
     },
-    "runtimeVersion": {
-      "policy": "sdkVersion"
-    },
+    "runtimeVersion": "1.0.1",
     "extra": {
       "eas": {
         "projectId": "4cba8a8d-b6b2-4e66-9113-3e228cce80fa"

+ 10 - 0
src/components/Map/Panels/FilterPanel/FilterPanel.tsx

@@ -13,6 +13,7 @@ import { SafeAreaView } from 'react-native-safe-area-context'
 import { Separator } from "../../../Separator"
 import { FilterLmTypes } from './FilterLmTypes'
 import { FilterMinRating } from './FilterMinRating'
+import { seeUserLandmarks } from "../../../Profile/ProfileHeader"
 
 interface FilterPanelProps {
     setMinLmRating: (min: number) => void,
@@ -79,6 +80,15 @@ export const FilterPanel: React.FC<FilterPanelProps> = (props) => {
         setLocalMinRating(props.minLmRating)
     }
 
+    /**
+     * Listens to the seeUserLandmarks boolean from ProfileHeader
+     */
+    useEffect(() => {
+        if (seeUserLandmarks == true) {
+            props.toggleOnlyOwned(true)
+        }
+    }, [seeUserLandmarks])
+
     // useEffects that update local settings based on parent changes (e.g. deleting a chip)
     useEffect(() => {
         setLocalMinRating(props.minLmRating)

+ 2 - 1
src/components/Map/Panels/LandmarkDetailsPanel/CommentsContainer.tsx

@@ -97,7 +97,8 @@ export const CommentsContainer: React.FC<CommentsContainerProps> = (props) => {
                 placeholderTextColor="gray" 
                 style={{padding: 15, paddingTop: 15, flex: 5}}
                 onFocus={() => props.mainScrollRef.current.scrollToEnd()}
-                multiline={true} />
+                multiline={true}
+                maxLength={500} />
             {props.newCommentId || props.commentBeingEdited ? 
             <View style={{alignItems: 'center', justifyContent: 'space-between', flexDirection: 'row', flex: 1}}>
                 <FontAwesome name="times" size={20} color="lightgray" style={{ backgroundColor: 'white',  }} onPress={Keyboard.dismiss} />

+ 1 - 1
src/components/Map/Panels/LandmarkDetailsPanel/LandmarkDetails.tsx

@@ -279,7 +279,7 @@ const LandmarkDetails: React.FC<LandmarkDetailsProps> = ({markerWindowPosition,
         }
         else {
             setFocusedComment(id);
-            // console.log(uri.substring(uri.length-10, uri.length))
+            console.log(uri.substring(uri.length-10, uri.length))
         }
     }
 

+ 28 - 12
src/components/Profile/ProfileHeader.tsx

@@ -7,13 +7,18 @@
 
 import React, { memo } from "react"
 import { View, Text } from "react-native"
+import { TouchableOpacity } from "react-native-gesture-handler"
 import { useAuth } from "../../data/Auth/AuthContext"
 import { useLandmarks } from "../../data/landmarks"
 import { UserProfile } from "../../data/profiles"
+import { navigate } from "../../navigation/RootNavigator"
 
-export const ProfileHeader: React.FC<{profile?: UserProfile}> = memo(({profile}) => {
+let seeUserLandmarks = false;
+
+export const ProfileHeader: React.FC<{ profile?: UserProfile }> = memo(({ profile }) => {
     const landmarkQuery = useLandmarks()
-    const {landmarkOwnedByUser} = useAuth()
+    const { landmarkOwnedByUser } = useAuth()
+    const delay = ms => new Promise(res => setTimeout(res, ms));
 
     const getLandmarkCount = () => {
         return landmarkQuery?.data?.filter(lm => landmarkOwnedByUser(lm)).length
@@ -22,26 +27,37 @@ export const ProfileHeader: React.FC<{profile?: UserProfile}> = memo(({profile})
     const getTotalLandmarkRating = () => {
         const userLandmarks = landmarkQuery?.data?.filter(lm => landmarkOwnedByUser(lm))
         if (userLandmarks?.length > 0)
-            return userLandmarks?.reduce((prev, current) => {return {rating: prev.rating + current.rating}}).rating
-        else 
+            return userLandmarks?.reduce((prev, current) => { return { rating: prev.rating + current.rating } }).rating
+        else
             return 0
     }
 
+    const seeOwnLandmarks = async () => {
+        navigate("Outdoor"); 
+        seeUserLandmarks = true;
+        await delay(1000);  // Give the FilterPanel time to react to seeUserLandmarks changing
+        seeUserLandmarks = false
+    }
+
     return (
-        <View style={{marginTop: 10, flexDirection: 'row', width: '100%', marginBottom: 20}}>
-            <View style={{flexBasis: "50%"}}>
-            <Text style={{fontSize: 17, textAlign: 'center'}}>{getLandmarkCount()}</Text>
-                <Text style={{textAlign: 'center'}}>Landmarks</Text>
+        <View style={{ marginTop: 10, flexDirection: 'row', width: '100%', marginBottom: 20 }}>
+            <View style={{ flexBasis: "50%" }}>
+                <TouchableOpacity onPress={() => {seeOwnLandmarks()}}>
+                    <Text style={{ fontSize: 17, textAlign: 'center' }}>{getLandmarkCount()}</Text>
+                    <Text style={{ textAlign: 'center' }}>Landmarks</Text>
+                </TouchableOpacity>
             </View>
             {/* This will be implemented when the social network feature is added
             <View style={{flexBasis: "33%"}}>
                 <Text style={{fontSize: 10, textAlign: 'center'}}>Not yet implemented</Text>
                 <Text style={{textAlign: 'center'}}>Friends</Text>
             </View> */}
-            <View style={{flexBasis: "50%"}}>
-                <Text style={{fontSize: 17, textAlign: 'center'}}>{getTotalLandmarkRating()}</Text>
-                <Text style={{textAlign: 'center'}}>Rating</Text>
+            <View style={{ flexBasis: "50%" }}>
+                <Text style={{ fontSize: 17, textAlign: 'center' }}>{getTotalLandmarkRating()}</Text>
+                <Text style={{ textAlign: 'center' }}>Rating</Text>
             </View>
         </View>
     )
-})
+})
+
+export {seeUserLandmarks};