Skip to content

Commit

Permalink
Purpose of camera/photo library access (#338)
Browse files Browse the repository at this point in the history
* added infoPlist

* added message regarding reasons for camera/photo library usage.
  • Loading branch information
Tbjerregaard authored Dec 19, 2024
1 parent ff80685 commit 44437a1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
6 changes: 5 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.girafsvenner.ugeplan",
"usesBroadcastPushNotifications": false
"usesBroadcastPushNotifications": false,
"infoPlist": {
"NSCameraUsageDescription": "GIRAF Weekplan bruger kameraadgang til at tage billeder til profilbilleder eller til at uploade billeder for din organisation.",
"NSPhotoLibraryUsageDescription": "GIRAF Weekplan bruger adgang til dit fotobibliotek for at vælge billeder til profilbilleder eller til at uploade billeder for din organisation."
}
},
"android": {
"adaptiveIcon": {
Expand Down
6 changes: 5 additions & 1 deletion app/auth/profile/changeprofilepicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const ChangeProfilePicture = () => {
<ProfilePicture style={styles.mainProfilePicture} label={label} userId={userId} />
)}
</View>
<CameraButton style={{ bottom: ScaleSizeH(230) }} onImageSelect={setImageUri} />
<CameraButton
style={{ bottom: ScaleSizeH(230) }}
onImageSelect={setImageUri}
promptMessage="Weekplan skal bruge adgang til at tage et billede eller vælge et fra dit fotoalbum for dit profilbillede"
/>
<SecondaryButton
style={{ backgroundColor: colors.green }}
label="Skift profilbillede"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const UploadPictogram = () => {
absolute={false}
style={styles.cameraButton}
onImageSelect={(uri: string) => setValue("piktogramURI", uri, { shouldValidate: true })}
promptMessage="Weekplan skal bruge adgang til at tage et billede eller vælge et fra dit fotoalbum for at tilføje det til din organisations billeder."
/>
</View>
</View>
Expand Down
8 changes: 6 additions & 2 deletions app/auth/register.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState } from "react";
import React, { useRef, useState } from "react";
import { SafeAreaView, View, StyleSheet, KeyboardAvoidingView, ScrollView } from "react-native";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
Expand Down Expand Up @@ -143,7 +143,11 @@ const RegisterScreen: React.FC = () => {
key={imageUri}
/>
</View>
<CameraButton style={{ bottom: ScaleSizeH(230) }} onImageSelect={setImageUri} />
<CameraButton
style={{ bottom: ScaleSizeH(230) }}
onImageSelect={setImageUri}
promptMessage="Weekplan skal bruge adgang til at tage et billede eller vælge et fra dit fotoalbum for dit profilbillede"
/>
<SecondaryButton
style={{ backgroundColor: colors.green }}
label="Upload billede"
Expand Down
10 changes: 8 additions & 2 deletions components/CameraButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ type CameraButtonProps = {
style?: StyleProp<ViewStyle>;
onImageSelect: (imageUri: string) => void;
absolute?: boolean;
promptMessage?: string;
};

const CameraButton = ({ style, onImageSelect, absolute = true }: CameraButtonProps) => {
const CameraButton = ({
style,
onImageSelect,
absolute = true,
promptMessage = "Vil du tage et billede eller vælge et fra dit fotoalbum?",
}: CameraButtonProps) => {
const handlePress = async () => {
Alert.alert("Vælg billede-kilde", "Vil du tage et billede eller vælge et fra dit fotoalbum?", [
Alert.alert("Vælg billede-kilde", promptMessage, [
{ text: "Kamera", onPress: handleTakePhoto },
{ text: "Fotoalbum", onPress: handlePickImage },
{ text: "Annuller", style: "cancel" },
Expand Down

0 comments on commit 44437a1

Please sign in to comment.