Skip to content

Commit

Permalink
feat: remove school mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-95 authored Mar 29, 2022
1 parent 5f527eb commit 866ce18
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import it.ministerodellasalute.verificaC19.ui.main.MainActivity
import it.ministerodellasalute.verificaC19sdk.data.local.prefs.PrefKeys
import it.ministerodellasalute.verificaC19sdk.model.FirstViewModel
import it.ministerodellasalute.verificaC19sdk.model.ScanMode
import it.ministerodellasalute.verificaC19sdk.model.validation.RuleSet
import it.ministerodellasalute.verificaC19sdk.util.ConversionUtility
import it.ministerodellasalute.verificaC19sdk.util.FORMATTED_DATE_LAST_SYNC
import it.ministerodellasalute.verificaC19sdk.util.TimeUtility.parseTo
Expand Down Expand Up @@ -89,16 +88,16 @@ class FirstActivity : AppCompatActivity(), View.OnClickListener,
binding = ActivityFirstBinding.inflate(layoutInflater)
shared = this.getSharedPreferences(PrefKeys.USER_PREF, Context.MODE_PRIVATE)

disableWorkMode()
disableUnusedScanModes()
setContentView(binding.root)
setSecureWindowFlags()
setOnClickListeners()
setupUI()
observeLiveData()
}

private fun disableWorkMode() {
if (viewModel.getScanMode() == ScanMode.WORK) {
private fun disableUnusedScanModes() {
if (viewModel.getScanMode() == ScanMode.WORK || viewModel.getScanMode() == ScanMode.SCHOOL) {
viewModel.setScanModeFlag(false)
shared.edit().remove("scanMode").commit()
}
Expand Down Expand Up @@ -261,7 +260,6 @@ class FirstActivity : AppCompatActivity(), View.OnClickListener,
ScanMode.STRENGTHENED -> getString(R.string.scan_mode_2G_header)
ScanMode.BOOSTER -> getString(R.string.scan_mode_booster_header)
ScanMode.ENTRY_ITALY -> getString(R.string.scan_mode_entry_italy_header)
ScanMode.SCHOOL -> getString(R.string.scan_mode_school_header)
else -> getString(R.string.scan_mode_3G_header)
}
binding.scanModeButton.text = chosenScanMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
1 -> viewModel.setScanMode(ScanMode.STRENGTHENED)
2 -> viewModel.setScanMode(ScanMode.BOOSTER)
3 -> viewModel.setScanMode(ScanMode.ENTRY_ITALY)
4 -> viewModel.setScanMode(ScanMode.SCHOOL)
}
}

Expand All @@ -112,7 +111,6 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
ScanMode.STRENGTHENED -> 1
ScanMode.BOOSTER -> 2
ScanMode.ENTRY_ITALY -> 3
ScanMode.SCHOOL -> 4
else -> 0
}
return chosenScanMode
Expand All @@ -124,7 +122,6 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
ScanModeChoice(getString(R.string.scan_mode_2G_header), ruleSet.getReinforcedScanModeDescription()),
ScanModeChoice(getString(R.string.scan_mode_booster_header), ruleSet.getBoosterScanModeDescription()),
ScanModeChoice(getString(R.string.scan_mode_entry_italy_header), ruleSet.getItalyEntryScanModeDescription()),
ScanModeChoice(getString(R.string.scan_mode_school_header), ruleSet.getSchoolScanModeDescription())
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class CodeReaderFragment : Fragment(), NavController.OnDestinationChangedListene
ScanMode.STANDARD -> getString(R.string.scan_mode_3G_header)
ScanMode.STRENGTHENED -> getString(R.string.scan_mode_2G_header)
ScanMode.BOOSTER -> getString(R.string.scan_mode_booster_header)
ScanMode.SCHOOL -> getString(R.string.scan_mode_school_header)
ScanMode.ENTRY_ITALY -> getString(R.string.scan_mode_entry_italy_header)
ScanMode.DOUBLE_SCAN -> getString(R.string.scan_mode_booster_header)
else -> getString(R.string.scan_mode_3G_header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class VerificationFragment : Fragment(), View.OnClickListener {
ScanMode.STANDARD -> getString(R.string.scan_mode_3G_header)
ScanMode.STRENGTHENED -> getString(R.string.scan_mode_2G_header)
ScanMode.BOOSTER -> getString(R.string.scan_mode_booster_header)
ScanMode.SCHOOL -> getString(R.string.scan_mode_school_header)
ScanMode.ENTRY_ITALY -> getString(R.string.scan_mode_entry_italy_header)
ScanMode.DOUBLE_SCAN -> getString(R.string.scan_mode_booster_header)
else -> getString(R.string.scan_mode_3G_header)
Expand Down

0 comments on commit 866ce18

Please sign in to comment.