Merge pull request #2531 from ecency/nt/ios-notification-fix

Nt/ios notification fix
This commit is contained in:
Feruz M 2022-11-16 15:23:25 +05:30 committed by GitHub
commit ffabc2f6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 488 additions and 484 deletions

View File

@ -35,7 +35,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.android.tools.build:gradle:7.3.1")
classpath 'com.google.gms:google-services:4.3.10'
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,12 @@
$RNFirebaseAsStaticFramework = true
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
use_frameworks! :linkage => :static
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
target 'Ecency' do
config = use_native_modules!
@ -35,6 +38,21 @@ target 'Ecency' do
# Pods for testing
end
# Convert all permission pods into static libraries
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
end
post_install do |installer|
react_native_post_install(

View File

@ -32,127 +32,126 @@ PODS:
- React-Core (= 0.70.3)
- React-jsi (= 0.70.3)
- ReactCommon/turbomodule/core (= 0.70.3)
- Firebase/Analytics (8.15.0):
- Firebase/Analytics (10.1.0):
- Firebase/Core
- Firebase/Core (8.15.0):
- Firebase/Core (10.1.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 8.15.0)
- Firebase/CoreOnly (8.15.0):
- FirebaseCore (= 8.15.0)
- Firebase/DynamicLinks (8.15.0):
- FirebaseAnalytics (~> 10.1.0)
- Firebase/CoreOnly (10.1.0):
- FirebaseCore (= 10.1.0)
- Firebase/DynamicLinks (10.1.0):
- Firebase/CoreOnly
- FirebaseDynamicLinks (~> 8.15.0)
- Firebase/Messaging (8.15.0):
- FirebaseDynamicLinks (~> 10.1.0)
- Firebase/Messaging (10.1.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 8.15.0)
- FirebaseAnalytics (8.15.0):
- FirebaseAnalytics/AdIdSupport (= 8.15.0)
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseAnalytics/AdIdSupport (8.15.0):
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleAppMeasurement (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseCore (8.15.0):
- FirebaseCoreDiagnostics (~> 8.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- FirebaseCoreDiagnostics (8.15.0):
- GoogleDataTransport (~> 9.1)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- nanopb (~> 2.30908.0)
- FirebaseDynamicLinks (8.15.0):
- FirebaseCore (~> 8.0)
- FirebaseInstallations (8.15.0):
- FirebaseCore (~> 8.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/UserDefaults (~> 7.7)
- PromisesObjC (< 3.0, >= 1.2)
- FirebaseMessaging (8.15.0):
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleDataTransport (~> 9.1)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Reachability (~> 7.7)
- GoogleUtilities/UserDefaults (~> 7.7)
- nanopb (~> 2.30908.0)
- FirebaseMessaging (~> 10.1.0)
- FirebaseAnalytics (10.1.0):
- FirebaseAnalytics/AdIdSupport (= 10.1.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.1.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.1.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseCore (10.1.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreExtension (10.1.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.1.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseDynamicLinks (10.1.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (10.1.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.1.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30910.0, >= 2.30908.0)
- fmt (6.2.1)
- glog (0.3.5)
- GoogleAppMeasurement (8.15.0):
- GoogleAppMeasurement/AdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (8.15.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (8.15.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement (10.1.0):
- GoogleAppMeasurement/AdIdSupport (= 10.1.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.1.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.1.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.1.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleDataTransport (9.2.0):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.7.0):
- GoogleUtilities/AppDelegateSwizzler (7.10.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.7.0):
- GoogleUtilities/Environment (7.10.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.7.0):
- GoogleUtilities/Logger (7.10.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.7.0):
- GoogleUtilities/MethodSwizzler (7.10.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.7.0):
- GoogleUtilities/Network (7.10.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.7.0)"
- GoogleUtilities/Reachability (7.7.0):
- "GoogleUtilities/NSData+zlib (7.10.0)"
- GoogleUtilities/Reachability (7.10.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.7.0):
- GoogleUtilities/UserDefaults (7.10.0):
- GoogleUtilities/Logger
- hermes-engine (0.70.3)
- libevent (2.1.12)
- libwebp (1.2.3):
- libwebp/demux (= 1.2.3)
- libwebp/mux (= 1.2.3)
- libwebp/webp (= 1.2.3)
- libwebp/demux (1.2.3):
- libwebp (1.2.4):
- libwebp/demux (= 1.2.4)
- libwebp/mux (= 1.2.4)
- libwebp/webp (= 1.2.4)
- libwebp/demux (1.2.4):
- libwebp/webp
- libwebp/mux (1.2.3):
- libwebp/mux (1.2.4):
- libwebp/demux
- libwebp/webp (1.2.3)
- libwebp/webp (1.2.4)
- lottie-ios (3.4.0)
- lottie-react-native (5.1.4):
- lottie-ios (~> 3.4.0)
- React-Core
- nanopb (2.30908.0):
- nanopb/decode (= 2.30908.0)
- nanopb/encode (= 2.30908.0)
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- Permission-Camera (3.6.1):
- RNPermissions
- PromisesObjC (2.1.1)
@ -512,20 +511,21 @@ PODS:
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
- RNFBAnalytics (14.12.0):
- Firebase/Analytics (= 8.15.0)
- RNFBAnalytics (16.4.3):
- Firebase/Analytics (= 10.1.0)
- React-Core
- RNFBApp
- RNFBApp (14.12.0):
- Firebase/CoreOnly (= 8.15.0)
- RNFBApp (16.4.3):
- Firebase/CoreOnly (= 10.1.0)
- React-Core
- RNFBDynamicLinks (14.12.0):
- Firebase/DynamicLinks (= 8.15.0)
- RNFBDynamicLinks (16.4.3):
- Firebase/DynamicLinks (= 10.1.0)
- GoogleUtilities/AppDelegateSwizzler
- React-Core
- RNFBApp
- RNFBMessaging (14.12.0):
- Firebase/Messaging (= 8.15.0)
- RNFBMessaging (16.4.3):
- Firebase/Messaging (= 10.1.0)
- FirebaseCoreExtension (= 10.1.0)
- React-Core
- RNFBApp
- RNGestureHandler (2.8.0):
@ -690,7 +690,8 @@ SPEC REPOS:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreExtension
- FirebaseCoreInternal
- FirebaseDynamicLinks
- FirebaseInstallations
- FirebaseMessaging
@ -883,24 +884,25 @@ SPEC CHECKSUMS:
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3b313c3fb52b597f7a9b430798e6367d2b9f07e5
FBReactNativeSpec: 99a7ecb7e9665d96f2fea706b0844e2f3117f381
Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d
FirebaseAnalytics: 7761cbadb00a717d8d0939363eb46041526474fa
FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseDynamicLinks: 1dc816ef789c5adac6fede0b46d11478175c70e4
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FirebaseMessaging: 5e5118a2383b3531e730d974680954c679ca0a13
Firebase: 444b35a9c568a516666213c2f6cccd10cb12559f
FirebaseAnalytics: 24cb27b52b2e11ad5013528195b4ca0755dec960
FirebaseCore: 55e7ae35991ccca4db03ff8d8df6ed5f17a3e4c7
FirebaseCoreExtension: 69b966c399abc4ca6dc75006ab87160f81512725
FirebaseCoreInternal: 96d75228e10fd369564da51bd898414eb0f54df5
FirebaseDynamicLinks: 0c8492a77625ee3c0c564bf98b4cdaa89d9e6535
FirebaseInstallations: 99d24bac0243cf8b0e96cf5426340d211f0bcc80
FirebaseMessaging: 4487bbff9b9b927ba1dd3ea40d1ceb58e4ee3cb5
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
GoogleAppMeasurement: e490e248af3da95afe8fa8e7baac232dc8d020b7
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95
hermes-engine: bb344d89a0d14c2c91ad357480a79698bb80e186
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
lottie-ios: 69495122151a378fdc7d1bb4c5930347e37baf1f
lottie-react-native: b702fab740cdb952a8e2354713d3beda63ff97b0
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
Permission-Camera: bf6791b17c7f614b6826019fcfdcc286d3a107f6
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
@ -953,17 +955,17 @@ SPEC CHECKSUMS:
RNCPushNotificationIOS: 87b8d16d3ede4532745e05b03c42cff33a36cc45
RNDeviceInfo: c31137f22ee779fe3931d1a8d60cc1af80ef4077
RNFastImage: 3207b9eb17c2425d574ca40db35185db6e324f4e
RNFBAnalytics: ea1421b49a0bf5e5bb7274df4a330713d0e85d2e
RNFBApp: e4439717c23252458da2b41b81b4b475c86f90c4
RNFBDynamicLinks: 538840f6e3f58511f857d15df1bc25ed655dc283
RNFBMessaging: 40dac204b4197a2661dec5be964780c6ec39bf65
RNFBAnalytics: 881ce1cb0fa57cbbafc540076326f05879e89989
RNFBApp: e2157f61e4769b53641df8948c534580630cb50a
RNFBDynamicLinks: 5dbccab1f947e2a8a4d1c523f7b390501bedfc7b
RNFBMessaging: 00da9a5a7136caa61a7b75d87e1dd83864251136
RNGestureHandler: 62232ba8f562f7dea5ba1b3383494eb5bf97a4d3
RNIap: e17233fe11083a71e0420682b0b09d497861faa1
RNImageCropPicker: 08ba3a2e2f4f8833d606f01906c371e382c4dea9
RNNotifee: dcb2593127f40945c4ee5fc09f61d71bbd00b9cf
RNOS: 6f2f9a70895bbbfbdad7196abd952e7b01d45027
RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c
RNReanimated: 2a91e85fcd343f8af3c58d3425b99fdd285590a5
RNReanimated: 26c85a645e1b0e187d05918fbd5a33446406e7bf
RNScreens: 4830eb40e0793b38849965cd27f4f3a7d7bc65c1
RNSVG: ecd661f380a07ba690c9c5929c475a44f432d674
RNVectorIcons: 368d6d8b8301224e5ffb6254191f4f8876c2be0d
@ -974,6 +976,6 @@ SPEC CHECKSUMS:
toolbar-android: 2a73856e98b750d7e71ce4644d3f41cc98211719
Yoga: 2ed968a4f060a92834227c036279f2736de0fce3
PODFILE CHECKSUM: 36d29e2c20cdf9c60df8598f3eb180df6812c820
PODFILE CHECKSUM: 0a6824051f9629d0ef72145297858a33cd8ff2d2
COCOAPODS: 1.11.3

View File

@ -46,10 +46,10 @@
"@react-native-community/netinfo": "^9.3.5",
"@react-native-community/push-notification-ios": "^1.2.0",
"@react-native-community/toolbar-android": "^0.2.1",
"@react-native-firebase/analytics": "^14.9.4",
"@react-native-firebase/app": "^14.9.4",
"@react-native-firebase/dynamic-links": "^14.9.4",
"@react-native-firebase/messaging": "^14.9.4",
"@react-native-firebase/analytics": "^16.4.3",
"@react-native-firebase/app": "^16.4.3",
"@react-native-firebase/dynamic-links": "^16.4.3",
"@react-native-firebase/messaging": "^16.4.3",
"@react-navigation/bottom-tabs": "^6.3.2",
"@react-navigation/drawer": "^6.4.3",
"@react-navigation/native": "^6.0.13",

View File

@ -12,18 +12,17 @@ import ROUTES from '../../../constants/routeNames';
import styles from './informationAreaStyles';
const FormInputView = ({ description, iconName, bold, link }) => {
const navigation = useNavigation();
const _onPress = () => {
navigation.navigate({
name: ROUTES.SCREENS.WEB_BROWSER,
params: {
url: link
url: link,
},
key: link
})
}
key: link,
});
};
return (
<TouchableOpacity onPress={_onPress}>
@ -32,8 +31,7 @@ const FormInputView = ({ description, iconName, bold, link }) => {
<Text style={[styles.infoText, bold && styles.bold]}>{description}</Text>
</View>
</TouchableOpacity>
)
}
);
};
export default FormInputView;

View File

@ -66,7 +66,6 @@ const MainStackNavigator = () => {
<MainStack.Screen name={ROUTES.SCREENS.FOLLOWS} component={Follows} />
<MainStack.Screen name={ROUTES.SCREENS.TRANSFER} component={Transfer} />
<MainStack.Screen name={ROUTES.SCREENS.EDITOR} component={Editor} />
</MainStack.Group>
</MainStack.Navigator>
);

View File

@ -5,8 +5,9 @@ import {
useQueries,
useQueryClient,
} from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import { useIntl } from 'react-intl';
import { unionBy } from 'lodash';
import bugsnapInstance from '../../config/bugsnag';
import { useAppDispatch, useAppSelector } from '../../hooks';
import { updateUnreadActivityCount } from '../../redux/actions/accountAction';
@ -15,17 +16,13 @@ import { getNotifications, markNotifications } from '../ecency/ecency';
import { NotificationFilters } from '../ecency/ecency.types';
import { markHiveNotifications } from '../hive/dhive';
import QUERIES from './queryKeys';
import { unionBy } from 'lodash';
const FETCH_LIMIT = 20;
export const useNotificationsQuery = (filter: NotificationFilters) => {
const [data, setData] = useState([]);
const [isRefreshing, setIsRefreshing] = useState(false);
const [pageParams, setPageParams] = useState(['']);
const _fetchNotifications = async (pageParam: string) => {
console.log('fetching page since:', pageParam);
const response = await getNotifications({ filter, since: pageParam, limit: FETCH_LIMIT });
@ -39,11 +36,6 @@ export const useNotificationsQuery = (filter: NotificationFilters) => {
return lastId;
};
const _onSuccess = () => {
const dataArrs = notificationQueries.map((query)=>query.data);
const _data = unionBy(...dataArrs, 'id')
setData(_data);
}
// query initialization
const notificationQueries = useQueries({
@ -51,7 +43,6 @@ export const useNotificationsQuery = (filter: NotificationFilters) => {
queryKey: [QUERIES.NOTIFICATIONS.GET, filter, pageParam],
queryFn: () => _fetchNotifications(pageParam),
initialData: [],
onSuccess:_onSuccess
})),
});
@ -76,8 +67,10 @@ export const useNotificationsQuery = (filter: NotificationFilters) => {
}
};
const _dataArrs = notificationQueries.map(query => query.data);
return {
data,
data: unionBy(..._dataArrs, 'id'),
isRefreshing,
isLoading: notificationQueries.lastItem.isLoading || notificationQueries.lastItem.isFetching,
fetchNextPage: _fetchNextPage,

View File

@ -17,7 +17,6 @@ import { injectIntl } from 'react-intl';
import { bindActionCreators } from 'redux';
import { isEmpty, some } from 'lodash';
import messaging from '@react-native-firebase/messaging';
import notifee from '@notifee/react-native';
import VersionNumber from 'react-native-version-number';
import ReceiveSharingIntent from 'react-native-receive-sharing-intent';
@ -37,7 +36,6 @@ import {
setExistUser,
getLastUpdateCheck,
setLastUpdateCheck,
getTheme,
} from '../../../realm/realm';
import { getUser, getDigitPinCode, getMutes } from '../../../providers/hive/dhive';
import { getPointsSummary } from '../../../providers/ecency/ePoint';
@ -92,8 +90,7 @@ import MigrationHelpers from '../../../utils/migrationHelpers';
import { deepLinkParser } from '../../../utils/deepLinkParser';
import bugsnapInstance from '../../../config/bugsnag';
let firebaseOnNotificationOpenedAppListener = null;
let firebaseOnMessageListener = null;
let firebaseOnMessageListener: any = null;
let appStateSub: NativeEventSubscription | null = null;
let linkingEventSub: EventSubscription | null = null;
@ -184,10 +181,6 @@ class ApplicationContainer extends Component {
firebaseOnMessageListener();
}
if (firebaseOnNotificationOpenedAppListener) {
firebaseOnNotificationOpenedAppListener();
}
this.netListener();
}
@ -334,97 +327,6 @@ class ApplicationContainer extends Component {
}
};
_pushNavigate = (notification) => {
const { dispatch } = this.props;
let params = null;
let key = null;
let routeName = null;
if (notification) {
const push = get(notification, 'data');
const type = get(push, 'type', '');
const fullPermlink =
get(push, 'permlink1', '') + get(push, 'permlink2', '') + get(push, 'permlink3', '');
// const username = get(push, 'target', '');
const activity_id = get(push, 'id', '');
switch (type) {
case 'vote':
case 'unvote':
params = {
author: get(push, 'target', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'mention':
params = {
author: get(push, 'source', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'follow':
case 'unfollow':
case 'ignore':
params = {
username: get(push, 'source', ''),
};
key = get(push, 'source', '');
routeName = ROUTES.SCREENS.PROFILE;
break;
case 'reblog':
params = {
author: get(push, 'target', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'reply':
params = {
author: get(push, 'source', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'transfer':
routeName = ROUTES.TABBAR.PROFILE;
params = {
activePage: 2,
};
break;
case 'inactive':
routeName = ROUTES.SCREENS.EDITOR;
key = push.source || 'inactive';
break;
default:
break;
}
markNotifications(activity_id).then((result) => {
dispatch(updateUnreadActivityCount(result.unread));
});
if (!some(params, isEmpty)) {
RootNavigation.navigate({
name: routeName,
params,
key,
});
}
}
};
_showNotificationToast = (remoteMessage) => {
const { dispatch } = this.props;
@ -434,11 +336,8 @@ class ApplicationContainer extends Component {
}
};
_createPushListener = () => {
(async () => await messaging().requestPermission())();
notifee.setBadgeCount(0);
notifee.cancelAllNotifications();
_createPushListener = async () => {
await messaging().requestPermission();
firebaseOnMessageListener = messaging().onMessage((remoteMessage) => {
console.log('Notification Received: foreground', remoteMessage);
@ -447,19 +346,6 @@ class ApplicationContainer extends Component {
foregroundNotificationData: remoteMessage,
});
});
firebaseOnNotificationOpenedAppListener = messaging().onNotificationOpenedApp(
(remoteMessage) => {
console.log('Notification Received, notification oped app:', remoteMessage);
this._pushNavigate(remoteMessage);
},
);
messaging()
.getInitialNotification()
.then((remoteMessage) => {
this._pushNavigate(remoteMessage);
});
};
_handleConntectionChange = (status) => {

View File

@ -2,7 +2,17 @@ import { useEffect, useRef } from 'react';
import Orientation, { useDeviceOrientationChange } from 'react-native-orientation-locker';
import { isLandscape } from 'react-native-device-info';
import EStyleSheet from 'react-native-extended-stylesheet';
import { Appearance, AppState, NativeEventSubscription, useColorScheme } from 'react-native';
import {
Alert,
Appearance,
AppState,
NativeEventSubscription,
Platform,
useColorScheme,
} from 'react-native';
import notifee, { EventType } from '@notifee/react-native';
import { isEmpty, some, get } from 'lodash';
import messaging from '@react-native-firebase/messaging';
import { useAppDispatch, useAppSelector } from '../../../hooks';
import { setDeviceOrientation, setLockedOrientation } from '../../../redux/actions/uiAction';
import { orientations } from '../../../redux/constants/orientationsConstants';
@ -12,6 +22,10 @@ import lightTheme from '../../../themes/lightTheme';
import { useUserActivityMutation } from '../../../providers/queries';
import THEME_OPTIONS from '../../../constants/options/theme';
import { setIsDarkTheme } from '../../../redux/actions/applicationActions';
import { markNotifications } from '../../../providers/ecency/ecency';
import { updateUnreadActivityCount } from '../../../redux/actions/accountAction';
import RootNavigation from '../../../navigation/rootNavigation';
import ROUTES from '../../../constants/routeNames';
export const useInitApplication = () => {
const dispatch = useAppDispatch();
@ -22,6 +36,9 @@ export const useInitApplication = () => {
const appState = useRef(AppState.currentState);
const appStateSubRef = useRef<NativeEventSubscription | null>(null);
const notifeeEventRef = useRef<any>(null);
const messagingEventRef = useRef<any>(null);
const userActivityMutation = useUserActivityMutation();
useDeviceOrientationChange((o) => {
@ -47,6 +64,8 @@ export const useInitApplication = () => {
userActivityMutation.lazyMutatePendingActivities();
_initPushListener();
return _cleanup;
}, []);
@ -66,6 +85,42 @@ export const useInitApplication = () => {
if (appStateSubRef.current) {
appStateSubRef.current.remove();
}
if (notifeeEventRef.current) {
notifeeEventRef.current();
}
if (messagingEventRef.current) {
messagingEventRef.current();
}
};
const _initPushListener = async () => {
await notifee.requestPermission();
notifee.setBadgeCount(0);
notifee.cancelAllNotifications();
// on android messaging event work fine for both background and quite state
// while notifee events do not fuction as expected
if (Platform.OS === 'android') {
messagingEventRef.current = messaging().onNotificationOpenedApp((remoteMessage) => {
_pushNavigate(remoteMessage);
});
const initialNotification = await messaging().getInitialNotification();
if (initialNotification) {
_pushNavigate(initialNotification);
}
} else if (Platform.OS === 'ios') {
// for ios, notifee events work while messaging event are malfunctioning, the foreground event
// on ios is called if user opens/starts app from notification
notifeeEventRef.current = notifee.onForegroundEvent(({ type, detail }) => {
if (type === EventType.PRESS) {
_pushNavigate(detail.notification);
}
});
}
};
const _handleAppStateChange = (nextAppState) => {
@ -75,4 +130,96 @@ export const useInitApplication = () => {
appState.current = nextAppState;
};
const _pushNavigate = (notification) => {
let params = null;
let key = null;
let routeName = null;
if (notification) {
const push = get(notification, 'data');
const type = get(push, 'type', '');
const fullPermlink =
get(push, 'permlink1', '') + get(push, 'permlink2', '') + get(push, 'permlink3', '');
// const username = get(push, 'target', '');
const activity_id = get(push, 'id', '');
switch (type) {
case 'vote':
case 'unvote':
params = {
author: get(push, 'target', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'mention':
params = {
author: get(push, 'source', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'follow':
case 'unfollow':
case 'ignore':
params = {
username: get(push, 'source', ''),
};
key = get(push, 'source', '');
routeName = ROUTES.SCREENS.PROFILE;
break;
case 'reblog':
params = {
author: get(push, 'target', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'favorites':
case 'bookmarks':
case 'reply':
params = {
author: get(push, 'source', ''),
permlink: fullPermlink,
};
key = fullPermlink;
routeName = ROUTES.SCREENS.POST;
break;
case 'transfer':
routeName = ROUTES.TABBAR.PROFILE;
params = {
activePage: 2,
};
break;
case 'inactive':
routeName = ROUTES.SCREENS.EDITOR;
key = push.source || 'inactive';
break;
default:
break;
}
markNotifications(activity_id).then((result) => {
dispatch(updateUnreadActivityCount(result.unread));
});
if (!some(params, isEmpty)) {
RootNavigation.navigate({
name: routeName,
params,
key,
});
}
}
};
};

View File

@ -4,10 +4,10 @@ import { WebView } from 'react-native-webview';
import { SafeAreaView } from 'react-native-safe-area-context';
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
import styles from './webBrowserStyles';
import { BasicHeader } from '../../../components';
import EStyleSheet from 'react-native-extended-stylesheet';
import { useIntl } from 'react-intl';
import styles from './webBrowserStyles';
import { BasicHeader } from '../../../components';
export interface WebBrowserParams {
url: string;
@ -28,7 +28,6 @@ const WebBrowser = ({ navigation, route }: Props) => {
const [isLoading, setIsLoading] = useState(true);
if (!url) {
Alert.alert('DEV: url parameter cannot be empty');
navigation.goBack();
@ -36,31 +35,28 @@ const WebBrowser = ({ navigation, route }: Props) => {
}
const urlObj = new URL(url);
const title = `${urlObj.host || urlObj.hostname}...`
const title = `${urlObj.host || urlObj.hostname}...`;
const _handleRightIconPress = () => {
Share.share({
message: url,
});
}
};
const _onError = () => {
Alert.alert(
intl.formatMessage({ id: 'alert.fail' }),
)
}
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
};
return (
<SafeAreaView style={styles.container}>
<BasicHeader
title={title}
backIconName='close'
rightIconName='share'
iconType='MaterialIcons'
backIconName="close"
rightIconName="share"
iconType="MaterialIcons"
handleRightIconPress={_handleRightIconPress}
/>
<View style={styles.container}>
<WebView
style={styles.webView}
@ -80,8 +76,6 @@ const WebBrowser = ({ navigation, route }: Props) => {
/>
)}
</View>
</SafeAreaView>
);
};

View File

@ -3,17 +3,17 @@ import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
container: {
flex: 1,
backgroundColor: '$primaryBackgroundColor'
backgroundColor: '$primaryBackgroundColor',
},
webView: {
flex: 1,
width: '100%'
width: '100%',
},
loading: {
position: "absolute",
position: 'absolute',
top: 16,
left: 0,
right: 0,
alignItems: 'center'
}
alignItems: 'center',
},
});

View File

@ -53,11 +53,11 @@ const WelcomeScreen = () => {
navigation.navigate({
name: ROUTES.SCREENS.WEB_BROWSER,
params: {
url
url,
},
key:url
})
}
key: url,
});
};
const _renderInfo = (iconName, headingIntlId, bodyIntlId) => (
<View style={styles.sectionRow}>

View File

@ -966,12 +966,12 @@
dependencies:
prop-types "^15.5.6"
"@expo/config-plugins@^4.1.5":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-4.1.5.tgz#9d357d2cda9c095e511b51583ede8a3b76174068"
integrity sha512-RVvU40RtZt12HavuDAe+LDIq9lHj7sheOfMEHdmpJ/uTA8pgvkbc56XF6JHQD+yRr6+uhhb+JnAasGq49dsQbw==
"@expo/config-plugins@^5.0.1":
version "5.0.4"
resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-5.0.4.tgz#216fea6558fe66615af1370de55193f4181cb23e"
integrity sha512-vzUcVpqOMs3h+hyRdhGwk+eGIOhXa5xYdd92yO17RMNHav3v/+ekMbs7XA2c3lepMO8Yd4/5hqmRw9ZTL6jGzg==
dependencies:
"@expo/config-types" "^45.0.0"
"@expo/config-types" "^47.0.0"
"@expo/json-file" "8.2.36"
"@expo/plist" "0.0.18"
"@expo/sdk-runtime-versions" "^1.0.0"
@ -987,10 +987,10 @@
xcode "^3.0.1"
xml2js "0.4.23"
"@expo/config-types@^45.0.0":
version "45.0.0"
resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-45.0.0.tgz#963c2fdce8fbcbd003758b92ed8a25375f437ef6"
integrity sha512-/QGhhLWyaGautgEyU50UJr5YqKJix5t77ePTwreOVAhmZH+ff3nrrtYTTnccx+qF08ZNQmfAyYMCD3rQfzpiJA==
"@expo/config-types@^47.0.0":
version "47.0.0"
resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-47.0.0.tgz#99eeabe0bba7a776e0f252b78beb0c574692c38d"
integrity sha512-r0pWfuhkv7KIcXMUiNACJmJKKwlTBGMw9VZHNdppS8/0Nve8HZMTkNRFQzTHW1uH3pBj8jEXpyw/2vSWDHex9g==
"@expo/json-file@8.2.36":
version "8.2.36"
@ -1965,40 +1965,45 @@
resolved "https://registry.yarnpkg.com/@react-native-community/toolbar-android/-/toolbar-android-0.2.1.tgz#5d021da8f6aef9412c58d5c981a62b91191af3fe"
integrity sha512-kq1jVuJTSnKvqiyFqHp0hNLfntZRdE16heQI2UbE7dUUI0pR7YIoBoRlnt8x5ivJJ/f6m1Dcidku9LkwtcUs6w==
"@react-native-firebase/analytics@^14.9.4":
version "14.12.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/analytics/-/analytics-14.12.0.tgz#a95ed34187018704d1c0aa7a05c02c1711fac94f"
integrity sha512-1ulisJVqpCVs+c3wukG7PCRyipBNqzWVzzC/WB+zaFLXu5gtYZU1RXbzuIUTQLLvVM4v+Yl1wdqcuhybjm+BQA==
"@react-native-firebase/analytics@^16.4.3":
version "16.4.3"
resolved "https://registry.yarnpkg.com/@react-native-firebase/analytics/-/analytics-16.4.3.tgz#1f0b318fccc8a9fdeb6404b37128f079672417e6"
integrity sha512-N930rgrnP6jjiZouCY+YsRI62gm/I7NGRMRecbhSO60HgObrLfVfPhNY3Ugm0VRlNxHMTME9SRER0qL4eZK/3w==
"@react-native-firebase/app@^14.9.4":
version "14.12.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/app/-/app-14.12.0.tgz#d9706973489485d8705ce8344e3b255115b381a8"
integrity sha512-r/4eP96U3StUs9t3QSlNwCIjjZpEAzI0u8GF8VlNNgrFxUKQXmwe63dRXQXVrI03MxnHgg87OpoWgIxhRlC9Rg==
"@react-native-firebase/app@^16.4.3":
version "16.4.3"
resolved "https://registry.yarnpkg.com/@react-native-firebase/app/-/app-16.4.3.tgz#707b18ab53324f401fc1a572bd308d08d10399a7"
integrity sha512-6cXm4D3CIVK3N8WMAz+vL/rzjKmoAuFdtdnjLTYsFU/fsQGcsKkZSGiWfMbZASCwcnspRR1/FjyRC5Y4tzqiuA==
dependencies:
"@expo/config-plugins" "^4.1.5"
"@expo/config-plugins" "^5.0.1"
opencollective-postinstall "^2.0.1"
superstruct "^0.6.2"
"@react-native-firebase/dynamic-links@^14.9.4":
version "14.12.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/dynamic-links/-/dynamic-links-14.12.0.tgz#58809a6e332750ac4c38258e76b1fa864557f63c"
integrity sha512-PAgj/TTmbxv4kvBePXVMN7UatatkcGMSgXAbjGMpsIqGiZ4KtWgDBsJSU+7K4P6VnTcOzuETAr4P0KXEnbJLaA==
"@react-native-firebase/dynamic-links@^16.4.3":
version "16.4.3"
resolved "https://registry.yarnpkg.com/@react-native-firebase/dynamic-links/-/dynamic-links-16.4.3.tgz#0d708b7a1b6ad702bc642df04f9ec01fdca2aa07"
integrity sha512-yzHSlrjkEgsq0rbOArO/B7N5eJeCwvJG6TXYDI/FVthv+WOQLI+EEhWVBOsjopNp8MrtKqqgQnBXiv6rqOQi9g==
"@react-native-firebase/messaging@^14.9.4":
version "14.12.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/messaging/-/messaging-14.12.0.tgz#02cad59f2cf52b68d9cdeed3f1206fe6f84c068f"
integrity sha512-4JF93pYLyFiLjwU2RYlHMKSjI7DKLuqQrqCnC3M2yhgTDeYaJsqnYnTSDMfmmh9vZHfHjTztc6E2scwr/Mw8tg==
"@react-native-firebase/messaging@^16.4.3":
version "16.4.3"
resolved "https://registry.yarnpkg.com/@react-native-firebase/messaging/-/messaging-16.4.3.tgz#c86904c06dd5ffe6d0ebad88257320fef1a0e55e"
integrity sha512-6DLfijnyQ7Ew7csVMN1IwLTv2aZS+Jk7Zi1DV/2M8sen2Zq31b+pl5keXEN/vMeQo93/qKkG9SiFjoQI9kNGXA==
"@react-native/assets@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@react-native/assets/-/assets-1.0.0.tgz#c6f9bf63d274bafc8e970628de24986b30a55c8e"
integrity sha512-KrwSpS1tKI70wuKl68DwJZYEvXktDHdZMG0k2AXD/rJVSlB23/X2CB2cutVR0HwNMJIal9HOUOBB2rVfa6UGtQ==
"@react-native/normalize-color@*", "@react-native/normalize-color@2.0.0", "@react-native/normalize-color@^2.0.0":
"@react-native/normalize-color@*", "@react-native/normalize-color@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-2.0.0.tgz#da955909432474a9a0fe1cbffc66576a0447f567"
integrity sha512-Wip/xsc5lw8vsBlmY2MO/gFLp3MvuZ2baBZjDeTjjndMgM0h5sxz7AZR62RDPGgstp8Np7JzjvVqVT7tpFZqsw==
"@react-native/normalize-color@^2.0.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-2.1.0.tgz#939b87a9849e81687d3640c5efa2a486ac266f91"
integrity sha512-Z1jQI2NpdFJCVgpY+8Dq/Bt3d+YUi1928Q+/CZm/oh66fzM0RUl54vvuXlPJKybH4pdCZey1eDTPaLHkMPNgWA==
"@react-native/polyfills@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-2.0.0.tgz#4c40b74655c83982c8cf47530ee7dc13d957b6aa"
@ -2443,9 +2448,9 @@
eslint-visitor-keys "^1.1.0"
"@xmldom/xmldom@~0.7.0":
version "0.7.6"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.6.tgz#6f55073fa73e65776bd85826958b98c8cd1457b5"
integrity sha512-HHXP9hskkFQHy8QxxUXkS7946FFIhYVfGqsk0WLwllmexN9x/+R4UBLvurHEuyXRfVEObVR8APuQehykLviwSQ==
version "0.7.9"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.9.tgz#7f9278a50e737920e21b297b8a35286e9942c056"
integrity sha512-yceMpm/xd4W2a85iqZyO09gTnHvXF6pyiWjD2jcOJs7hRoZtNNOO1eJlhHj1ixA+xip2hOyGn+LgcvLCMo5zXA==
"@yarnpkg/lockfile@^1.0.0":
version "1.1.0"