Skip to content

Commit

Permalink
upgrade plugins and libraries to the latest versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneh-s committed Oct 7, 2024
1 parent f6a5e6c commit 3eaaeeb
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {

defaultConfig {
applicationId = "com.canopas.yourspace"
minSdk = 21
minSdk = 23
targetSdk = 34
versionCode = versionMajor * 1000000 + versionMinor * 10000 + versionBuild
versionName = "$versionMajor.$versionMinor.$versionBuild"
Expand Down Expand Up @@ -128,36 +128,36 @@ android {

dependencies {

implementation("androidx.core:core-ktx:1.13.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.9.0")
implementation(platform("androidx.compose:compose-bom:2024.04.01"))
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6")
implementation("androidx.activity:activity-compose:1.9.2")
implementation(platform("androidx.compose:compose-bom:2024.09.03"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.navigation:navigation-compose:2.8.2")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
implementation("androidx.compose.foundation:foundation:1.6.6")
implementation("androidx.compose.foundation:foundation:1.7.3")

implementation(platform("com.google.firebase:firebase-bom:32.8.1"))
implementation(platform("com.google.firebase:firebase-bom:33.4.0"))
implementation("com.google.firebase:firebase-firestore-ktx")
implementation("com.google.firebase:firebase-messaging-ktx")
implementation("com.google.firebase:firebase-auth")
implementation("com.google.firebase:firebase-storage")
implementation("com.google.firebase:firebase-crashlytics")

implementation("com.google.android.gms:play-services-auth:21.1.0")
implementation("androidx.lifecycle:lifecycle-process:2.7.0")
implementation("com.google.android.gms:play-services-auth:21.2.0")
implementation("androidx.lifecycle:lifecycle-process:2.8.6")
// Test
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2024.04.01"))
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2024.09.03"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.0.0")
testImplementation("org.mockito:mockito-inline:4.5.1")
testImplementation("org.mockito:mockito-core:5.7.0")
Expand All @@ -170,10 +170,10 @@ dependencies {
// Work manager
implementation("androidx.hilt:hilt-work:1.2.0")
ksp("androidx.hilt:hilt-compiler:1.2.0")
implementation("androidx.work:work-runtime-ktx:2.9.0")
implementation("androidx.work:work-runtime-ktx:2.9.1")

// DataStore
implementation("androidx.datastore:datastore-preferences:1.1.0")
implementation("androidx.datastore:datastore-preferences:1.1.1")

// Timber
implementation("com.jakewharton.timber:timber:5.0.1")
Expand All @@ -182,7 +182,7 @@ dependencies {
implementation("com.canopas.jetcountrypicker:jetcountrypicker:1.1.1")

// coil
implementation("io.coil-kt:coil-compose:2.5.0")
implementation("io.coil-kt:coil-compose:2.6.0")

// Accompanist permission
implementation("com.google.accompanist:accompanist-permissions:0.32.0")
Expand All @@ -195,7 +195,7 @@ dependencies {
implementation("com.vanniktech:android-image-cropper:4.5.0")

// Place
implementation("com.google.android.libraries.places:places:3.4.0")
implementation("com.google.android.libraries.places:places:4.0.0")

// Room-DB
implementation("androidx.room:room-runtime:2.6.1")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/canopas/yourspace/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MainActivity : ComponentActivity() {
super.onNewIntent(intent)
val viewModel = ViewModelProvider(this)[MainViewModel::class.java]
viewModel.handleIntentData(intent)
intent?.extras?.clear()
intent.extras?.clear()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.canopas.yourspace.ui.component

import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.waitForUpOrCancellation
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand All @@ -18,12 +15,7 @@ import androidx.compose.ui.draw.scale
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.PointerInputChange
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.debugInspectorInfo
import androidx.compose.ui.unit.dp

const val FLAG_IGNORE_GLOBAL_SETTINGS = 2
const val FEEDBACK_CONSTANT = 3

interface MultipleEventsCutter {
fun processEvent(event: () -> Unit)
Expand Down Expand Up @@ -58,7 +50,7 @@ fun Modifier.motionClickEvent(
val multipleEventsCutter = remember { MultipleEventsCutter.get() }
val interactionSource = remember { MutableInteractionSource() }
var selected by remember { mutableStateOf(false) }
val scale = animateFloatAsState(if (selected) 0.96f else 1f)
val scale = animateFloatAsState(if (selected) 0.96f else 1f, label = "")
this
.scale(scale.value)
.clickable(
Expand All @@ -81,54 +73,6 @@ fun Modifier.motionClickEvent(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun Modifier.combinedMotionClickEvent(onClick: () -> Unit, onLongClick: () -> Unit) = composed(
inspectorInfo = debugInspectorInfo {
name = "combinedMotionClickEvent"
}
) {
val multipleEventsCutter = remember { MultipleEventsCutter.get() }
val view = LocalView.current
val interactionSource = remember { MutableInteractionSource() }
var selected by remember { mutableStateOf(false) }
val scale = animateFloatAsState(if (selected) 0.96f else 1f)
this
.scale(scale.value)
.combinedClickable(
interactionSource = interactionSource,
indication = null,
onClick = {
multipleEventsCutter.processEvent { onClick() }
},
onLongClick = {
view.performHapticFeedback(FEEDBACK_CONSTANT, FLAG_IGNORE_GLOBAL_SETTINGS)
onLongClick()
}
)
.pointerInput(selected) {
awaitPointerEventScope {
selected = if (selected) {
waitForUpOrCancellation()
false
} else {
awaitFirstDown(false)
true
}
}
}
}

// user this event modifier only for icon button
fun Modifier.rippleClickEvent(
onClick: () -> Unit
) = composed {
this.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false, radius = 20.dp),
onClick = { onClick() }
)
}

fun Modifier.gesturesDisabled(disabled: Boolean = true) =
if (disabled) {
pointerInput(Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import com.canopas.yourspace.ui.theme.AppTheme

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun PagerIndicator(
count: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedTextFieldDefaults
Expand All @@ -47,7 +47,6 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
Expand Down Expand Up @@ -105,7 +104,7 @@ private fun PhoneSignInAppBar(onBackPressed: () -> Unit = {}) {
modifier = Modifier
) {
Icon(
Icons.Filled.ArrowBack,
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null,
tint = AppTheme.colorScheme.textSecondary
)
Expand All @@ -114,7 +113,7 @@ private fun PhoneSignInAppBar(onBackPressed: () -> Unit = {}) {
)
}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun PhoneLoginContent(
modifier: Modifier
Expand Down Expand Up @@ -238,7 +237,7 @@ private fun PhoneTextField() {
)
}

Divider(
HorizontalDivider(
Modifier
.padding(start = 20.dp)
.width(1.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
Expand Down Expand Up @@ -49,7 +49,7 @@ fun PlaceAddedPopup(
placeName: String,
onDismiss: (() -> Unit)
) {
AlertDialog(
BasicAlertDialog(
onDismissRequest = onDismiss,
properties = DialogProperties(
dismissOnBackPress = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private fun LocateOnMapContent(
) {
if (!state.selectedPlaceName.isNullOrEmpty()) {
PlaceNameContent(
state.updatedPlaceName ?: "",
state.updatedPlaceName,
cameraPositionState,
userLocation,
onPlaceNameChanged = viewModel::onPlaceNameChanged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fun MapScreen() {
enter = slideInVertically(tween(100)) { it },
exit = slideOutVertically(tween(100)) { it }
) {
PermissionFooter() {
PermissionFooter {
viewModel.navigateToPermissionScreen()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.canopas.yourspace.ui.flow.intro

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -31,7 +30,6 @@ import com.canopas.yourspace.ui.theme.AppTheme
import com.canopas.yourspace.ui.theme.AppTheme.colorScheme
import kotlinx.coroutines.launch

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun IntroScreen() {
val viewModel = hiltViewModel<IntroViewModel>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import com.canopas.yourspace.ui.flow.messages.chat.toFormattedTitle
import com.canopas.yourspace.ui.theme.AppTheme
import java.util.concurrent.TimeUnit

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ColumnScope.MessageList(
lazyState: LazyListState,
Expand Down Expand Up @@ -76,7 +75,7 @@ fun ColumnScope.MessageList(
contentPadding = PaddingValues(16.dp),
reverseLayout = true
) {
itemsIndexed(newMessagesToAppend, key = { index, item -> item.id }) { index, message ->
itemsIndexed(newMessagesToAppend, key = { _, item -> item.id }) { index, message ->
val by = members.firstOrNull { it.user.id == message.sender_id }

val myLatestMsg =
Expand All @@ -96,7 +95,7 @@ fun ColumnScope.MessageList(
messagesByDate.forEach { section ->
val messages = section.value

itemsIndexed(messages, key = { index, item -> item.id }) { index, message ->
itemsIndexed(messages, key = { _, item -> item.id }) { index, message ->
val by = members.firstOrNull { it.user.id == message.sender_id }

val seenBy =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.canopas.yourspace.ui.flow.messages.thread

import androidx.compose.animation.core.exponentialDecay
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -189,7 +190,7 @@ fun ThreadList(
) {
itemsIndexed(
threadInfos,
key = { index, item -> item.thread.id }
key = { _, item -> item.thread.id }
) { index, threadInfo ->
val threadMembers = members.filter { member ->
threadInfo.thread.member_ids.contains(member.user.id) && member.user.id != currentUser?.id
Expand Down Expand Up @@ -240,7 +241,9 @@ private fun SwipeToDelete(
var showDeleteConfirmation by remember {
mutableStateOf(false)
}

val decayAnimationSpec = exponentialDecay<Float>(
frictionMultiplier = 1f
)
val state = remember {
AnchoredDraggableState(
initialValue = DragAnchors.Center,
Expand All @@ -250,9 +253,11 @@ private fun SwipeToDelete(
},
positionalThreshold = { distance: Float -> distance * 0.5f },
velocityThreshold = { with(density) { 100.dp.toPx() } },
animationSpec = tween()
snapAnimationSpec = tween(),
decayAnimationSpec = decayAnimationSpec
)
}

Box(
modifier = Modifier
.fillMaxSize()
Expand Down Expand Up @@ -289,7 +294,11 @@ private fun SwipeToDelete(
y = 0
)
}
.anchoredDraggable(state, Orientation.Horizontal, reverseDirection = true),
.anchoredDraggable(
state = state,
orientation = Orientation.Horizontal,
reverseDirection = true
),
content = content
)
}
Expand Down
Loading

0 comments on commit 3eaaeeb

Please sign in to comment.