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 () => {
|
const _handleChangeProfilePhoto = async () => {
|
||||||
await ImagePicker.getMediaLibraryPermissionsAsync()
|
await ImagePicker.requestMediaLibraryPermissionsAsync()
|
||||||
|
|
||||||
const { uri } = await ImagePicker.launchImageLibraryAsync({
|
const { uri } = await ImagePicker.launchImageLibraryAsync({
|
||||||
allowsEditing: true,
|
allowsEditing: true,
|
||||||
|
|
|
@ -35,22 +35,23 @@ const PublishJsx = ({ navigation }) => {
|
||||||
instance = instancePair[1];
|
instance = instancePair[1];
|
||||||
accessToken = JSON.parse(tokenPair[1]).access_token;
|
accessToken = JSON.parse(tokenPair[1]).access_token;
|
||||||
|
|
||||||
return ImagePicker.getMediaLibraryPermissionsAsync();
|
return ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||||
})
|
})
|
||||||
.then(({ granted }) => {
|
.then(permissionResult => {
|
||||||
if (granted) {
|
console.warn(permissionResult);
|
||||||
|
if (permissionResult.granted) {
|
||||||
return ImagePicker.launchImageLibraryAsync({
|
return ImagePicker.launchImageLibraryAsync({
|
||||||
allowsEditing: true,
|
allowsEditing: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
navigation.goBack();
|
throw "Permission not granted";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((imageData) => {
|
.then((imageData) => {
|
||||||
if (!imageData.cancelled) {
|
if (!imageData.cancelled) {
|
||||||
return imageData;
|
return imageData;
|
||||||
} else {
|
} else {
|
||||||
navigation.goBack();
|
throw "Image picker closed";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(({ uri, type, width, height }) => {
|
.then(({ uri, type, width, height }) => {
|
||||||
|
@ -71,6 +72,10 @@ const PublishJsx = ({ navigation }) => {
|
||||||
height: getAutoHeight(width, height, SCREEN_WIDTH),
|
height: getAutoHeight(width, height, SCREEN_WIDTH),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.warn(e);
|
||||||
|
navigation.goBack();
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue