Skip to content

Commit

Permalink
Merge branch 'dev' into 14-mockup-ui-overhaul-for-setup-view
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/at/bitfire/icsdroid/ui/views/EnterUrlComposable.kt
  • Loading branch information
ArnyminerZ committed Apr 10, 2024
2 parents 6dc2926 + 60ab4a0 commit 785ca49
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
23 changes: 23 additions & 0 deletions app/src/main/java/at/bitfire/icsdroid/ProcessEventsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import at.bitfire.icsdroid.ui.views.EditCalendarActivity
import java.io.InputStream
import java.io.InputStreamReader
import java.time.Duration
import at.bitfire.icsdroid.ui.views.CalendarListActivity
import net.fortuna.ical4j.model.Property
import net.fortuna.ical4j.model.PropertyList
import net.fortuna.ical4j.model.component.VAlarm
Expand Down Expand Up @@ -60,6 +61,7 @@ class ProcessEventsTask(
} catch (e: Exception) {
Log.e(Constants.TAG, "Couldn't sync calendar", e)
subscriptionsDao.updateStatusError(subscription.id, e.localizedMessage ?: e.toString())
notifyError(e)
}
Log.i(Constants.TAG, "iCalendar file completely processed")
}
Expand Down Expand Up @@ -262,4 +264,25 @@ class ProcessEventsTask(
Log.i(Constants.TAG, "$deleted events deleted")
}

private fun notifyError(exception: Exception) {
val notificationManager = NotificationUtils.createChannels(context)
val notification = NotificationCompat.Builder(context, NotificationUtils.CHANNEL_SYNC)
.setSmallIcon(R.drawable.ic_sync_problem_white)
.setCategory(NotificationCompat.CATEGORY_ERROR)
.setGroup(context.getString(R.string.app_name))
.setContentTitle(context.getString(R.string.sync_error_title))
.setContentText(exception.localizedMessage ?: exception.message)
.setAutoCancel(true)
.setWhen(System.currentTimeMillis())
.setOnlyAlertOnce(true)
.setContentIntent(
PendingIntent.getActivity(
context,
0,
Intent(context, CalendarListActivity::class.java),
PendingIntent.FLAG_IMMUTABLE
)
)
notificationManager.notify(subscription.id.toInt(), notification.build())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.os.PowerManager
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
Expand All @@ -34,6 +35,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
Expand Down Expand Up @@ -208,6 +210,15 @@ class CalendarListActivity: AppCompatActivity() {
containerColor = MaterialTheme.colorScheme.primary,
contentColor = MaterialTheme.colorScheme.onPrimary
)

// progress indicator
AnimatedVisibility(syncing) {
LinearProgressIndicator(
color = MaterialTheme.colorScheme.secondary,
modifier = Modifier.fillMaxWidth()
)
}

LazyColumn(Modifier.fillMaxSize()) {
// Calendar permission card
if (askForCalendarPermission) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.material.icons.filled.FolderOpen
import androidx.compose.material.icons.filled.Link
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
Expand Down Expand Up @@ -103,6 +104,9 @@ fun EnterUrlComposable(
Scaffold(
snackbarHost = { SnackbarHost(snackbarHostState) }
) { paddingValues ->
AnimatedVisibility(isVerifyingUrl) {
LinearProgressIndicator(Modifier.fillMaxWidth())
}
Column(
modifier = Modifier
.fillMaxSize()
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
aboutLibs = "11.1.1"
aboutLibs = "11.1.2"
agp = "8.3.1"
androidx-activityCompose = "1.8.2"
androidx-appCompat = "1.6.1"
Expand All @@ -18,16 +18,16 @@ commons-lang3 = "3.8.1"
# Keep in sync with Kotlin version: https://developer.android.com/jetpack/androidx/releases/compose-kotlin
compose-compiler = "1.5.11"
compose-dialogs = "1.3.0"
compose-material = "1.6.4"
compose-material = "1.6.5"
compose-material3 = "1.2.1"
compose-runtime = "1.6.4"
compose-ui = "1.6.4"
compose-runtime = "1.6.5"
compose-ui = "1.6.5"
desugaring = "2.0.4"
joda-time = "2.12.7"
junit = "4.13.2"
kotlin = "1.9.23"
kotlinx-coroutines = "1.8.0"
ksp = "1.9.23-1.0.19"
ksp = "1.9.23-1.0.20"
okhttp = "4.12.0"
room = "2.6.1"

Expand Down

0 comments on commit 785ca49

Please sign in to comment.