@hedia/recommendation-screen 2.2.0-alpha.45 → 2.2.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/index.js +0 -1
  2. package/dist/src/RecommendationScreen.d.ts +67 -64
  3. package/dist/src/RecommendationScreen.js +145 -157
  4. package/dist/src/assets/assets/activity/Cyclist.png +0 -0
  5. package/dist/src/assets/assets/activity/Other.png +0 -0
  6. package/dist/src/assets/assets/activity/Runner.png +0 -0
  7. package/dist/src/assets/assets/activity/Swimmer.png +0 -0
  8. package/dist/src/assets/assets/activity/Walk.png +0 -0
  9. package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
  10. package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
  11. package/dist/src/assets/assets/icons/Edit.tsx +22 -0
  12. package/dist/src/assets/assets/icons/X.tsx +14 -0
  13. package/dist/src/assets/assets/mood/happy.png +0 -0
  14. package/dist/src/assets/assets/mood/happy_active.png +0 -0
  15. package/dist/src/assets/assets/mood/neutral.png +0 -0
  16. package/dist/src/assets/assets/mood/neutral_active.png +0 -0
  17. package/dist/src/assets/assets/mood/sad.png +0 -0
  18. package/dist/src/assets/assets/mood/sad_active.png +0 -0
  19. package/dist/src/assets/assets/mood/semi_happy.png +0 -0
  20. package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
  21. package/dist/src/assets/assets/mood/semi_sad.png +0 -0
  22. package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
  23. package/dist/src/assets/icons/Edit.d.ts +4 -0
  24. package/dist/src/assets/icons/Edit.js +7 -0
  25. package/dist/src/assets/{IconsSVG/Edit.d.ts → icons/X.d.ts} +2 -2
  26. package/dist/src/assets/icons/X.js +6 -0
  27. package/dist/src/components/ForecastInfoBar.d.ts +109 -0
  28. package/dist/src/components/ForecastInfoBar.js +138 -0
  29. package/dist/src/components/Header.d.ts +8 -0
  30. package/dist/src/components/Header.js +54 -0
  31. package/dist/src/components/Icon.d.ts +20 -0
  32. package/dist/src/components/Icon.js +43 -0
  33. package/dist/src/components/InfoBars.d.ts +28 -13
  34. package/dist/src/components/InfoBars.js +63 -33
  35. package/dist/src/components/InvisibleNumberInput.d.ts +3 -8
  36. package/dist/src/components/InvisibleNumberInput.js +20 -22
  37. package/dist/src/components/LimitationMessage.d.ts +14 -0
  38. package/dist/src/components/LimitationMessage.js +30 -0
  39. package/dist/src/components/LineSeparator.d.ts +1 -5
  40. package/dist/src/components/LineSeparator.js +3 -2
  41. package/dist/src/components/RecentInsulin.d.ts +1 -2
  42. package/dist/src/components/RecentInsulin.js +40 -57
  43. package/dist/src/components/RecommendationModal.d.ts +63 -61
  44. package/dist/src/components/RecommendationModal.js +118 -133
  45. package/dist/src/components/RecommendedCarbs.d.ts +0 -2
  46. package/dist/src/components/RecommendedCarbs.js +99 -82
  47. package/dist/src/components/RecommendedInsulin.d.ts +1 -1
  48. package/dist/src/components/RecommendedInsulin.js +72 -56
  49. package/dist/src/components/Remeasure.d.ts +15 -5
  50. package/dist/src/components/Remeasure.js +77 -50
  51. package/dist/src/components/{TransferToLogbook.d.ts → SaveButton.d.ts} +2 -2
  52. package/dist/src/components/{TransferToLogbook.js → SaveButton.js} +30 -27
  53. package/dist/src/components/TwoOptionModal.d.ts +136 -0
  54. package/dist/src/components/TwoOptionModal.js +141 -0
  55. package/dist/src/components/activity/Activity.d.ts +2 -2
  56. package/dist/src/components/activity/Activity.js +49 -58
  57. package/dist/src/components/activity/ActivityIcon.d.ts +7 -7
  58. package/dist/src/components/activity/ActivityIcon.js +29 -37
  59. package/dist/src/components/activity/ActivityIntensity.d.ts +1 -1
  60. package/dist/src/components/activity/ActivityIntensity.js +23 -20
  61. package/dist/src/components/mood/Emotion.d.ts +1 -1
  62. package/dist/src/components/mood/Emotion.js +16 -21
  63. package/dist/src/components/mood/MoodIcon.d.ts +5 -4
  64. package/dist/src/components/mood/MoodIcon.js +23 -28
  65. package/dist/src/components/text/TextBold.d.ts +8 -0
  66. package/dist/src/components/text/TextBold.js +12 -0
  67. package/dist/src/components/text/TextRegular.d.ts +8 -0
  68. package/dist/src/components/text/TextRegular.js +12 -0
  69. package/dist/src/locale/da/messages.js +1 -0
  70. package/dist/src/locale/da/messages.po +353 -0
  71. package/dist/src/locale/de/messages.js +1 -0
  72. package/dist/src/locale/de/messages.po +353 -0
  73. package/dist/src/locale/en/messages.js +1 -0
  74. package/dist/src/locale/en/messages.po +353 -0
  75. package/dist/src/locale/es/messages.js +1 -0
  76. package/dist/src/locale/es/messages.po +353 -0
  77. package/dist/src/locale/fr/messages.js +1 -0
  78. package/dist/src/locale/fr/messages.po +353 -0
  79. package/dist/src/locale/i18nUtils.d.ts +18 -0
  80. package/dist/src/locale/i18nUtils.js +39 -0
  81. package/dist/src/locale/it/messages.js +1 -0
  82. package/dist/src/locale/it/messages.po +353 -0
  83. package/dist/src/types/enum.d.ts +15 -21
  84. package/dist/src/types/enum.js +18 -27
  85. package/dist/src/types/types.js +0 -1
  86. package/dist/src/utils/AttentionMessages.js +24 -29
  87. package/dist/src/utils/Constants.d.ts +3 -17
  88. package/dist/src/utils/Constants.js +1 -16
  89. package/dist/src/utils/RecommendationError.js +24 -26
  90. package/dist/src/utils/RecommendationUtils.js +2 -5
  91. package/dist/src/utils/Translations.js +5 -5
  92. package/dist/src/utils/Utils.d.ts +1 -1
  93. package/dist/src/utils/Utils.js +0 -1
  94. package/dist/src/utils/Validations.d.ts +1 -1
  95. package/dist/src/utils/Validations.js +2 -3
  96. package/package.json +99 -89
  97. package/dist/index.js.map +0 -1
  98. package/dist/src/RecommendationScreen.js.map +0 -1
  99. package/dist/src/assets/IconsSVG/Close.d.ts +0 -4
  100. package/dist/src/assets/IconsSVG/Close.js +0 -7
  101. package/dist/src/assets/IconsSVG/Close.js.map +0 -1
  102. package/dist/src/assets/IconsSVG/CloseOutlined.d.ts +0 -4
  103. package/dist/src/assets/IconsSVG/CloseOutlined.js +0 -9
  104. package/dist/src/assets/IconsSVG/CloseOutlined.js.map +0 -1
  105. package/dist/src/assets/IconsSVG/Edit.js +0 -8
  106. package/dist/src/assets/IconsSVG/Edit.js.map +0 -1
  107. package/dist/src/assets/IconsSVG/activity/Cycling.d.ts +0 -4
  108. package/dist/src/assets/IconsSVG/activity/Cycling.js +0 -12
  109. package/dist/src/assets/IconsSVG/activity/Cycling.js.map +0 -1
  110. package/dist/src/assets/IconsSVG/activity/Running.d.ts +0 -4
  111. package/dist/src/assets/IconsSVG/activity/Running.js +0 -10
  112. package/dist/src/assets/IconsSVG/activity/Running.js.map +0 -1
  113. package/dist/src/assets/IconsSVG/activity/Stretching.d.ts +0 -4
  114. package/dist/src/assets/IconsSVG/activity/Stretching.js +0 -10
  115. package/dist/src/assets/IconsSVG/activity/Stretching.js.map +0 -1
  116. package/dist/src/assets/IconsSVG/activity/Swimming.d.ts +0 -4
  117. package/dist/src/assets/IconsSVG/activity/Swimming.js +0 -13
  118. package/dist/src/assets/IconsSVG/activity/Swimming.js.map +0 -1
  119. package/dist/src/assets/IconsSVG/activity/Walking.d.ts +0 -4
  120. package/dist/src/assets/IconsSVG/activity/Walking.js +0 -11
  121. package/dist/src/assets/IconsSVG/activity/Walking.js.map +0 -1
  122. package/dist/src/assets/IconsSVG/mood/Happy.d.ts +0 -4
  123. package/dist/src/assets/IconsSVG/mood/Happy.js +0 -11
  124. package/dist/src/assets/IconsSVG/mood/Happy.js.map +0 -1
  125. package/dist/src/assets/IconsSVG/mood/Neutral.d.ts +0 -4
  126. package/dist/src/assets/IconsSVG/mood/Neutral.js +0 -11
  127. package/dist/src/assets/IconsSVG/mood/Neutral.js.map +0 -1
  128. package/dist/src/assets/IconsSVG/mood/Sad.d.ts +0 -4
  129. package/dist/src/assets/IconsSVG/mood/Sad.js +0 -11
  130. package/dist/src/assets/IconsSVG/mood/Sad.js.map +0 -1
  131. package/dist/src/assets/IconsSVG/mood/SemiHappy.d.ts +0 -4
  132. package/dist/src/assets/IconsSVG/mood/SemiHappy.js +0 -11
  133. package/dist/src/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
  134. package/dist/src/assets/IconsSVG/mood/SemiSad.d.ts +0 -4
  135. package/dist/src/assets/IconsSVG/mood/SemiSad.js +0 -11
  136. package/dist/src/assets/IconsSVG/mood/SemiSad.js.map +0 -1
  137. package/dist/src/components/ExitModal.d.ts +0 -25
  138. package/dist/src/components/ExitModal.js +0 -91
  139. package/dist/src/components/ExitModal.js.map +0 -1
  140. package/dist/src/components/InfoBars.js.map +0 -1
  141. package/dist/src/components/InvisibleNumberInput.js.map +0 -1
  142. package/dist/src/components/LineSeparator.js.map +0 -1
  143. package/dist/src/components/RecentInsulin.js.map +0 -1
  144. package/dist/src/components/RecommendationModal.js.map +0 -1
  145. package/dist/src/components/RecommendedCarbs.js.map +0 -1
  146. package/dist/src/components/RecommendedInsulin.js.map +0 -1
  147. package/dist/src/components/Remeasure.js.map +0 -1
  148. package/dist/src/components/Text.d.ts +0 -13
  149. package/dist/src/components/Text.js +0 -14
  150. package/dist/src/components/Text.js.map +0 -1
  151. package/dist/src/components/TimeoutModal.d.ts +0 -24
  152. package/dist/src/components/TimeoutModal.js +0 -84
  153. package/dist/src/components/TimeoutModal.js.map +0 -1
  154. package/dist/src/components/TransferToLogbook.js.map +0 -1
  155. package/dist/src/components/activity/Activity.js.map +0 -1
  156. package/dist/src/components/activity/ActivityIcon.js.map +0 -1
  157. package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
  158. package/dist/src/components/mood/Emotion.js.map +0 -1
  159. package/dist/src/components/mood/MoodIcon.js.map +0 -1
  160. package/dist/src/components/styles/fonts.d.ts +0 -143
  161. package/dist/src/components/styles/fonts.js +0 -145
  162. package/dist/src/components/styles/fonts.js.map +0 -1
  163. package/dist/src/locales/da/translations.json +0 -82
  164. package/dist/src/locales/de/translations.json +0 -81
  165. package/dist/src/locales/en/translations.json +0 -84
  166. package/dist/src/locales/es/translations.json +0 -81
  167. package/dist/src/locales/fr/translations.json +0 -81
  168. package/dist/src/locales/it/translations.json +0 -81
  169. package/dist/src/locales/translate.d.ts +0 -19
  170. package/dist/src/locales/translate.js +0 -53
  171. package/dist/src/locales/translate.js.map +0 -1
  172. package/dist/src/types/enum.js.map +0 -1
  173. package/dist/src/types/types.js.map +0 -1
  174. package/dist/src/utils/AttentionMessages.js.map +0 -1
  175. package/dist/src/utils/Constants.js.map +0 -1
  176. package/dist/src/utils/RecommendationError.js.map +0 -1
  177. package/dist/src/utils/RecommendationUtils.js.map +0 -1
  178. package/dist/src/utils/Translations.js.map +0 -1
  179. package/dist/src/utils/Utils.js.map +0 -1
  180. package/dist/src/utils/Validations.js.map +0 -1
  181. package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.js CHANGED
