Fix bug causing Publish to never ask for media permissions
This commit is contained in:
parent
9062206c34
commit
3eb7b250d8
File diff suppressed because it is too large
Load Diff
|
@ -89,7 +89,7 @@ const SettingsJsx = (props) => {
|
|||
}, []);
|
||||
|
||||
const _handleChangeProfilePhoto = async () => {
|
||||
await ImagePicker.getMediaLibraryPermissionsAsync()
|
||||
await ImagePicker.requestMediaLibraryPermissionsAsync()
|
||||
|
||||
const { uri } = await ImagePicker.launchImageLibraryAsync({
|
||||
allowsEditing: true,
|
||||
|
|
|
@ -35,22 +35,23 @@ const PublishJsx = ({ navigation }) => {
|
|||
instance = instancePair[1];
|
||||
accessToken = JSON.parse(tokenPair[1]).access_token;
|
||||
|
||||
return ImagePicker.getMediaLibraryPermissionsAsync();
|
||||
return ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||
})
|
||||
.then(({ granted }) => {
|
||||
if (granted) {
|
||||
.then(permissionResult => {
|
||||
console.warn(permissionResult);
|
||||
if (permissionResult.granted) {
|
||||
return ImagePicker.launchImageLibraryAsync({
|
||||
allowsEditing: true,
|
||||
});
|
||||
} else {
|
||||
navigation.goBack();
|
||||
throw "Permission not granted";
|
||||
}
|
||||
})
|
||||
.then((imageData) => {
|
||||
if (!imageData.cancelled) {
|
||||
return imageData;
|
||||
} else {
|
||||
navigation.goBack();
|
||||
throw "Image picker closed";
|
||||
}
|
||||
})
|
||||
.then(({ uri, type, width, height }) => {
|
||||
|
@ -71,6 +72,10 @@ const PublishJsx = ({ navigation }) => {
|
|||
height: getAutoHeight(width, height, SCREEN_WIDTH),
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.warn(e);
|
||||
navigation.goBack();
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Reference in New Issue