diff --git a/app/build.gradle b/app/build.gradle index cfe6ce9fd2..1eb82b0f11 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2237 - versionName "0.22.37" + versionCode 2238 + versionName "0.22.38" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/courses/TakeCourseFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/courses/TakeCourseFragment.kt index 18319fe46d..398a97d0dd 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/courses/TakeCourseFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/courses/TakeCourseFragment.kt @@ -141,11 +141,14 @@ class TakeCourseFragment : Fragment(), ViewPager.OnPageChangeListener, View.OnCl fragmentTakeCourseBinding.btnRemove.visibility = View.GONE } } + + val detachedUserModel = userModel?.let { mRealm.copyFromRealm(it) } + val detachedCurrentCourse = currentCourse?.let { mRealm.copyFromRealm(it) } withContext(Dispatchers.IO) { try { Realm.getDefaultInstance().use { backgroundRealm -> - createActivity(backgroundRealm, userModel?.let { backgroundRealm.copyFromRealm(it) }, currentCourse?.let { backgroundRealm.copyFromRealm(it) }) + createActivity(backgroundRealm, detachedUserModel, detachedCurrentCourse) } } catch (e: Exception) { e.printStackTrace()