@hedia/recommendation-screen 2.1.22 → 2.1.23-alpha.1

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 (72) hide show
  1. package/.flowconfig +65 -0
  2. package/android/app/build.gradle +20 -18
  3. package/android/app/src/debug/AndroidManifest.xml +7 -2
  4. package/android/app/src/main/AndroidManifest.xml +0 -2
  5. package/android/app/src/main/res/values/styles.xml +1 -2
  6. package/android/build.gradle +8 -8
  7. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  8. package/android/gradle.properties +1 -1
  9. package/android/gradlew +14 -17
  10. package/android/gradlew.bat +7 -18
  11. package/coverage/clover.xml +716 -0
  12. package/coverage/coverage-final.json +28 -0
  13. package/coverage/lcov-report/base.css +224 -0
  14. package/coverage/lcov-report/block-navigation.js +79 -0
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +201 -0
  17. package/coverage/lcov-report/prettify.css +1 -0
  18. package/coverage/lcov-report/prettify.js +2 -0
  19. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  20. package/coverage/lcov-report/sorter.js +170 -0
  21. package/coverage/lcov-report/src/RecommendationScreen.tsx.html +2501 -0
  22. package/coverage/lcov-report/src/__tests__/index.html +111 -0
  23. package/coverage/lcov-report/src/__tests__/utils.tsx.html +533 -0
  24. package/coverage/lcov-report/src/components/Header.tsx.html +356 -0
  25. package/coverage/lcov-report/src/components/InfoBars.tsx.html +518 -0
  26. package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +566 -0
  27. package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +209 -0
  28. package/coverage/lcov-report/src/components/LineSeparator.tsx.html +161 -0
  29. package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +410 -0
  30. package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +923 -0
  31. package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +1061 -0
  32. package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +779 -0
  33. package/coverage/lcov-report/src/components/Remeasure.tsx.html +551 -0
  34. package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +443 -0
  35. package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +665 -0
  36. package/coverage/lcov-report/src/components/activity/Activity.tsx.html +371 -0
  37. package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +281 -0
  38. package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +281 -0
  39. package/coverage/lcov-report/src/components/activity/index.html +141 -0
  40. package/coverage/lcov-report/src/components/index.html +276 -0
  41. package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +353 -0
  42. package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +335 -0
  43. package/coverage/lcov-report/src/components/mood/index.html +126 -0
  44. package/coverage/lcov-report/src/index.html +111 -0
  45. package/coverage/lcov-report/src/locale/i18nUtils.ts.html +206 -0
  46. package/coverage/lcov-report/src/locale/index.html +111 -0
  47. package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +554 -0
  48. package/coverage/lcov-report/src/utils/Constants.ts.html +248 -0
  49. package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +620 -0
  50. package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +764 -0
  51. package/coverage/lcov-report/src/utils/Translations.ts.html +131 -0
  52. package/coverage/lcov-report/src/utils/Utils.ts.html +545 -0
  53. package/coverage/lcov-report/src/utils/Validations.ts.html +1544 -0
  54. package/coverage/lcov-report/src/utils/index.html +201 -0
  55. package/coverage/lcov.info +1611 -0
  56. package/ios/HediaRecommendationScreen/AppDelegate.m +7 -4
  57. package/ios/HediaRecommendationScreen/Info.plist +0 -2
  58. package/ios/HediaRecommendationScreen/LaunchScreen.storyboard +47 -0
  59. package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +192 -549
  60. package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +1 -1
  61. package/ios/Podfile +13 -87
  62. package/ios/Podfile.lock +353 -283
  63. package/jest.config.js +3 -3
  64. package/jest.mock.js +1 -1
  65. package/metro.config.js +1 -1
  66. package/package.json +10 -9
  67. package/src/RecommendationScreen.d.ts +6 -1
  68. package/src/RecommendationScreen.js +5 -5
  69. package/src/__tests__/RecommendationScreen.test.js +4 -6
  70. package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +0 -42
  71. package/ios/HediaRecommendationScreen-tvOS/Info.plist +0 -53
  72. package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +0 -24
