Modern Apps git

← Modern-Apps.git

general: update to target Android 17

Commit
a0729788c8824a5d9bafbecd00060930ed1272a0
Author
Vayun Mathur <[email protected]>
When
2026-04-27 20:43 UTC (7 months ago)
Parents
8f9ae6f

Diff

build-logic/src/main/kotlin/RoomExtension.kt
diff --git a/build-logic/src/main/kotlin/RoomExtension.kt b/build-logic/src/main/kotlin/RoomExtension.ktindex e9f6621412..89b860da0f 100644--- a/build-logic/src/main/kotlin/RoomExtension.kt+++ b/build-logic/src/main/kotlin/RoomExtension.kt@@ -1,5 +1,5 @@-import gradle.kotlin.dsl.accessors._fbec4b978d86c39e55b50a6ada210591.implementation-import gradle.kotlin.dsl.accessors._fbec4b978d86c39e55b50a6ada210591.ksp+import gradle.kotlin.dsl.accessors._50084b53781b2d5f3340afb1e969649a.implementation+import gradle.kotlin.dsl.accessors._b80debccebb9ece8e914e516f0647706.ksp import org.gradle.kotlin.dsl.DependencyHandlerScope  fun DependencyHandlerScope.implementRoom(libs: org.gradle.accessors.dm.LibrariesForLibs) {
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 33f09b40d5..f957709674 100644--- a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts+++ b/build-logic/src/main/kotlin/common-conventions-app.gradle.kts@@ -37,9 +37,9 @@ configure<com.android.build.api.dsl.ApplicationExtension> {      namespace = "com.vayunmathur${path.replace(":", ".")}"     compileSdk {-        version = release(36)+        version = release(37)     }-    compileSdkExtension = 19+    //compileSdkExtension = 19      androidResources {         generateLocaleConfig = true
contacts/src/main/res/values-pl/strings.xml
diff --git a/contacts/src/main/res/values-pl/strings.xml b/contacts/src/main/res/values-pl/strings.xmlindex 2502841fc5..a8acf1ac4f 100644--- a/contacts/src/main/res/values-pl/strings.xml+++ b/contacts/src/main/res/values-pl/strings.xml@@ -28,8 +28,6 @@     <string name="account">Konto</string>     <string name="choose_account">Wybór konta</string>     <string name="remove_birthday">Usuń urodziny</string>-    <string name="add_detail_type">Dodaj %1$s</string>-    <string name="remove_detail_type">Usuń %1$s</string>     <string name="dates">Daty</string>     <string name="phone">Telefon</string>     <string name="email">Email</string>@@ -45,8 +43,7 @@     <string name="account_name">Nazwa konta</string>     <string name="add">Dodaj</string>     <string name="delete_contact_title">Usuń kontakt</string>-    <string name="delete_contact_confirm">Czy na pewno chcesz usunąć %1$s? Tej czynności nie można cofnąć.</string>-    <string name="this_contact">ten kontakt</string>+    <string name="delete_contact_confirm">Czy na pewno chcesz usunąć ten kontakt? Tej czynności nie można cofnąć.</string>     <string name="delete">Usuń</string>     <string name="grant_contacts_permission">Proszę zezwolić na dostęp do kontaktów</string>     <string name="select_contact_hint">Wybierz kontakt, aby wyświetlić szczegóły</string>
findfamily/src/main/java/com/vayunmathur/findfamily/util/Platform.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/util/Platform.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/util/Platform.ktindex 6112fd7626..9ee66a3a87 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/util/Platform.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/util/Platform.kt@@ -17,93 +17,92 @@ class Platform(private val context: Context) {     @SuppressLint("Range")     @Composable     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)-//            }-//            return{}-//        } else {+        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)+            }+        } else {             val launcher =                 rememberLauncherForActivityResult(ActivityResultContracts.PickContact()) { uri ->                     if (uri == null) return@rememberLauncherForActivityResult@@ -138,7 +137,7 @@ class Platform(private val context: Context) {                     permissionLauncher.launch(Manifest.permission.READ_CONTACTS)                 }             }-//        }+        }     }      fun copy(content: String) {
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 1f8baa5239..d642b1a58b 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -1,6 +1,6 @@ [versions] # Build & Core Language-agp = "9.1.0"+agp = "9.2.0" kotlin = "2.3.20" ksp = "2.3.6"