mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-23 16:36:37 +03:00
Merge pull request #1698 from ecency/feature/firebase-push
Changed appcenter push with firebase push
This commit is contained in:
commit
bbe157584e
@ -122,7 +122,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force "com.facebook.soloader:soloader:0.8.0"
|
||||
force "com.facebook.soloader:soloader:0.8.1"
|
||||
}
|
||||
}
|
||||
android {
|
||||
@ -212,6 +212,7 @@ dependencies {
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
|
||||
implementation 'com.android.support:multidex:2.0.1'
|
||||
implementation project(':@react-native-community_viewpager')
|
||||
implementation 'com.google.firebase:firebase-analytics:17.2.3'
|
||||
|
||||
if (enableHermes) {
|
||||
def hermesPath = "../../node_modules/hermes-engine/android/";
|
||||
|
@ -57,9 +57,9 @@
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@mipmap/ic_notification" />
|
||||
<meta-data
|
||||
<!-- <meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/notification_icon" />
|
||||
android:resource="@color/notification_icon" /> -->
|
||||
<meta-data
|
||||
android:name="com.bugsnag.android.API_KEY"
|
||||
android:value="88a8a25738939a80ba49f1d5289dbc80" />
|
||||
|
@ -29,7 +29,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath('com.android.tools.build:gradle:3.5.2')
|
||||
|
||||
classpath 'com.google.gms:google-services:4.0.2'
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
@ -35,6 +35,7 @@ target 'eSteem' do
|
||||
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
|
||||
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
||||
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
|
||||
pod 'Firebase/Analytics'
|
||||
|
||||
target 'eSteemTests' do
|
||||
inherit! :search_paths
|
||||
|
144
ios/Podfile.lock
144
ios/Podfile.lock
@ -40,6 +40,57 @@ PODS:
|
||||
- React-Core (= 0.61.5)
|
||||
- React-jsi (= 0.61.5)
|
||||
- ReactCommon/turbomodule/core (= 0.61.5)
|
||||
- Firebase/Analytics (6.25.0):
|
||||
- Firebase/Core
|
||||
- Firebase/Core (6.25.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseAnalytics (= 6.5.1)
|
||||
- Firebase/CoreOnly (6.25.0):
|
||||
- FirebaseCore (= 6.7.1)
|
||||
- Firebase/Messaging (6.25.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (~> 4.4.1)
|
||||
- FirebaseAnalytics (6.5.1):
|
||||
- FirebaseCore (~> 6.7)
|
||||
- FirebaseInstallations (~> 1.2)
|
||||
- GoogleAppMeasurement (= 6.5.1)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
|
||||
- GoogleUtilities/MethodSwizzler (~> 6.0)
|
||||
- GoogleUtilities/Network (~> 6.0)
|
||||
- "GoogleUtilities/NSData+zlib (~> 6.0)"
|
||||
- nanopb (~> 1.30905.0)
|
||||
- FirebaseAnalyticsInterop (1.5.0)
|
||||
- FirebaseCore (6.7.1):
|
||||
- FirebaseCoreDiagnostics (~> 1.3)
|
||||
- FirebaseCoreDiagnosticsInterop (~> 1.2)
|
||||
- GoogleUtilities/Environment (~> 6.5)
|
||||
- GoogleUtilities/Logger (~> 6.5)
|
||||
- FirebaseCoreDiagnostics (1.3.0):
|
||||
- FirebaseCoreDiagnosticsInterop (~> 1.2)
|
||||
- GoogleDataTransportCCTSupport (~> 3.1)
|
||||
- GoogleUtilities/Environment (~> 6.5)
|
||||
- GoogleUtilities/Logger (~> 6.5)
|
||||
- nanopb (~> 1.30905.0)
|
||||
- FirebaseCoreDiagnosticsInterop (1.2.0)
|
||||
- FirebaseInstallations (1.2.0):
|
||||
- FirebaseCore (~> 6.6)
|
||||
- GoogleUtilities/Environment (~> 6.6)
|
||||
- GoogleUtilities/UserDefaults (~> 6.6)
|
||||
- PromisesObjC (~> 1.2)
|
||||
- FirebaseInstanceID (4.3.4):
|
||||
- FirebaseCore (~> 6.6)
|
||||
- FirebaseInstallations (~> 1.0)
|
||||
- GoogleUtilities/Environment (~> 6.5)
|
||||
- GoogleUtilities/UserDefaults (~> 6.5)
|
||||
- FirebaseMessaging (4.4.1):
|
||||
- FirebaseAnalyticsInterop (~> 1.5)
|
||||
- FirebaseCore (~> 6.6)
|
||||
- FirebaseInstanceID (~> 4.3)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 6.5)
|
||||
- GoogleUtilities/Environment (~> 6.5)
|
||||
- GoogleUtilities/Reachability (~> 6.5)
|
||||
- GoogleUtilities/UserDefaults (~> 6.5)
|
||||
- Protobuf (>= 3.9.2, ~> 3.9)
|
||||
- FLAnimatedImage (1.0.12)
|
||||
- Folly (2018.10.22.00):
|
||||
- boost-for-react-native
|
||||
@ -51,10 +102,46 @@ PODS:
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- glog (0.3.5)
|
||||
- GoogleAppMeasurement (6.5.1):
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
|
||||
- GoogleUtilities/MethodSwizzler (~> 6.0)
|
||||
- GoogleUtilities/Network (~> 6.0)
|
||||
- "GoogleUtilities/NSData+zlib (~> 6.0)"
|
||||
- nanopb (~> 1.30905.0)
|
||||
- GoogleDataTransport (6.1.1)
|
||||
- GoogleDataTransportCCTSupport (3.1.0):
|
||||
- GoogleDataTransport (~> 6.1)
|
||||
- nanopb (~> 1.30905.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (6.6.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network
|
||||
- GoogleUtilities/Environment (6.6.0):
|
||||
- PromisesObjC (~> 1.2)
|
||||
- GoogleUtilities/Logger (6.6.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/MethodSwizzler (6.6.0):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network (6.6.0):
|
||||
- GoogleUtilities/Logger
|
||||
- "GoogleUtilities/NSData+zlib"
|
||||
- GoogleUtilities/Reachability
|
||||
- "GoogleUtilities/NSData+zlib (6.6.0)"
|
||||
- GoogleUtilities/Reachability (6.6.0):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/UserDefaults (6.6.0):
|
||||
- GoogleUtilities/Logger
|
||||
- lottie-ios (3.1.3)
|
||||
- lottie-react-native (3.3.2):
|
||||
- lottie-ios (~> 3.1.3)
|
||||
- React
|
||||
- nanopb (1.30905.0):
|
||||
- nanopb/decode (= 1.30905.0)
|
||||
- nanopb/encode (= 1.30905.0)
|
||||
- nanopb/decode (1.30905.0)
|
||||
- nanopb/encode (1.30905.0)
|
||||
- PromisesObjC (1.2.8)
|
||||
- Protobuf (3.12.0)
|
||||
- QBImagePickerController (3.4.0)
|
||||
- RCTRequired (0.61.5)
|
||||
- RCTTypeSafety (0.61.5):
|
||||
@ -277,6 +364,16 @@ PODS:
|
||||
- React-Core
|
||||
- RNCAsyncStorage (1.7.1):
|
||||
- React
|
||||
- RNCPushNotificationIOS (1.2.0):
|
||||
- React
|
||||
- RNFBApp (7.1.0):
|
||||
- Firebase/CoreOnly (~> 6.25.0)
|
||||
- React
|
||||
- RNFBMessaging (7.1.0):
|
||||
- Firebase/Analytics (~> 6.25.0)
|
||||
- Firebase/Messaging (~> 6.25.0)
|
||||
- React
|
||||
- RNFBApp
|
||||
- RNGestureHandler (1.5.2):
|
||||
- React
|
||||
- RNIap (3.4.15):
|
||||
@ -309,6 +406,7 @@ DEPENDENCIES:
|
||||
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
|
||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
||||
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
|
||||
- Firebase/Analytics
|
||||
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
|
||||
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
|
||||
- lottie-ios (from `../node_modules/lottie-ios`)
|
||||
@ -345,6 +443,9 @@ DEPENDENCIES:
|
||||
- ReactNativeDarkMode (from `../node_modules/react-native-dark-mode`)
|
||||
- rn-fetch-blob (from `../node_modules/rn-fetch-blob`)
|
||||
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
|
||||
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
|
||||
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
|
||||
- "RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`)"
|
||||
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
|
||||
- RNIap (from `../node_modules/react-native-iap`)
|
||||
- RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
|
||||
@ -358,7 +459,23 @@ SPEC REPOS:
|
||||
- AppCenter
|
||||
- AppCenterReactNativeShared
|
||||
- boost-for-react-native
|
||||
- Firebase
|
||||
- FirebaseAnalytics
|
||||
- FirebaseAnalyticsInterop
|
||||
- FirebaseCore
|
||||
- FirebaseCoreDiagnostics
|
||||
- FirebaseCoreDiagnosticsInterop
|
||||
- FirebaseInstallations
|
||||
- FirebaseInstanceID
|
||||
- FirebaseMessaging
|
||||
- FLAnimatedImage
|
||||
- GoogleAppMeasurement
|
||||
- GoogleDataTransport
|
||||
- GoogleDataTransportCCTSupport
|
||||
- GoogleUtilities
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
- Protobuf
|
||||
- QBImagePickerController
|
||||
- RSKImageCropper
|
||||
- SDWebImage
|
||||
@ -448,6 +565,12 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/rn-fetch-blob"
|
||||
RNCAsyncStorage:
|
||||
:path: "../node_modules/@react-native-community/async-storage"
|
||||
RNCPushNotificationIOS:
|
||||
:path: "../node_modules/@react-native-community/push-notification-ios"
|
||||
RNFBApp:
|
||||
:path: "../node_modules/@react-native-firebase/app"
|
||||
RNFBMessaging:
|
||||
:path: "../node_modules/@react-native-firebase/messaging"
|
||||
RNGestureHandler:
|
||||
:path: "../node_modules/react-native-gesture-handler"
|
||||
RNIap:
|
||||
@ -476,11 +599,27 @@ SPEC CHECKSUMS:
|
||||
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
|
||||
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
|
||||
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
|
||||
Firebase: 5719b4f965f76643241a1bb8244483ff6117db39
|
||||
FirebaseAnalytics: 93565f3f0f0f50a5d8770850bfe6a82eaba5db27
|
||||
FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae
|
||||
FirebaseCore: 6023faeada5afa95a349fccafb40900e32e9ac42
|
||||
FirebaseCoreDiagnostics: 4a773a47bd83bbd5a9b1ccf1ce7caa8b2d535e67
|
||||
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
|
||||
FirebaseInstallations: 2119fb3e46b0a88bfdbf12562f855ee3252462fa
|
||||
FirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b
|
||||
FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44
|
||||
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
|
||||
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
|
||||
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
|
||||
GoogleAppMeasurement: 137afe68bfa406c3f4221b9395253d9e5d4654cf
|
||||
GoogleDataTransport: ad884314b81cdb808fb1d23787b367ff8da4e28a
|
||||
GoogleDataTransportCCTSupport: d70a561f7d236af529fee598835caad5e25f6d3d
|
||||
GoogleUtilities: 39530bc0ad980530298e9c4af8549e991fd033b1
|
||||
lottie-ios: 496ac5cea1bbf1a7bd1f1f472f3232eb1b8d744b
|
||||
lottie-react-native: 2a1a82bb326ae51331a5520de0cf706733c6db69
|
||||
nanopb: c43f40fadfe79e8b8db116583945847910cbabc9
|
||||
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
|
||||
Protobuf: 2793fcd0622a00b546c60e7cbbcc493e043e9bb9
|
||||
QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022
|
||||
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
|
||||
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
|
||||
@ -511,6 +650,9 @@ SPEC CHECKSUMS:
|
||||
ReactNativeDarkMode: 0178ffca3b10f6a7c9f49d6f9810232b328fa949
|
||||
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
|
||||
RNCAsyncStorage: 44395cb9c7c1523104c2b499eb426ef7aff82bca
|
||||
RNCPushNotificationIOS: 4d9ffd08f00ef6c1029ebbf4d72fc711eca3ff01
|
||||
RNFBApp: 25a6476dfd7aac2bcbe984f569875bcea122895b
|
||||
RNFBMessaging: ea4ce2a6466b3a6dfb46a8c28c38a7989da36a31
|
||||
RNGestureHandler: 946a7691e41df61e2c4b1884deab41a4cdc3afff
|
||||
RNIap: b4c77c8bc4501203f4b743126a05da23f10f40b4
|
||||
RNImageCropPicker: e1d8c3381e5b05a1bdcd13ea57a4f1c020a09cef
|
||||
@ -521,6 +663,6 @@ SPEC CHECKSUMS:
|
||||
SDWebImage: c10d14a8883ebd89664f02a422006f66a85c0c5d
|
||||
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
|
||||
|
||||
PODFILE CHECKSUM: d4edbb9c1c57c5484f4893520a7865260cb898d3
|
||||
PODFILE CHECKSUM: 162b87bf8ea343d40707844f5dfad5d6aa5a4e99
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -13,6 +13,7 @@
|
||||
#import <AppCenterReactNativeCrashes.h>
|
||||
#import <AppCenterReactNativePush.h>
|
||||
#import <BugsnagReactNative/BugsnagReactNative.h>
|
||||
@import Firebase;
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
@ -30,6 +31,7 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
[FIRApp configure];
|
||||
[AppCenterReactNativePush register];
|
||||
[AppCenterReactNative register];
|
||||
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
|
||||
|
@ -33,6 +33,9 @@
|
||||
"@react-native-community/async-storage": "^1.7.1",
|
||||
"@react-native-community/cameraroll": "^1.3.0",
|
||||
"@react-native-community/netinfo": "^5.3.3",
|
||||
"@react-native-community/push-notification-ios": "^1.2.0",
|
||||
"@react-native-firebase/app": "^7.1.0",
|
||||
"@react-native-firebase/messaging": "^7.1.0",
|
||||
"appcenter": "^2.6.0",
|
||||
"appcenter-analytics": "^2.6.0",
|
||||
"appcenter-crashes": "^2.6.0",
|
||||
@ -70,6 +73,7 @@
|
||||
"react-native-modal-dropdown": "esteemapp/react-native-modal-dropdown",
|
||||
"react-native-modal-translucent": "^5.0.0",
|
||||
"react-native-navigation-bar-color": "^1.0.0",
|
||||
"react-native-push-notification": "^3.5.1",
|
||||
"react-native-qrcode-svg": "^6.0.3",
|
||||
"react-native-reanimated": "^1.3.0",
|
||||
"react-native-scrollable-tab-view": "esteemapp/react-native-scrollable-tab-view",
|
||||
|
@ -85,7 +85,9 @@ class UpvoteContainer extends PureComponent {
|
||||
if (pendingPayout > 0 && pendingPayout < minimumAmountForPayout) {
|
||||
warnZeroPayout = true;
|
||||
}
|
||||
const { base, quote, sbdPrintRate } = globalProps;
|
||||
const base = get(globalProps, 'base', 0);
|
||||
const quote = get(globalProps, 'quote', 0);
|
||||
const sbdPrintRate = get(globalProps, 'sbdPrintRate', 0);
|
||||
const SBD_PRINT_RATE_MAX = 10000;
|
||||
const percent_steem_dollars = get(content, 'percent_steem_dollars') / 20000;
|
||||
const pending_payout_sbd = pendingPayout * percent_steem_dollars;
|
||||
|
@ -3,6 +3,7 @@ import 'react-native-gesture-handler';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import { PersistGate } from 'redux-persist/integration/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import { flattenMessages } from './utils/flattenMessages';
|
||||
import messages from './config/locales';
|
||||
|
||||
|
@ -2,9 +2,7 @@ import { Component } from 'react';
|
||||
import { Platform, BackHandler, Alert, Linking, AppState } from 'react-native';
|
||||
import NetInfo from '@react-native-community/netinfo';
|
||||
import Config from 'react-native-config';
|
||||
import Push from 'appcenter-push';
|
||||
import get from 'lodash/get';
|
||||
import AppCenter from 'appcenter';
|
||||
import changeNavigationBarColor from 'react-native-navigation-bar-color';
|
||||
import { connect } from 'react-redux';
|
||||
import { injectIntl } from 'react-intl';
|
||||
@ -16,6 +14,8 @@ import {
|
||||
initialMode as nativeThemeInitialMode,
|
||||
eventEmitter as nativeThemeEventEmitter,
|
||||
} from 'react-native-dark-mode';
|
||||
import messaging from '@react-native-firebase/messaging';
|
||||
import PushNotification from 'react-native-push-notification';
|
||||
|
||||
// Constants
|
||||
import AUTH_TYPE from '../../../constants/authType';
|
||||
@ -85,6 +85,9 @@ export const setPreviousAppState = () => {
|
||||
}, 500);
|
||||
};
|
||||
|
||||
let firebaseOnNotificationOpenedAppListener = null;
|
||||
let firebaseOnMessageListener = null;
|
||||
|
||||
class ApplicationContainer extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -155,6 +158,14 @@ class ApplicationContainer extends Component {
|
||||
clearTimeout(this._pinCodeTimer);
|
||||
}
|
||||
|
||||
if (firebaseOnMessageListener) {
|
||||
firebaseOnMessageListener();
|
||||
}
|
||||
|
||||
if (firebaseOnNotificationOpenedAppListener) {
|
||||
firebaseOnNotificationOpenedAppListener();
|
||||
}
|
||||
|
||||
this.netListener();
|
||||
}
|
||||
|
||||
@ -277,27 +288,16 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_createPushListener = () => {
|
||||
_pushNavigate = (notification) => {
|
||||
const { dispatch } = this.props;
|
||||
let params = null;
|
||||
let key = null;
|
||||
let routeName = null;
|
||||
|
||||
Push.setListener({
|
||||
onPushNotificationReceived(pushNotification) {
|
||||
if (previousAppState !== 'active') {
|
||||
const push = get(pushNotification, 'customProperties');
|
||||
if (previousAppState !== 'active' && !!notification) {
|
||||
const push = get(notification, 'data');
|
||||
const type = get(push, 'type', '');
|
||||
const permlink1 = get(push, 'permlink1', '');
|
||||
const permlink2 = get(push, 'permlink2', '');
|
||||
const permlink3 = get(push, 'permlink3', '');
|
||||
//const parentPermlink1 = get(push, 'parent_permlink1', '');
|
||||
//const parentPermlink2 = get(push, 'parent_permlink2', '');
|
||||
//const parentPermlink3 = get(push, 'parent_permlink3', '');
|
||||
|
||||
//const fullParentPermlink = `${parentPermlink1}${parentPermlink2}${parentPermlink3}`;
|
||||
const fullPermlink = `${permlink1}${permlink2}${permlink3}`;
|
||||
|
||||
const fullPermlink = get(push, 'permlink', '');
|
||||
const username = get(push, 'target', '');
|
||||
const activity_id = get(push, 'id', '');
|
||||
|
||||
@ -370,8 +370,34 @@ class ApplicationContainer extends Component {
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
_createPushListener = () => {
|
||||
(async () => await messaging().requestPermission())();
|
||||
|
||||
PushNotification.setApplicationIconBadgeNumber(0);
|
||||
PushNotification.cancelAllLocalNotifications();
|
||||
|
||||
firebaseOnMessageListener = messaging().onMessage((remoteMessage) => {
|
||||
console.log('remoteMessage 1 ', remoteMessage);
|
||||
// this._pushNavigate(remoteMessage);
|
||||
});
|
||||
|
||||
firebaseOnNotificationOpenedAppListener = messaging().onNotificationOpenedApp(
|
||||
(remoteMessage) => {
|
||||
console.log('remoteMessage 2:>> ', remoteMessage);
|
||||
// this._pushNavigate(remoteMessage);
|
||||
},
|
||||
);
|
||||
|
||||
messaging()
|
||||
.getInitialNotification()
|
||||
.then((remoteMessage) => {
|
||||
console.log('remoteMessage 3:>> ', remoteMessage);
|
||||
// this._pushNavigate(remoteMessage);
|
||||
});
|
||||
|
||||
// return unsubscribe;
|
||||
};
|
||||
|
||||
_handleConntectionChange = (status) => {
|
||||
@ -526,8 +552,6 @@ class ApplicationContainer extends Component {
|
||||
}),
|
||||
);
|
||||
dispatch(changeAllNotificationSettings(settings));
|
||||
|
||||
Push.setEnabled(settings.notification);
|
||||
}
|
||||
if (settings.nsfw !== '') dispatch(setNsfw(settings.nsfw));
|
||||
|
||||
@ -596,8 +620,10 @@ class ApplicationContainer extends Component {
|
||||
};
|
||||
|
||||
_enableNotification = async (username, isEnable) => {
|
||||
const token = await AppCenter.getInstallId();
|
||||
|
||||
messaging()
|
||||
.getToken()
|
||||
.then((token) => {
|
||||
console.log('token :>> ', token);
|
||||
setPushToken({
|
||||
username,
|
||||
token,
|
||||
@ -605,6 +631,7 @@ class ApplicationContainer extends Component {
|
||||
allows_notify: Number(isEnable),
|
||||
notify_types: [1, 2, 3, 4, 5, 6],
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
_switchAccount = async (targetAccountUsername) => {
|
||||
|
@ -2,8 +2,8 @@ import React, { PureComponent } from 'react';
|
||||
import { Alert, Platform } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import AppCenter from 'appcenter';
|
||||
import Config from 'react-native-config';
|
||||
import messaging from '@react-native-firebase/messaging';
|
||||
|
||||
// Services and Actions
|
||||
import { login } from '../../../providers/steem/auth';
|
||||
@ -100,7 +100,6 @@ class LoginContainer extends PureComponent {
|
||||
transfers: 6,
|
||||
};
|
||||
const notifyTypes = [];
|
||||
const token = await AppCenter.getInstallId();
|
||||
|
||||
Object.keys(notificationDetails).map((item) => {
|
||||
const notificationType = item.replace('Notification', '');
|
||||
@ -110,6 +109,9 @@ class LoginContainer extends PureComponent {
|
||||
}
|
||||
});
|
||||
|
||||
messaging()
|
||||
.getToken()
|
||||
.then((token) => {
|
||||
const data = {
|
||||
username,
|
||||
token,
|
||||
@ -120,6 +122,7 @@ class LoginContainer extends PureComponent {
|
||||
setPushToken(data).then(() => {
|
||||
setPushTokenSaved(true);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
_getAccountsWithUsername = async (username) => {
|
||||
|
@ -1,12 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Platform } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import AppCenter from 'appcenter';
|
||||
import Push from 'appcenter-push';
|
||||
import { Client } from '@esteemapp/dhive';
|
||||
import VersionNumber from 'react-native-version-number';
|
||||
import Config from 'react-native-config';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import messaging from '@react-native-firebase/messaging';
|
||||
|
||||
// Realm
|
||||
import {
|
||||
@ -267,7 +266,6 @@ class SettingsContainer extends Component {
|
||||
notifyTypes.sort();
|
||||
|
||||
if (actionType === 'notification') {
|
||||
await Push.setEnabled(action);
|
||||
this._setPushToken(action ? notifyTypes : []);
|
||||
} else {
|
||||
this._setPushToken(notifyTypes);
|
||||
@ -312,13 +310,14 @@ class SettingsContainer extends Component {
|
||||
const { isLoggedIn, otherAccounts = [] } = this.props;
|
||||
|
||||
if (isLoggedIn) {
|
||||
const token = await AppCenter.getInstallId();
|
||||
|
||||
getExistUser().then((isExistUser) => {
|
||||
if (isExistUser) {
|
||||
otherAccounts.forEach((item) => {
|
||||
const { isNotificationSettingsOpen } = this.props;
|
||||
|
||||
messaging()
|
||||
.getToken()
|
||||
.then((token) => {
|
||||
const data = {
|
||||
username: item.username,
|
||||
token,
|
||||
@ -328,6 +327,7 @@ class SettingsContainer extends Component {
|
||||
};
|
||||
setPushToken(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
89
yarn.lock
89
yarn.lock
@ -1520,11 +1520,37 @@
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-5.3.3.tgz#2e627456d83c1d75d4c43ab6cef70fe125b9691d"
|
||||
integrity sha512-L4BsdIEEuG5rKkVNzjESdJ1wvusn0kflj/FrwctaW+xkLxiFs1+mdBg/mvqqfXvVFuBEphbyXJTFT4aG4Okkow==
|
||||
|
||||
"@react-native-community/push-notification-ios@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/push-notification-ios/-/push-notification-ios-1.2.0.tgz#3353598450a39c42d079603aad2d1c0f9c2c1729"
|
||||
integrity sha512-B5qPb9P/6vvxGGQDePlK/q6NxoZPWSVFtKCQ9jlboP7gNZmf3AAyBhTzrb++s2NSXXogjkGi6vt9df1ipZiawQ==
|
||||
dependencies:
|
||||
invariant "^2.2.4"
|
||||
|
||||
"@react-native-community/viewpager@^2.0.1":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/viewpager/-/viewpager-2.0.2.tgz#622b190294b1310c4825c98daeaee1c8443f7124"
|
||||
integrity sha512-CKVhIZdX/Cmb80muog8sKpi5vM8npwFp4tx4Dj1IvTBidZweuO22+VH2rDOj7E0LzdV9IYRJ4FGBwcPBD2qUrQ==
|
||||
|
||||
"@react-native-firebase/app-types@6.7.2":
|
||||
version "6.7.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-firebase/app-types/-/app-types-6.7.2.tgz#d2e1530af5702e00578914b41468898c10d3289c"
|
||||
integrity sha512-pIwc6e0ZINw6PJqNVsAxzOVJUDg6au2TdulY+ZOYQ11SPDs5I2n9likoGrElPmJjajT4s9h87uz/6PWP2k9PxQ==
|
||||
|
||||
"@react-native-firebase/app@^7.1.0":
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-firebase/app/-/app-7.1.0.tgz#df56260b7861b700c5888a3865b217e17536dbff"
|
||||
integrity sha512-C/SCrU/zzlYVUrqFar+a7zQ1qN01I39LREzD098Pl6gPi8ONhd5bda8ZX0Qq7fRwNmSZlQ1j93VLysagt41woA==
|
||||
dependencies:
|
||||
"@react-native-firebase/app-types" "6.7.2"
|
||||
opencollective-postinstall "^2.0.1"
|
||||
superstruct "^0.6.2"
|
||||
|
||||
"@react-native-firebase/messaging@^7.1.0":
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-firebase/messaging/-/messaging-7.1.0.tgz#49040d84ad021aec6b34caaee7dd790ffb2abc7a"
|
||||
integrity sha512-pl/qUICfK3NoOUdajgSw1Qcl1w7UHyfkwTRjwrRawySGd05p5BEkig1X32D+YHGdB14OPDKn46JxAZuw6a6Lyw==
|
||||
|
||||
"@react-navigation/core@^3.5.1":
|
||||
version "3.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-3.5.1.tgz#7a2339fca3496979305fb3a8ab88c2ca8d8c214d"
|
||||
@ -2679,6 +2705,16 @@ cliui@^5.0.0:
|
||||
strip-ansi "^5.2.0"
|
||||
wrap-ansi "^5.1.0"
|
||||
|
||||
clone-deep@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-2.0.2.tgz#00db3a1e173656730d1188c3d6aced6d7ea97713"
|
||||
integrity sha512-SZegPTKjCgpQH63E+eN6mVEEPdQBOUzjyJm5Pora4lrwWRFS8I0QAxV/KD6vV/i0WuijHZWQC1fMsPEdxfdVCQ==
|
||||
dependencies:
|
||||
for-own "^1.0.0"
|
||||
is-plain-object "^2.0.4"
|
||||
kind-of "^6.0.0"
|
||||
shallow-clone "^1.0.0"
|
||||
|
||||
clone@^1.0.2:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
||||
@ -4168,11 +4204,23 @@ follow-redirects@1.5.10:
|
||||
dependencies:
|
||||
debug "=3.1.0"
|
||||
|
||||
for-in@^1.0.2:
|
||||
for-in@^0.1.3:
|
||||
version "0.1.8"
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"
|
||||
integrity sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=
|
||||
|
||||
for-in@^1.0.1, for-in@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||
integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=
|
||||
|
||||
for-own@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b"
|
||||
integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=
|
||||
dependencies:
|
||||
for-in "^1.0.1"
|
||||
|
||||
forever-agent@~0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
|
||||
@ -5639,6 +5687,11 @@ kind-of@^6.0.0, kind-of@^6.0.2:
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"
|
||||
integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==
|
||||
|
||||
kind-of@^6.0.1:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
|
||||
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
|
||||
|
||||
klaw@^1.0.0:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
|
||||
@ -6415,6 +6468,14 @@ mixin-deep@^1.2.0:
|
||||
for-in "^1.0.2"
|
||||
is-extendable "^1.0.1"
|
||||
|
||||
mixin-object@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e"
|
||||
integrity sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=
|
||||
dependencies:
|
||||
for-in "^0.1.3"
|
||||
is-extendable "^0.1.1"
|
||||
|
||||
mkdirp@0.5.1, mkdirp@^0.5.1, mkdirp@~0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
|
||||
@ -6772,7 +6833,7 @@ open@^6.2.0:
|
||||
dependencies:
|
||||
is-wsl "^1.1.0"
|
||||
|
||||
opencollective-postinstall@^2.0.2:
|
||||
opencollective-postinstall@^2.0.1, opencollective-postinstall@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89"
|
||||
integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==
|
||||
@ -7559,6 +7620,13 @@ react-native-navigation-bar-color@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/react-native-navigation-bar-color/-/react-native-navigation-bar-color-1.0.0.tgz#04ff752a58049af93ceea9ccf266b8d3fbc6514a"
|
||||
integrity sha512-djBE0zSp+JT65VeUm4UpIpr9DA9SpE9YTLwDAcqkWfB9JI8l3djSx+SmrIYfc7dUs216Y6qo2dr0qR3+M5qbOQ==
|
||||
|
||||
react-native-push-notification@^3.5.1:
|
||||
version "3.5.1"
|
||||
resolved "https://registry.yarnpkg.com/react-native-push-notification/-/react-native-push-notification-3.5.1.tgz#438dd6b526903e01659f34b1ba5d9f293ac663a1"
|
||||
integrity sha512-F2h4qlEnKzjtqFhtT3To3rUAFuzmfHrFum55yttb40dE0+gMh1Piu0EyebIseKsin6Ia3830tLK/e1Q1kQMMjA==
|
||||
dependencies:
|
||||
"@react-native-community/push-notification-ios" "^1.2.0"
|
||||
|
||||
react-native-qrcode-svg@^6.0.3:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/react-native-qrcode-svg/-/react-native-qrcode-svg-6.0.3.tgz#27b6a7a1df02c5bf10796fd97e8b55c0044dc0f8"
|
||||
@ -8410,6 +8478,15 @@ sha.js@^2.4.0, sha.js@^2.4.8:
|
||||
inherits "^2.0.1"
|
||||
safe-buffer "^5.0.1"
|
||||
|
||||
shallow-clone@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-1.0.0.tgz#4480cd06e882ef68b2ad88a3ea54832e2c48b571"
|
||||
integrity sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA==
|
||||
dependencies:
|
||||
is-extendable "^0.1.1"
|
||||
kind-of "^5.0.0"
|
||||
mixin-object "^2.0.1"
|
||||
|
||||
shallow-equal@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.2.1.tgz#4c16abfa56043aa20d050324efa68940b0da79da"
|
||||
@ -8852,6 +8929,14 @@ sudo-prompt@^9.0.0:
|
||||
resolved "https://registry.yarnpkg.com/sudo-prompt/-/sudo-prompt-9.1.1.tgz#73853d729770392caec029e2470db9c221754db0"
|
||||
integrity sha512-es33J1g2HjMpyAhz8lOR+ICmXXAqTuKbuXuUWLhOLew20oN9oUCgCJx615U/v7aioZg7IX5lIh9x34vwneu4pA==
|
||||
|
||||
superstruct@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.6.2.tgz#c5eb034806a17ff98d036674169ef85e4c7f6a1c"
|
||||
integrity sha512-lvA97MFAJng3rfjcafT/zGTSWm6Tbpk++DP6It4Qg7oNaeM+2tdJMuVgGje21/bIpBEs6iQql1PJH6dKTjl4Ig==
|
||||
dependencies:
|
||||
clone-deep "^2.0.1"
|
||||
kind-of "^6.0.1"
|
||||
|
||||
supports-color@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||
|
Loading…
Reference in New Issue
Block a user