@@ -3,4 +3,3 @@ import * as Errors from "./src/utils/RecommendationError";
3
3
  export default RecommendationScreen;
4
4
  export { Errors };
5
5
  export * from "./src/types/enum";
6
- //# sourceMappingURL=index.js.map
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
2
  import { AppStateStatus } from "react-native";
3
3
  import { BloodGlucoseUnit, BloodKetonesUnit, BolusCalculator, Languages, Logbook, UserSettings } from "@hedia/types";
4
- import { ExitModalActions, TimeoutModalActions } from "./types/enum";
5
- import { IActivityDisplayProps } from "./types/types";
6
4
  import { RecommendationError } from "./utils/RecommendationError";
5
+ import { IActivityDisplayProps } from "./types/types";
7
6
  /** Represents both a suggestion by HDA and an actual amount of either insulin or carbohydrates. */
8
7
  export interface IResult {
9
8
  /** The suggested amount (of insulin in units or carbohydrates in grams) */
@@ -15,7 +14,7 @@ export interface IRecommendationProps {
15
14
  /** The blood glucose measurement unit that the user prefers. */
16
15
  bloodGlucoseUnit: BloodGlucoseUnit;
17
16
  /** The user’s preferred language. */
18
- language: keyof typeof Languages;
17
+ language: Languages;
19
18
  /** The user’s preferred default reminder time in hours when they enter carbohydrates or an activity. */
20
19
  userReminder: number;
21
20
  /** The values needed to make an insulin recommendation calculation. */
@@ -30,8 +29,10 @@ export interface IRecommendationProps {
30
29
  latestLogbookFrom6Hours: Logbook.Types.ILogbookEntry | null;
31
30
  /** The properties of the entered activity that are not used for making the calculation itself, but will be used on the recommendation screen. */
32
31
  activityDisplayProps: IActivityDisplayProps | null;
33
- /** Should the exit modal be displayed or not */
34
- showExitModal: boolean;
32
+ /** The forecasted glucose value to display. */
33
+ forecastedGlucose: string | null;
34
+ /** Forecasted time value to display. */
35
+ forecastedTime: string;
35
36
  /**
36
37
  * Callback function taking a single boolean argument and returning nothing.
37
38
  * To be called when the user decides on a presented carbohydrate recommendation.
@@ -55,12 +56,6 @@ export interface IRecommendationProps {
55
56
  * Should allow the user to enter when they injected insulin and how much.
56
57
  */
57
58
  onRecentInsulinYes(): void;
58
- /**
59
- * Callback function without arguments or return values.
60
- * To be called if the user taps “No” when asked if they have taken insulin recently, making the recommendation visible.
61
- * Or if they have recently taken insulin and the recommendation is visible.
62
- */
63
- onRecommendationDisplayed(): void;
64
59
  /**
65
60
  * To be called when the “Transfer to Logbook” button is pressed.
66
61
  * @param carbs The suggested and entered amount of carbohydrates.
@@ -75,16 +70,18 @@ export interface IRecommendationProps {
75
70
  * To be called in case a serious issue with the validity of input data is detected.
76
71
  * @param error The detected error.
77
72
  */
78
- onError(error: RecommendationError | Error): void;
73
+ onError(error: RecommendationError): void;
74
+ /**
75
+ * Callback function taking a single argument of type boolean.
76
+ * To be called to hide the bottom navigation bar while displaying modal dialogs.
77
+ * @param toggle Showing (true) or hiding (false) the bottom navigation bar on the calculation flow screens.
78
+ */
79
+ showBolusBar(toggle: boolean): void;
79
80
  /**
80
81
  * Callback function taking no arguments.
81
82
  * To be called if the user chooses to restart the calculation.
82
83
  */
83
84
  restartCalculation(): void;
84
- /**
85
- * Callback function taking a single argument of type boolean.
86
- */
87
- hideExitModal(): void;
88
85
  }
89
86
  interface IState {
90
87
  /** The time in hours in hours until a reminder notification will be sent to the user. If 0 then no notification will be sent. */
@@ -117,14 +114,10 @@ interface IState {
117
114
  * The exit modal prompts the user to consider saving the calculation to a logbook entry before closing the recommendation screen.
118
115
  */
119
116
  showExitModal: boolean;
120
- /** Keeps track of action taken in the exit modal. */
121
- exitModalAction: ExitModalActions | null;
122
- /** Keeps track of whether or not only the limitation page of the recommendation modal should be visible. */
123
- onlyShowLimitationMessage: boolean;
117
+ /** Keeps track of whether or not a message about insulin limitation should be displayed. */
118
+ showLimitationMessage: boolean;
124
119
  /** Keeps track of whether or not a message about the recommendation being too old should be displayed. */
125
120
  showTimeoutModal: boolean;
126
- /** Keeps track of action taken in the timout modal. */
127
- timeoutModalAction: TimeoutModalActions | null;
128
121
  }
129
122
  /**
130
123
  * The RecommendationScreen is the React component that passes relevant inputs to the recommendation calculation module and presents
@@ -158,6 +151,11 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
158
151
  * It'll allow us to later remove the subscription.
159
152
  */
160
153
  private appStateSubscription?;
154
+ /**
155
+ * A reference to the eventSubscription that'll be returned by BackHandler.addEventListener().
156
+ * It'll allow us to later remove the subscription.
157
+ */
158
+ private backHandlerSubscription?;
161
159
  /**
162
160
  * Steps:
163
161
  * 1. Call the super() method with the props.
@@ -167,7 +165,6 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
167
165
  * - Set the language by using the language prop as argument for calling changeLanguage()
168
166
  * - Unpack recentBoluses from the calculatorParams prop.
169
167
  * - Use the calculatorParams prop as argument for calling calculateRecommendation() and unpack all of the resulting values.
170
- * - Call the onRecommendationDisplayed() callback prop if the recommendation is visible
171
168
  * - Copy the carbRecommendation to the suggestedCarbs member variable.
172
169
  * - Set the following state variables:
173
170
  * - Set remeasureTime to the return value from calling the getBGLevelRemeasurementReminder() method.
@@ -179,8 +176,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
179
176
  * - Set activeInsulin to the estimation returned from the calculation result.
180
177
  * - Set enteredCarbs, enteredInsulin, selectedMood to null.
181
178
  * - Set recommendationModal to be true if wasLimited is true or if carbRecommendation after being rounded is truthy or if the return value from calling the getBGLevelAttentionMessage() method is truthy.
182
- * - Set onlyShowLimitationMessage, showTimeoutModal to be false.
183
- * - Set showExitModal with the value of the showExitModal prop.
179
+ * - Set showExitModal, showLimitationMessage, showTimeoutModal to be false.
184
180
  * 3. Start a 15 minute timer assigned to the timer member variable using the setTimeout() function. When the timer expires, call the showTimeoutModal() method.
185
181
  * @param props The data required to initialise the Recommendation Screen
186
182
  */
@@ -203,14 +199,6 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
203
199
  * 2. Remove the listener for app state changes that was set by the componentDidMount() method.
204
200
  */
205
201
  componentWillUnmount(): void;
206
- /**
207
- * Called immediately after updating occurs. This method is not called for the initial render.
208
- * Use this as an opportunity to operate on the DOM when the component has been updated.
209
- * Steps:
210
- * 1. If the showExitModal prop is true and it was false before, call the onExit() method.
211
- * @param showExitModal The previous showExitModal props of the component.
212
- */
213
- componentDidUpdate({ showExitModal }: IRecommendationProps): void;
214
202
  /**
215
203
  * Steps:
216
204
  * 1. Evaluate a boolean called isOlderThan15Minutes to indicate whether the recommendationDate member variable represents a time more than 15 minutes ago.
@@ -220,7 +208,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
220
208
  handleAppStateChange: (nextAppState: AppStateStatus) => void;
221
209
  /**
222
210
  * Steps:
223
- * 1. Set the showTimeoutModal state variable to be true.
211
+ * 1. Set the showTimeoutModal state variable to be true. Use a callback function to call the showBolusBar prop callback function with false as argument when the state has been updated.
224
212
  * */
225
213
  showTimeoutModal: () => void;
226
214
  /**
@@ -242,11 +230,19 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
242
230
  *
243
231
  * Steps:
244
232
  * 1. If the insulin recommendation is being displayed (the isRecommendationDisplayed state variable is true):
245
- * - Set the showExitModal state variable to true.
233
+ * - Set the showExitModal state variable to true. When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showExitModal state variable as argument.
246
234
  * 2. Else:
247
235
  * - Call the exitCallback prop callback function.
248
236
  */
249
237
  onExit: () => void;
238
+ /**
239
+ * Callback to be executed by the back handler listener.
240
+ *
241
+ * Steps:
242
+ * 1. Call the onExist method
243
+ * 2. Return true so that the default behaviour is overwritten.
244
+ */
245
+ onBackHandlerPress: () => boolean;
250
246
  /**
251
247
  * Hide the modal that shows attention messages.
252
248
  *
@@ -255,37 +251,28 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
255
251
  */
256
252
  hideAttentionModal: () => void;
257
253
  /**
258
- * Handle presses on the transfer button in the exit modal.
259
- */
260
- onPressTransferExitModal: () => void;
261
- /**
262
- * Handle presses on the close calculation button in the exit modal.
263
- */
264
- onPressCloseExitModal: () => void;
265
- /**
266
- * Handle presses on the hide button in the exit modal.
267
- */
268
- onPressHideExitModal: () => void;
269
- /**
270
- * Call the chosen modal action on the didHide modal callback .
271
- */
272
- onExitModalDidHide: () => void;
273
- /**
274
- * Handle presses on the close calculation button in the timeout modal.
275
- */
276
- onPressCloseCalculationTimeoutModal: () => void;
277
- /**
278
- * Handle presses on the restart calculation button in the timeout modal.
254
+ * Hide the modal that shows attention messages.
255
+ *
256
+ * Steps:
257
+ * 1. Set the showLimitationMessage state variable to false.
279
258
  */
280
- onPressRestartCalculationTimeoutModal: () => void;
259
+ hideLimitationMessage: () => void;
281
260
  /**
282
- * Handle presses on the transfer button in the timeout modal.
261
+ * Hide the exit modal. To be used when the user closes the modal directly or in some way exits the recommendation screen.
262
+ *
263
+ * Steps:
264
+ * 1. Set the showExitModal state variable to false.
265
+ * When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showExitModal state variable as argument.
283
266
  */
284
- onPressTransferTimeoutModal: () => void;
267
+ hideExitModal: () => void;
285
268
  /**
286
- * Call the chosen modal action on the didHide modal callback .
269
+ * Hide the modal that warns the user that their recommendation is old.
270
+ *
271
+ * Steps:
272
+ * 1. Set the showTimeoutModal state variable to false.
273
+ * When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showTimeoutModal state variable as argument.
287
274
  */
288
- onTimeoutModalDidHide: () => void;
275
+ hideTimeoutModal: () => void;
289
276
  /**
290
277
  * Used as a callback function for the Remeasure component to update the state when the remeasure time slider’s value changes.
291
278
  *
@@ -301,8 +288,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
301
288
  *
302
289
  * Steps:
303
290
  * 1. Set the isRecommendationDisplayed state variable to be true.
304
- * 2. Call the onRecommendationDisplayed prop callback function.
305
- * 3. As a callback to the setState() method, define a new anonymous function that calls setTimeout() with a duration of 0 milliseconds.
291
+ * 2. As a callback to the setState() method, define a new anonymous function that calls setTimeout() with a duration of 0 milliseconds.
306
292
  * When the time expires, call the scrollToEnd() method of the scrollView member, with the animated argument set to true.
307
293
  * This ensures that the scroll event happens after all other events that get queued to happen at the same time,
308
294
  * so all relevant elements are visible on the screen and the scroll happens reliably.
@@ -344,6 +330,22 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
344
330
  * 2. Call the carbRecommendationAnswer() prop callback function with true as argument.
345
331
  */
346
332
  acceptCarbRecommendation: () => void;
333
+ /**
334
+ * Handles what happens when the user hits the “close calculation”-button on the exit modal.
335
+ *
336
+ * Steps:
337
+ * 1. If the showExitModal state variable is true then call the hideExitModal() method. Otherwise, call the hideTimeoutModal() method
338
+ * 2. Call the closeCalculationCallback prop callback function.
339
+ */
340
+ closeCalculation: () => void;
341
+ /**
342
+ * Close the current recommendation and start a new bolus calculation.
343
+ *
344
+ * Steps:
345
+ * 1. Call the hideTimeoutModal() method.
346
+ * 2. Call the restartCalculation prop callback function.
347
+ */
348
+ restartCalculation: () => void;
347
349
  /**
348
350
  * Used as a callback function for the Emotion component to update the state when a mood icon is tapped.
349
351
  *
@@ -368,7 +370,8 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
368
370
  * 1. Unpack the enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, and showExitModal state variables
369
371
  * 2. Create an IResult object called carbs consisting of suggestedCarbs and enteredCarbs.
370
372
  * 3. Create an IResult object called Insulin consisting of insulinRecommendation and enteredInsulin.
371
- * 4. Call the transferToLogbook prop callback function with the following arguments:
373
+ * 4. If showExitModal is true then call the hideExitModal() method. otherwise call the hideTimeoutModal() method.
374
+ * 5. Call the transferToLogbook prop callback function with the following arguments:
372
375
  * - Set the carbs argument to the carbs IResult object.
373
376
  * - Set the insulin argument to the insulin IResult object.
374
377
  * - Set the reminder argument to the remeasureTime state variable.