Skip to content

Commit

Permalink
feat: remove work mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-95 authored Mar 28, 2022
1 parent d82d99c commit 5f527eb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,22 @@ class FirstActivity : AppCompatActivity(), View.OnClickListener,
super.onCreate(savedInstanceState)
binding = ActivityFirstBinding.inflate(layoutInflater)
shared = this.getSharedPreferences(PrefKeys.USER_PREF, Context.MODE_PRIVATE)

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

private fun disableWorkMode() {
if (viewModel.getScanMode() == ScanMode.WORK) {
viewModel.setScanModeFlag(false)
shared.edit().remove("scanMode").commit()
}
}

private fun observeLiveData() {
observeSyncStatus()
observeRetryCount()
Expand Down Expand Up @@ -251,7 +260,6 @@ class FirstActivity : AppCompatActivity(), 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.WORK -> getString(R.string.scan_mode_work_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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
0 -> viewModel.setScanMode(ScanMode.STANDARD)
1 -> viewModel.setScanMode(ScanMode.STRENGTHENED)
2 -> viewModel.setScanMode(ScanMode.BOOSTER)
3 -> viewModel.setScanMode(ScanMode.WORK)
4 -> viewModel.setScanMode(ScanMode.ENTRY_ITALY)
5 -> viewModel.setScanMode(ScanMode.SCHOOL)
3 -> viewModel.setScanMode(ScanMode.ENTRY_ITALY)
4 -> viewModel.setScanMode(ScanMode.SCHOOL)
}
}

Expand All @@ -112,9 +111,8 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
ScanMode.STANDARD -> 0
ScanMode.STRENGTHENED -> 1
ScanMode.BOOSTER -> 2
ScanMode.WORK -> 3
ScanMode.ENTRY_ITALY -> 4
ScanMode.SCHOOL -> 5
ScanMode.ENTRY_ITALY -> 3
ScanMode.SCHOOL -> 4
else -> 0
}
return chosenScanMode
Expand All @@ -125,7 +123,6 @@ class ScanModeDialogFragment(private val ruleSet: RuleSet) : DialogFragment(), S
ScanModeChoice(getString(R.string.scan_mode_3G_header), ruleSet.getBaseScanModeDescription() ?: ""),
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_work_header), ruleSet.getWorkScanModeDescription()),
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 @@ -112,9 +112,9 @@ class CodeReaderFragment : Fragment(), NavController.OnDestinationChangedListene
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.WORK -> getString(R.string.scan_mode_work_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)
}
binding.scanModeText.text = chosenScanMode
binding.closeButton.setOnClickListener(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ class VerificationFragment : Fragment(), View.OnClickListener {
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.WORK -> getString(R.string.scan_mode_work_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)
}
binding.scanModeText.text = chosenScanMode
}
Expand Down

1 comment on commit 5f527eb

@zubeer95
Copy link

@zubeer95 zubeer95 commented on 5f527eb Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buonasera,
non converrebbe impostare automaticamente la modalità "BASE" anziché lasciare far scegliere di nuovo all'utente?
Semplificherebbe quelle situazioni nelle quali il dispositivo è in modalità totem, non è presidiato da un operatore con aggiornamenti e gestione remoti.

private fun disableWorkMode() {
        if (viewModel.getScanMode() == ScanMode.WORK) {
            viewModel.setScanMode(ScanMode.STANDARD)
           }
    }

A livello burocratico mi sembra regolare questa procedura dato che WORK coinciderebbe a STANDARD dal 1 aprile.

Please sign in to comment.