From b0019d85e076a97f836079c5c5afa9c0274f55c9 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Wed, 22 Aug 2018 19:15:39 +0200 Subject: [PATCH 01/12] Install dep --- android/.project | 17 ++ .../org.eclipse.buildship.core.prefs | 2 + android/app/.classpath | 6 + android/app/.project | 23 ++ .../org.eclipse.buildship.core.prefs | 2 + android/app/build.gradle | 1 + .../main/java/com/drip/MainApplication.java | 2 + android/build.gradle | 2 +- android/settings.gradle | 2 + ios/drip.xcodeproj/project.pbxproj | 19 ++ package-lock.json | 200 +++++++++--------- package.json | 1 + 12 files changed, 177 insertions(+), 100 deletions(-) create mode 100644 android/.project create mode 100644 android/.settings/org.eclipse.buildship.core.prefs create mode 100644 android/app/.classpath create mode 100644 android/app/.project create mode 100644 android/app/.settings/org.eclipse.buildship.core.prefs diff --git a/android/.project b/android/.project new file mode 100644 index 0000000..ce7fcb4 --- /dev/null +++ b/android/.project @@ -0,0 +1,17 @@ + + + drip + Project drip created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/android/app/.classpath b/android/app/.classpath new file mode 100644 index 0000000..eb19361 --- /dev/null +++ b/android/app/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/android/app/.project b/android/app/.project new file mode 100644 index 0000000..ac485d7 --- /dev/null +++ b/android/app/.project @@ -0,0 +1,23 @@ + + + app + Project app created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/android/app/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/android/app/build.gradle b/android/app/build.gradle index fa56b47..83f5938 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,6 +138,7 @@ android { } dependencies { + compile project(':react-native-notifications') compile project(':react-native-vector-icons') compile project(':react-native-fs') compile project(':react-native-document-picker') diff --git a/android/app/src/main/java/com/drip/MainApplication.java b/android/app/src/main/java/com/drip/MainApplication.java index 4dc63a4..47d0dfd 100644 --- a/android/app/src/main/java/com/drip/MainApplication.java +++ b/android/app/src/main/java/com/drip/MainApplication.java @@ -3,6 +3,7 @@ package com.drip; import android.app.Application; import com.facebook.react.ReactApplication; +import com.wix.reactnativenotifications.RNNotificationsPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.rnfs.RNFSPackage; import com.reactnativedocumentpicker.ReactNativeDocumentPicker; @@ -29,6 +30,7 @@ public class MainApplication extends Application implements ReactApplication, Sh protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new RNNotificationsPackage(MainApplication.this), new VectorIconsPackage(), new RNFSPackage(), new ReactNativeDocumentPicker(), diff --git a/android/build.gradle b/android/build.gradle index 3d21e10..9c37a08 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,7 +30,7 @@ allprojects { ext { buildToolsVersion = "26.0.3" - minSdkVersion = 16 + minSdkVersion = 19 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = "26.1.0" diff --git a/android/settings.gradle b/android/settings.gradle index 6a9c8c8..c9e7814 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'drip' +include ':react-native-notifications' +project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-fs' diff --git a/ios/drip.xcodeproj/project.pbxproj b/ios/drip.xcodeproj/project.pbxproj index 25f1f76..33e6850 100644 --- a/ios/drip.xcodeproj/project.pbxproj +++ b/ios/drip.xcodeproj/project.pbxproj @@ -58,6 +58,7 @@ A1410AC4C98A49B2820D9E45 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B6F5078F7DEC470782757471 /* Zocial.ttf */; }; 29DF0CCC1AEA4C92BCA0BCCD /* libRNDocumentPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */; }; 17AD822C42A44BADA96BD860 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84CCEBD3B2C44758853BC941 /* libRNFS.a */; }; + E4B64D87B7934535B40E787A /* libRNNotifications.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7E1DC8298CC4C6C9E2F5B83 /* libRNNotifications.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -389,6 +390,8 @@ D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */ = {isa = PBXFileReference; name = "libRNDocumentPicker.a"; path = "libRNDocumentPicker.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; 49089E09BFCF4F3DB209B6E9 /* RNFS.xcodeproj */ = {isa = PBXFileReference; name = "RNFS.xcodeproj"; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; 84CCEBD3B2C44758853BC941 /* libRNFS.a */ = {isa = PBXFileReference; name = "libRNFS.a"; path = "libRNFS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + FD8183079FD143548AF51C50 /* RNNotifications.xcodeproj */ = {isa = PBXFileReference; name = "RNNotifications.xcodeproj"; path = "../node_modules/react-native-notifications/RNNotifications/RNNotifications.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + A7E1DC8298CC4C6C9E2F5B83 /* libRNNotifications.a */ = {isa = PBXFileReference; name = "libRNNotifications.a"; path = "libRNNotifications.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -424,6 +427,7 @@ AED64B7892744F21B3A156BB /* libRNVectorIcons.a in Frameworks */, 29DF0CCC1AEA4C92BCA0BCCD /* libRNDocumentPicker.a in Frameworks */, 17AD822C42A44BADA96BD860 /* libRNFS.a in Frameworks */, + E4B64D87B7934535B40E787A /* libRNNotifications.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -618,6 +622,7 @@ D1E5ACC4B66345868F556374 /* RNVectorIcons.xcodeproj */, 1F05FE29622E4F21AF70C2B7 /* RNDocumentPicker.xcodeproj */, 49089E09BFCF4F3DB209B6E9 /* RNFS.xcodeproj */, + FD8183079FD143548AF51C50 /* RNNotifications.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1284,6 +1289,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1292,6 +1298,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1315,6 +1322,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1323,6 +1331,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1349,6 +1358,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1374,6 +1384,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1406,6 +1417,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1414,6 +1426,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1446,6 +1459,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1454,6 +1468,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1485,6 +1500,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1493,6 +1509,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1524,6 +1541,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1532,6 +1550,7 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", + "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; diff --git a/package-lock.json b/package-lock.json index 9c136b0..f1ec9f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3721,8 +3721,8 @@ "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "optional": true, "requires": { - "nan": "2.10.0", - "node-pre-gyp": "0.10.0" + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" }, "dependencies": { "abbrev": { @@ -3744,21 +3744,19 @@ "bundled": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -3769,18 +3767,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -3815,7 +3810,7 @@ "bundled": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "fs.realpath": { @@ -3828,14 +3823,14 @@ "bundled": true, "optional": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "glob": { @@ -3843,12 +3838,12 @@ "bundled": true, "optional": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "has-unicode": { @@ -3861,7 +3856,7 @@ "bundled": true, "optional": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "^2.1.0" } }, "ignore-walk": { @@ -3869,7 +3864,7 @@ "bundled": true, "optional": true, "requires": { - "minimatch": "3.0.4" + "minimatch": "^3.0.4" } }, "inflight": { @@ -3877,14 +3872,13 @@ "bundled": true, "optional": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -3894,9 +3888,8 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "isarray": { @@ -3907,23 +3900,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.2.4", "bundled": true, - "optional": true, "requires": { - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, "minizlib": { @@ -3931,13 +3921,12 @@ "bundled": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3952,9 +3941,9 @@ "bundled": true, "optional": true, "requires": { - "debug": "2.6.9", - "iconv-lite": "0.4.21", - "sax": "1.2.4" + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" } }, "node-pre-gyp": { @@ -3962,16 +3951,16 @@ "bundled": true, "optional": true, "requires": { - "detect-libc": "1.0.3", - "mkdirp": "0.5.1", - "needle": "2.2.0", - "nopt": "4.0.1", - "npm-packlist": "1.1.10", - "npmlog": "4.1.2", - "rc": "1.2.7", - "rimraf": "2.6.2", - "semver": "5.5.0", - "tar": "4.4.1" + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" } }, "nopt": { @@ -3979,8 +3968,8 @@ "bundled": true, "optional": true, "requires": { - "abbrev": "1.1.1", - "osenv": "0.1.5" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npm-bundled": { @@ -3993,8 +3982,8 @@ "bundled": true, "optional": true, "requires": { - "ignore-walk": "3.0.1", - "npm-bundled": "1.0.3" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, "npmlog": { @@ -4002,16 +3991,15 @@ "bundled": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -4021,9 +4009,8 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -4041,8 +4028,8 @@ "bundled": true, "optional": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "path-is-absolute": { @@ -4060,10 +4047,10 @@ "bundled": true, "optional": true, "requires": { - "deep-extend": "0.5.1", - "ini": "1.3.5", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -4078,13 +4065,13 @@ "bundled": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "rimraf": { @@ -4092,7 +4079,7 @@ "bundled": true, "optional": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -4127,11 +4114,10 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -4139,14 +4125,14 @@ "bundled": true, "optional": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { "version": "3.0.1", "bundled": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -4159,13 +4145,13 @@ "bundled": true, "optional": true, "requires": { - "chownr": "1.0.1", - "fs-minipass": "1.2.5", - "minipass": "2.2.4", - "minizlib": "1.1.0", - "mkdirp": "0.5.1", - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" } }, "util-deprecate": { @@ -4178,7 +4164,7 @@ "bundled": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { @@ -6685,6 +6671,22 @@ } } }, + "react-native-notifications": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/react-native-notifications/-/react-native-notifications-1.1.20.tgz", + "integrity": "sha512-55DvP6/W13Hum7fZE7U4o3Ge07zA3FxqOFtLBLMYvMHzGhEe7czDe7/9zd8aoo9lJPI1TWVWdwhXhKrT4GalYA==", + "requires": { + "core-js": "^1.0.0", + "uuid": "^2.0.3" + }, + "dependencies": { + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" + } + } + }, "react-native-safe-area-view": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.8.0.tgz", diff --git a/package.json b/package.json index 2c492c5..fd40b44 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "react-native-document-picker": "^2.1.0", "react-native-fs": "^2.10.14", "react-native-modal-datetime-picker-nevo": "^4.11.0", + "react-native-notifications": "^1.1.20", "react-native-share": "^1.1.0", "react-native-simple-radio-button": "^2.7.1", "react-native-vector-icons": "^5.0.0", From 6c6d8ae03842054e50c0ea5dc724c0af5b2b859a Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Wed, 22 Aug 2018 19:38:53 +0200 Subject: [PATCH 02/12] Add reminder setting --- components/home.js | 1 + components/labels.js | 4 ++++ components/settings.js | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/components/home.js b/components/home.js index 2962492..d43521b 100644 --- a/components/home.js +++ b/components/home.js @@ -9,6 +9,7 @@ import { LocalDate } from 'js-joda' import styles from '../styles/index' import cycleModule from '../lib/cycle' import { getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithDummyData, deleteAll } from '../db' +import {NotificationsAndroid} from 'react-native-notifications' const getCycleDayNumber = cycleModule().getCycleDayNumber diff --git a/components/labels.js b/components/labels.js index b249e37..5d4ac97 100644 --- a/components/labels.js +++ b/components/labels.js @@ -42,6 +42,10 @@ export const settings = { max: 'Max', loadError: 'Could not load saved temperature scale settings', saveError: 'Could not save temperature scale settings' + }, + tempReminder: { + title: 'Temperature reminder', + explainer: 'Set a morning reminder to take your temperature' } } diff --git a/components/settings.js b/components/settings.js index f03aec9..c2b0f30 100644 --- a/components/settings.js +++ b/components/settings.js @@ -4,8 +4,11 @@ import { TouchableOpacity, ScrollView, Alert, - Text + Text, + TextInput, + Keyboard } from 'react-native' +import DateTimePicker from 'react-native-modal-datetime-picker-nevo' import Slider from '@ptomasroos/react-native-multi-slider' import Share from 'react-native-share' import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker' @@ -18,9 +21,39 @@ import importCsv from '../lib/import-export/import-from-csv' import { scaleObservable, saveTempScale } from '../local-storage' export default class Settings extends Component { + constructor(props) { + super(props) + this.state = {} + } + render() { return ( + + + {settingsLabels.tempReminder.title} + + {settingsLabels.tempReminder.explainer} + { + Keyboard.dismiss() + this.setState({ isTimePickerVisible: true }) + }} + value={this.state.time} + /> + { + this.setState({ + time: `${jsDate.getHours()}:${jsDate.getMinutes()}`, + isTimePickerVisible: false + }) + }} + onCancel={() => this.setState({ isTimePickerVisible: false })} + /> + {settingsLabels.tempScale.segmentTitle} From a5b7e1064e0b654dfe3c91e03f54c941e1903cac Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 09:41:07 +0200 Subject: [PATCH 03/12] Pad time value with 0s --- components/settings.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/components/settings.js b/components/settings.js index c2b0f30..5681bd3 100644 --- a/components/settings.js +++ b/components/settings.js @@ -29,31 +29,31 @@ export default class Settings extends Component { render() { return ( - + this.setState({ isTimePickerVisible: true })} + > {settingsLabels.tempReminder.title} - {settingsLabels.tempReminder.explainer} - { - Keyboard.dismiss() - this.setState({ isTimePickerVisible: true }) - }} - value={this.state.time} - /> + {this.state.time ? + {settingsLabels.tempReminder.explainerChange} + : + {settingsLabels.tempReminder.explainer} + } + {this.state.time} { this.setState({ - time: `${jsDate.getHours()}:${jsDate.getMinutes()}`, + time: padWithZeros(`${jsDate.getHours()}:${jsDate.getMinutes()}`), isTimePickerVisible: false }) }} onCancel={() => this.setState({ isTimePickerVisible: false })} /> - + {settingsLabels.tempScale.segmentTitle} @@ -232,3 +232,13 @@ function importError(msg) { const postFixed = `${msg}\n\n${settingsLabels.import.errors.postFix}` alertError(postFixed) } + +function padWithZeros(time) { + const vals = time.split(':') + return vals.map(val => { + if (parseInt(val) < 10) { + val = `0${val}` + } + return val + }).join(':') +} \ No newline at end of file From de858fe8c2e526e462209854498707db353eefc9 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 10:04:57 +0200 Subject: [PATCH 04/12] Style temp reminder setting --- components/labels.js | 3 ++- components/settings.js | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/components/labels.js b/components/labels.js index 5d4ac97..a70e66f 100644 --- a/components/labels.js +++ b/components/labels.js @@ -45,7 +45,8 @@ export const settings = { }, tempReminder: { title: 'Temperature reminder', - explainer: 'Set a morning reminder to take your temperature' + noTimeSet: 'Set a time for a daily reminder to take your temperature', + timeSet: time => `Daily reminder set for ${time}` } } diff --git a/components/settings.js b/components/settings.js index 5681bd3..9f0451a 100644 --- a/components/settings.js +++ b/components/settings.js @@ -5,8 +5,7 @@ import { ScrollView, Alert, Text, - TextInput, - Keyboard + Switch } from 'react-native' import DateTimePicker from 'react-native-modal-datetime-picker-nevo' import Slider from '@ptomasroos/react-native-multi-slider' @@ -36,12 +35,20 @@ export default class Settings extends Component { {settingsLabels.tempReminder.title} - {this.state.time ? - {settingsLabels.tempReminder.explainerChange} - : - {settingsLabels.tempReminder.explainer} - } - {this.state.time} + + + {this.state.time ? + {settingsLabels.tempReminder.timeSet(this.state.time)} + : + {settingsLabels.tempReminder.noTimeSet} + } + + this.setState({ tempReminderEnabled: val })} + onTintColor={secondaryColor} + /> + Date: Mon, 27 Aug 2018 10:59:53 +0200 Subject: [PATCH 05/12] Save temp reminder settings --- components/settings.js | 79 ++++++++++++++++++++++++++++-------------- local-storage/index.js | 25 ++++++++----- 2 files changed, 70 insertions(+), 34 deletions(-) diff --git a/components/settings.js b/components/settings.js index 9f0451a..b56eb06 100644 --- a/components/settings.js +++ b/components/settings.js @@ -17,7 +17,12 @@ import config from '../config' import { settings as settingsLabels, shared as sharedLabels } from './labels' import getDataAsCsvDataUri from '../lib/import-export/export-to-csv' import importCsv from '../lib/import-export/import-from-csv' -import { scaleObservable, saveTempScale } from '../local-storage' +import { + scaleObservable, + saveTempScale, + tempReminderObservable, + saveTempReminder +} from '../local-storage' export default class Settings extends Component { constructor(props) { @@ -35,31 +40,7 @@ export default class Settings extends Component { {settingsLabels.tempReminder.title} - - - {this.state.time ? - {settingsLabels.tempReminder.timeSet(this.state.time)} - : - {settingsLabels.tempReminder.noTimeSet} - } - - this.setState({ tempReminderEnabled: val })} - onTintColor={secondaryColor} - /> - - { - this.setState({ - time: padWithZeros(`${jsDate.getHours()}:${jsDate.getMinutes()}`), - isTimePickerVisible: false - }) - }} - onCancel={() => this.setState({ isTimePickerVisible: false })} - /> + @@ -99,6 +80,52 @@ export default class Settings extends Component { } } +class TempReminderPicker extends Component { + constructor(props) { + super(props) + this.state = Object.assign({}, tempReminderObservable.value) + } + + render() { + return ( + + + {this.state.time && this.state.enabled ? + {settingsLabels.tempReminder.timeSet(this.state.time)} + : + {settingsLabels.tempReminder.noTimeSet} + } + + { + this.setState({ enabled: val }) + if (val && !this.state.time) this.setState({ isTimePickerVisible: true }) + if (!val) saveTempReminder({ enabled: false }) + }} + onTintColor={secondaryColor} + /> + { + const time = padWithZeros(`${jsDate.getHours()}:${jsDate.getMinutes()}`) + this.setState({ + time, + isTimePickerVisible: false + }) + saveTempReminder({ + time, + enabled: true + }) + }} + onCancel={() => this.setState({ isTimePickerVisible: false })} + /> + + ) + } +} + class TempSlider extends Component { constructor(props) { super(props) diff --git a/local-storage/index.js b/local-storage/index.js index 50d886f..6296271 100644 --- a/local-storage/index.js +++ b/local-storage/index.js @@ -3,20 +3,25 @@ import Observable from 'obv' import config from '../config' export const scaleObservable = Observable() -setTempScaleInitially() +setObvWithInitValue('tempScale', scaleObservable, { + min: config.temperatureScale.defaultLow, + max: config.temperatureScale.defaultHigh +}) -async function setTempScaleInitially() { - const result = await AsyncStorage.getItem('tempScale') +export const tempReminderObservable = Observable() +setObvWithInitValue('tempReminder', tempReminderObservable, { + enabled: false +}) + +async function setObvWithInitValue(key, obv, defaultValue) { + const result = await AsyncStorage.getItem(key) let value if (result) { value = JSON.parse(result) } else { - value = { - min: config.temperatureScale.defaultLow, - max: config.temperatureScale.defaultHigh - } + value = defaultValue } - scaleObservable.set(value) + obv.set(value) } export async function saveTempScale(scale) { @@ -24,3 +29,7 @@ export async function saveTempScale(scale) { scaleObservable.set(scale) } +export async function saveTempReminder(reminder) { + await AsyncStorage.setItem('tempReminder', JSON.stringify(reminder)) + tempReminderObservable.set(reminder) +} \ No newline at end of file From a6d082dffc280bc6a758fcbbd5eee21fc68bb4c3 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 11:03:52 +0200 Subject: [PATCH 06/12] Handle cancel --- components/settings.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/settings.js b/components/settings.js index b56eb06..8f46ca4 100644 --- a/components/settings.js +++ b/components/settings.js @@ -119,7 +119,10 @@ class TempReminderPicker extends Component { enabled: true }) }} - onCancel={() => this.setState({ isTimePickerVisible: false })} + onCancel={() => { + this.setState({ isTimePickerVisible: false }) + if (!this.state.time) this.setState({enabled: false}) + }} /> ) From 660f19a790853f7a195ce28c12f2b85701b329ef Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 11:30:23 +0200 Subject: [PATCH 07/12] Add more to temp reminder component --- components/settings.js | 95 +++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/components/settings.js b/components/settings.js index 8f46ca4..d6eeda4 100644 --- a/components/settings.js +++ b/components/settings.js @@ -33,15 +33,7 @@ export default class Settings extends Component { render() { return ( - this.setState({ isTimePickerVisible: true })} - > - - {settingsLabels.tempReminder.title} - - - + {settingsLabels.tempScale.segmentTitle} @@ -88,43 +80,52 @@ class TempReminderPicker extends Component { render() { return ( - - - {this.state.time && this.state.enabled ? - {settingsLabels.tempReminder.timeSet(this.state.time)} - : - {settingsLabels.tempReminder.noTimeSet} - } + this.setState({ isTimePickerVisible: true })} + > + + {settingsLabels.tempReminder.title} + + + + {this.state.time && this.state.enabled ? + {settingsLabels.tempReminder.timeSet(this.state.time)} + : + {settingsLabels.tempReminder.noTimeSet} + } + + { + this.setState({ enabled: val }) + if (val && !this.state.time) this.setState({ isTimePickerVisible: true }) + if (!val) saveTempReminder({ enabled: false }) + }} + onTintColor={secondaryColor} + /> + { + const time = padWithZeros(`${jsDate.getHours()}:${jsDate.getMinutes()}`) + this.setState({ + time, + isTimePickerVisible: false, + enabled: true + }) + saveTempReminder({ + time, + enabled: true + }) + }} + onCancel={() => { + this.setState({ isTimePickerVisible: false }) + if (!this.state.time) this.setState({enabled: false}) + }} + /> - { - this.setState({ enabled: val }) - if (val && !this.state.time) this.setState({ isTimePickerVisible: true }) - if (!val) saveTempReminder({ enabled: false }) - }} - onTintColor={secondaryColor} - /> - { - const time = padWithZeros(`${jsDate.getHours()}:${jsDate.getMinutes()}`) - this.setState({ - time, - isTimePickerVisible: false - }) - saveTempReminder({ - time, - enabled: true - }) - }} - onCancel={() => { - this.setState({ isTimePickerVisible: false }) - if (!this.state.time) this.setState({enabled: false}) - }} - /> - + ) } } @@ -156,7 +157,7 @@ class TempSlider extends Component { render() { return ( - + {`${settingsLabels.tempScale.min} ${this.state.min}`} {`${settingsLabels.tempScale.max} ${this.state.max}`} Date: Mon, 27 Aug 2018 11:32:10 +0200 Subject: [PATCH 08/12] Shorten line lengths --- components/settings.js | 64 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/components/settings.js b/components/settings.js index d6eeda4..aac1a65 100644 --- a/components/settings.js +++ b/components/settings.js @@ -14,7 +14,7 @@ import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker import rnfs from 'react-native-fs' import styles, { secondaryColor } from '../styles/index' import config from '../config' -import { settings as settingsLabels, shared as sharedLabels } from './labels' +import { settings as labels, shared as sharedLabels } from './labels' import getDataAsCsvDataUri from '../lib/import-export/export-to-csv' import importCsv from '../lib/import-export/import-from-csv' import { @@ -36,34 +36,34 @@ export default class Settings extends Component { - {settingsLabels.tempScale.segmentTitle} + {labels.tempScale.segmentTitle} - {settingsLabels.tempScale.segmentExplainer} + {labels.tempScale.segmentExplainer} - {settingsLabels.export.button} + {labels.export.button} - {settingsLabels.export.segmentExplainer} + {labels.export.segmentExplainer} - {settingsLabels.export.button} + {labels.export.button} - {settingsLabels.import.button} + {labels.import.button} - {settingsLabels.import.segmentExplainer} + {labels.import.segmentExplainer} - {settingsLabels.import.button} + {labels.import.button} @@ -85,22 +85,24 @@ class TempReminderPicker extends Component { onPress={() => this.setState({ isTimePickerVisible: true })} > - {settingsLabels.tempReminder.title} + {labels.tempReminder.title} {this.state.time && this.state.enabled ? - {settingsLabels.tempReminder.timeSet(this.state.time)} + {labels.tempReminder.timeSet(this.state.time)} : - {settingsLabels.tempReminder.noTimeSet} + {labels.tempReminder.noTimeSet} } { - this.setState({ enabled: val }) - if (val && !this.state.time) this.setState({ isTimePickerVisible: true }) - if (!val) saveTempReminder({ enabled: false }) + onValueChange={switchOn => { + this.setState({ enabled: switchOn }) + if (switchOn && !this.state.time) { + this.setState({ isTimePickerVisible: true }) + } + if (!switchOn) saveTempReminder({ enabled: false }) }} onTintColor={secondaryColor} /> @@ -151,15 +153,15 @@ class TempSlider extends Component { try { saveTempScale(this.state) } catch(err) { - alertError(settingsLabels.tempScale.saveError) + alertError(labels.tempScale.saveError) } } render() { return ( - {`${settingsLabels.tempScale.min} ${this.state.min}`} - {`${settingsLabels.tempScale.max} ${this.state.max}`} + {`${labels.tempScale.min} ${this.state.min}`} + {`${labels.tempScale.max} ${this.state.max}`} getFileContentAndImport({ deleteExisting: false }) }, { - text: settingsLabels.import.deleteOption, + text: labels.import.deleteOption, onPress: () => getFileContentAndImport({ deleteExisting: true }) }, { text: sharedLabels.cancel, style: 'cancel', onPress: () => { } @@ -251,12 +253,12 @@ async function getFileContentAndImport({ deleteExisting }) { try { fileContent = await rnfs.readFile(fileInfo.uri, 'utf8') } catch (err) { - return importError(settingsLabels.import.errors.couldNotOpenFile) + return importError(labels.import.errors.couldNotOpenFile) } try { await importCsv(fileContent, deleteExisting) - Alert.alert(sharedLabels.successTitle, settingsLabels.import.success.message) + Alert.alert(sharedLabels.successTitle, labels.import.success.message) } catch(err) { importError(err.message) } @@ -267,7 +269,7 @@ function alertError(msg) { } function importError(msg) { - const postFixed = `${msg}\n\n${settingsLabels.import.errors.postFix}` + const postFixed = `${msg}\n\n${labels.import.errors.postFix}` alertError(postFixed) } From b90fda113d3dba280c55000cd9995d1813120578 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 12:37:48 +0200 Subject: [PATCH 09/12] First attempt at notifying at given time --- components/app.js | 5 ++++- components/home.js | 1 - lib/notifications.js | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 lib/notifications.js diff --git a/components/app.js b/components/app.js index dbd3cfb..91b21a3 100644 --- a/components/app.js +++ b/components/app.js @@ -10,6 +10,7 @@ import Chart from './chart/chart' import Settings from './settings' import Stats from './stats' import {headerTitles as titles} from './labels' +import setupNotifications from '../lib/notifications' const isSymptomView = name => Object.keys(symptomViews).indexOf(name) > -1 @@ -60,4 +61,6 @@ export default class App extends Component { ) } -} \ No newline at end of file +} + +setupNotifications() \ No newline at end of file diff --git a/components/home.js b/components/home.js index d43521b..2962492 100644 --- a/components/home.js +++ b/components/home.js @@ -9,7 +9,6 @@ import { LocalDate } from 'js-joda' import styles from '../styles/index' import cycleModule from '../lib/cycle' import { getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithDummyData, deleteAll } from '../db' -import {NotificationsAndroid} from 'react-native-notifications' const getCycleDayNumber = cycleModule().getCycleDayNumber diff --git a/lib/notifications.js b/lib/notifications.js new file mode 100644 index 0000000..033d4ad --- /dev/null +++ b/lib/notifications.js @@ -0,0 +1,27 @@ +import {tempReminderObservable} from '../local-storage' +import { LocalTime, ChronoUnit } from 'js-joda' +import {NotificationsAndroid} from 'react-native-notifications' + +let stopCheckingTheTime = () => {} + +export default function setupNotifications() { + tempReminderObservable(reminder => { + stopCheckingTheTime() + if (reminder.enabled) { + stopCheckingTheTime = notifyAt(reminder.time) + } + }) +} + +function notifyAt(time) { + const id = setInterval(() => { + const now = LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString() + if (now === time) { + NotificationsAndroid.localNotification({ + title: 'yo', + body: 'much notification' + }) + } + }, 60 * 1000) + return () => clearInterval(id) +} \ No newline at end of file From e64b46c41b116dc2a5b2643aadd2b99a2d68f8ab Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 12:38:17 +0200 Subject: [PATCH 10/12] Revert "Install dep" This reverts commit 138ce17ade64dcfec10fecab9b1b41e298c35fb2. --- android/.project | 17 -- .../org.eclipse.buildship.core.prefs | 2 - android/app/.classpath | 6 - android/app/.project | 23 -- .../org.eclipse.buildship.core.prefs | 2 - android/app/build.gradle | 1 - .../main/java/com/drip/MainApplication.java | 2 - android/build.gradle | 2 +- android/settings.gradle | 2 - ios/drip.xcodeproj/project.pbxproj | 19 -- package-lock.json | 200 +++++++++--------- package.json | 1 - 12 files changed, 100 insertions(+), 177 deletions(-) delete mode 100644 android/.project delete mode 100644 android/.settings/org.eclipse.buildship.core.prefs delete mode 100644 android/app/.classpath delete mode 100644 android/app/.project delete mode 100644 android/app/.settings/org.eclipse.buildship.core.prefs diff --git a/android/.project b/android/.project deleted file mode 100644 index ce7fcb4..0000000 --- a/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - drip - Project drip created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e889521..0000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/android/app/.classpath b/android/app/.classpath deleted file mode 100644 index eb19361..0000000 --- a/android/app/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/android/app/.project b/android/app/.project deleted file mode 100644 index ac485d7..0000000 --- a/android/app/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - app - Project app created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index b1886ad..0000000 --- a/android/app/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir=.. -eclipse.preferences.version=1 diff --git a/android/app/build.gradle b/android/app/build.gradle index 83f5938..fa56b47 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,7 +138,6 @@ android { } dependencies { - compile project(':react-native-notifications') compile project(':react-native-vector-icons') compile project(':react-native-fs') compile project(':react-native-document-picker') diff --git a/android/app/src/main/java/com/drip/MainApplication.java b/android/app/src/main/java/com/drip/MainApplication.java index 47d0dfd..4dc63a4 100644 --- a/android/app/src/main/java/com/drip/MainApplication.java +++ b/android/app/src/main/java/com/drip/MainApplication.java @@ -3,7 +3,6 @@ package com.drip; import android.app.Application; import com.facebook.react.ReactApplication; -import com.wix.reactnativenotifications.RNNotificationsPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.rnfs.RNFSPackage; import com.reactnativedocumentpicker.ReactNativeDocumentPicker; @@ -30,7 +29,6 @@ public class MainApplication extends Application implements ReactApplication, Sh protected List getPackages() { return Arrays.asList( new MainReactPackage(), - new RNNotificationsPackage(MainApplication.this), new VectorIconsPackage(), new RNFSPackage(), new ReactNativeDocumentPicker(), diff --git a/android/build.gradle b/android/build.gradle index 9c37a08..3d21e10 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,7 +30,7 @@ allprojects { ext { buildToolsVersion = "26.0.3" - minSdkVersion = 19 + minSdkVersion = 16 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = "26.1.0" diff --git a/android/settings.gradle b/android/settings.gradle index c9e7814..6a9c8c8 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,6 +1,4 @@ rootProject.name = 'drip' -include ':react-native-notifications' -project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-fs' diff --git a/ios/drip.xcodeproj/project.pbxproj b/ios/drip.xcodeproj/project.pbxproj index 33e6850..25f1f76 100644 --- a/ios/drip.xcodeproj/project.pbxproj +++ b/ios/drip.xcodeproj/project.pbxproj @@ -58,7 +58,6 @@ A1410AC4C98A49B2820D9E45 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B6F5078F7DEC470782757471 /* Zocial.ttf */; }; 29DF0CCC1AEA4C92BCA0BCCD /* libRNDocumentPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */; }; 17AD822C42A44BADA96BD860 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84CCEBD3B2C44758853BC941 /* libRNFS.a */; }; - E4B64D87B7934535B40E787A /* libRNNotifications.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7E1DC8298CC4C6C9E2F5B83 /* libRNNotifications.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -390,8 +389,6 @@ D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */ = {isa = PBXFileReference; name = "libRNDocumentPicker.a"; path = "libRNDocumentPicker.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; 49089E09BFCF4F3DB209B6E9 /* RNFS.xcodeproj */ = {isa = PBXFileReference; name = "RNFS.xcodeproj"; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; 84CCEBD3B2C44758853BC941 /* libRNFS.a */ = {isa = PBXFileReference; name = "libRNFS.a"; path = "libRNFS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; - FD8183079FD143548AF51C50 /* RNNotifications.xcodeproj */ = {isa = PBXFileReference; name = "RNNotifications.xcodeproj"; path = "../node_modules/react-native-notifications/RNNotifications/RNNotifications.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - A7E1DC8298CC4C6C9E2F5B83 /* libRNNotifications.a */ = {isa = PBXFileReference; name = "libRNNotifications.a"; path = "libRNNotifications.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -427,7 +424,6 @@ AED64B7892744F21B3A156BB /* libRNVectorIcons.a in Frameworks */, 29DF0CCC1AEA4C92BCA0BCCD /* libRNDocumentPicker.a in Frameworks */, 17AD822C42A44BADA96BD860 /* libRNFS.a in Frameworks */, - E4B64D87B7934535B40E787A /* libRNNotifications.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -622,7 +618,6 @@ D1E5ACC4B66345868F556374 /* RNVectorIcons.xcodeproj */, 1F05FE29622E4F21AF70C2B7 /* RNDocumentPicker.xcodeproj */, 49089E09BFCF4F3DB209B6E9 /* RNFS.xcodeproj */, - FD8183079FD143548AF51C50 /* RNNotifications.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1289,7 +1284,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1298,7 +1292,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1322,7 +1315,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1331,7 +1323,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1358,7 +1349,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1384,7 +1374,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1417,7 +1406,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1426,7 +1414,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1459,7 +1446,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1468,7 +1454,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; @@ -1500,7 +1485,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1509,7 +1493,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Debug; @@ -1541,7 +1524,6 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1550,7 +1532,6 @@ "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker", "$(SRCROOT)/../node_modules/react-native-fs/**", - "$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications", ); }; name = Release; diff --git a/package-lock.json b/package-lock.json index f1ec9f6..9c136b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3721,8 +3721,8 @@ "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "optional": true, "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" + "nan": "2.10.0", + "node-pre-gyp": "0.10.0" }, "dependencies": { "abbrev": { @@ -3744,19 +3744,21 @@ "bundled": true, "optional": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "delegates": "1.0.0", + "readable-stream": "2.3.6" } }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -3767,15 +3769,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3810,7 +3815,7 @@ "bundled": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "fs.realpath": { @@ -3823,14 +3828,14 @@ "bundled": true, "optional": true, "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" } }, "glob": { @@ -3838,12 +3843,12 @@ "bundled": true, "optional": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "has-unicode": { @@ -3856,7 +3861,7 @@ "bundled": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": "2.1.2" } }, "ignore-walk": { @@ -3864,7 +3869,7 @@ "bundled": true, "optional": true, "requires": { - "minimatch": "^3.0.4" + "minimatch": "3.0.4" } }, "inflight": { @@ -3872,13 +3877,14 @@ "bundled": true, "optional": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3888,8 +3894,9 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "isarray": { @@ -3900,20 +3907,23 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "minizlib": { @@ -3921,12 +3931,13 @@ "bundled": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3941,9 +3952,9 @@ "bundled": true, "optional": true, "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" + "debug": "2.6.9", + "iconv-lite": "0.4.21", + "sax": "1.2.4" } }, "node-pre-gyp": { @@ -3951,16 +3962,16 @@ "bundled": true, "optional": true, "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.0", + "nopt": "4.0.1", + "npm-packlist": "1.1.10", + "npmlog": "4.1.2", + "rc": "1.2.7", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.1" } }, "nopt": { @@ -3968,8 +3979,8 @@ "bundled": true, "optional": true, "requires": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1.1.1", + "osenv": "0.1.5" } }, "npm-bundled": { @@ -3982,8 +3993,8 @@ "bundled": true, "optional": true, "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.3" } }, "npmlog": { @@ -3991,15 +4002,16 @@ "bundled": true, "optional": true, "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" } }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4009,8 +4021,9 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "os-homedir": { @@ -4028,8 +4041,8 @@ "bundled": true, "optional": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" } }, "path-is-absolute": { @@ -4047,10 +4060,10 @@ "bundled": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "deep-extend": "0.5.1", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" }, "dependencies": { "minimist": { @@ -4065,13 +4078,13 @@ "bundled": true, "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "rimraf": { @@ -4079,7 +4092,7 @@ "bundled": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "safe-buffer": { @@ -4114,10 +4127,11 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "string_decoder": { @@ -4125,14 +4139,14 @@ "bundled": true, "optional": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "strip-ansi": { "version": "3.0.1", "bundled": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-json-comments": { @@ -4145,13 +4159,13 @@ "bundled": true, "optional": true, "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.2.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "util-deprecate": { @@ -4164,7 +4178,7 @@ "bundled": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "1.0.2" } }, "wrappy": { @@ -6671,22 +6685,6 @@ } } }, - "react-native-notifications": { - "version": "1.1.20", - "resolved": "https://registry.npmjs.org/react-native-notifications/-/react-native-notifications-1.1.20.tgz", - "integrity": "sha512-55DvP6/W13Hum7fZE7U4o3Ge07zA3FxqOFtLBLMYvMHzGhEe7czDe7/9zd8aoo9lJPI1TWVWdwhXhKrT4GalYA==", - "requires": { - "core-js": "^1.0.0", - "uuid": "^2.0.3" - }, - "dependencies": { - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" - } - } - }, "react-native-safe-area-view": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.8.0.tgz", diff --git a/package.json b/package.json index fd40b44..2c492c5 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "react-native-document-picker": "^2.1.0", "react-native-fs": "^2.10.14", "react-native-modal-datetime-picker-nevo": "^4.11.0", - "react-native-notifications": "^1.1.20", "react-native-share": "^1.1.0", "react-native-simple-radio-button": "^2.7.1", "react-native-vector-icons": "^5.0.0", From eb41ae354f7a8dfe8b4e3f15a98c560b29103c69 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 14:31:28 +0200 Subject: [PATCH 11/12] Use rn-push-notifications and set up recurring notification --- android/app/build.gradle | 1 + android/app/src/main/AndroidManifest.xml | 49 +++++ .../main/java/com/drip/MainApplication.java | 2 + android/settings.gradle | 2 + components/app.js | 3 +- components/labels.js | 3 +- lib/notifications.js | 43 ++-- package-lock.json | 189 +++++++++--------- package.json | 1 + 9 files changed, 172 insertions(+), 121 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index fa56b47..6348b76 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,6 +138,7 @@ android { } dependencies { + compile project(':react-native-push-notification') compile project(':react-native-vector-icons') compile project(':react-native-fs') compile project(':react-native-document-picker') diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4654ff4..207d90a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -3,6 +3,15 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/java/com/drip/MainApplication.java b/android/app/src/main/java/com/drip/MainApplication.java index 4dc63a4..da1f79f 100644 --- a/android/app/src/main/java/com/drip/MainApplication.java +++ b/android/app/src/main/java/com/drip/MainApplication.java @@ -3,6 +3,7 @@ package com.drip; import android.app.Application; import com.facebook.react.ReactApplication; +import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.rnfs.RNFSPackage; import com.reactnativedocumentpicker.ReactNativeDocumentPicker; @@ -29,6 +30,7 @@ public class MainApplication extends Application implements ReactApplication, Sh protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new ReactNativePushNotificationPackage(), new VectorIconsPackage(), new RNFSPackage(), new ReactNativeDocumentPicker(), diff --git a/android/settings.gradle b/android/settings.gradle index 6a9c8c8..fe009fa 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'drip' +include ':react-native-push-notification' +project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-fs' diff --git a/components/app.js b/components/app.js index 91b21a3..827b11e 100644 --- a/components/app.js +++ b/components/app.js @@ -21,6 +21,7 @@ export default class App extends Component { currentPage: 'Home' } this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonPress) + setupNotifications(this.navigate) } componentWillUnmount() { @@ -62,5 +63,3 @@ export default class App extends Component { ) } } - -setupNotifications() \ No newline at end of file diff --git a/components/labels.js b/components/labels.js index a70e66f..7066663 100644 --- a/components/labels.js +++ b/components/labels.js @@ -46,7 +46,8 @@ export const settings = { tempReminder: { title: 'Temperature reminder', noTimeSet: 'Set a time for a daily reminder to take your temperature', - timeSet: time => `Daily reminder set for ${time}` + timeSet: time => `Daily reminder set for ${time}`, + notification: 'Record your morning temperature' } } diff --git a/lib/notifications.js b/lib/notifications.js index 033d4ad..3d34661 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -1,27 +1,32 @@ import {tempReminderObservable} from '../local-storage' -import { LocalTime, ChronoUnit } from 'js-joda' -import {NotificationsAndroid} from 'react-native-notifications' +import Notification from 'react-native-push-notification' +import { LocalDate } from 'js-joda' +import { settings as labels } from '../components/labels' +import { getOrCreateCycleDay } from '../db' -let stopCheckingTheTime = () => {} - -export default function setupNotifications() { - tempReminderObservable(reminder => { - stopCheckingTheTime() - if (reminder.enabled) { - stopCheckingTheTime = notifyAt(reminder.time) +export default function setupNotifications(navigate) { + Notification.configure({ + onNotification: () => { + const todayDateString = LocalDate.now().toString() + const cycleDay = getOrCreateCycleDay(todayDateString) + navigate('TemperatureEditView', { cycleDay }) } }) -} -function notifyAt(time) { - const id = setInterval(() => { - const now = LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString() - if (now === time) { - NotificationsAndroid.localNotification({ - title: 'yo', - body: 'much notification' + tempReminderObservable(reminder => { + Notification.cancelAllLocalNotifications() + if (reminder.enabled) { + const date = new Date() + const [hours, minutes] = reminder.time.split(':') + date.setHours(parseInt(hours)) + date.setMinutes(parseInt(minutes)) + date.setSeconds(0) + Notification.localNotificationSchedule({ + message: labels.tempReminder.notification, + date, + vibrate: false, + repeatType: 'day' }) } - }, 60 * 1000) - return () => clearInterval(id) + }) } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9c136b0..a481c22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3721,8 +3721,8 @@ "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "optional": true, "requires": { - "nan": "2.10.0", - "node-pre-gyp": "0.10.0" + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" }, "dependencies": { "abbrev": { @@ -3744,21 +3744,19 @@ "bundled": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -3769,18 +3767,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -3815,7 +3810,7 @@ "bundled": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "fs.realpath": { @@ -3828,14 +3823,14 @@ "bundled": true, "optional": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "glob": { @@ -3843,12 +3838,12 @@ "bundled": true, "optional": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "has-unicode": { @@ -3861,7 +3856,7 @@ "bundled": true, "optional": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "^2.1.0" } }, "ignore-walk": { @@ -3869,7 +3864,7 @@ "bundled": true, "optional": true, "requires": { - "minimatch": "3.0.4" + "minimatch": "^3.0.4" } }, "inflight": { @@ -3877,14 +3872,13 @@ "bundled": true, "optional": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -3894,9 +3888,8 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "isarray": { @@ -3907,23 +3900,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.2.4", "bundled": true, - "optional": true, "requires": { - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, "minizlib": { @@ -3931,13 +3921,12 @@ "bundled": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3952,9 +3941,9 @@ "bundled": true, "optional": true, "requires": { - "debug": "2.6.9", - "iconv-lite": "0.4.21", - "sax": "1.2.4" + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" } }, "node-pre-gyp": { @@ -3962,16 +3951,16 @@ "bundled": true, "optional": true, "requires": { - "detect-libc": "1.0.3", - "mkdirp": "0.5.1", - "needle": "2.2.0", - "nopt": "4.0.1", - "npm-packlist": "1.1.10", - "npmlog": "4.1.2", - "rc": "1.2.7", - "rimraf": "2.6.2", - "semver": "5.5.0", - "tar": "4.4.1" + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" } }, "nopt": { @@ -3979,8 +3968,8 @@ "bundled": true, "optional": true, "requires": { - "abbrev": "1.1.1", - "osenv": "0.1.5" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npm-bundled": { @@ -3993,8 +3982,8 @@ "bundled": true, "optional": true, "requires": { - "ignore-walk": "3.0.1", - "npm-bundled": "1.0.3" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, "npmlog": { @@ -4002,16 +3991,15 @@ "bundled": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -4021,9 +4009,8 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -4041,8 +4028,8 @@ "bundled": true, "optional": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "path-is-absolute": { @@ -4060,10 +4047,10 @@ "bundled": true, "optional": true, "requires": { - "deep-extend": "0.5.1", - "ini": "1.3.5", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -4078,13 +4065,13 @@ "bundled": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "rimraf": { @@ -4092,7 +4079,7 @@ "bundled": true, "optional": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -4127,11 +4114,10 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -4139,14 +4125,14 @@ "bundled": true, "optional": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { "version": "3.0.1", "bundled": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -4159,13 +4145,13 @@ "bundled": true, "optional": true, "requires": { - "chownr": "1.0.1", - "fs-minipass": "1.2.5", - "minipass": "2.2.4", - "minizlib": "1.1.0", - "mkdirp": "0.5.1", - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" } }, "util-deprecate": { @@ -4178,7 +4164,7 @@ "bundled": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { @@ -6685,6 +6671,11 @@ } } }, + "react-native-push-notification": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/react-native-push-notification/-/react-native-push-notification-3.1.1.tgz", + "integrity": "sha512-4+4yQXNPqh5IVvpSBmR4Cy/UeMjTcfE8KIJgEuT7pME97WK+aGPn6W3ybhOoXC1n+ZWKfrAlsHydLE4xfBZDJg==" + }, "react-native-safe-area-view": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.8.0.tgz", diff --git a/package.json b/package.json index 2c492c5..66497ad 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "react-native-document-picker": "^2.1.0", "react-native-fs": "^2.10.14", "react-native-modal-datetime-picker-nevo": "^4.11.0", + "react-native-push-notification": "^3.1.1", "react-native-share": "^1.1.0", "react-native-simple-radio-button": "^2.7.1", "react-native-vector-icons": "^5.0.0", From c5178ea441664ff370f2b63091d0fa166f1909c9 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 27 Aug 2018 16:17:05 +0200 Subject: [PATCH 12/12] If time has already passed, start notification tomorrow --- lib/notifications.js | 16 +++++++++++----- package.json | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/notifications.js b/lib/notifications.js index 3d34661..dc1a7a5 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -1,6 +1,7 @@ import {tempReminderObservable} from '../local-storage' import Notification from 'react-native-push-notification' import { LocalDate } from 'js-joda' +import Moment from 'moment' import { settings as labels } from '../components/labels' import { getOrCreateCycleDay } from '../db' @@ -16,14 +17,19 @@ export default function setupNotifications(navigate) { tempReminderObservable(reminder => { Notification.cancelAllLocalNotifications() if (reminder.enabled) { - const date = new Date() const [hours, minutes] = reminder.time.split(':') - date.setHours(parseInt(hours)) - date.setMinutes(parseInt(minutes)) - date.setSeconds(0) + let target = new Moment() + .hours(parseInt(hours)) + .minutes(parseInt(minutes)) + .seconds(0) + + if(target.isBefore(new Moment())) { + target = target.add(1, 'd') + } + Notification.localNotificationSchedule({ message: labels.tempReminder.notification, - date, + date: target.toDate(), vibrate: false, repeatType: 'day' }) diff --git a/package.json b/package.json index 66497ad..11c62a8 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "isobject": "^3.0.1", "js-base64": "^2.4.8", "js-joda": "^1.8.2", - "moment": "^2.22.1", + "moment": "^2.22.2", "object-path": "^0.11.4", "obv": "0.0.1", "react": "16.4.1",