[App] Swap devMode with debugMode. Fix hiding sticks from old.

This commit is contained in:
Kuba Szczodrzyński 2020-10-16 17:18:19 +02:00
parent b31039ecd9
commit a0c302b663
13 changed files with 21 additions and 21 deletions

View File

@ -57,8 +57,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
val profileId
get() = profile.id
var devMode = false
var debugMode = false
var devMode = false
}
val notificationChannelsManager by lazy { NotificationChannelsManager(this) }
@ -107,7 +107,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
.readTimeout(30, TimeUnit.SECONDS)
builder.installHttpsSupport(this)
if (debugMode || BuildConfig.DEBUG) {
if (devMode || BuildConfig.DEBUG) {
HyperLog.initialize(this)
HyperLog.setLogLevel(Log.VERBOSE)
HyperLog.setLogFormat(DebugLogFormat(this))
@ -162,7 +162,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
Iconics.registerFont(SzkolnyFont)
App.db = AppDb(this)
Themes.themeInt = config.ui.theme
debugMode = config.debugMode
devMode = config.debugMode
MHttp.instance().customOkHttpClient(http)
if (!profileLoadById(config.lastProfileId)) {
@ -173,9 +173,9 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
setLanguage(it)
}
devMode = BuildConfig.DEBUG
debugMode = BuildConfig.DEBUG
if (BuildConfig.DEBUG)
debugMode = true
devMode = true
Signing.getCert(this)
@ -185,7 +185,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
if (config.devModePassword != null)
checkDevModePassword()
debugMode = devMode || config.debugMode
devMode = debugMode || config.debugMode
if (config.sync.enabled)
SyncWorker.scheduleNext(this@App, false)

View File

@ -232,7 +232,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
list += NavTarget(TARGET_MESSAGES_DETAILS, R.string.menu_message, MessageFragment::class).withPopTo(DRAWER_ITEM_MESSAGES)
list += NavTarget(TARGET_MESSAGES_COMPOSE, R.string.menu_message_compose, MessagesComposeFragment::class)
list += NavTarget(TARGET_WEB_PUSH, R.string.menu_web_push, WebPushFragment::class)
if (App.debugMode) {
if (App.devMode) {
list += NavTarget(DRAWER_ITEM_DEBUG, R.string.menu_debug, DebugFragment::class)
list += NavTarget(TARGET_LAB, R.string.menu_lab, LabFragment::class)
.withIcon(CommunityMaterial.Icon.cmd_flask_outline)
@ -566,7 +566,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
.withIcon(CommunityMaterial.Icon2.cmd_help_circle_outline)
.withOnClickListener(View.OnClickListener { loadTarget(TARGET_FEEDBACK) })
)
if (App.debugMode) {
if (App.devMode) {
bottomSheet += BottomSheetPrimaryItem(false)
.withTitle(R.string.menu_debug)
.withIcon(CommunityMaterial.Icon.cmd_android_studio)

View File

@ -89,7 +89,7 @@ class VulcanLoginWebMain(val data: DataVulcan, val onSuccess: () -> Unit) {
return true
}
val fsLogin = FSLogin(data.app.http, debug = App.debugMode)
val fsLogin = FSLogin(data.app.http, debug = App.devMode)
fsLogin.performLogin(
realm = realm,
username = data.webUsername ?: data.webEmail ?: return false,

View File

@ -136,7 +136,7 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
val db: AppDb by lazy { app.db }
init {
if (App.devMode) {
if (App.debugMode) {
fakeLogin = loginStore.hasLoginData("fakeLogin")
}
clear()

View File

@ -193,7 +193,7 @@ class EventDetailsDialog(
b.goToTimetableButton.attachToastHint(R.string.hint_go_to_timetable)
// RE-DOWNLOAD
b.downloadButton.isVisible = App.debugMode
b.downloadButton.isVisible = App.devMode
b.downloadButton.onClick {
EdziennikTask.eventGet(event.profileId, event).enqueue(activity)
}

View File

@ -57,7 +57,7 @@ class GradeDetailsDialog(
b.grade = grade
b.weightText = manager.getWeightString(app, grade)
b.commentVisible = false
b.devMode = App.debugMode
b.devMode = App.devMode
b.gradeName.setTextColor(if (ColorUtils.calculateLuminance(gradeColor) > 0.3) 0xaa000000.toInt() else 0xccffffff.toInt())
b.gradeName.background.setTintColor(gradeColor)

View File

@ -78,7 +78,7 @@ class LessonDetailsDialog(
)
}
if (App.debugMode)
if (App.devMode)
b.lessonId.visibility = View.VISIBLE
update()

View File

@ -55,7 +55,7 @@ class AttendanceDetailsDialog(
val attendanceColor = manager.getAttendanceColor(attendance)
b.attendance = attendance
b.devMode = App.debugMode
b.devMode = App.devMode
b.attendanceName.setTextColor(if (ColorUtils.calculateLuminance(attendanceColor) > 0.3) 0xaa000000.toInt() else 0xccffffff.toInt())
b.attendanceName.background.setTintColor(attendanceColor)

View File

@ -45,7 +45,7 @@ class ErrorDetailsDialog(
listOf(
it.getStringReason(activity).asBoldSpannable().asColoredSpannable(R.attr.colorOnBackground.resolveAttr(activity)),
activity.getString(R.string.error_unknown_format, it.errorCode, it.tag),
if (App.debugMode)
if (App.devMode)
it.throwable?.stackTraceString ?: it.throwable?.localizedMessage
else
it.throwable?.localizedMessage

View File

@ -127,7 +127,7 @@ class LoginFormFragment : Fragment(), CoroutineScope {
"loginMode" to loginMode
)
if (App.devMode && b.fakeLogin.isChecked) {
if (App.debugMode && b.fakeLogin.isChecked) {
payload.putBoolean("fakeLogin", true)
}

View File

@ -108,7 +108,7 @@ class MessageFragment : Fragment(), CoroutineScope {
.setNegativeButton(R.string.cancel, null)
.show()
}
b.downloadButton.isVisible = App.debugMode
b.downloadButton.isVisible = App.devMode
b.downloadButton.onClick {
EdziennikTask.messageGet(App.profileId, message).enqueue(activity)
}

View File

@ -581,7 +581,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
syncCardIntervalItem.setChecked(app.getConfig().getSync().getEnabled());
syncCardIntervalItem.setOnClickAction(() -> {
List<CharSequence> intervalNames = new ArrayList<>();
if (App.Companion.getDevMode() && false) {
if (App.Companion.getDebugMode() && false) {
intervalNames.add(ExtensionsKt.plural(activity, R.plurals.time_till_seconds, 30));
intervalNames.add(ExtensionsKt.plural(activity, R.plurals.time_till_minutes, 2));
}
@ -593,7 +593,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
intervalNames.add(ExtensionsKt.plural(activity, R.plurals.time_till_hours, 3));
intervalNames.add(ExtensionsKt.plural(activity, R.plurals.time_till_hours, 4));
List<Integer> intervals = new ArrayList<>();
if (App.Companion.getDevMode() && false) {
if (App.Companion.getDebugMode() && false) {
intervals.add(30);
intervals.add(2 * 60);
}
@ -1263,7 +1263,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
})
.build());*/
if (App.Companion.getDebugMode()) {
if (App.Companion.getDevMode()) {
items.add(new MaterialAboutActionItem.Builder()
.text(R.string.settings_about_crash_text)
.subText(R.string.settings_about_crash_subtext)

View File

@ -108,7 +108,7 @@ public class Utils {
public static List<String> debugLog = new ArrayList<>();
public static void d(String TAG, String message) {
if (App.Companion.getDebugMode()) {
if (App.Companion.getDevMode()) {
HyperLog.d("Szkolny/"+TAG, message);
//debugLog.add(TAG+": "+message);
}