diff --git a/.gitignore b/.gitignore index 4c2015b620..a11c1d4702 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ project.xcworkspace .idea .gradle local.properties -status-im.iml +*.iml # node.js # diff --git a/.re-natal b/.re-natal index c69d936f9b..4e0749c40e 100644 --- a/.re-natal +++ b/.re-natal @@ -30,6 +30,7 @@ "react-native-image-crop-picker", "react-native-webview-bridge", "react-native-drawer-layout", + "react-native-fcm", "homoglyph-finder", "web3", "eccjs", diff --git a/android/app/build.gradle b/android/app/build.gradle index 62b7eb4988..f0c6932507 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -163,6 +163,7 @@ android { dependencies { compile project(':react-native-svg') + compile project(':react-native-mapbox-gl') compile 'com.android.support:multidex:1.0.1' compile project(':react-native-http-bridge') compile project(':nfc-react-native') @@ -186,9 +187,10 @@ dependencies { compile project(':react-native-fs') compile project(':react-native-image-crop-picker') compile project(':react-native-webview-bridge') - compile project(':reactnativemapboxgl') compile 'testfairy:testfairy-android-sdk:1.+@aar' compile project(':react-native-config') + compile project(':react-native-fcm') + compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version compile fileTree(dir: "node_modules/realm/android/libs", include: ["*.jar"]) } @@ -199,3 +201,5 @@ task copyDownloadableDepsToLibs(type: Copy) { into 'libs' } +// Must be at bottom to avoid dependency collision +apply plugin: "com.google.gms.google-services" diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000000..ebe2374d0e --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "854811651919", + "firebase_url": "https://status-react-app.firebaseio.com", + "project_id": "status-react-app", + "storage_bucket": "status-react-app.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:854811651919:android:11ee7444ded8a00a", + "android_client_info": { + "package_name": "im.status.ethereum" + } + }, + "oauth_client": [ + { + "client_id": "854811651919-gua52csicclb5p9gr4eeu33ukk0aaphj.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAOF4W1j8GYeXzzVKRfNKlXywD6bx0rJtQ" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9631792ec6..c23d9bf5df 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -54,6 +54,19 @@ android:exported="true"/> + + + + + + + + + + + + + diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index 75a2d9f28f..cd6b8f8a62 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -8,6 +8,8 @@ import com.cboy.rn.splashscreen.SplashScreenReactPackage; import com.centaurwarchief.smslistener.SmsListenerPackage; import com.facebook.react.ReactApplication; import com.horcrux.svg.SvgPackage; +import com.mapbox.reactnativemapboxgl.ReactNativeMapboxGLPackage; +import com.evollu.react.fcm.FIRMessagingPackage; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; @@ -26,7 +28,6 @@ import fr.bamlab.rnimageresizer.ImageResizerPackage; import im.status.ethereum.module.StatusPackage; import io.realm.react.RealmReactPackage; import me.alwx.HttpServer.HttpServerReactPackage; -import com.mapbox.reactnativemapboxgl.ReactNativeMapboxGLPackage; import java.util.ArrayList; import java.util.Arrays; @@ -44,7 +45,9 @@ public class MainApplication extends MultiDexApplication implements ReactApplica protected List getPackages() { List packages = new ArrayList(Arrays.asList( new MainReactPackage(), - new SvgPackage(), + new SvgPackage(), + new ReactNativeMapboxGLPackage(), + new FIRMessagingPackage(), new HttpServerReactPackage(), new NfcReactNativePackage(), new SplashScreenReactPackage(), @@ -63,9 +66,8 @@ public class MainApplication extends MultiDexApplication implements ReactApplica new ImageResizerPackage(), new PickerPackage(), new WebViewBridgePackage(BuildConfig.DEBUG), - new ReactNativeMapboxGLPackage(), new ReactNativeConfigPackage() - )); + )); if (!BuildConfig.DEBUG) { packages.add(new RNInstabugReactnativePackage("b239f82a9cb00464e4c72cc703e6821e", MainApplication.this, "shake")); diff --git a/android/build.gradle b/android/build.gradle index 496c8d0e35..3474637c41 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,6 +6,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/android/settings.gradle b/android/settings.gradle index 38e95ae881..f40f38b6c1 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -2,6 +2,10 @@ rootProject.name = 'StatusIm' include ':react-native-svg' project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') +include ':react-native-mapbox-gl' +project(':react-native-mapbox-gl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapbox-gl/android') +include ':react-native-fcm' +project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android') include ':app' include ':react-native-http-bridge' project(':react-native-http-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-http-bridge/android') @@ -44,8 +48,5 @@ project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '. include ':react-native-webview-bridge' project(':react-native-webview-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-bridge/android') -include ':reactnativemapboxgl' -project(':reactnativemapboxgl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapbox-gl/android') - include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') diff --git a/ios/GoogleService-Info.plist b/ios/GoogleService-Info.plist new file mode 100644 index 0000000000..41f4728a86 --- /dev/null +++ b/ios/GoogleService-Info.plist @@ -0,0 +1,40 @@ + + + + + AD_UNIT_ID_FOR_BANNER_TEST + ca-app-pub-3940256099942544/2934735716 + AD_UNIT_ID_FOR_INTERSTITIAL_TEST + ca-app-pub-3940256099942544/4411468910 + CLIENT_ID + 854811651919-30s20e3l0me0ins0vc4185jbnj7ja49o.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.854811651919-30s20e3l0me0ins0vc4185jbnj7ja49o + API_KEY + AIzaSyCwlaE5cnsT4rmGyOFxE39FlPVyKQ_2Mdo + GCM_SENDER_ID + 854811651919 + PLIST_VERSION + 1 + BUNDLE_ID + im.status.ethereum + PROJECT_ID + status-react-app + STORAGE_BUCKET + status-react-app.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:854811651919:ios:11ee7444ded8a00a + DATABASE_URL + https://status-react-app.firebaseio.com + + \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 32d3be4f0f..497519ffc7 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,6 +1,15 @@ # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' +# Need to explicitly declare this avoid downgrade +# https://github.com/evollu/react-native-fcm/issues/420 +pod 'Firebase/Core', '4.0.0' + +# react-native-fcm should support FB 4, but latest breaks builds, hence older version +# TODO(oskarth): Awaiting RN 0.47 upgrade, and/or PN working on iOS device before deciding which version to use +pod 'Firebase/Messaging' +#pod 'Firebase/Messaging', '3.17.0' + target 'StatusIm' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4c12fa0e62..e588230544 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,12 +1,47 @@ PODS: + - Firebase/Core (4.0.0): + - FirebaseAnalytics (= 4.0.0) + - FirebaseCore (= 4.0.0) + - Firebase/Messaging (4.0.0): + - Firebase/Core + - FirebaseMessaging (= 2.0.0) + - FirebaseAnalytics (4.0.0): + - FirebaseCore (~> 4.0) + - FirebaseInstanceID (~> 2.0) + - GoogleToolboxForMac/NSData+zlib (~> 2.1) + - FirebaseCore (4.0.0): + - GoogleToolboxForMac/NSData+zlib (~> 2.1) + - FirebaseInstanceID (2.0.0): + - FirebaseCore (~> 4.0) + - FirebaseMessaging (2.0.0): + - FirebaseAnalytics (~> 4.0) + - FirebaseCore (~> 4.0) + - FirebaseInstanceID (~> 2.0) + - GoogleToolboxForMac/Logger (~> 2.1) + - Protobuf (~> 3.1) + - GoogleToolboxForMac/Defines (2.1.1) + - GoogleToolboxForMac/Logger (2.1.1): + - GoogleToolboxForMac/Defines (= 2.1.1) + - GoogleToolboxForMac/NSData+zlib (2.1.1): + - GoogleToolboxForMac/Defines (= 2.1.1) - Instabug (7.2.6) + - Protobuf (3.3.0) DEPENDENCIES: + - Firebase/Core (= 4.0.0) + - Firebase/Messaging - Instabug (~> 7.0) SPEC CHECKSUMS: + Firebase: 284eea779b73fdff309791817da7c68bff8dd572 + FirebaseAnalytics: 6f08e746f7d66f5452931bc2e822b5df9c66b64a + FirebaseCore: 85ad466044c2f013cdb167f85d426d15b128114a + FirebaseInstanceID: 9fbf536668f4d3f0880e7438456dabd1376e294b + FirebaseMessaging: 227406c05b0dc9290702d2e9f18ab5528f0c2cf2 + GoogleToolboxForMac: 8e329f1b599f2512c6b10676d45736bcc2cbbeb0 Instabug: 49d4fbf1bf14e2f9074dfb7774ca5611bae993b4 + Protobuf: d582fecf68201eac3d79ed61369ef45734394b9c -PODFILE CHECKSUM: b75d6ec95102ddea68ad1e171f7f8f974533bac7 +PODFILE CHECKSUM: 11992cf30b55e1387c6201ced321cae502e7ebe3 COCOAPODS: 1.3.1 diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index 1987e02ac4..6c857ee3d9 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -34,6 +34,7 @@ 3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */; }; 4D3D740D5EFA4F8592B048D7 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */; }; 4FFAE7B0414A463991039A2E /* libRNRandomBytes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C55F15EB4D4DAF9202A662 /* libRNRandomBytes.a */; }; + 5974D2035B8B47E0946B63B6 /* libRNFIRMessaging.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F752F17B1E04216B1337A72 /* libRNFIRMessaging.a */; }; 5F8585D411844E5981B94F40 /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EC426A98043452BB6F9C134 /* libRNInstabug.a */; }; 67F099D82798449FADF8358A /* libRCTOrientation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5535217F57E44D77AA9CF083 /* libRCTOrientation.a */; }; 6CE6374707AC4EC788354DD1 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 11632AA0A5F84F029DD91797 /* libRNVectorIcons.a */; }; @@ -42,6 +43,7 @@ 82E689BAF9FB43C8AC6FF1CA /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CEB0E2659D1A4F5FA842057A /* EvilIcons.ttf */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 8E55E6877F950B81C8D711C5 /* libPods-StatusIm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 101A4045637A2ADF57D28EF5 /* libPods-StatusIm.a */; }; + 92A0DF7D1F4DE3A4002051BC /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 92A0DF491F4DE3A0002051BC /* GoogleService-Info.plist */; }; 9E0B01A11DDC5DA7002B0359 /* SF-UI-Text-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9E0B01A01DDC5DA7002B0359 /* SF-UI-Text-Light.otf */; }; 9E3AB6D01D87DB2B008846B4 /* libReact-Native-Webview-Bridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E3AB6C61D87DA2B008846B4 /* libReact-Native-Webview-Bridge.a */; }; 9E54D6001F17A5DB009F0C16 /* libTestFairy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E54D5FD1F17A5DB009F0C16 /* libTestFairy.a */; }; @@ -70,6 +72,7 @@ CE4E31B31D8695250033ED64 /* Statusgo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4E31B21D8695250033ED64 /* Statusgo.framework */; }; D28AEFB4C39548EB80416889 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 52E205D210BC48B7A553BB62 /* Entypo.ttf */; }; E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BEE3436791D42248F853999 /* libRCTImageResizer.a */; }; + EE99697599F14E309CD2D44C /* libRCTMapboxGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E945DF3D3D4E58845B95DA /* libRCTMapboxGL.a */; }; EF2B5857B4A34E0C9707FB3F /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B3B19223008342D096AA356E /* Octicons.ttf */; }; F9238D6C1E5F055900C047B9 /* SF-UI-Text-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = F9238D6B1E5F055900C047B9 /* SF-UI-Text-Semibold.otf */; }; FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 674B3D9595A047AB8D518F4E /* libRNFS.a */; }; @@ -245,6 +248,27 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; + 922C4C4A1F4D5C3F0033C753 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RNFIRMessaging; + }; + 922C4D2D1F4D8EBB0033C753 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2C513ED88AE849F8A4CA3475 /* RCTMapboxGL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C5DBB3401AF2EF2B00E611A9; + remoteInfo = RCTMapboxGL; + }; + 922C4D2F1F4D8EBB0033C753 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2C513ED88AE849F8A4CA3475 /* RCTMapboxGL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C5DBB34B1AF2EF2B00E611A9; + remoteInfo = RCTMapboxGLTests; + }; 9E3AB6C51D87DA2B008846B4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9E3AB6B21D87DA2A008846B4 /* React-Native-Webview-Bridge.xcodeproj */; @@ -464,6 +488,7 @@ 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = QBImagePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2756305FAFF144C4A6B0A039 /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = ""; }; 2BEE3436791D42248F853999 /* libRCTImageResizer.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTImageResizer.a; sourceTree = ""; }; + 2C513ED88AE849F8A4CA3475 /* RCTMapboxGL.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTMapboxGL.xcodeproj; path = "../node_modules/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj"; sourceTree = ""; }; 305F194186D848FDB07AF34C /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = ""; }; 359B076A658B4FBAB5128B03 /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = ""; }; 38A44830EC5708E89387F641 /* Pods-StatusIm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusIm.release.xcconfig"; path = "Pods/Target Support Files/Pods-StatusIm/Pods-StatusIm.release.xcconfig"; sourceTree = ""; }; @@ -485,10 +510,13 @@ 78C55F15EB4D4DAF9202A662 /* libRNRandomBytes.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNRandomBytes.a; sourceTree = ""; }; 7B5870D9ED504F32B6A09C35 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; }; 7ED174A34D7D42358313368B /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = ""; }; + 7F752F17B1E04216B1337A72 /* libRNFIRMessaging.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFIRMessaging.a; sourceTree = ""; }; 807594C429CA44128AB5666B /* BVLinearGradient.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = BVLinearGradient.xcodeproj; path = "../node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 8AE71EE8751F4652B13BFE83 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = ""; }; 8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; + 922C4CA61F4D5F8B0033C753 /* StatusIm.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = StatusIm.entitlements; path = StatusIm/StatusIm.entitlements; sourceTree = ""; }; + 92A0DF491F4DE3A0002051BC /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 9E0B01A01DDC5DA7002B0359 /* SF-UI-Text-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Light.otf"; sourceTree = ""; }; 9E3AB6B21D87DA2A008846B4 /* React-Native-Webview-Bridge.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "React-Native-Webview-Bridge.xcodeproj"; path = "../node_modules/react-native-webview-bridge/ios/React-Native-Webview-Bridge.xcodeproj"; sourceTree = ""; }; 9E54D5FD1F17A5DB009F0C16 /* libTestFairy.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTestFairy.a; sourceTree = ""; }; @@ -508,6 +536,7 @@ B24FC7FE1DE7195F00D694FF /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; B2A5F42F1DEC36B200174F4D /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTHttpServer.xcodeproj; path = "../node_modules/react-native-http-bridge/ios/RCTHttpServer.xcodeproj"; sourceTree = ""; }; + B2E945DF3D3D4E58845B95DA /* libRCTMapboxGL.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTMapboxGL.a; sourceTree = ""; }; B2F2D1BB1D9D531B00B7B453 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StatusIm/Images.xcassets; sourceTree = ""; }; B3B19223008342D096AA356E /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = ""; }; C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libTcpSockets.a; sourceTree = ""; }; @@ -518,6 +547,7 @@ DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = ""; }; F090E261B9854867A728CE4F /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = ""; }; F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = ""; }; + F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFIRMessaging.xcodeproj; path = "../node_modules/react-native-fcm/ios/RNFIRMessaging.xcodeproj"; sourceTree = ""; }; F9238D6B1E5F055900C047B9 /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = ""; }; FC1CBCFE6C906043D6CCEEE1 /* libPods-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1E74DC52A1E449A2BA858B14 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; name = "RNSVG.xcodeproj"; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; @@ -578,6 +608,8 @@ 9EE470541ED007E10048FD10 /* libRCTMapboxGL.a in Frameworks */, 9EF0836B1F3B53AB00876A8F /* libReactNativeConfig.a in Frameworks */, B957A49EB0DE44D9A31CAF2D /* libRNSVG.a in Frameworks */, + 5974D2035B8B47E0946B63B6 /* libRNFIRMessaging.a in Frameworks */, + EE99697599F14E309CD2D44C /* libRCTMapboxGL.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -664,6 +696,7 @@ 13B07FAE1A68108700A75B9A /* StatusIm */ = { isa = PBXGroup; children = ( + 922C4CA61F4D5F8B0033C753 /* StatusIm.entitlements */, 9E54D5FD1F17A5DB009F0C16 /* libTestFairy.a */, 9E54D5FE1F17A5DB009F0C16 /* TestFairy.h */, 9E54D5FF1F17A5DB009F0C16 /* upload-dsym.sh */, @@ -876,6 +909,8 @@ 5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */, F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */, 1E74DC52A1E449A2BA858B14 /* RNSVG.xcodeproj */, + F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */, + 2C513ED88AE849F8A4CA3475 /* RCTMapboxGL.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -892,6 +927,7 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( + 92A0DF491F4DE3A0002051BC /* GoogleService-Info.plist */, 9EE470501ED0079E0048FD10 /* Mapbox.framework */, 9EE4701B1ED007190048FD10 /* RCTMapboxGL.xcodeproj */, 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */, @@ -917,6 +953,23 @@ name = Products; sourceTree = ""; }; + 922C4C211F4D5C3F0033C753 /* Products */ = { + isa = PBXGroup; + children = ( + 922C4C4B1F4D5C3F0033C753 /* libRNFIRMessaging.a */, + ); + name = Products; + sourceTree = ""; + }; + 922C4D171F4D8EBB0033C753 /* Products */ = { + isa = PBXGroup; + children = ( + 922C4D2E1F4D8EBB0033C753 /* libRCTMapboxGL.a */, + 922C4D301F4D8EBB0033C753 /* RCTMapboxGLTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; 9E3AB6B31D87DA2A008846B4 /* Products */ = { isa = PBXGroup; children = ( @@ -1072,6 +1125,14 @@ 13B07F861A680F5B00A75B9A = { DevelopmentTeam = DTX7Z4U3YA; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.BackgroundModes = { + enabled = 1; + }; + com.apple.Push = { + enabled = 1; + }; + }; }; }; }; @@ -1135,6 +1196,10 @@ ProductGroup = 9EE4701C1ED007190048FD10 /* Products */; ProjectRef = 9EE4701B1ED007190048FD10 /* RCTMapboxGL.xcodeproj */; }, + { + ProductGroup = 922C4D171F4D8EBB0033C753 /* Products */; + ProjectRef = 2C513ED88AE849F8A4CA3475 /* RCTMapboxGL.xcodeproj */; + }, { ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; @@ -1183,6 +1248,10 @@ ProductGroup = 20B7D1251D3F74CD00B70F14 /* Products */; ProjectRef = F090E261B9854867A728CE4F /* RealmReact.xcodeproj */; }, + { + ProductGroup = 922C4C211F4D5C3F0033C753 /* Products */; + ProjectRef = F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */; + }, { ProductGroup = 20B7D1161D3F74CD00B70F14 /* Products */; ProjectRef = 305F194186D848FDB07AF34C /* RNFS.xcodeproj */; @@ -1382,6 +1451,27 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 922C4C4B1F4D5C3F0033C753 /* libRNFIRMessaging.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNFIRMessaging.a; + remoteRef = 922C4C4A1F4D5C3F0033C753 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 922C4D2E1F4D8EBB0033C753 /* libRCTMapboxGL.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTMapboxGL.a; + remoteRef = 922C4D2D1F4D8EBB0033C753 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 922C4D301F4D8EBB0033C753 /* RCTMapboxGLTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = RCTMapboxGLTests.xctest; + remoteRef = 922C4D2F1F4D8EBB0033C753 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 9E3AB6C61D87DA2B008846B4 /* libReact-Native-Webview-Bridge.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1583,6 +1673,7 @@ AE97D4B08C9F4821B8E9C50B /* Ionicons.ttf in Resources */, 0F942CF509F74CCDB5CB35B0 /* MaterialIcons.ttf in Resources */, EF2B5857B4A34E0C9707FB3F /* Octicons.ttf in Resources */, + 92A0DF7D1F4DE3A4002051BC /* GoogleService-Info.plist in Resources */, 74242ACAF37A48D0BFACDE82 /* Zocial.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1802,6 +1893,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm"; @@ -1841,6 +1934,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm"; @@ -1854,6 +1949,7 @@ ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_ENTITLEMENTS = StatusIm/StatusIm.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = DTX7Z4U3YA; @@ -1883,6 +1979,8 @@ "$(SRCROOT)/../node_modules/react-native-splash-screen/ios", "$(SRCROOT)/../node_modules/react-native-config/ios/**", "$(SRCROOT)/../node_modules/react-native-svg/ios/**", + "$(SRCROOT)/../node_modules/react-native-fcm/ios", + "$(SRCROOT)/../node_modules/react-native-mapbox-gl/ios/**", ); INFOPLIST_FILE = StatusIm/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1909,6 +2007,7 @@ ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_ENTITLEMENTS = StatusIm/StatusIm.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = DTX7Z4U3YA; @@ -1938,6 +2037,8 @@ "$(SRCROOT)/../node_modules/react-native-splash-screen/ios", "$(SRCROOT)/../node_modules/react-native-config/ios/**", "$(SRCROOT)/../node_modules/react-native-svg/ios/**", + "$(SRCROOT)/../node_modules/react-native-fcm/ios", + "$(SRCROOT)/../node_modules/react-native-mapbox-gl/ios/**", ); INFOPLIST_FILE = StatusIm/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; diff --git a/ios/StatusIm/AppDelegate.h b/ios/StatusIm/AppDelegate.h index a9654d5e01..14ef57dbd2 100644 --- a/ios/StatusIm/AppDelegate.h +++ b/ios/StatusIm/AppDelegate.h @@ -9,7 +9,9 @@ #import -@interface AppDelegate : UIResponder +@import UserNotifications; + +@interface AppDelegate : UIResponder @property (nonatomic, strong) UIWindow *window; diff --git a/ios/StatusIm/AppDelegate.m b/ios/StatusIm/AppDelegate.m index 7e895c3448..8dcc9ae791 100644 --- a/ios/StatusIm/AppDelegate.m +++ b/ios/StatusIm/AppDelegate.m @@ -14,6 +14,8 @@ #import "RCTRootView.h" #import "SplashScreen.h" #import "TestFairy.h" +#import "RNFIRMessaging.h" + #define NSLog(s, ...) do { NSLog(s, ##__VA_ARGS__); TFLog(s, ##__VA_ARGS__); } while (0) @import Instabug; @@ -31,7 +33,7 @@ initialProperties:nil launchOptions:launchOptions]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; - + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; @@ -43,7 +45,30 @@ [TestFairy begin:@"969f6c921cb435cea1d41d1ea3f5b247d6026d55"]; } [Instabug startWithToken:@"5534212f4a44f477c9ab270ab5cd2062" invocationEvent:IBGInvocationEventShake]; + + [FIRApp configure]; + [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; + return YES; } + +- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler +{ +[RNFIRMessaging willPresentNotification:notification withCompletionHandler:completionHandler]; +} + +- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler +{ +[RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler]; +} + +-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { +[RNFIRMessaging didReceiveLocalNotification:notification]; +} + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{ +[RNFIRMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; +} + @end diff --git a/ios/StatusIm/Info.plist b/ios/StatusIm/Info.plist index 9b7a0db342..fcc172c689 100644 --- a/ios/StatusIm/Info.plist +++ b/ios/StatusIm/Info.plist @@ -1,91 +1,95 @@ - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - Status - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - im.status.ethereum - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSApplicationQueriesSchemes - - whatsapp - - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSExceptionDomains - - api.status.im - - NSTemporaryExceptionAllowsInsecureHTTPLoads - - - localhost - - NSTemporaryExceptionAllowsInsecureHTTPLoads - - - - - NSMicrophoneUsageDescription - Need microphone access for Instabug and Audio Messages - NSCameraUsageDescription - We need to access your camera - NSContactsUsageDescription - We need to access your contacts - NSLocationWhenInUseUsageDescription - - NSPhotoLibraryUsageDescription - We need to access your photo storage to give you an ability to select photos - UIAppFonts - - RobotoMono-Medium.ttf - SF-UI-Text-Semibold.otf - SF-UI-Text-Bold.otf - SF-UI-Text-Regular.otf - SF-UI-Text-Medium.otf - SF-UI-Text-Light.otf - SF-UI-Display-Medium.otf - SF-UI-Display-Regular.otf - SF-UI-Display-Semibold.otf - SF-UI-Display-Thin.otf - Entypo.ttf - EvilIcons.ttf - FontAwesome.ttf - Foundation.ttf - Ionicons.ttf - MaterialIcons.ttf - Octicons.ttf - Zocial.ttf - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - UIViewControllerBasedStatusBarAppearance - - + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Status + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + im.status.ethereum + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationQueriesSchemes + + whatsapp + + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + api.status.im + + NSTemporaryExceptionAllowsInsecureHTTPLoads + + + localhost + + NSTemporaryExceptionAllowsInsecureHTTPLoads + + + + + NSCameraUsageDescription + We need to access your camera + NSContactsUsageDescription + We need to access your contacts + NSLocationWhenInUseUsageDescription + + NSMicrophoneUsageDescription + Need microphone access for Instabug and Audio Messages + NSPhotoLibraryUsageDescription + We need to access your photo storage to give you an ability to select photos + UIAppFonts + + RobotoMono-Medium.ttf + SF-UI-Text-Semibold.otf + SF-UI-Text-Bold.otf + SF-UI-Text-Regular.otf + SF-UI-Text-Medium.otf + SF-UI-Text-Light.otf + SF-UI-Display-Medium.otf + SF-UI-Display-Regular.otf + SF-UI-Display-Semibold.otf + SF-UI-Display-Thin.otf + Entypo.ttf + EvilIcons.ttf + FontAwesome.ttf + Foundation.ttf + Ionicons.ttf + MaterialIcons.ttf + Octicons.ttf + Zocial.ttf + + UIBackgroundModes + + remote-notification + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UIViewControllerBasedStatusBarAppearance + + diff --git a/ios/StatusIm/StatusIm.entitlements b/ios/StatusIm/StatusIm.entitlements new file mode 100644 index 0000000000..903def2af5 --- /dev/null +++ b/ios/StatusIm/StatusIm.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/package-lock.json b/package-lock.json index 4ba2b58fb2..a7f738ae98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "Base64": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/Base64/-/Base64-0.2.1.tgz", - "integrity": "sha1-ujpCMHCOGGcFBl5mur3Uw1z2ACg=" - }, "abbrev": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", @@ -963,6 +958,11 @@ "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", "integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs=" }, + "Base64": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/Base64/-/Base64-0.2.1.tgz", + "integrity": "sha1-ujpCMHCOGGcFBl5mur3Uw1z2ACg=" + }, "base64-js": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", @@ -4827,6 +4827,11 @@ "string.fromcodepoint": "0.2.1" } }, + "react-native-fcm": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/react-native-fcm/-/react-native-fcm-7.5.1.tgz", + "integrity": "sha1-NAK/CkhjwsUuKZhadlCtoeDLyFo=" + }, "react-native-fs": { "version": "2.1.0-rc.1", "resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.1.0-rc.1.tgz", @@ -4963,9 +4968,9 @@ "integrity": "sha1-Eax0iB8tu2QFktex5g1HKVhVAxQ=" }, "react-native-tcp": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/react-native-tcp/-/react-native-tcp-3.2.2.tgz", - "integrity": "sha512-XN3A6a3vBZ7BMqI0jFBQedZfTztXlu20GjUgYlEp4Y1Yklr1xcl2tINRCi6KDXpYGByso0M6apNYMI9EzuD1Ug==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/react-native-tcp/-/react-native-tcp-3.3.0.tgz", + "integrity": "sha512-WAiL3IGhVxvmM0iw7/5ZRzdkiJBfBbLoFKNaHLJIsTZVqD/N5ZHUlJMjIQ+RrmB/f5nJ82bUEZ2vPCxe+rlNqQ==", "requires": { "base64-js": "0.0.8", "buffer": "5.0.7", @@ -6080,6 +6085,11 @@ } } }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "string-range": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/string-range/-/string-range-1.2.2.tgz", @@ -6100,11 +6110,6 @@ "resolved": "https://registry.npmjs.org/string.fromcodepoint/-/string.fromcodepoint-0.2.1.tgz", "integrity": "sha1-jZeDM8C8klOPUPOD5IiPPlYZ1lM=" }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", diff --git a/package.json b/package.json index 07e0a486a2..769afa19f9 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "react-native-dialogs": "0.0.16", "react-native-drawer-layout": "1.1.3", "react-native-emoji-picker": "git+https://github.com/alwx/react-native-emoji-picker.git", + "react-native-fcm": "7.5.1", "react-native-fs": "2.1.0-rc.1", "react-native-http": "github:tradle/react-native-http#834492d", "react-native-http-bridge": "^0.4.1", @@ -112,7 +113,8 @@ "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify", - "net": "react-native-tcp" + "net": "react-native-tcp", + "fcm": "react-native-fcm" }, "react-native": { "crypto": "react-native-crypto", @@ -137,6 +139,7 @@ "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify", - "net": "react-native-tcp" + "net": "react-native-tcp", + "fcm": "react-native-fcm" } } diff --git a/react-native/src/status_im/react_native/js_dependencies.cljs b/react-native/src/status_im/react_native/js_dependencies.cljs index decba6208f..2504bf2013 100644 --- a/react-native/src/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/status_im/react_native/js_dependencies.cljs @@ -32,5 +32,6 @@ (def vector-icons (js/require "react-native-vector-icons/Ionicons")) (def webview-bridge (js/require "react-native-webview-bridge")) (def svg (js/require "react-native-svg")) +(def react-native-fcm (js/require "react-native-fcm")) diff --git a/src/status_im/ui/screens/chats_list/views.cljs b/src/status_im/ui/screens/chats_list/views.cljs index 7a19a30d7f..8264775ba2 100644 --- a/src/status_im/ui/screens/chats_list/views.cljs +++ b/src/status_im/ui/screens/chats_list/views.cljs @@ -25,7 +25,8 @@ [status-im.ui.screens.chats-list.views.inner-item :refer [chat-list-item-inner-view]] [status-im.ui.screens.chats-list.styles :as st] [status-im.i18n :refer [label]] - [status-im.utils.platform :refer [platform-specific ios?]])) + [status-im.utils.platform :refer [platform-specific ios?]] + [status-im.utils.notifications :as notifications])) (def android-toolbar-popup-options [{:text (label :t/edit) :value #(dispatch [:set-in [:chat-list-ui-props :edit?] true])}]) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs index 275694e4b3..7d567a64ba 100644 --- a/src/status_im/ui/screens/events.cljs +++ b/src/status_im/ui/screens/events.cljs @@ -26,6 +26,7 @@ [status-im.ui.screens.db :refer [app-db]] [status-im.utils.config :as config] [status-im.utils.crypt :as crypt] + [status-im.utils.notifications :as notifications] [status-im.utils.handlers :refer [register-handler-db register-handler-fx]] [status-im.utils.instabug :as inst] [status-im.utils.platform :as platform] @@ -164,7 +165,8 @@ [:start-requesting-discoveries] [:remove-old-discoveries!] [:set :accounts/creating-account? false] - [:init-wallet]]})) + [:init-wallet] + [:get-fcm-token]]})) (register-handler-fx :check-console-chat @@ -264,3 +266,11 @@ :update-geolocation (fn [db [_ geolocation]] (assoc db :geolocation geolocation))) + +;; TODO(oskarth): Put this token in DB +(register-handler-fx + :get-fcm-token + (fn [_ _] + (notifications/get-fcm-token) + {})) + diff --git a/src/status_im/utils/notifications.cljs b/src/status_im/utils/notifications.cljs new file mode 100644 index 0000000000..beb14a1346 --- /dev/null +++ b/src/status_im/utils/notifications.cljs @@ -0,0 +1,10 @@ +(ns status-im.utils.notifications + (:require [status-im.react-native.js-dependencies :as rn])) + +;; Work in progress namespace responsible for push notifications and interacting +;; with Firebase Cloud Messaging. + +(defn get-fcm-token [] + (let [fcm (aget rn/react-native-fcm "default")] + (.then ((.-getFCMToken fcm)) + (fn [x] (println "*** FCM TOKEN" x)))))