We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76ca330 commit dd7e6ebCopy full SHA for dd7e6eb
app/logics/phone/phone.go
@@ -12,6 +12,8 @@ import (
12
"totoval/app/logics/phone/sms"
13
)
14
15
+const SMS_RESERVED_AMOUNT = uint(4)
16
+
17
type phone struct {
18
chip interfaces.Chipper
19
notifier interfaces.Notifier
@@ -106,7 +108,11 @@ func (ph *phone) parse(msg []byte) error {
106
108
}
107
109
110
log.Info("sms amount", toto.V{"amount": smsAmount, "max": smsMax})
- if smsAmount >= smsMax {
111
+ amountToClean := smsMax
112
+ if smsMax <= SMS_RESERVED_AMOUNT {
113
+ amountToClean = 0
114
+ }
115
+ if smsAmount >= amountToClean {
116
for i := uint(0); i < smsAmount; i++ {
117
if err := sms.Delete(ph.chip, i+1); err != nil {
118
return err
0 commit comments