@@ -109,29 +109,58 @@ object SentryDebug {
109
109
var count = 1
110
110
val data = mutableMapOf<String , Any >()
111
111
112
- fun String.keyPad (): String = padStart(length = 15 )
113
- fun Int.countPad (): String = toString().padStart(length = 2 , ' 0' )
114
- fun count (): String = " ${count.countPad().also { count++ }} ."
115
- fun format (index : Int ): String = (index + 1 ).countPad()
116
-
117
- data[count() + " step" .keyPad()] = step
118
- data[count() + " email" .keyPad()] = AccountUtils .currentMailboxEmail.toString()
119
-
120
- data[count() + " draft" .keyPad() + " - localUuid" ] = localUuid
121
- data[count() + " draft" .keyPad() + " - remoteUuid" ] = remoteUuid.toString()
122
- data[count() + " draft" .keyPad() + " - action" ] = action?.name.toString()
123
- data[count() + " draft" .keyPad() + " - mode" ] = when {
112
+ fun Int.countPadding (): String = toString().padStart(length = 2 , ' 0' )
113
+
114
+ fun addData (category : String , key : String = "", value : String ) {
115
+ data[count.countPadding() + " ." + category.padStart(length = 15 ) + key] = value
116
+ count++
117
+ }
118
+
119
+ fun addStepData (value : String ) {
120
+ addData(category = " step" , value = value)
121
+ }
122
+
123
+ fun addEmailData (value : String ) {
124
+ addData(category = " email" , value = value)
125
+ }
126
+
127
+ fun addDraftData (key : String , value : String ) {
128
+ addData(category = " draft" , key = " - $key " , value = value)
129
+ }
130
+
131
+ fun addAttachmentsData (key : String , value : String ) {
132
+ addData(category = " attachments" , key = " - $key " , value = value)
133
+ }
134
+
135
+ fun addAttachmentData (index : Int , value : String ) {
136
+ addData(category = " attachment #${(index + 1 ).countPadding()} " , value = value)
137
+ }
138
+
139
+ addStepData(value = step)
140
+ addEmailData(value = AccountUtils .currentMailboxEmail.toString())
141
+
142
+ addDraftData(key = " localUuid" , value = localUuid)
143
+ addDraftData(key = " remoteUuid" , value = remoteUuid.toString())
144
+ addDraftData(key = " action" , value = action?.name.toString())
145
+
146
+ val draftMode = when {
124
147
inReplyToUid != null -> " REPLY or REPLY_ALL"
125
148
forwardedUid != null -> " FORWARD"
126
149
else -> " NEW_MAIL"
127
150
}
151
+ addDraftData(key = " mode" , value = draftMode)
128
152
129
- data[count() + " attachments " .keyPad() + " - count" ] = attachments.count()
153
+ addAttachmentsData(key = " count" , value = attachments.count().toString() )
130
154
131
155
attachments.forEachIndexed { index, it ->
132
- data[count() + " attachment #${format(index)} " .keyPad()] =
133
- " localUuid: ${it.localUuid} | uuid: ${it.uuid} | uploadLocalUri: ${it.uploadLocalUri} "
134
- data[count() + " attachment #${format(index)} " .keyPad()] = " uploadStatus: ${it.uploadStatus.name} | size: ${it.size} "
156
+ addAttachmentData(
157
+ index = index,
158
+ value = " localUuid: ${it.localUuid} | uuid: ${it.uuid} | uploadLocalUri: ${it.uploadLocalUri} " ,
159
+ )
160
+ addAttachmentData(
161
+ index = index,
162
+ value = " uploadStatus: ${it.uploadStatus.name} | size: ${it.size} " ,
163
+ )
135
164
}
136
165
137
166
addInfoBreadcrumb(category = " Attachments_Situation" , data = data)
0 commit comments