@hedia/recommendation-screen 1.0.0

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 (118) hide show
  1. package/.prettierignore +2 -0
  2. package/Changelog.md +5 -0
  3. package/README.md +3 -0
  4. package/android/app/BUCK +55 -0
  5. package/android/app/build.gradle +226 -0
  6. package/android/app/build_defs.bzl +19 -0
  7. package/android/app/debug.keystore +0 -0
  8. package/android/app/proguard-rules.pro +10 -0
  9. package/android/app/src/debug/AndroidManifest.xml +8 -0
  10. package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +72 -0
  11. package/android/app/src/main/AndroidManifest.xml +27 -0
  12. package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +15 -0
  13. package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +80 -0
  14. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  15. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  16. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  17. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  18. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  19. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  20. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  21. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  22. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  23. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  24. package/android/app/src/main/res/values/strings.xml +3 -0
  25. package/android/app/src/main/res/values/styles.xml +9 -0
  26. package/android/build.gradle +38 -0
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  29. package/android/gradle.properties +28 -0
  30. package/android/gradlew +188 -0
  31. package/android/gradlew.bat +100 -0
  32. package/android/settings.gradle +3 -0
  33. package/index-git.sh +5 -0
  34. package/index.d.ts +5 -0
  35. package/index.js +16 -0
  36. package/index.ts +19 -0
  37. package/ios/HediaRecommendationScreen/AppDelegate.h +8 -0
  38. package/ios/HediaRecommendationScreen/AppDelegate.m +58 -0
  39. package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +42 -0
  40. package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
  41. package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +6 -0
  42. package/ios/HediaRecommendationScreen/Info.plist +57 -0
  43. package/ios/HediaRecommendationScreen/main.m +9 -0
  44. package/ios/HediaRecommendationScreen-tvOS/Info.plist +53 -0
  45. package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +24 -0
  46. package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +807 -0
  47. package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +88 -0
  48. package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +88 -0
  49. package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +65 -0
  50. package/ios/HediaRecommendationScreenTests/Info.plist +24 -0
  51. package/ios/Podfile +104 -0
  52. package/package.json +75 -0
  53. package/src/RecommendationScreen.d.ts +42 -0
  54. package/src/RecommendationScreen.js +142 -0
  55. package/src/RecommendationScreen.tsx +210 -0
  56. package/src/assets/happy.png +0 -0
  57. package/src/assets/happy_active.png +0 -0
  58. package/src/assets/neutral.png +0 -0
  59. package/src/assets/neutral_active.png +0 -0
  60. package/src/assets/sad.png +0 -0
  61. package/src/assets/sad_active.png +0 -0
  62. package/src/assets/semi_happy.png +0 -0
  63. package/src/assets/semi_happy_active.png +0 -0
  64. package/src/assets/semi_sad.png +0 -0
  65. package/src/assets/semi_sad_active.png +0 -0
  66. package/src/components/Emotion.d.ts +14 -0
  67. package/src/components/Emotion.js +55 -0
  68. package/src/components/Emotion.tsx +71 -0
  69. package/src/components/Header.d.ts +52 -0
  70. package/src/components/Header.js +83 -0
  71. package/src/components/Header.tsx +94 -0
  72. package/src/components/Icon.js +41 -0
  73. package/src/components/InfoBars.d.ts +67 -0
  74. package/src/components/InfoBars.js +89 -0
  75. package/src/components/InfoBars.tsx +93 -0
  76. package/src/components/InvisibleNumberInput.d.ts +24 -0
  77. package/src/components/InvisibleNumberInput.js +64 -0
  78. package/src/components/InvisibleNumberInput.tsx +88 -0
  79. package/src/components/MoodIcon.d.ts +14 -0
  80. package/src/components/MoodIcon.js +53 -0
  81. package/src/components/MoodIcon.tsx +58 -0
  82. package/src/components/RecentInsulin.d.ts +9 -0
  83. package/src/components/RecentInsulin.js +91 -0
  84. package/src/components/RecentInsulin.tsx +97 -0
  85. package/src/components/RecommendedCarbs.d.ts +30 -0
  86. package/src/components/RecommendedCarbs.js +193 -0
  87. package/src/components/RecommendedCarbs.tsx +242 -0
  88. package/src/components/RecommendedInsulin.d.ts +22 -0
  89. package/src/components/RecommendedInsulin.js +110 -0
  90. package/src/components/RecommendedInsulin.tsx +147 -0
  91. package/src/components/Remeasure.d.ts +13 -0
  92. package/src/components/Remeasure.js +89 -0
  93. package/src/components/Remeasure.tsx +105 -0
  94. package/src/components/TransferToLogbook.d.ts +14 -0
  95. package/src/components/TransferToLogbook.js +81 -0
  96. package/src/components/TransferToLogbook.tsx +97 -0
  97. package/src/locale/da/messages.js +1 -0
  98. package/src/locale/da/messages.po +119 -0
  99. package/src/locale/en/messages.js +1 -0
  100. package/src/locale/en/messages.po +119 -0
  101. package/src/locale/i18nUtils.d.ts +5 -0
  102. package/src/locale/i18nUtils.js +22 -0
  103. package/src/locale/i18nUtils.ts +21 -0
  104. package/src/types/enum.d.ts +26 -0
  105. package/src/types/enum.js +34 -0
  106. package/src/types/enum.ts +30 -0
  107. package/src/types/types.d.ts +21 -0
  108. package/src/types/types.js +2 -0
  109. package/src/types/types.ts +23 -0
  110. package/src/utils/Constants.d.ts +3 -0
  111. package/src/utils/Constants.js +6 -0
  112. package/src/utils/Constants.ts +3 -0
  113. package/src/utils/RecommendationError.d.ts +9 -0
  114. package/src/utils/RecommendationError.js +17 -0
  115. package/src/utils/RecommendationError.ts +30 -0
  116. package/src/utils/Utils.d.ts +5 -0
  117. package/src/utils/Utils.js +24 -0
  118. package/src/utils/Utils.ts +26 -0
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1130"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
18
+ BuildableName = "HediaRecommendationScreen-tvOS.app"
19
+ BlueprintName = "HediaRecommendationScreen-tvOS"
20
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ <TestableReference
32
+ skipped = "NO">
33
+ <BuildableReference
34
+ BuildableIdentifier = "primary"
35
+ BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
36
+ BuildableName = "HediaRecommendationScreen-tvOSTests.xctest"
37
+ BlueprintName = "HediaRecommendationScreen-tvOSTests"
38
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
39
+ </BuildableReference>
40
+ </TestableReference>
41
+ </Testables>
42
+ </TestAction>
43
+ <LaunchAction
44
+ buildConfiguration = "Debug"
45
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47
+ launchStyle = "0"
48
+ useCustomWorkingDirectory = "NO"
49
+ ignoresPersistentStateOnLaunch = "NO"
50
+ debugDocumentVersioning = "YES"
51
+ debugServiceExtension = "internal"
52
+ allowLocationSimulation = "YES">
53
+ <BuildableProductRunnable
54
+ runnableDebuggingMode = "0">
55
+ <BuildableReference
56
+ BuildableIdentifier = "primary"
57
+ BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
58
+ BuildableName = "HediaRecommendationScreen-tvOS.app"
59
+ BlueprintName = "HediaRecommendationScreen-tvOS"
60
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
61
+ </BuildableReference>
62
+ </BuildableProductRunnable>
63
+ </LaunchAction>
64
+ <ProfileAction
65
+ buildConfiguration = "Release"
66
+ shouldUseLaunchSchemeArgsEnv = "YES"
67
+ savedToolIdentifier = ""
68
+ useCustomWorkingDirectory = "NO"
69
+ debugDocumentVersioning = "YES">
70
+ <BuildableProductRunnable
71
+ runnableDebuggingMode = "0">
72
+ <BuildableReference
73
+ BuildableIdentifier = "primary"
74
+ BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
75
+ BuildableName = "HediaRecommendationScreen-tvOS.app"
76
+ BlueprintName = "HediaRecommendationScreen-tvOS"
77
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
78
+ </BuildableReference>
79
+ </BuildableProductRunnable>
80
+ </ProfileAction>
81
+ <AnalyzeAction
82
+ buildConfiguration = "Debug">
83
+ </AnalyzeAction>
84
+ <ArchiveAction
85
+ buildConfiguration = "Release"
86
+ revealArchiveInOrganizer = "YES">
87
+ </ArchiveAction>
88
+ </Scheme>
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1130"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18
+ BuildableName = "HediaRecommendationScreen.app"
19
+ BlueprintName = "HediaRecommendationScreen"
20
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ <TestableReference
32
+ skipped = "NO">
33
+ <BuildableReference
34
+ BuildableIdentifier = "primary"
35
+ BlueprintIdentifier = "00E356ED1AD99517003FC87E"
36
+ BuildableName = "HediaRecommendationScreenTests.xctest"
37
+ BlueprintName = "HediaRecommendationScreenTests"
38
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
39
+ </BuildableReference>
40
+ </TestableReference>
41
+ </Testables>
42
+ </TestAction>
43
+ <LaunchAction
44
+ buildConfiguration = "Debug"
45
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47
+ launchStyle = "0"
48
+ useCustomWorkingDirectory = "NO"
49
+ ignoresPersistentStateOnLaunch = "NO"
50
+ debugDocumentVersioning = "YES"
51
+ debugServiceExtension = "internal"
52
+ allowLocationSimulation = "YES">
53
+ <BuildableProductRunnable
54
+ runnableDebuggingMode = "0">
55
+ <BuildableReference
56
+ BuildableIdentifier = "primary"
57
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
58
+ BuildableName = "HediaRecommendationScreen.app"
59
+ BlueprintName = "HediaRecommendationScreen"
60
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
61
+ </BuildableReference>
62
+ </BuildableProductRunnable>
63
+ </LaunchAction>
64
+ <ProfileAction
65
+ buildConfiguration = "Release"
66
+ shouldUseLaunchSchemeArgsEnv = "YES"
67
+ savedToolIdentifier = ""
68
+ useCustomWorkingDirectory = "NO"
69
+ debugDocumentVersioning = "YES">
70
+ <BuildableProductRunnable
71
+ runnableDebuggingMode = "0">
72
+ <BuildableReference
73
+ BuildableIdentifier = "primary"
74
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
75
+ BuildableName = "HediaRecommendationScreen.app"
76
+ BlueprintName = "HediaRecommendationScreen"
77
+ ReferencedContainer = "container:HediaRecommendationScreen.xcodeproj">
78
+ </BuildableReference>
79
+ </BuildableProductRunnable>
80
+ </ProfileAction>
81
+ <AnalyzeAction
82
+ buildConfiguration = "Debug">
83
+ </AnalyzeAction>
84
+ <ArchiveAction
85
+ buildConfiguration = "Release"
86
+ revealArchiveInOrganizer = "YES">
87
+ </ArchiveAction>
88
+ </Scheme>
@@ -0,0 +1,65 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <XCTest/XCTest.h>
3
+
4
+ #import <React/RCTLog.h>
5
+ #import <React/RCTRootView.h>
6
+
7
+ #define TIMEOUT_SECONDS 600
8
+ #define TEXT_TO_LOOK_FOR @"Welcome to React"
9
+
10
+ @interface HediaRecommendationScreenTests : XCTestCase
11
+
12
+ @end
13
+
14
+ @implementation HediaRecommendationScreenTests
15
+
16
+ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
17
+ {
18
+ if (test(view)) {
19
+ return YES;
20
+ }
21
+ for (UIView *subview in [view subviews]) {
22
+ if ([self findSubviewInView:subview matching:test]) {
23
+ return YES;
24
+ }
25
+ }
26
+ return NO;
27
+ }
28
+
29
+ - (void)testRendersWelcomeScreen
30
+ {
31
+ UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32
+ NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33
+ BOOL foundElement = NO;
34
+
35
+ __block NSString *redboxError = nil;
36
+ #ifdef DEBUG
37
+ RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
38
+ if (level >= RCTLogLevelError) {
39
+ redboxError = message;
40
+ }
41
+ });
42
+ #endif
43
+
44
+ while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
45
+ [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
46
+ [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47
+
48
+ foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
49
+ if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
50
+ return YES;
51
+ }
52
+ return NO;
53
+ }];
54
+ }
55
+
56
+ #ifdef DEBUG
57
+ RCTSetLogFunction(RCTDefaultLogFunction);
58
+ #endif
59
+
60
+ XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
61
+ XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
62
+ }
63
+
64
+
65
+ @end
@@ -0,0 +1,24 @@
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>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>
package/ios/Podfile ADDED
@@ -0,0 +1,104 @@
1
+ platform :ios, '9.0'
2
+ require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3
+
4
+ def add_flipper_pods!(versions = {})
5
+ versions['Flipper'] ||= '~> 0.33.1'
6
+ versions['DoubleConversion'] ||= '1.1.7'
7
+ versions['Flipper-Folly'] ||= '~> 2.1'
8
+ versions['Flipper-Glog'] ||= '0.3.6'
9
+ versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
10
+ versions['Flipper-RSocket'] ||= '~> 1.0'
11
+
12
+ pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug'
13
+ pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug'
14
+ pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
15
+ pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
16
+ pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'
17
+
18
+ # List all transitive dependencies for FlipperKit pods
19
+ # to avoid them being linked in Release builds
20
+ pod 'Flipper', versions['Flipper'], :configuration => 'Debug'
21
+ pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug'
22
+ pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug'
23
+ pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug'
24
+ pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug'
25
+ pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug'
26
+ pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug'
27
+ pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
28
+ pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
29
+ pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
30
+ pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
31
+ pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
32
+ pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
33
+ pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
34
+ end
35
+
36
+ # Post Install processing for Flipper
37
+ def flipper_post_install(installer)
38
+ installer.pods_project.targets.each do |target|
39
+ if target.name == 'YogaKit'
40
+ target.build_configurations.each do |config|
41
+ config.build_settings['SWIFT_VERSION'] = '4.1'
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ target 'HediaRecommendationScreen' do
48
+ # Pods for HediaRecommendationScreen
49
+ pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
50
+ pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
51
+ pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
52
+ pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
53
+ pod 'React', :path => '../node_modules/react-native/'
54
+ pod 'React-Core', :path => '../node_modules/react-native/'
55
+ pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
56
+ pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
57
+ pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
58
+ pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
59
+ pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
60
+ pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
61
+ pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
62
+ pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
63
+ pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
64
+ pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
65
+ pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
66
+ pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
67
+
68
+ pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
69
+ pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
70
+ pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
71
+ pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
72
+ pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
73
+ pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
74
+ pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
75
+
76
+ pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
77
+ pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
78
+ pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
79
+
80
+ target 'HediaRecommendationScreenTests' do
81
+ inherit! :complete
82
+ # Pods for testing
83
+ end
84
+
85
+ use_native_modules!
86
+
87
+ # Enables Flipper.
88
+ #
89
+ # Note that if you have use_frameworks! enabled, Flipper will not work and
90
+ # you should disable these next few lines.
91
+ add_flipper_pods!
92
+ post_install do |installer|
93
+ flipper_post_install(installer)
94
+ end
95
+ end
96
+
97
+ target 'HediaRecommendationScreen-tvOS' do
98
+ # Pods for HediaRecommendationScreen-tvOS
99
+
100
+ target 'HediaRecommendationScreen-tvOSTests' do
101
+ inherit! :search_paths
102
+ # Pods for testing
103
+ end
104
+ end
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@hedia/recommendation-screen",
3
+ "version": "1.0.0",
4
+ "description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "a": "cd android && gradlew clean && cd .. && react-native run-android",
8
+ "start": "react-native start",
9
+ "la": "cd ./android && ./gradlew clean && cd .. && gnome-terminal -- /bin/bash -c \"wmctrl -c 'Terminal';react-native start $SHELL\" && react-native run-android",
10
+ "lint": "tslint --project .",
11
+ "lint-fix": "tslint --fix --project .",
12
+ "lint-pkg": "npmPkgJsonLint .",
13
+ "prettier": "npx prettier --check \"src/**/*.{ts,tsx}\"",
14
+ "test": "npm run tsc-clean && jest",
15
+ "test-coverage": "npm run tsc-clean && jest --coverage",
16
+ "tsc": "tsc",
17
+ "tsc-clean": "tsc --build --clean",
18
+ "prepublish": "npm run lint && npm run lint-pkg && npm run prettier && npm run test-coverage && npm run tsc",
19
+ "publish-patch": "npm version patch && ./ignore-publish.sh && npm publish",
20
+ "publish-minor": "npm version minor && ./ignore-publish.sh && npm publish",
21
+ "publish-major": "npm version major && ./ignore-publish.sh && npm publish",
22
+ "postpublish": "./ignore-git.sh && ./index-git.sh && git push",
23
+ "add-locale": "lingui add-locale",
24
+ "extract": "lingui extract",
25
+ "compile": "npm run cleanLanguage && lingui compile",
26
+ "cleanLanguage": "node ./src/locale/CleanLanguage.ts"
27
+ },
28
+ "keywords": [
29
+ "Hedia",
30
+ "Bolus",
31
+ "Screen",
32
+ "Carbs",
33
+ "Carbohydrate",
34
+ "Insulin"
35
+ ],
36
+ "author": "Hedia",
37
+ "license": "ISC",
38
+ "dependencies": {
39
+ "@hedia/recommendation-calculator": "1.1.2",
40
+ "@lingui/react": "2.9.1",
41
+ "@react-native-community/slider": "3.0.0",
42
+ "react": "16.13.1",
43
+ "react-native": "0.62.2",
44
+ "react-native-linear-gradient": "2.5.6",
45
+ "react-native-vector-icons": "6.6.0"
46
+ },
47
+ "devDependencies": {
48
+ "@babel/core": "7.10.3",
49
+ "@babel/preset-env": "7.10.2",
50
+ "@babel/preset-react": "7.10.1",
51
+ "@babel/preset-typescript": "7.10.1",
52
+ "@lingui/babel-preset-react": "2.9.1",
53
+ "@lingui/cli": "2.9.1",
54
+ "@lingui/macro": "2.9.1",
55
+ "@testing-library/jest-native": "3.1.0",
56
+ "@types/jest": "25.2.3",
57
+ "@types/lingui__core": "2.7.0",
58
+ "@types/lingui__macro": "2.7.3",
59
+ "@types/lingui__react": "2.8.2",
60
+ "@types/react": "16.9.35",
61
+ "@types/react-native": "0.62.13",
62
+ "babel-core": "7.0.0-bridge.0",
63
+ "babel-jest": "26.0.1",
64
+ "babel-loader": "8.1.0",
65
+ "babel-plugin-macros": "2.8.0",
66
+ "jest": "26.0.1",
67
+ "metro-react-native-babel-preset": "0.58.0",
68
+ "npm-package-json-lint": "5.1.0",
69
+ "react-native-testing-library": "2.1.0",
70
+ "react-test-renderer": "16.13.1",
71
+ "tslint": "6.1.2",
72
+ "tslint-config-prettier": "1.18.0",
73
+ "typescript": "3.9.5"
74
+ }
75
+ }
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { BGUnit, InjectionMethod, Languages, MoodEnum } from "./types/enum";
3
+ import * as Calculator from "@hedia/recommendation-calculator";
4
+ import { RecommendationError } from "./utils/RecommendationError";
5
+ interface IResult {
6
+ suggested: number;
7
+ entered?: number;
8
+ }
9
+ export interface IRecommendationProps {
10
+ units: BGUnit;
11
+ language: Languages;
12
+ calculatorParams: Calculator.IRecommendationParams;
13
+ injectionMethod: InjectionMethod;
14
+ exitCallback(): void;
15
+ removeRecommendedCarbs(): void;
16
+ onRecentInsulinYes(): void;
17
+ transferToLogbook(carbs: IResult, insulin: IResult, reminder: number): void;
18
+ onError(error: RecommendationError): void;
19
+ }
20
+ interface IState {
21
+ remeasureTime: number;
22
+ showRecentInsulin: boolean;
23
+ insulinRecommendation: number;
24
+ activityReduction?: number;
25
+ carbRecommendation: number;
26
+ activeInsulin: number;
27
+ selectedMood: MoodEnum | 0;
28
+ enteredCarbs?: number;
29
+ enteredInsulin?: number;
30
+ }
31
+ export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
32
+ constructor(props: IRecommendationProps);
33
+ updateRemeasureTime: (remeasureTime: number) => void;
34
+ handleNoRecentInsulin: () => void;
35
+ removeCarbRecommendation: () => void;
36
+ handleMoodSelected: (selectedMood: IState["selectedMood"]) => void;
37
+ updateCarbRecommendation: (enteredCarbs: number) => void;
38
+ updateInsulinRecommendation: (enteredInsulin: number) => void;
39
+ handleTransfer: () => void;
40
+ render(): JSX.Element;
41
+ }
42
+ export {};
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const react_1 = __importDefault(require("react"));
26
+ const react_native_1 = require("react-native");
27
+ const Constants_1 = require("./utils/Constants");
28
+ const Header_1 = __importStar(require("./components/Header"));
29
+ const InfoBars_1 = __importStar(require("./components/InfoBars"));
30
+ const RecentInsulin_1 = __importDefault(require("./components/RecentInsulin"));
31
+ const RecommendedCarbs_1 = __importDefault(require("./components/RecommendedCarbs"));
32
+ const RecommendedInsulin_1 = __importDefault(require("./components/RecommendedInsulin"));
33
+ const Remeasure_1 = __importDefault(require("./components/Remeasure"));
34
+ const Calculator = __importStar(require("@hedia/recommendation-calculator"));
35
+ const macro_1 = require("@lingui/macro");
36
+ const react_2 = require("@lingui/react");
37
+ const Emotion_1 = __importDefault(require("./components/Emotion"));
38
+ const TransferToLogbook_1 = __importDefault(require("./components/TransferToLogbook"));
39
+ const i18nUtils_1 = require("./locale/i18nUtils");
40
+ const Utils_1 = require("./utils/Utils");
41
+ class RecommendationScreen extends react_1.default.Component {
42
+ constructor(props) {
43
+ super(props);
44
+ this.updateRemeasureTime = (remeasureTime) => {
45
+ this.setState({
46
+ remeasureTime,
47
+ });
48
+ };
49
+ this.handleNoRecentInsulin = () => {
50
+ this.setState({
51
+ showRecentInsulin: false,
52
+ });
53
+ };
54
+ this.removeCarbRecommendation = () => {
55
+ this.setState({
56
+ enteredCarbs: null,
57
+ carbRecommendation: null,
58
+ });
59
+ this.props.removeRecommendedCarbs();
60
+ };
61
+ this.handleMoodSelected = (selectedMood) => {
62
+ this.setState({
63
+ selectedMood,
64
+ });
65
+ };
66
+ this.updateCarbRecommendation = (enteredCarbs) => {
67
+ this.setState({
68
+ enteredCarbs,
69
+ });
70
+ };
71
+ this.updateInsulinRecommendation = (enteredInsulin) => {
72
+ this.setState({
73
+ enteredInsulin,
74
+ });
75
+ };
76
+ this.handleTransfer = () => {
77
+ this.props.transferToLogbook({
78
+ suggested: this.state.carbRecommendation,
79
+ entered: this.state.enteredCarbs,
80
+ }, {
81
+ suggested: this.state.insulinRecommendation,
82
+ entered: this.state.enteredInsulin,
83
+ }, this.state.remeasureTime);
84
+ };
85
+ i18nUtils_1.changeLanguage(props.language);
86
+ const { bolus, carbRecommendation, activityReduction } = Calculator.calculateRecommendation(props.calculatorParams);
87
+ this.state = {
88
+ remeasureTime: 1.5,
89
+ showRecentInsulin: true,
90
+ insulinRecommendation: Utils_1.Utils.roundValue(bolus, props.injectionMethod),
91
+ activityReduction,
92
+ carbRecommendation,
93
+ activeInsulin: 0.0,
94
+ selectedMood: 0,
95
+ };
96
+ }
97
+ render() {
98
+ return (<react_2.I18nProvider language={this.props.language} i18n={i18nUtils_1.i18n}>
99
+ <react_native_1.ScrollView style={containerStyles.container}>
100
+ <Header_1.default exitCallback={this.props.exitCallback}/>
101
+ <InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Active Insulin`)} value={`${this.state.activeInsulin}`} units={i18nUtils_1.i18n._(macro_1.t `units`)} showZeroAsDash={false}/>
102
+ <InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`)} value={`${this.props.calculatorParams.currentBGL}`} units={this.props.units} showZeroAsDash={true}/>
103
+ <react_native_1.View style={containerStyles.calcContainer}>
104
+ <react_native_1.View style={containerStyles.calcMargin}>
105
+ <react_native_1.View style={[
106
+ containerStyles.calcBorder,
107
+ {
108
+ borderColor: this.state.carbRecommendation
109
+ ? Constants_1.BORDER_COLOUR_TEAL
110
+ : Constants_1.BORDER_COLOUR_WHITE,
111
+ },
112
+ ]}>
113
+ <RecommendedCarbs_1.default enteredCarbs={`${this.props.calculatorParams.carbohydrates}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${this.state.enteredCarbs ?? this.state.carbRecommendation}`} removeRecommendedCarbs={this.removeCarbRecommendation} onError={this.props.onError}/>
114
+ <Remeasure_1.default onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
115
+ </react_native_1.View>
116
+ </react_native_1.View>
117
+ </react_native_1.View>
118
+ {this.state.showRecentInsulin ? (<RecentInsulin_1.default onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin_1.default injectionMethod={this.props.injectionMethod} insulinRecommendation={this.state.enteredInsulin ?? this.state.insulinRecommendation} activityReduction={this.state.activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation} onError={this.props.onError}/>)}
119
+ <Emotion_1.default moodSelected={this.handleMoodSelected}/>
120
+ <TransferToLogbook_1.default visible={!this.state.showRecentInsulin} transfer={this.handleTransfer}/>
121
+ </react_native_1.ScrollView>
122
+ </react_2.I18nProvider>);
123
+ }
124
+ }
125
+ exports.default = RecommendationScreen;
126
+ const containerStyles = react_native_1.StyleSheet.create({
127
+ container: {
128
+ flex: 1,
129
+ backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE,
130
+ },
131
+ calcContainer: {
132
+ flex: 1,
133
+ },
134
+ calcMargin: {
135
+ flex: 1,
136
+ margin: Header_1.headerStyles.margin.margin,
137
+ },
138
+ calcBorder: {
139
+ ...InfoBars_1.infoStyles.border,
140
+ borderColor: Constants_1.BORDER_COLOUR_TEAL,
141
+ },
142
+ });