Skip to content

Commit

Permalink
pre-release-v4.1.1.7 (#56 )
Browse files Browse the repository at this point in the history
pre-release-v4.1.1.7
  • Loading branch information
aiyu-ayaan authored Nov 18, 2022
2 parents cd53df6 + bf93d93 commit 47e8976
Show file tree
Hide file tree
Showing 20 changed files with 508 additions and 281 deletions.
13 changes: 11 additions & 2 deletions bitapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId "com.atech.bit"
minSdk 24
targetSdk 33
versionCode 32
versionName "4.1.1 Patch 6"
versionCode 33
versionName "4.1.1 Patch 7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -39,12 +39,21 @@ android {
versionNameSuffix "-beta"
}
}
signingConfigs {
release {
storeFile file('keystore/keystore.jks')
storePassword System.getenv("SIGNING_STORE_PASSWORD")
keyAlias System.getenv("SIGNING_KEY_ALIAS")
keyPassword System.getenv("SIGNING_KEY_PASSWORD")
}
}

buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.navigation.fragment.findNavController
import com.atech.bit.R
import com.atech.bit.databinding.FragmentCourseBinding
import com.atech.core.utils.Course
import com.atech.core.utils.KEY_TOGGLE_SYLLABUS_SOURCE
import com.atech.core.utils.KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY
import com.atech.core.utils.RemoteConfigUtil
import com.atech.core.utils.TAG
import com.google.android.material.transition.MaterialElevationScale
Expand All @@ -32,8 +32,6 @@ class CourseFragment : Fragment(R.layout.fragment_course) {
@Inject
lateinit var db: FirebaseFirestore

@Inject
lateinit var remoteConfigUtil: RemoteConfigUtil

@Inject
lateinit var pref: SharedPreferences
Expand Down Expand Up @@ -69,21 +67,8 @@ class CourseFragment : Fragment(R.layout.fragment_course) {
navigateToSemChoose(Course.Bba.name, imageButtonBba)
}
}
setDefaultValueForSwitch()
}

private fun setDefaultValueForSwitch() {
remoteConfigUtil.fetchData({
Log.e(TAG, "setDefaultValueForSwitch: $it")
}) {
val isSwitchOn = remoteConfigUtil.getBoolean(KEY_TOGGLE_SYLLABUS_SOURCE)
pref.edit()
.putBoolean(KEY_TOGGLE_SYLLABUS_SOURCE, isSwitchOn)
.apply()
}
}


override fun onPause() {
super.onPause()
myScrollViewerInstanceState = binding.nestedViewSyllabus.onSaveInstanceState()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.atech.bit.ui.fragments.course.sem_choose

import android.util.Log
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.asLiveData
import com.atech.bit.utils.SyllabusEnableModel
import com.atech.core.api.ApiRepository
import com.atech.core.data.room.syllabus.SyllabusDao
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down Expand Up @@ -45,6 +45,9 @@ class ChooseSemViewModel @Inject constructor(
state["chooseSemNestedViewPosition"] = value
}

var syllabusEnableModel: SyllabusEnableModel =
SyllabusEnableModel()


fun getOnlineSyllabus() = sem.flatMapLatest { semester ->
apiRepository.getSyllabus(semester.lowercase())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.Log
import android.view.View
import android.viewbinding.library.fragment.viewBinding
import android.widget.Toast
import androidx.annotation.Keep
import androidx.core.content.ContextCompat
import androidx.core.view.doOnPreDraw
import androidx.core.view.isVisible
Expand All @@ -25,14 +26,16 @@ import com.atech.bit.ui.activity.main_activity.viewmodels.PreferenceManagerViewM
import com.atech.bit.ui.custom_views.DividerItemDecorationNoLast
import com.atech.bit.ui.fragments.course.sem_choose.adapters.SubjectAdapter
import com.atech.bit.ui.fragments.course.sem_choose.adapters.SyllabusOnlineAdapter
import com.atech.bit.utils.SyllabusEnableModel
import com.atech.bit.utils.addMenuHost
import com.atech.bit.utils.compareToCourseSem
import com.atech.bit.utils.loadAdds
import com.atech.bit.utils.openBugLink
import com.atech.core.api.syllabus.Semester
import com.atech.core.api.syllabus.SubjectModel
import com.atech.core.data.room.syllabus.SyllabusModel
import com.atech.core.utils.DataState
import com.atech.core.utils.KEY_TOGGLE_SYLLABUS_SOURCE
import com.atech.core.utils.KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY
import com.atech.core.utils.RemoteConfigUtil
import com.atech.core.utils.openCustomChromeTab
import com.atech.core.utils.showSnackBar
Expand All @@ -41,6 +44,7 @@ import com.google.android.material.transition.MaterialContainerTransform
import com.google.android.material.transition.MaterialElevationScale
import com.google.android.material.transition.MaterialSharedAxis
import com.google.firebase.firestore.FirebaseFirestore
import com.google.gson.Gson
import dagger.hilt.android.AndroidEntryPoint
import retrofit2.HttpException
import javax.inject.Inject
Expand Down Expand Up @@ -115,9 +119,9 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
buttonClick()
setUpMenu()
switchClick()
setSource()
getOnlineSyllabus()
setAds()
setSyllabusEnableModel()

}

Expand Down Expand Up @@ -212,10 +216,28 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
prefManagerViewModel.preferencesFlow.observe(viewLifecycleOwner) {
viewModel.sem.value = "${viewModel.request}${it.semSyllabus}"
courseSem = "${viewModel.request}${it.semSyllabus}".lowercase()
setSource(courseSem)
buttonColorChange(it.semSyllabus, binding)
}
}

