Skip to content

Commit 2dc3c03

Browse files
committed
Merge branch 'develop'
# Conflicts: # core/data/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/data/service/Api.kt
2 parents 7fe3913 + 6448030 commit 2dc3c03

File tree

45 files changed

+384
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+384
-362
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ plugins {
2121
android {
2222
namespace = "de.tum.informatics.www1.artemis.native_app.android"
2323

24-
val versionName = "2.0.2"
24+
val versionName = "2.1.0"
2525
val versionCode = 624
2626

2727
setProperty("archivesBaseName", "artemis-android-$versionName-$versionCode")

app/src/main/java/de/tum/informatics/www1/artemis/native_app/android/ui/MainActivity.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ import de.tum.informatics.www1.artemis.native_app.core.ui.WindowSizeClassProvide
4646
import de.tum.informatics.www1.artemis.native_app.core.ui.alert.TextAlertDialog
4747
import de.tum.informatics.www1.artemis.native_app.core.ui.markdown.link_resolving.LocalMarkdownLinkResolver
4848
import de.tum.informatics.www1.artemis.native_app.core.ui.remote_images.LocalArtemisImageProvider
49-
import de.tum.informatics.www1.artemis.native_app.feature.dashboard.ui.DashboardScreen
49+
import de.tum.informatics.www1.artemis.native_app.feature.dashboard.ui.DashboardScreenRoute
5050
import de.tum.informatics.www1.artemis.native_app.feature.force_update.repository.UpdateRepository
5151
import de.tum.informatics.www1.artemis.native_app.feature.force_update.ui.navigateToUpdateScreen
52-
import de.tum.informatics.www1.artemis.native_app.feature.login.LoginScreen
52+
import de.tum.informatics.www1.artemis.native_app.feature.login.LoginScreenRoute
5353
import de.tum.informatics.www1.artemis.native_app.feature.login.navigateToLogin
5454
import de.tum.informatics.www1.artemis.native_app.feature.metis.shared.visiblemetiscontextreporter.LocalVisibleMetisContextManager
5555
import de.tum.informatics.www1.artemis.native_app.feature.metis.shared.visiblemetiscontextreporter.VisibleMetisContext
@@ -91,8 +91,8 @@ class MainActivity : AppCompatActivity(),
9191
// When the user is logged in, immediately display the course overview.
9292
val startDestination = runBlocking {
9393
when (accountService.authenticationData.first()) {
94-
is AccountService.AuthenticationData.LoggedIn -> DashboardScreen
95-
AccountService.AuthenticationData.NotLoggedIn -> LoginScreen(null)
94+
is AccountService.AuthenticationData.LoggedIn -> DashboardScreenRoute
95+
AccountService.AuthenticationData.NotLoggedIn -> LoginScreenRoute(null)
9696
}
9797
}
9898

@@ -202,7 +202,7 @@ class MainActivity : AppCompatActivity(),
202202
.collect { (wasLoggedIn, isLoggedIn) ->
203203
if (wasLoggedIn == true && !isLoggedIn) {
204204
navController.navigateToLogin {
205-
popUpTo(DashboardScreen) {
205+
popUpTo(DashboardScreenRoute) {
206206
inclusive = true
207207
}
208208
}

app/src/main/java/de/tum/informatics/www1/artemis/native_app/android/ui/RootNavGraph.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ import de.tum.informatics.www1.artemis.native_app.feature.courseview.ui.course_o
1010
import de.tum.informatics.www1.artemis.native_app.feature.courseview.ui.course_overview.navigateToCourse
1111
import de.tum.informatics.www1.artemis.native_app.feature.dashboard.ui.dashboard
1212
import de.tum.informatics.www1.artemis.native_app.feature.dashboard.ui.navigateToDashboard
13+
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.ExerciseScreenRoute
1314
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.ExerciseViewDestination
1415
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.ExerciseViewMode
15-
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.ExerciseViewUi
1616
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.exercise
1717
import de.tum.informatics.www1.artemis.native_app.feature.exerciseview.navigateToExercise
1818
import de.tum.informatics.www1.artemis.native_app.feature.faq.ui.detail.faqDetail
1919
import de.tum.informatics.www1.artemis.native_app.feature.faq.ui.detail.navigateToFaqDetail
2020
import de.tum.informatics.www1.artemis.native_app.feature.force_update.ui.updateNavGraph
2121
import de.tum.informatics.www1.artemis.native_app.feature.lectureview.lecture
2222
import de.tum.informatics.www1.artemis.native_app.feature.lectureview.navigateToLecture
23-
import de.tum.informatics.www1.artemis.native_app.feature.login.LoginScreen
23+
import de.tum.informatics.www1.artemis.native_app.feature.login.LoginScreenRoute
2424
import de.tum.informatics.www1.artemis.native_app.feature.login.loginNavGraph
2525
import de.tum.informatics.www1.artemis.native_app.feature.quiz.QuizType
2626
import de.tum.informatics.www1.artemis.native_app.feature.quiz.participation.navigateToQuizParticipation
@@ -68,7 +68,7 @@ fun NavGraphBuilder.rootNavGraph(
6868
if (deepLink == null) {
6969
// Navigate to the course overview and remove the login screen from the navigation stack.
7070
navController.navigateToDashboard {
71-
popUpTo<LoginScreen> {
71+
popUpTo<LoginScreenRoute> {
7272
inclusive = true
7373
}
7474
}
@@ -77,7 +77,7 @@ fun NavGraphBuilder.rootNavGraph(
7777
navController.navigate(
7878
Uri.parse(deepLink),
7979
navOptions {
80-
popUpTo<LoginScreen>()
80+
popUpTo<LoginScreenRoute>()
8181
}
8282
)
8383
} catch (_: IllegalArgumentException) {
@@ -157,7 +157,7 @@ fun NavGraphBuilder.rootNavGraph(
157157
quizParticipation(
158158
onLeaveQuiz = {
159159
val previousBackStackEntry = navController.previousBackStackEntry
160-
if (previousBackStackEntry?.destination?.route == ExerciseViewUi::class.qualifiedName.orEmpty()) {
160+
if (previousBackStackEntry?.destination?.route == ExerciseScreenRoute::class.qualifiedName.orEmpty()) {
161161
previousBackStackEntry.savedStateHandle[ExerciseViewDestination.REQUIRE_RELOAD_KEY] =
162162
true
163163
}

core/core-test/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/test/test_setup/course_creation/CourseManagementRequests.kt

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ import de.tum.informatics.www1.artemis.native_app.core.model.exercise.QuizExerci
1212
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.Attachment
1313
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.Lecture
1414
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnit
15-
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitAttachment
1615
import de.tum.informatics.www1.artemis.native_app.core.test.test_setup.generateId
1716
import io.ktor.client.call.body
1817
import io.ktor.client.request.accept
1918
import io.ktor.client.request.forms.formData
2019
import io.ktor.client.request.forms.submitFormWithBinaryData
21-
import io.ktor.client.request.parameter
2220
import io.ktor.client.request.post
2321
import io.ktor.client.request.put
2422
import io.ktor.client.request.setBody
@@ -29,7 +27,6 @@ import io.ktor.http.HttpHeaders
2927
import io.ktor.http.appendPathSegments
3028
import io.ktor.http.contentType
3129
import kotlinx.coroutines.flow.first
32-
import kotlinx.serialization.Serializable
3330
import org.koin.core.component.KoinComponent
3431
import org.koin.core.component.get
3532

@@ -214,60 +211,6 @@ suspend fun KoinComponent.createLectureUnit(
214211
}.body()
215212
}
216213

217-
suspend fun KoinComponent.createAttachmentUnit(
218-
accessToken: String,
219-
lectureId: Long,
220-
lectureUnitName: String = "Attachment lecture unit ${generateId()}"
221-
): LectureUnitAttachment {
222-
return ktorProvider.ktorClient.submitFormWithBinaryData(
223-
formData {
224-
append(
225-
"file",
226-
"file content".encodeToByteArray(),
227-
Headers.build {
228-
append(HttpHeaders.ContentDisposition, "filename=file.txt")
229-
}
230-
)
231-
232-
append(
233-
"attachment",
234-
"""
235-
{"name":"$lectureUnitName","releaseDate":null,"version":1,"attachmentType":"FILE"}
236-
""".trimIndent(),
237-
Headers.build {
238-
set("Content-Type", "application/json")
239-
set("filename", "blob")
240-
}
241-
)
242-
243-
append(
244-
"attachmentUnit",
245-
"""
246-
{"competencies":[],"type":"attachment","description":"Description ${generateId()}"}
247-
""".trimIndent(),
248-
Headers.build {
249-
set("Content-Type", "application/json")
250-
set("filename", "blob")
251-
}
252-
)
253-
}
254-
) {
255-
url(serverConfigurationService.serverUrl.first())
256-
257-
url {
258-
appendPathSegments(*Api.Lecture.Lectures.path, lectureId.toString(), "attachment-units")
259-
}
260-
261-
parameter("keepFilename", true)
262-
263-
cookieAuth(accessToken)
264-
265-
contentType(ContentType.MultiPart.FormData)
266-
accept(ContentType.Application.Json)
267-
}
268-
.body()
269-
}
270-
271214
suspend fun KoinComponent.createAttachment(
272215
accessToken: String,
273216
lectureId: Long,
@@ -348,7 +291,4 @@ suspend fun KoinComponent.startQuizExerciseBatch(
348291

349292
contentType(ContentType.Application.Json)
350293
}.body()
351-
}
352-
353-
@Serializable
354-
private data class FileUploadResponse(val path: String)
294+
}

core/core-test/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/test/test_setup/course_creation/Templates.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,6 @@ fun createExerciseLectureUnit(
437437
}
438438
""".trimIndent()
439439

440-
fun createVideoLectureUnit(name: String) = """
441-
{
442-
"name": "$name",
443-
"competencies": [],
444-
"type": "video",
445-
"description": "${generateId()}",
446-
"source": "https://example.com/"
447-
}
448-
""".trimIndent()
449-
450440
fun createOnlineLectureUnit(name: String) = """
451441
{
452442
"name": "$name",

core/data/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/data/service/Api.kt

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ private const val api = "api"
99
* There were breaking changes introduced to the server API with Artemis 8.0.0 (see
1010
* https://github.com/ls1intum/Artemis/pull/10416). To run the app together with a version lower
1111
* than 8.0.0, remove the first level (module) of the paths (eg. "core", "communication", etc.).
12+
* (See the git history of this file for the previous version.)
1213
*/
1314
sealed class Api(
1415
vararg val path: String
@@ -23,13 +24,6 @@ sealed class Api(
2324
data object Courses : Api(*Core.path, "courses")
2425
data object Files : Api(*Core.path, "files")
2526
data object Passkey : Api(*Core.path, "passkey")
26-
27-
/**
28-
* This is a special case, because for the 8.0 API the image path for eg profile picture or
29-
* course icons do not contain the "api(/core)/files" part, while prior to 8.0 it did.
30-
*/
31-
// TODO: this can be removed once the app v2.0.0 is released
32-
data object UploadedFile : Api(*Files.path)
3327
}
3428

3529
data object Communication: Api(api, "communication") {
@@ -62,51 +56,4 @@ sealed class Api(
6256
data object Quiz: Api(api, "quiz") {
6357
data object QuizExercises : Api(*Quiz.path, "quiz-exercises")
6458
}
65-
66-
67-
// Prior to 8.0.0 API changes:
68-
// Uncomment this block and remove the block above to run the app with a Artemis version lower than 8.0.0
69-
70-
// data object Core: Api(api) {
71-
// data object Public : Api(*Core.path, "public")
72-
// data object Courses : Api(*Core.path, "courses")
73-
// data object Files : Api(*Core.path, "files")
74-
//
75-
// /**
76-
// * This is a special case, because for the 8.0 API the image path for eg profile picture or
77-
// * course icons do not contain the "api(/core)/files" part, while prior to 8.0 it did.
78-
// */
79-
// data object UploadedFile : Api("")
80-
// }
81-
//
82-
// data object Communication: Api(api) {
83-
// data object Courses : Api(*Communication.path, "courses")
84-
// data object NotificationSettings : Api(*Communication.path, "notification-settings")
85-
// data object PushNotification : Api(*Communication.path, "push_notification")
86-
// data object SavedPosts : Api(*Communication.path, "saved-posts")
87-
// }
88-
//
89-
// data object Lecture: Api(api) {
90-
// data object Lectures : Api(*Lecture.path, "lectures")
91-
// }
92-
//
93-
// data object Exercise: Api(api) {
94-
// data object Exercises : Api(*Exercise.path, "exercises")
95-
// }
96-
//
97-
// data object Text: Api(api) {
98-
// data object TextExercises : Api(*Text.path, "text-exercises")
99-
// }
100-
//
101-
// data object Modeling: Api(api) {
102-
// data object ModelingExercises : Api(*Modeling.path, "modeling-exercises")
103-
// }
104-
//
105-
// data object Programming: Api(api) {
106-
// data object ProgrammingExercises : Api(*Programming.path, "programming-exercises")
107-
// }
108-
//
109-
// data object Quiz: Api(api) {
110-
// data object QuizExercises : Api(*Quiz.path, "quiz-exercises")
111-
// }
11259
}

core/model/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/model/lecture/lecture_deserializer.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package de.tum.informatics.www1.artemis.native_app.core.model.lecture
22

33
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnit
4-
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitAttachment
4+
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitAttachmentVideo
55
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitExercise
66
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitOnline
77
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitText
88
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitUnknown
9-
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitVideo
109
import kotlinx.serialization.ExperimentalSerializationApi
1110
import kotlinx.serialization.modules.SerializersModule
1211
import kotlinx.serialization.modules.polymorphic
@@ -15,10 +14,9 @@ import kotlinx.serialization.modules.subclass
1514
@OptIn(ExperimentalSerializationApi::class)
1615
val lectureSerializerModule = SerializersModule {
1716
polymorphic(LectureUnit::class) {
18-
subclass(LectureUnitAttachment::class)
17+
subclass(LectureUnitAttachmentVideo::class)
1918
subclass(LectureUnitExercise::class)
2019
subclass(LectureUnitText::class)
21-
subclass(LectureUnitVideo::class)
2220
subclass(LectureUnitOnline::class)
2321

2422
defaultDeserializer { LectureUnitUnknown.serializer() }

core/model/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/model/lecture/lecture_units/LectureUnitAttachment.kt renamed to core/model/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/model/lecture/lecture_units/LectureUnitAttachmentVideo.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ import kotlinx.serialization.Serializable
77

88
@Serializable
99
@SerialName("attachment")
10-
data class LectureUnitAttachment(
10+
data class LectureUnitAttachmentVideo(
1111
override val id: Long = 0,
1212
override val name: String? = null,
1313
override val releaseDate: Instant? = null,
1414
override val visibleToStudents: Boolean = true,
1515
override val completed: Boolean = false,
1616
val description: String? = null,
17-
val attachment: Attachment? = null
17+
val attachment: Attachment? = null,
18+
val videoSource: String? = null,
1819
) : LectureUnit() {
1920
override fun withCompleted(newCompleted: Boolean): LectureUnit = copy(completed = newCompleted)
21+
22+
val hasVideo = videoSource != null
23+
val hasAttachment = attachment != null
24+
val onlyHasAttachment = hasAttachment && !hasVideo
2025
}

core/model/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/model/lecture/lecture_units/LectureUnitVideo.kt

Lines changed: 0 additions & 19 deletions
This file was deleted.

core/ui/src/debug/kotlin/de/tum/informatics/www1/artemis/native_app/core/ui/ScreenshotData.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ import de.tum.informatics.www1.artemis.native_app.core.model.exercise.participat
1717
import de.tum.informatics.www1.artemis.native_app.core.model.exercise.submission.Result
1818
import de.tum.informatics.www1.artemis.native_app.core.model.exercise.submission.UnknownSubmission
1919
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.Lecture
20+
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitAttachmentVideo
2021
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitText
21-
import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnitVideo
2222
import de.tum.informatics.www1.artemis.native_app.core.ui.ScreenshotData.Images.IMAGE_ASTRONAUT
2323
import de.tum.informatics.www1.artemis.native_app.core.ui.ScreenshotData.Images.IMAGE_MARS
2424
import de.tum.informatics.www1.artemis.native_app.core.ui.ScreenshotData.Images.IMAGE_SATURN_5
2525
import de.tum.informatics.www1.artemis.native_app.core.ui.common.course.CourseSearchConfiguration
26-
import de.tum.informatics.www1.artemis.native_app.core.ui.exercise.BoundExerciseActions
2726
import kotlinx.datetime.Clock
2827
import kotlin.time.Duration.Companion.days
2928

@@ -128,7 +127,7 @@ object ScreenshotData {
128127
name = "Introduction to Fuel Types",
129128
completed = true,
130129
),
131-
LectureUnitVideo(
130+
LectureUnitAttachmentVideo(
132131
id = 1L,
133132
name = "Rocket Fuel Types",
134133
completed = true,
@@ -158,16 +157,6 @@ object ScreenshotData {
158157
}
159158
}
160159
}
161-
162-
val emptyBoundExerciseActions = BoundExerciseActions(
163-
onClickStartTextExercise = {},
164-
onClickPracticeQuiz = {},
165-
onClickOpenQuiz = {},
166-
onClickStartQuiz = {},
167-
onClickOpenTextExercise = { _, _ -> },
168-
onClickViewResult = {},
169-
onClickViewQuizResults = {}
170-
)
171160

172161
fun searchConfiguration(
173162
hint: String,

0 commit comments

Comments
 (0)