Skip to content

Commit

Permalink
Merge pull request #20 from raccoongang/develop
Browse files Browse the repository at this point in the history
Develop to main. Release v1.1
  • Loading branch information
volodymyr-chekyrta authored Apr 19, 2023
2 parents 777d3de + e1e1eec commit 91939b3
Show file tree
Hide file tree
Showing 150 changed files with 3,590 additions and 1,414 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ Modern vision of the mobile application for the Open EdX platform from Raccoon G

6. Click the **Run** button.

## API plugin
This project uses custom APIs to improve performance and reduce the number of requests to the server.

You can find the plugin with the API and installation guide [here](https://github.com/raccoongang/mobile-api-extensions).

## Roadmap
Please feel welcome to develop any of the suggested features below and submit a pull request.

- Migrate to the new APIs
- ~~Migrate to the new APIs~~
- Recent searches
- Migrate to the Olive and JWT token
- UnAuth User mode
Expand Down
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ dependencies {

kapt "androidx.room:room-compiler:$room_version"

implementation "androidx.window:window:1.0.0"
implementation 'androidx.core:core-splashscreen:1.0.0'
testImplementation 'junit:junit:4.13.2'

Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/raccoongang/newedx/AppActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import androidx.window.layout.WindowMetricsCalculator
import com.raccoongang.auth.presentation.signin.SignInFragment
import com.raccoongang.core.data.storage.PreferencesManager
import com.raccoongang.core.extension.requestApplyInsetsWhenAttached
import com.raccoongang.core.presentation.global.AppData
import com.raccoongang.core.presentation.global.AppDataHolder
import com.raccoongang.core.presentation.global.InsetHolder
import com.raccoongang.core.presentation.global.WindowSizeHolder
import com.raccoongang.core.ui.WindowSize
Expand All @@ -24,7 +26,7 @@ import com.raccoongang.profile.presentation.ProfileRouter
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel

class AppActivity : AppCompatActivity(), InsetHolder, WindowSizeHolder {
class AppActivity : AppCompatActivity(), InsetHolder, WindowSizeHolder, AppDataHolder {

override val topInset: Int
get() = _insetTop
Expand All @@ -34,6 +36,9 @@ class AppActivity : AppCompatActivity(), InsetHolder, WindowSizeHolder {
override val windowSize: WindowSize
get() = _windowSize

override val appData: AppData
get() = AppData(BuildConfig.VERSION_NAME)

private lateinit var binding: ActivityAppBinding
private val preferencesManager by inject<PreferencesManager>()
private val viewModel by viewModel<AppViewModel>()
Expand Down
39 changes: 21 additions & 18 deletions app/src/main/java/com/raccoongang/newedx/AppRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import com.raccoongang.auth.presentation.signin.SignInFragment
import com.raccoongang.auth.presentation.signup.SignUpFragment
import com.raccoongang.core.FragmentViewType
import com.raccoongang.core.domain.model.Account
import com.raccoongang.core.domain.model.Certificate
import com.raccoongang.core.domain.model.CoursewareAccess
import com.raccoongang.core.presentation.course.CourseViewMode
import com.raccoongang.course.presentation.CourseRouter
import com.raccoongang.course.presentation.container.CourseContainerFragment
import com.raccoongang.course.presentation.container.NoAccessCourseContainerFragment
import com.raccoongang.course.presentation.detail.CourseDetailFragment
import com.raccoongang.course.presentation.detail.CourseDetailsFragment
import com.raccoongang.course.presentation.handouts.HandoutsType
import com.raccoongang.course.presentation.handouts.WebViewFragment
import com.raccoongang.discovery.presentation.search.CourseSearchFragment
Expand All @@ -38,7 +37,7 @@ import com.raccoongang.profile.presentation.delete.DeleteProfileFragment
import com.raccoongang.profile.presentation.edit.EditProfileFragment
import com.raccoongang.profile.presentation.settings.video.VideoQualityFragment
import com.raccoongang.profile.presentation.settings.video.VideoSettingsFragment
import java.util.Date
import java.util.*

class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, DiscussionRouter,
ProfileRouter {
Expand All @@ -62,7 +61,7 @@ class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, Di

//region DiscoveryRouter
override fun navigateToCourseDetail(fm: FragmentManager, courseId: String) {
replaceFragmentWithBackStack(fm, CourseDetailFragment.newInstance(courseId))
replaceFragmentWithBackStack(fm, CourseDetailsFragment.newInstance(courseId))
}

override fun navigateToCourseSearch(fm: FragmentManager) {
Expand All @@ -71,26 +70,26 @@ class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, Di
//endregion

//region DashboardRouter

override fun navigateToCourseOutline(
fm: FragmentManager,
courseId: String,
title: String,
image: String,
certificate: Certificate,
coursewareAccess: CoursewareAccess,
auditAccessExpires: Date?
courseTitle: String
) {
val destinationFragment = if (coursewareAccess.hasAccess) {
CourseContainerFragment.newInstance(courseId, title, image, certificate)
} else {
NoAccessCourseContainerFragment.newInstance(title, coursewareAccess, auditAccessExpires)
}

replaceFragmentWithBackStack(
fm,
destinationFragment
CourseContainerFragment.newInstance(courseId, courseTitle)
)
}

override fun navigateToNoAccess(
fm: FragmentManager,
title: String,
coursewareAccess: CoursewareAccess,
auditAccessExpires: Date?
) {
replaceFragment(fm, NoAccessCourseContainerFragment.newInstance(title,coursewareAccess, auditAccessExpires))
}
//endregion

//region CourseRouter
Expand Down Expand Up @@ -194,10 +193,14 @@ class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, Di
)
}

override fun navigateToDiscussionResponses(fm: FragmentManager, comment: DiscussionComment) {
override fun navigateToDiscussionResponses(
fm: FragmentManager,
comment: DiscussionComment,
isClosed: Boolean
) {
replaceFragmentWithBackStack(
fm,
DiscussionResponsesFragment.newInstance(comment)
DiscussionResponsesFragment.newInstance(comment, isClosed)
)
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/raccoongang/newedx/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.google.gson.GsonBuilder
import com.raccoongang.auth.presentation.AuthRouter
import com.raccoongang.core.data.storage.PreferencesManager
import com.raccoongang.core.module.DownloadWorkerController
import com.raccoongang.core.module.TranscriptManager
import com.raccoongang.core.module.download.FileDownloader
import com.raccoongang.core.system.AppCookieManager
import com.raccoongang.core.system.ResourceManager
Expand Down Expand Up @@ -99,4 +100,6 @@ val appModule = module {
single {
DownloadWorkerController(get(), get(), get())
}

single { TranscriptManager(get()) }
}
6 changes: 4 additions & 2 deletions app/src/main/java/com/raccoongang/newedx/di/ScreenModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.raccoongang.auth.presentation.signin.SignInViewModel
import com.raccoongang.auth.presentation.signup.SignUpViewModel
import com.raccoongang.core.Validator
import com.raccoongang.core.domain.model.Account
import com.raccoongang.core.presentation.dialog.SelectDialogViewModel
import com.raccoongang.course.data.repository.CourseRepository
import com.raccoongang.course.domain.interactor.CourseInteractor
import com.raccoongang.course.presentation.container.CourseContainerViewModel
Expand Down Expand Up @@ -81,12 +82,13 @@ val screenModule = module {
viewModel { (courseId: String) -> CourseOutlineViewModel(courseId, get(), get(), get(), get(), get(), get(), get()) }
viewModel { CourseUnitsViewModel(get(), get(),get(), get(), get()) }
viewModel { (courseId: String) -> CourseSectionViewModel(get(), get(), get(), get(), get(), get(), courseId) }
viewModel { (courseId: String) -> CourseUnitContainerViewModel(get(), courseId) }
viewModel { (courseId: String) -> CourseUnitContainerViewModel(get(), get(), courseId) }
viewModel { (courseId: String) -> CourseVideoViewModel(courseId, get(), get(), get(), get(), get(), get(), get()) }
viewModel { (courseId: String) -> VideoViewModel(courseId, get(), get(), get()) }
viewModel { (courseId: String) -> VideoUnitViewModel(courseId, get(), get(), get(), get()) }
viewModel { (courseId: String) -> VideoUnitViewModel(courseId, get(), get(), get(), get(), get()) }
viewModel { (courseId:String, handoutsType: String) -> HandoutsViewModel(courseId, handoutsType, get()) }
viewModel { CourseSearchViewModel(get(), get()) }
viewModel { SelectDialogViewModel(get()) }

single { DiscussionRepository(get()) }
factory { DiscussionInteractor(get()) }
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/raccoongang/newedx/room/AppDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.raccoongang.core.data.model.room.CourseEntity
import com.raccoongang.core.data.model.room.CourseStructureEntity
import com.raccoongang.core.data.model.room.discovery.EnrolledCourseEntity
import com.raccoongang.core.module.db.DownloadDao
import com.raccoongang.core.module.db.DownloadModelEntity
import com.raccoongang.course.data.model.BlockDbEntity
import com.raccoongang.course.data.storage.CourseConverter
import com.raccoongang.course.data.storage.CourseDao
import com.raccoongang.dashboard.data.DashboardDao
Expand All @@ -21,7 +21,7 @@ const val DATABASE_NAME = "newEdx_db"
entities = [
CourseEntity::class,
EnrolledCourseEntity::class,
BlockDbEntity::class,
CourseStructureEntity::class,
DownloadModelEntity::class
],
version = DATABASE_VERSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private fun RestorePasswordScreen(
.height(42.dp),
contentAlignment = Alignment.Center
) {
CircularProgressIndicator(color = MaterialTheme.colors.primary)
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
}
} else {
NewEdxButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
Expand Down Expand Up @@ -254,7 +255,7 @@ private fun AuthForm(
}

if (isLoading) {
CircularProgressIndicator(color = MaterialTheme.colors.primary)
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
} else {
NewEdxButton(
width = buttonWidth,
Expand All @@ -274,7 +275,11 @@ private fun PasswordTextField(
onValueChanged: (String) -> Unit,
onPressDone: () -> Unit,
) {
var passwordTextFieldValue by rememberSaveable { mutableStateOf("") }
var passwordTextFieldValue by rememberSaveable(stateSaver = TextFieldValue.Saver) {
mutableStateOf(
TextFieldValue("")
)
}
val focusManager = LocalFocusManager.current
Text(
modifier = Modifier.fillMaxWidth(),
Expand All @@ -288,7 +293,7 @@ private fun PasswordTextField(
value = passwordTextFieldValue,
onValueChange = {
passwordTextFieldValue = it
onValueChanged(it.trim())
onValueChanged(it.text.trim())
},
colors = TextFieldDefaults.outlinedTextFieldColors(
unfocusedBorderColor = MaterialTheme.appColors.textFieldBorder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ internal fun RegistrationScreen(
Modifier
.fillMaxSize(), contentAlignment = Alignment.Center
) {
CircularProgressIndicator()
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
}
}
is SignUpUIState.Fields -> {
Expand Down Expand Up @@ -380,7 +380,7 @@ internal fun RegistrationScreen(
.height(42.dp),
contentAlignment = Alignment.Center
) {
CircularProgressIndicator()
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
}
} else {
NewEdxButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.input.*
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.raccoongang.auth.R
Expand Down Expand Up @@ -194,8 +191,10 @@ fun LoginTextField(
imeAction: ImeAction = ImeAction.Next,
keyboardActions: (FocusManager) -> Unit = { it.moveFocus(FocusDirection.Down) }
) {
var loginTextFieldValue by rememberSaveable {
mutableStateOf("")
var loginTextFieldValue by rememberSaveable(stateSaver = TextFieldValue.Saver) {
mutableStateOf(
TextFieldValue("")
)
}
val focusManager = LocalFocusManager.current
Text(
Expand All @@ -209,7 +208,7 @@ fun LoginTextField(
value = loginTextFieldValue,
onValueChange = {
loginTextFieldValue = it
onValueChanged(it.trim())
onValueChanged(it.text.trim())
},
colors = TextFieldDefaults.outlinedTextFieldColors(
unfocusedBorderColor = MaterialTheme.appColors.textFieldBorder,
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ ext {

work_version = '2.8.0'

window_version = '1.0.0'

//testing
mockk_version = '1.13.3'
android_arch_version = '2.1.0'
Expand Down
4 changes: 4 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ android {
resValue "string", "privacy_policy_link", envUrls.privacyPolicy
resValue "string", "terms_of_service_link", envUrls.termsOfService
resValue "string", "contact_us_link", envUrls.contactUs
resValue "string", "feedback_email_address", envUrls.FEEDBACK_EMAIL_ADDRESS
}
develop {
def envMap = config.environments.find { it.key == "DEV" }
Expand All @@ -60,6 +61,7 @@ android {
resValue "string", "privacy_policy_link", envUrls.privacyPolicy
resValue "string", "terms_of_service_link", envUrls.termsOfService
resValue "string", "contact_us_link", envUrls.contactUs
resValue "string", "feedback_email_address", envUrls.FEEDBACK_EMAIL_ADDRESS
}
stage {
def envMap = config.environments.find { it.key == "STAGE" }
Expand All @@ -73,6 +75,7 @@ android {
resValue "string", "privacy_policy_link", envUrls.privacyPolicy
resValue "string", "terms_of_service_link", envUrls.termsOfService
resValue "string", "contact_us_link", envUrls.contactUs
resValue "string", "feedback_email_address", envUrls.FEEDBACK_EMAIL_ADDRESS
}
}

Expand Down Expand Up @@ -114,6 +117,7 @@ dependencies {
api "androidx.fragment:fragment-ktx:$fragment_version"
api "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
api "androidx.viewpager2:viewpager2:$viewpager2_version"
api "androidx.window:window:$window_version"

//Android Jetpack
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
Expand Down
Binary file added core/libs/subtitleConvert-1.0.2.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.raccoongang.core
import java.util.*

object AppDataConstants {
const val USER_MIN_YEAR = 18
const val USER_MIN_YEAR = 13
const val USER_MAX_YEAR = 77
const val DEFAULT_MIME_TYPE = "image/jpeg"
val defaultLocale = Locale("en")
Expand Down
Loading

0 comments on commit 91939b3

Please sign in to comment.