package/jest.config.js CHANGED
@@ -179,9 +179,9 @@ module.exports = {
179
179
  // transform: undefined,
180
180
 
181
181
  // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
182
- // transformIgnorePatterns: [
183
- // "/node_modules/"
184
- // ],
182
+ transformIgnorePatterns: [
183
+ "node_modules/(?!(@react-native|react-native|react-native-vector-icons|react-native-linear-gradient|react-native-modal|react-native-animatable)/)"
184
+ ],
185
185
 
186
186
  // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
187
187
  // unmockedModulePathPatterns: undefined,
package/jest.mock.js CHANGED
@@ -1 +1 @@
1
- jest.mock('react-native/Libraries/Animated/src/NativeAnimatedHelper');
1
+ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
package/metro.config.js CHANGED
@@ -10,7 +10,7 @@ module.exports = {
10
10
  getTransformOptions: async () => ({
11
11
  transform: {
12
12
  experimentalImportSupport: false,
13
- inlineRequires: false,
13
+ inlineRequires: true,
14
14
  },
15
15
  }),
16
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/recommendation-screen",
3
- "version": "2.1.22",
3
+ "version": "2.1.23-alpha.1",
4
4
  "description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,36 +32,37 @@
32
32
  "author": "Hedia",
33
33
  "license": "ISC",
34
34
  "devDependencies": {
35
- "@babel/core": "7.10.3",
35
+ "@babel/core": "7.12.9",
36
36
  "@babel/plugin-proposal-decorators": "7.8.3",
37
37
  "@babel/plugin-transform-typescript": "7.13.0",
38
38
  "@babel/preset-env": "7.10.2",
39
39
  "@babel/preset-react": "7.10.1",
40
40
  "@babel/preset-typescript": "7.10.1",
41
+ "@babel/runtime": "7.12.5",
41
42
  "@hedia/recommendation-calculator": "2.0.7",
42
43
  "@react-native-community/slider": "3.0.0",
43
44
  "@testing-library/jest-native": "3.1.0",
44
- "@types/jest": "25.2.3",
45
+ "@types/jest": "26.0.24",
45
46
  "@types/lingui__core": "2.7.0",
46
47
  "@types/lingui__macro": "2.7.3",
47
48
  "@types/lingui__react": "2.8.2",
48
49
  "@types/react": "16.9.35",
49
- "@types/react-native": "0.62.13",
50
+ "@types/react-native": "0.65.3",
50
51
  "@types/react-test-renderer": "17.0.1",
51
52
  "babel-core": "7.0.0-bridge.0",
52
53
  "babel-jest": "26.0.1",
53
54
  "babel-loader": "8.1.0",
54
55
  "babel-plugin-macros": "2.8.0",
55
- "jest": "26.0.1",
56
- "metro-react-native-babel-preset": "0.58.0",
56
+ "jest": "26.6.3",
57
+ "metro-react-native-babel-preset": "0.66.2",
57
58
  "npm-package-json-lint": "5.1.0",
58
59
  "prettier": "2.2.1",
59
- "react": "16.13.1",
60
- "react-native": "0.62.2",
60
+ "react": "17.0.2",
61
+ "react-native": "0.66.0",
61
62
  "react-native-linear-gradient": "2.5.6",
62
63
  "react-native-testing-library": "2.1.0",
63
64
  "react-native-vector-icons": "6.6.0",
64
- "react-test-renderer": "16.13.1",
65
+ "react-test-renderer": "17.0.2",
65
66
  "tslint": "6.1.2",
66
67
  "tslint-config-prettier": "1.18.0",
67
68
  "typedoc": "0.21.4",
@@ -142,6 +142,11 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
142
142
  * The member is initiated without a value but will be set as soon as the component is being rendered.
143
143
  */
144
144
  private scrollView?;
145
+ /**
146
+ * A reference to the eventSubscription that'll be returned by addEventListener().
147
+ * It'll allow us to later remove the subscription.
148
+ */
149
+ private appStateSubscription?;
145
150
  /**
146
151
  * Steps:
147
152
  * 1. Call the super() method with the props.
@@ -178,7 +183,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
178
183
  * Called immediately before a component is destroyed.
179
184
  * Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.
180
185
  *
181
- * Clear the 15 minute timer that was set in the constructor during initialisation so it doesnt keep running and gets triggered after the recommendation screen was closed.
186
+ * Clear the 15 minute timer that was set in the constructor during initialisation so it doesn't keep running and gets triggered after the recommendation screen was closed.
182
187
  *
183
188
  * Steps:
184
189
  * 1. Call clearTimeout on the timer member variable.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppState, ScrollView, StyleSheet, View, YellowBox } from "react-native";
2
+ import { AppState, LogBox, ScrollView, StyleSheet, View } from "react-native";
3
3
  import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "./utils/Constants";
4
4
  import Header from "./components/Header";
5
5
  import InfoBars, { infoStyles } from "./components/InfoBars";
@@ -26,7 +26,7 @@ import { validateParams } from "./utils/Validations";
26
26
  const { InfoBarTestIds, RecommendationScreenTestIds } = Testing.Id;
27
27
  // Ignoring long timer warnings
28
28
  // https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
29
- YellowBox.ignoreWarnings([`Setting a timer`]);
29
+ LogBox.ignoreLogs([`Setting a timer`]);
30
30
  /**
31
31
  * The RecommendationScreen is the React component that passes relevant inputs to the recommendation calculation module and presents
32
32
  * the resulting recommendation along with related messages or warnings to the user.
@@ -389,13 +389,13 @@ export default class RecommendationScreen extends React.Component {
389
389
  * 1. Create a listener to call the handleAppStateChange() method when the app state changes.
390
390
  */
391
391
  componentDidMount() {
392
- AppState.addEventListener(`change`, this.handleAppStateChange);
392
+ this.appStateSubscription = AppState.addEventListener(`change`, this.handleAppStateChange);
393
393
  }
394
394
  /**
395
395
  * Called immediately before a component is destroyed.
396
396
  * Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.
397
397
  *
398
- * Clear the 15 minute timer that was set in the constructor during initialisation so it doesnt keep running and gets triggered after the recommendation screen was closed.
398
+ * Clear the 15 minute timer that was set in the constructor during initialisation so it doesn't keep running and gets triggered after the recommendation screen was closed.
399
399
  *
400
400
  * Steps:
401
401
  * 1. Call clearTimeout on the timer member variable.
@@ -405,7 +405,7 @@ export default class RecommendationScreen extends React.Component {
405
405
  if (this.timer !== undefined) {
406
406
  clearTimeout(this.timer);
407
407
  }
408
- AppState.removeEventListener(`change`, this.handleAppStateChange);
408
+ this.appStateSubscription?.remove();
409
409
  }
410
410
  /** Render a JSX element for displaying the insulin recommendation screen. */
411
411
  render() {
@@ -892,15 +892,14 @@ describe(`Recommendation Screen - TwoOptionModal related tests`, () => {
892
892
  test(`Opening the app with a old calculation will show the timeout modal`, () => {
893
893
  const props = getRecommendationProps();
894
894
  let appStateListener;
895
- const getMockAppStateListener = jest.fn((event, callback) => {
895
+ const getMockAppStateListener = jest.fn((event, listener) => {
896
896
  if (event === `change`) {
897
- appStateListener = callback;
897
+ appStateListener = listener;
898
898
  }
899
899
  });
900
900
  jest.resetModules();
901
901
  jest.doMock(`react-native/Libraries/AppState/AppState`, () => ({
902
902
  addEventListener: getMockAppStateListener,
903
- removeEventListener: jest.fn(),
904
903
  }));
905
904
  const wrapper = render(<RecommendationScreen {...props}/>);
906
905
  // @ts-ignore
@@ -914,7 +913,7 @@ describe(`Recommendation Screen - TwoOptionModal related tests`, () => {
914
913
  expectTextNotExists(wrapper, `No, return to dashboard`);
915
914
  global.Date.now = () => new Date().getTime() + Milliseconds.Minute * 15;
916
915
  // @ts-ignore
917
- appStateListener(`active`);
916
+ appStateListener?.(`active`);
918
917
  wrapper.rerender(<RecommendationScreen {...props}/>);
919
918
  expect(props.showBolusBar).toBeCalledWith(false);
920
919
  expectTextExists(wrapper, `No, return to dashboard`);
@@ -935,11 +934,10 @@ describe(`Recommendation Screen - TwoOptionModal related tests`, () => {
935
934
  jest.resetModules();
936
935
  jest.doMock(`react-native/Libraries/AppState/AppState`, () => ({
937
936
  addEventListener: getMockAppStateListener,
938
- removeEventListener: jest.fn(),
939
937
  }));
940
938
  const rendered = render(<RecommendationScreen {...props}/>);
941
939
  // @ts-ignore
942
- appStateListener(`NotAnAppStateStatus`);
940
+ appStateListener?.(`NotAnAppStateStatus`);
943
941
  rendered.rerender(<RecommendationScreen {...props}/>);
944
942
  expect(props.showBolusBar).not.toBeCalled();
945
943
  expectTextNotExists(rendered, `No, return to dashboard`);
@@ -1,42 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
- <dependencies>
4
- <deployment identifier="iOS"/>
5
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
- <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
- </dependencies>
8
- <objects>
9
- <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
- <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
- <view contentMode="scaleToFill" id="iN0-l3-epB">
12
- <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
- <subviews>
15
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
- <rect key="frame" x="20" y="439" width="441" height="21"/>
17
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
- <nil key="highlightedColor"/>
20
- </label>
21
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="HediaRecommendationScreen" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
- <rect key="frame" x="20" y="140" width="441" height="43"/>
23
- <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
- <nil key="highlightedColor"/>
26
- </label>
27
- </subviews>
28
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
- <constraints>
30
- <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
- <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
- <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
- <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
- <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
- <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
- </constraints>
37
- <nil key="simulatedStatusBarMetrics"/>
38
- <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
- <point key="canvasLocation" x="548" y="455"/>
40
- </view>
41
- </objects>
42
- </document>
@@ -1,53 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>en</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>APPL</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleSignature</key>
20
- <string>????</string>
21
- <key>CFBundleVersion</key>
22
- <string>1</string>
23
- <key>LSRequiresIPhoneOS</key>
24
- <true/>
25
- <key>NSAppTransportSecurity</key>
26
- <dict>
27
- <key>NSExceptionDomains</key>
28
- <dict>
29
- <key>localhost</key>
30
- <dict>
31
- <key>NSExceptionAllowsInsecureHTTPLoads</key>
32
- <true/>
33
- </dict>
34
- </dict>
35
- </dict>
36
- <key>NSLocationWhenInUseUsageDescription</key>
37
- <string></string>
38
- <key>UILaunchStoryboardName</key>
39
- <string>LaunchScreen</string>
40
- <key>UIRequiredDeviceCapabilities</key>
41
- <array>
42
- <string>armv7</string>
43
- </array>
44
- <key>UISupportedInterfaceOrientations</key>
45
- <array>
46
- <string>UIInterfaceOrientationPortrait</string>
47
- <string>UIInterfaceOrientationLandscapeLeft</string>
48
- <string>UIInterfaceOrientationLandscapeRight</string>
49
- </array>
50
- <key>UIViewControllerBasedStatusBarAppearance</key>
51
- <false/>
52
- </dict>
53
- </plist>
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>en</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>BNDL</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleSignature</key>
20
- <string>????</string>
21
- <key>CFBundleVersion</key>
22
- <string>1</string>
23
- </dict>
24
- </plist>