Skip to content

Commit

Permalink
* fix for displaying the show code on entry when using manual mqtt co…
Browse files Browse the repository at this point in the history
…mponent
  • Loading branch information
thanksmister committed May 27, 2021
1 parent 94cbb92 commit 9a3556a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply plugin: 'com.google.firebase.crashlytics'
def versionMajor = 1
def versionMinor = 1
def versionPatch = 1
def versionBuild = 4 // bump for dog food builds, public betas, etc.
def versionBuild = 5 // bump for dog food builds, public betas, etc.

def ALARM_CODE() {
Properties properties = new Properties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_ARM_
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_BRIGHTNESS
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_CURRENT_URL
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_DISARM
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_PENDING
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_PRESENCE
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_SCREEN_ON
import com.thanksmister.iot.mqtt.alarmpanel.utils.MqttUtils.Companion.STATE_TRIGGERED
Expand Down Expand Up @@ -435,13 +436,14 @@ class AlarmPanelService : LifecycleService(), MQTTModule.MQTTListener {
COMMAND_ARM_HOME -> {
insertMessage(id, topic, payload, TYPE_ALARM, delay)
}
MqttUtils.STATE_TRIGGERED -> {
STATE_TRIGGERED -> {
if (configuration.alarmMode == MqttUtils.STATE_TRIGGERED && configuration.hasSystemAlerts()) {
notifications.createAlarmNotification(getString(R.string.text_notification_trigger_title), getString(R.string.text_notification_trigger_description))
}
insertMessage(id, topic, payload, TYPE_ALARM, delay)

}
MqttUtils.STATE_PENDING -> {
STATE_PENDING -> {
if (configuration.isAlarmArmedMode() && configuration.hasSystemAlerts()) {
notifications.createAlarmNotification(getString(R.string.text_notification_entry_title), getString(R.string.text_notification_entry_description))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ class MainActivity : BaseActivity(),
}
MqttUtils.STATE_PENDING -> {
val pendingTime = getPendingTime(payload, delay)
showCodeDialog(CodeTypes.DISARM, pendingTime)
val isArming = configuration.isAlarmArming()
val alarmMode = configuration.alarmMode
if(configuration.isAlarmArming().not()) {
showCodeDialog(CodeTypes.DISARM, pendingTime)
}
}
MqttUtils.STATE_ARMING -> {
dismissBottomSheets()
Expand Down Expand Up @@ -589,12 +593,10 @@ class MainActivity : BaseActivity(),
override fun showAlarmTriggered() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) // keep the screen awake
triggeredView.visibility = View.VISIBLE
//pagerView.visibility = View.GONE
}

override fun hideTriggeredView() {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) // let the screen sleep
//pagerView.visibility = View.VISIBLE
triggeredView.visibility = View.GONE
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class ControlsFragment : BaseFragment() {
STATE_PENDING -> {
if (configuration.isAlarmArmedMode()) {
setEntryMode(payload)
} else if (configuration.isAlarmArming()) {
} else if (configuration.isAlarmArming().not()) {
setArmingMode(payload, delay)
}
}
Expand Down

0 comments on commit 9a3556a

Please sign in to comment.