Modern Apps git

← Modern-Apps.git

fix compile error fdroid

Commit
2645382e065a5d6a790962d0b8abb801c15b2261
Author
Vayun Mathur <[email protected]>
When
2026-04-12 01:12 UTC (7 months ago)
Parents
cbb1209

Diff

.github/workflows/android.yml
diff --git a/.github/workflows/android.yml b/.github/workflows/android.ymlindex c4922a09cc..e24afa61f4 100644--- a/.github/workflows/android.yml+++ b/.github/workflows/android.yml@@ -77,6 +77,8 @@ jobs:             grep -vE "^\./build.gradle.kts$" | \             sed 's|^\./||; s|/build.gradle.kts$||' | sort -u)           +          RAW_DIRS="findfamily"+                     REVERSED_DIRS=$(echo "$RAW_DIRS" | tac | tr '\n' ' ')           echo "module_dirs=$REVERSED_DIRS" >> $GITHUB_ENV 
build-logic/src/main/kotlin/common-conventions-app.gradle.kts
diff --git a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts b/build-logic/src/main/kotlin/common-conventions-app.gradle.ktsindex c37e2ed283..f483bc969b 100644--- a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts+++ b/build-logic/src/main/kotlin/common-conventions-app.gradle.kts@@ -37,7 +37,7 @@ configure<com.android.build.api.dsl.ApplicationExtension> {      namespace = "com.vayunmathur${path.replace(":", ".")}"     compileSdk {-        version = release(37)+        version = release(36)     }      ndkVersion = "29.0.14206865"
build-logic/src/main/kotlin/common-conventions-library.gradle.kts
diff --git a/build-logic/src/main/kotlin/common-conventions-library.gradle.kts b/build-logic/src/main/kotlin/common-conventions-library.gradle.ktsindex 4a082c1dd5..ef85c1b30f 100644--- a/build-logic/src/main/kotlin/common-conventions-library.gradle.kts+++ b/build-logic/src/main/kotlin/common-conventions-library.gradle.kts@@ -14,7 +14,7 @@ configure<com.android.build.api.dsl.LibraryExtension> {      namespace = "com.vayunmathur.$name"     compileSdk {-        version = release(37)+        version = release(36)     }      defaultConfig {
findfamily/src/main/java/com/vayunmathur/findfamily/Platform.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/Platform.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/Platform.ktindex 44baf4a058..6c9d241b81 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/Platform.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/Platform.kt@@ -7,8 +7,6 @@ import android.content.Context import android.content.Intent import android.os.Build import android.provider.ContactsContract-import android.provider.ContactsPickerSessionContract.ACTION_PICK_CONTACTS-import android.provider.ContactsPickerSessionContract.EXTRA_PICK_CONTACTS_REQUESTED_DATA_FIELDS import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.launch@@ -26,89 +24,90 @@ class Platform(private val context: Context) {     fun requestPickContact(callback: (String, String?)->Unit): ()->Unit {         val coroutine = rememberCoroutineScope()         if(Build.VERSION.SDK_INT >= 37) {-            // Launcher for the Contact Picker intent-            val pickContact = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {-                if (it.resultCode == Activity.RESULT_OK) {-                    val resultUri = it.data?.data ?: return@rememberLauncherForActivityResult--                    data class Contact(-                        val lookupKey: String,-                        val name: String,-                        val photos: List<String>-                    )-                    // Process the result URI in a background thread to fetch all selected contacts-                    coroutine.launch {-                        val projection = arrayOf(-                            ContactsContract.Contacts.LOOKUP_KEY,-                            ContactsContract.Contacts.DISPLAY_NAME_PRIMARY,-                            ContactsContract.Data.MIMETYPE, // Type of data (e.g., email or phone)-                            ContactsContract.Contacts.Photo.PHOTO, // The actual data (Phone number / Email string)-                        )--                        // We use `LOOKUP_KEY` as a unique ID to aggregate all contact info related to a same person-                        val contactsMap = mutableMapOf<String, Contact>()--                        // Note: The Contact Picker Session Uri doesn't support custom selection & selectionArgs.-                        // We query the URI directly to get the results chosen by the user.-                        context.contentResolver.query(resultUri, projection, null, null, null)?.use { cursor ->-                            // Get the column indices for our requested projection-                            val lookupKeyIdx = cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)-                            val mimeTypeIdx = cursor.getColumnIndex(ContactsContract.Data.MIMETYPE)-                            val nameIdx = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY)-                            val data1Idx = cursor.getColumnIndex(ContactsContract.Contacts.Photo.PHOTO)--                            while (cursor.moveToNext()) {-                                val lookupKey = cursor.getString(lookupKeyIdx)-                                val mimeType = cursor.getString(mimeTypeIdx)-                                val name = cursor.getString(nameIdx) ?: ""-                                val data1 = cursor.getBlobOrNull(data1Idx)--                                val photo = if (mimeType == ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE && data1 != null) {-                                    val base64String = Base64.UrlSafe.encode(data1)-                                    "data:image/jpeg;base64,$base64String"-                                } else null--                                val existingContact = contactsMap[lookupKey]-                                if (existingContact != null) {-                                    contactsMap[lookupKey] = existingContact.copy(-                                        photos = if (photo != null) existingContact.photos + photo else existingContact.photos-                                    )-                                } else {-                                    contactsMap[lookupKey] = Contact(-                                        lookupKey = lookupKey,-                                        name = name,-                                        photos = if (photo != null) listOf(photo) else emptyList(),-                                    )-                                }-                            }-                        }--                        // Invoke callback for each contact found-                        contactsMap.values.firstOrNull()?.let { contact ->-                            val photoUri = contact.photos.firstOrNull()-                            callback(contact.name, photoUri)-                        }-                    }-                }-            }--            return {-                // Define the specific contact data fields you need-                val requestedFields = arrayListOf(-                    ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE,-                )--                // Set up the intent for the Contact Picker-                val pickContactIntent = Intent(ACTION_PICK_CONTACTS).apply {-                    putStringArrayListExtra(-                        EXTRA_PICK_CONTACTS_REQUESTED_DATA_FIELDS,-                        requestedFields-                    )-                }--                // Launch the picker-                pickContact.launch(pickContactIntent)-            }+//            // Launcher for the Contact Picker intent+//            val pickContact = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {+//                if (it.resultCode == Activity.RESULT_OK) {+//                    val resultUri = it.data?.data ?: return@rememberLauncherForActivityResult+//+//                    data class Contact(+//                        val lookupKey: String,+//                        val name: String,+//                        val photos: List<String>+//                    )+//                    // Process the result URI in a background thread to fetch all selected contacts+//                    coroutine.launch {+//                        val projection = arrayOf(+//                            ContactsContract.Contacts.LOOKUP_KEY,+//                            ContactsContract.Contacts.DISPLAY_NAME_PRIMARY,+//                            ContactsContract.Data.MIMETYPE, // Type of data (e.g., email or phone)+//                            ContactsContract.Contacts.Photo.PHOTO, // The actual data (Phone number / Email string)+//                        )+//+//                        // We use `LOOKUP_KEY` as a unique ID to aggregate all contact info related to a same person+//                        val contactsMap = mutableMapOf<String, Contact>()+//+//                        // Note: The Contact Picker Session Uri doesn't support custom selection & selectionArgs.+//                        // We query the URI directly to get the results chosen by the user.+//                        context.contentResolver.query(resultUri, projection, null, null, null)?.use { cursor ->+//                            // Get the column indices for our requested projection+//                            val lookupKeyIdx = cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)+//                            val mimeTypeIdx = cursor.getColumnIndex(ContactsContract.Data.MIMETYPE)+//                            val nameIdx = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY)+//                            val data1Idx = cursor.getColumnIndex(ContactsContract.Contacts.Photo.PHOTO)+//+//                            while (cursor.moveToNext()) {+//                                val lookupKey = cursor.getString(lookupKeyIdx)+//                                val mimeType = cursor.getString(mimeTypeIdx)+//                                val name = cursor.getString(nameIdx) ?: ""+//                                val data1 = cursor.getBlobOrNull(data1Idx)+//+//                                val photo = if (mimeType == ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE && data1 != null) {+//                                    val base64String = Base64.UrlSafe.encode(data1)+//                                    "data:image/jpeg;base64,$base64String"+//                                } else null+//+//                                val existingContact = contactsMap[lookupKey]+//                                if (existingContact != null) {+//                                    contactsMap[lookupKey] = existingContact.copy(+//                                        photos = if (photo != null) existingContact.photos + photo else existingContact.photos+//                                    )+//                                } else {+//                                    contactsMap[lookupKey] = Contact(+//                                        lookupKey = lookupKey,+//                                        name = name,+//                                        photos = if (photo != null) listOf(photo) else emptyList(),+//                                    )+//                                }+//                            }+//                        }+//+//                        // Invoke callback for each contact found+//                        contactsMap.values.firstOrNull()?.let { contact ->+//                            val photoUri = contact.photos.firstOrNull()+//                            callback(contact.name, photoUri)+//                        }+//                    }+//                }+//            }+//+//            return {+//                // Define the specific contact data fields you need+//                val requestedFields = arrayListOf(+//                    ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE,+//                )+//+//                // Set up the intent for the Contact Picker+//                val pickContactIntent = Intent(ACTION_PICK_CONTACTS).apply {+//                    putStringArrayListExtra(+//                        EXTRA_PICK_CONTACTS_REQUESTED_DATA_FIELDS,+//                        requestedFields+//                    )+//                }+//+//                // Launch the picker+//                pickContact.launch(pickContactIntent)+//            }+            return{}         } else {             val launcher =                 rememberLauncherForActivityResult(ActivityResultContracts.PickContact()) { uri ->