private fun setSyllabusEnableModel() {
val source = pref.getString(
KEY_TOGGLE_SYLLABUS_SOURCE_ARRAY,
resources.getString(R.string.def_value_online_syllabus)
)
viewModel.syllabusEnableModel = Gson().fromJson(source, SyllabusEnableModel::class.java)
}

private fun setSource(courseSem: String) {
val source = viewModel.syllabusEnableModel.compareToCourseSem(courseSem)
binding.switchOldNew.isChecked = source
setText(source)
layoutChanges(source)
}



private fun getOnlineSyllabus() {
viewModel.getOnlineSyllabus().observe(viewLifecycleOwner) { dataState ->
when (dataState) {
Expand Down Expand Up @@ -271,16 +293,9 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
onlinePEAdapter.submitList(data.subjects.pe)
}

private fun setSource() {
val source = pref.getBoolean(KEY_TOGGLE_SYLLABUS_SOURCE, false)
binding.switchOldNew.isChecked = source
setText(source)
layoutChanges(source)
}

private fun switchClick() = binding.switchOldNew.apply {
setOnCheckedChangeListener { _, isChecked ->
saveSource(isChecked)
setText(isChecked)
layoutChanges(isChecked)
}
Expand All @@ -291,11 +306,6 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
else resources.getString(R.string.switch_to_new)
}

private fun saveSource(isEnable: Boolean) {
pref.edit().putBoolean(
KEY_TOGGLE_SYLLABUS_SOURCE, isEnable
).apply()
}

private fun layoutChanges(isEnable: Boolean) = binding.apply {
semChoseOnlineExt.root.isVisible = isEnable
Expand Down Expand Up @@ -392,4 +402,6 @@ class SemChooseFragment : Fragment(R.layout.fragment_sem_choose) {
else -> Log.d("Error", "buttonColorChange: Error")
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.atech.core.api.syllabus.DiffUtilTheorySyllabusCallback
import com.atech.core.api.syllabus.SubjectModel

class SyllabusOnlineAdapter(
private val isFromHome: Boolean = false,
private val onClick: (SubjectModel) -> Unit
) : ListAdapter<SubjectModel, SyllabusOnlineViewHolder<SubjectModel>>(DiffUtilTheorySyllabusCallback()) {

Expand Down Expand Up @@ -43,6 +44,11 @@ class SyllabusOnlineAdapter(
R.string.theory_code, type, theory.code
)
creditTextView.text = theory.credit.toString()
if (isFromHome) {
subjectTextView.textSize = 16f
subjectCodeTextView.textSize = 12f
creditTextView.textSize = 12f
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.lifecycle.asLiveData
import androidx.navigation.fragment.navArgs
import com.atech.bit.R
import com.atech.bit.databinding.FragmentViewSyllabusBinding
import com.atech.bit.utils.loadAdds
import com.atech.core.api.ApiRepository
import com.atech.core.utils.DataState
import com.atech.core.utils.getColorForText
Expand Down Expand Up @@ -98,6 +99,7 @@ class ViewSyllabusFragment : Fragment(R.layout.fragment_view_syllabus) {
}

private fun FragmentViewSyllabusBinding.setMarkDownFile(dataState: DataState.Success<String>) {
requireContext().loadAdds(adViewSyllabusLabContent)
markdown.apply {
setViewsVisible(true)
setBackgroundColor(
Expand Down
Loading

0 comments on commit 47e8976

Please sign in to comment.