Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'haileyok-fix/android-image-picker-patch' into main

+73 -1
+64
patches/expo-image-picker+14.7.1.patch
··· 1 + diff --git a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt 2 + index ff15c91..41aaf12 100644 3 + --- a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt 4 + +++ b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt 5 + @@ -26,51 +26,26 @@ import java.io.Serializable 6 + * @see [androidx.activity.result.contract.ActivityResultContracts.GetMultipleContents] 7 + */ 8 + internal class ImageLibraryContract( 9 + - private val appContextProvider: AppContextProvider 10 + + private val appContextProvider: AppContextProvider, 11 + ) : AppContextActivityResultContract<ImageLibraryContractOptions, ImagePickerContractResult> { 12 + private val contentResolver: ContentResolver 13 + get() = appContextProvider.appContext.reactContext?.contentResolver 14 + ?: throw Exceptions.ReactContextLost() 15 + 16 + override fun createIntent(context: Context, input: ImageLibraryContractOptions): Intent { 17 + - val request = PickVisualMediaRequest.Builder() 18 + - .setMediaType( 19 + - when (input.options.mediaTypes) { 20 + - MediaTypes.VIDEOS -> { 21 + - PickVisualMedia.VideoOnly 22 + - } 23 + - 24 + - MediaTypes.IMAGES -> { 25 + - PickVisualMedia.ImageOnly 26 + - } 27 + - 28 + - else -> { 29 + - PickVisualMedia.ImageAndVideo 30 + - } 31 + - } 32 + - ) 33 + - .build() 34 + + val intent = Intent(Intent.ACTION_GET_CONTENT) 35 + + .addCategory(Intent.CATEGORY_OPENABLE) 36 + + .setType("image/*") 37 + 38 + if (input.options.allowsMultipleSelection) { 39 + - val selectionLimit = input.options.selectionLimit 40 + - 41 + - if (selectionLimit == 1) { 42 + - // If multiple selection is allowed but the limit is 1, we should ignore 43 + - // the multiple selection flag and just treat it as a single selection. 44 + - return PickVisualMedia().createIntent(context, request) 45 + + if(input.options.selectionLimit == 1) { 46 + + return intent 47 + } 48 + 49 + - if (selectionLimit > 1) { 50 + - return PickMultipleVisualMedia(selectionLimit).createIntent(context, request) 51 + - } 52 + - 53 + - // If the selection limit is 0, it is the same as unlimited selection. 54 + - if (selectionLimit == UNLIMITED_SELECTION) { 55 + - return PickMultipleVisualMedia().createIntent(context, request) 56 + - } 57 + + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true) 58 + } 59 + 60 + - return PickVisualMedia().createIntent(context, request) 61 + + return intent 62 + } 63 + 64 + override fun parseResult(input: ImageLibraryContractOptions, resultCode: Int, intent: Intent?) =
+3
patches/expo-image-picker+14.7.1.patch.md
··· 1 + added by https://github.com/bluesky-social/social-app/pull/2384#pullrequestreview-1800985521 2 + 3 + hackfixes the image picker on android so that the user can select from their typical image sources
+6 -1
src/lib/media/picker.shared.ts
··· 4 4 MediaTypeOptions, 5 5 } from 'expo-image-picker' 6 6 import {getDataUriSize} from './util' 7 + import * as Toast from 'view/com/util/Toast' 7 8 8 9 export async function openPicker(opts?: ImagePickerOptions) { 9 10 const response = await launchImageLibraryAsync({ ··· 13 14 ...opts, 14 15 }) 15 16 16 - return (response.assets ?? []).map(image => ({ 17 + if (response.assets && response.assets.length > 4) { 18 + Toast.show('You may only select up to 4 images') 19 + } 20 + 21 + return (response.assets ?? []).slice(0, 4).map(image => ({ 17 22 mime: 'image/jpeg', 18 23 height: image.height, 19 24 width: image.width,