@@ -141,6 +141,7 @@ class ContactImageUpdater {
141141 // Format extraDelta based on the user's unit preference
142142 let unitPreference = UserDefaultsRepository . units. value
143143 let formattedExtraDelta : String
144+ let yOffset : CGFloat = unitPreference == " mg/dL " ? 46 : 61 // Add 15 if mmol is selected
144145 if unitPreference == " mg/dL " {
145146 formattedExtraDelta = String ( format: " %.0f " , ( extraDelta as NSString ) . doubleValue)
146147 } else {
@@ -149,17 +150,17 @@ class ContactImageUpdater {
149150
150151 if contactType == " Trend " && ObservableUserDefaults . shared. contactTrend. value == " Separate " {
151152 // Customizing image for Trend contact when value is Separate
152- let trendRect = CGRect ( x: 0 , y: 46 , width: size. width, height: size. height - 80 )
153+ let trendRect = CGRect ( x: 0 , y: yOffset , width: size. width, height: size. height - 80 )
153154 extraTrend. draw ( in: trendRect, withAttributes: trendAttributes)
154155 } else if contactType == " Delta " && ObservableUserDefaults . shared. contactDelta. value == " Separate " {
155156 // Customizing image for Delta contact when value is Separate
156- let deltaRect = CGRect ( x: 0 , y: 46 , width: size. width, height: size. height - 80 )
157+ let deltaRect = CGRect ( x: 0 , y: yOffset , width: size. width, height: size. height - 80 )
157158 formattedExtraDelta. draw ( in: deltaRect, withAttributes: deltaAttributes)
158159 } else if contactType == " BG " {
159160 // Customizing image for BG contact
160161 let bgRect = extra. isEmpty
161- ? CGRect ( x: 0 , y: 46 , width: size. width, height: size. height - 80 )
162- : CGRect ( x: 0 , y: 26 , width: size. width, height: size. height / 2 )
162+ ? CGRect ( x: 0 , y: yOffset , width: size. width, height: size. height - 80 )
163+ : CGRect ( x: 0 , y: yOffset - 20 , width: size. width, height: size. height / 2 )
163164
164165 bgValue. draw ( in: bgRect, withAttributes: bgAttributes)
165166
0 commit comments