Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

fix: Minor bugs in default config due to missing feature flags #1842

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions OpenEdXMobile/src/main/java/org/edx/mobile/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -159,8 +158,7 @@ public static class ProgramConfig {
private String detailUrlTemplate;

public boolean isEnabled() {
// TODO Disable program feature for kitkat users, See Jira story LEARNER-6625 for more details.
return enabled && Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT;
return enabled;
}

public String getUrl() {
Expand Down Expand Up @@ -277,22 +275,6 @@ public String getSegmentWriteKey() {
}
}

public static class DomainWhiteListConfig {
@SerializedName("ENABLED")
private boolean mEnabled;

@SerializedName("DOMAINS")
private List<String> mDomains;

public boolean isEnabled() {
return mEnabled;
}

public List<String> getDomains() {
return mDomains != null ? mDomains : new ArrayList<String>();
}
}

public static class FirebaseConfig {
@SerializedName("ENABLED")
private boolean mEnabled;
Expand Down Expand Up @@ -363,6 +345,9 @@ public static class ApiUrlVersionConfig {
@SerializedName("ENROLLMENTS")
private String enrollmentsApiVersion;

public ApiUrlVersionConfig() {
HamzaIsrar12 marked this conversation as resolved.
Show resolved Hide resolved
}

public ApiUrlVersionConfig(String blocksApiVersion, String registrationApiVersion, String enrollmentsApiVersion) {
this.blocksApiVersion = blocksApiVersion;
this.registrationApiVersion = registrationApiVersion;
Expand Down Expand Up @@ -713,9 +698,7 @@ private <T> T getObjectOrNewInstance(@NonNull String key, @NonNull Class<T> cls)
} else {
try {
return cls.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ class CourseTabsDashboardFragment : BaseFragment() {
var actionListener: View.OnClickListener? = null
var actionResId = 0

if (binding.pager.currentItem != 3) {
if (environment.config.isCourseDatesEnabled && binding.pager.currentItem != 3) {
actionListener = View.OnClickListener { binding.pager.currentItem = 3 }
actionResId = R.string.assessment_view_all_dates
}
Expand Down Expand Up @@ -799,7 +799,9 @@ class CourseTabsDashboardFragment : BaseFragment() {
items.add(createDatesItem())
}
items.add(createHandoutsItem())
items.add(createAnnouncementsItem())
if (environment.config.isAnnouncementEnabled) {
items.add(createAnnouncementsItem())
}

return items
}
Expand Down
44 changes: 22 additions & 22 deletions OpenEdXMobile/src/main/java/org/edx/mobile/view/LearnFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class LearnFragment : OfflineSupportBaseFragment() {
private var items: ArrayList<LearnScreenItem> = arrayListOf()
private var selectedItemPosition = -1
private var lastPopupWindowDismissTime = 0L
private var isTitleCollapsed = false

override fun onCreateView(
inflater: LayoutInflater,
Expand Down Expand Up @@ -70,29 +69,30 @@ class LearnFragment : OfflineSupportBaseFragment() {
binding.ivSelectorIcon.setImageDrawable(R.drawable.ic_drop_up)
}
}

binding.appbar.setTitleStateListener(
binding.collapsingToolbar,
object : CollapsingToolbarStatListener {
override fun onExpanded() {
ViewAnimationUtil.animateTitleSize(
binding.tvSelectedItem,
resources.getDimension(R.dimen.edx_x_large)
)
ImageUtils.animateIconSize(binding.ivSelectorIcon, 1f)
}

override fun onCollapsed() {
ViewAnimationUtil.animateTitleSize(
binding.tvSelectedItem,
resources.getDimension(R.dimen.edx_large)
)
ImageUtils.animateIconSize(binding.ivSelectorIcon, 0.75f)
}
})
} else {
binding.llLearnSelection.setVisibility(false)
binding.ivSelectorIcon.setVisibility(false)
}

binding.appbar.setTitleStateListener(
binding.collapsingToolbar,
object : CollapsingToolbarStatListener {
override fun onExpanded() {
ViewAnimationUtil.animateTitleSize(
binding.tvSelectedItem,
resources.getDimension(R.dimen.edx_x_large)
)
ImageUtils.animateIconSize(binding.ivSelectorIcon, 1f)
}

override fun onCollapsed() {
ViewAnimationUtil.animateTitleSize(
binding.tvSelectedItem,
resources.getDimension(R.dimen.edx_large)
)
ImageUtils.animateIconSize(binding.ivSelectorIcon, 0.75f)
}
})

selectedItemPosition = arguments?.getInt(SELECTED_POSITION) ?: items.first().ordinal
// no need to track event cuz handle event through event bus on tab selection.
updateScreen(items[selectedItemPosition], false)
Expand Down
Loading