fix: enable android 13 notifications (#5118)

* set target 33

* update cameraroll

* wip

* ask android push permission

* test
This commit is contained in:
Gleidson Daniel Silva 2023-07-12 15:28:25 -03:00 committed by GitHub
parent a44951296d
commit 48acd0669e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 19 deletions

View File

@ -14,6 +14,9 @@
<!-- permissions related to jitsi call -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- android 13 notifications -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application
android:name="chat.rocket.reactnative.MainApplication"
android:allowBackup="false"

View File

@ -5,10 +5,10 @@ buildscript {
ext {
// TODO: target 33
buildToolsVersion = "31.0.0"
buildToolsVersion = "33.0.0"
minSdkVersion = 23
compileSdkVersion = 31
targetSdkVersion = 31
compileSdkVersion = 33
targetSdkVersion = 33
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"

View File

@ -7,6 +7,7 @@ import {
NotificationAction,
NotificationCategory
} from 'react-native-notifications';
import { PermissionsAndroid, Platform } from 'react-native';
import { INotification } from '../../definitions';
import { isIOS } from '../methods/helpers';
@ -36,9 +37,16 @@ export const pushNotificationConfigure = (onNotification: (notification: INotifi
});
const notificationCategory = new NotificationCategory('MESSAGE', [notificationAction]);
Notifications.setCategories([notificationCategory]);
} else if (Platform.OS === 'android' && Platform.constants.Version >= 33) {
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS).then(permissionStatus => {
if (permissionStatus === 'granted') {
Notifications.registerRemoteNotifications();
} else {
// TODO: Ask user to enable notifications
}
});
} else {
// init
Notifications.android.registerRemoteNotifications();
Notifications.registerRemoteNotifications();
}
Notifications.events().registerRemoteNotificationsRegistered((event: Registered) => {

View File

@ -1,10 +1,10 @@
import CameraRoll from '@react-native-community/cameraroll';
import { CameraRoll } from '@react-native-camera-roll/camera-roll';
import { HeaderBackground, useHeaderHeight } from '@react-navigation/elements';
import { StackNavigationOptions } from '@react-navigation/stack';
import { ResizeMode, Video } from 'expo-av';
import { sha256 } from 'js-sha256';
import React from 'react';
import { PermissionsAndroid, useWindowDimensions, View } from 'react-native';
import { PermissionsAndroid, View, useWindowDimensions } from 'react-native';
import * as mime from 'react-native-mime-types';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { shallowEqual } from 'react-redux';

View File

@ -382,7 +382,7 @@ describe('Team', () => {
describe('Room Members', () => {
beforeAll(async () => {
await tapAndWaitFor(element(by.id('room-actions-members')), element(by.id('room-members-view')), 2000);
await tapAndWaitFor(element(by.id('room-actions-members')), element(by.id('room-members-view')), 10000);
});
it('should show all users', async () => {

View File

@ -385,7 +385,7 @@ PODS:
- React-Core
- react-native-blur (4.1.0):
- React-Core
- react-native-cameraroll (4.1.2):
- react-native-cameraroll (5.6.0):
- React-Core
- react-native-cookies (6.2.1):
- React-Core
@ -636,7 +636,7 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-background-timer (from `../node_modules/react-native-background-timer`)
- "react-native-blur (from `../node_modules/@react-native-community/blur`)"
- "react-native-cameraroll (from `../node_modules/@react-native-community/cameraroll`)"
- "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)"
- "react-native-cookies (from `../node_modules/@react-native-cookies/cookies`)"
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
- react-native-mmkv-storage (from `../node_modules/react-native-mmkv-storage`)
@ -785,7 +785,7 @@ EXTERNAL SOURCES:
react-native-blur:
:path: "../node_modules/@react-native-community/blur"
react-native-cameraroll:
:path: "../node_modules/@react-native-community/cameraroll"
:path: "../node_modules/@react-native-camera-roll/camera-roll"
react-native-cookies:
:path: "../node_modules/@react-native-cookies/cookies"
react-native-document-picker:
@ -944,7 +944,7 @@ SPEC CHECKSUMS:
React-logger: 3f8ebad1be1bf3299d1ab6d7f971802d7395c7ef
react-native-background-timer: 17ea5e06803401a379ebf1f20505b793ac44d0fe
react-native-blur: ba2f37268542f8a26d809f48c5162705a3261fc6
react-native-cameraroll: 2957f2bce63ae896a848fbe0d5352c1bd4d20866
react-native-cameraroll: 755bcc628148a90a7c9cf3f817a252be3a601bc5
react-native-cookies: f54fcded06bb0cda05c11d86788020b43528a26c
react-native-document-picker: f5ec1a712ca2a975c233117f044817bb8393cad4
react-native-mmkv-storage: cfb6854594cfdc5f7383a9e464bb025417d1721c

View File

@ -43,10 +43,10 @@
"@hookform/resolvers": "^2.9.10",
"@nozbe/watermelondb": "^0.25.5",
"@react-native-async-storage/async-storage": "^1.17.11",
"@react-native-camera-roll/camera-roll": "^5.6.0",
"@react-native-clipboard/clipboard": "^1.8.5",
"@react-native-community/art": "^1.2.0",
"@react-native-community/blur": "^4.1.0",
"@react-native-community/cameraroll": "4.1.2",
"@react-native-community/datetimepicker": "^6.7.5",
"@react-native-community/hooks": "3.0.0",
"@react-native-community/netinfo": "6.0.0",

View File

@ -4628,6 +4628,11 @@
dependencies:
merge-options "^3.0.4"
"@react-native-camera-roll/camera-roll@^5.6.0":
version "5.6.0"
resolved "https://registry.yarnpkg.com/@react-native-camera-roll/camera-roll/-/camera-roll-5.6.0.tgz#385082d57d694f3fd5ae386f8b8ce24b0969c5f9"
integrity sha512-a/GYwnBTxj1yKWB9m/qy8GzjowSocML8NbLT81wdMh0JzZYXCLze51BR2cb8JNDgRPzA9xe7KpD3j9qQOSOjag==
"@react-native-clipboard/clipboard@^1.8.5":
version "1.8.5"
resolved "https://registry.yarnpkg.com/@react-native-clipboard/clipboard/-/clipboard-1.8.5.tgz#b11276e38ef288b0fd70c0a38506e2deecc5fa5a"
@ -4647,11 +4652,6 @@
resolved "https://registry.yarnpkg.com/@react-native-community/blur/-/blur-4.1.0.tgz#ed1361a569150c2249aae9b734e278fd262b70cd"
integrity sha512-esfuAjbAoeysfI3RhmCHlYwlXobXzcsVGZEHgDhVGB88aO9RktY6b13mYbo2FXZ8XnntcccuvXlgckvoIsggWg==
"@react-native-community/cameraroll@4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-4.1.2.tgz#489c6bb6137571540d93c543d5fcf8c652b548ec"
integrity sha512-jkdhMByMKD2CZ/5MPeBieYn8vkCfC4MOTouPpBpps3I8N6HUYJk+1JnDdktVYl2WINnqXpQptDA2YptVyifYAg==
"@react-native-community/cli-clean@^10.1.1":
version "10.1.1"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-10.1.1.tgz#4c73ce93a63a24d70c0089d4025daac8184ff504"