Skip to content

Commit

Permalink
Push react native to 0.73.6 (mattermost#7863)
Browse files Browse the repository at this point in the history
* Bump react native to 0.73.6

* iOS changes

* Fix gallery

* Fix test

* Add missing patch

* Unify react native navigation patch

* Update the rest of libraries

* iOS updates

* Update mattermost libraries

* Fix tests and final bumps

* iOS podfile update

* Update android locks

* Revert webrtc update because it was messing with the tests

* Update podfile for webrtc
  • Loading branch information
larkox authored and Tim DE WINTER committed Jul 12, 2024
1 parent ad29231 commit 1405bc2
Show file tree
Hide file tree
Showing 57 changed files with 3,661 additions and 3,504 deletions.
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

sh ./scripts/pre-commit.sh
9 changes: 2 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'kotlin-android'

/**
* This is the configuration block to customize your React Native Android app.
Expand Down Expand Up @@ -199,13 +199,8 @@ repositories {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down
2 changes: 0 additions & 2 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
Expand Down

This file was deleted.

150 changes: 0 additions & 150 deletions android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java

This file was deleted.

134 changes: 134 additions & 0 deletions android/app/src/main/java/com/mattermost/rnbeta/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package com.mattermost.rnbeta

import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import android.util.Log
import android.view.KeyEvent

import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.facebook.react.ReactActivityDelegate

import com.github.emilioicai.hwkeyboardevent.HWKeyboardEventModule

import com.mattermost.call.CallManagerModule
import com.mattermost.notification.NotificationUtils

import com.reactnativenavigation.NavigationActivity

class MainActivity : NavigationActivity() {
private var HWKeyboardConnected = false
private val foldableObserver = FoldableObserver.getInstance(this)

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "Mattermost"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, DefaultNewArchitectureEntryPoint.fabricEnabled)


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
setContentView(R.layout.launch_screen)
handleIntentExtras(getIntent())
setHWKeyboardConnected()
foldableObserver.onCreate()
}

override fun onStart() {
super.onStart()
foldableObserver.onStart()
}

override fun onStop() {
super.onStop()
foldableObserver.onStop()
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
HWKeyboardConnected = true
} else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
HWKeyboardConnected = false
}
}

override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
reactGateway.onWindowFocusChanged(hasFocus)
}

/*
https://mattermost.atlassian.net/browse/MM-10601
Required by react-native-hw-keyboard-event
(https://github.com/emilioicai/react-native-hw-keyboard-event)
*/
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (HWKeyboardConnected) {
val keyCode = event.keyCode
val keyAction = event.action
if (keyAction == KeyEvent.ACTION_UP) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
val keyPressed = if (event.isShiftPressed) "shift-enter" else "enter"
HWKeyboardEventModule.getInstance().keyPressed(keyPressed)
return true
} else if (keyCode == KeyEvent.KEYCODE_K && event.isCtrlPressed) {
HWKeyboardEventModule.getInstance().keyPressed("find-channels")
return true
}
}
}
return super.dispatchKeyEvent(event)
}

private fun setHWKeyboardConnected() {
HWKeyboardConnected = getResources().configuration.keyboard == Configuration.KEYBOARD_QWERTY
}

override fun onWindowFocusChanged(intent: Intent) {
super.onNewIntent(intent)
handleIntentExtras(intent)
}

public fun handleIntentExtras(intent: Intent) {
Log.i("handleIntentExtras", "handleIntentExtras")
if (intent != null && intent.getExtras() != null) {
Log.i("handleIntentExtras", "intent.getExtras() != null")
val options: WebRTCModuleOptions = WebRTCModuleOptions.getInstance()
val bundle: Bundle = intent.getExtras()
val channelId: String = bundle.getString(NotificationUtils.CHANNEL_ID_KEY)
val serverId: String = bundle.getString(NotificationUtils.SERVER_ID_KEY)
val conferenceId: String = bundle.getString(NotificationUtils.CONFERENCE_ID_KEY)
val conferenceJWT: String = bundle.getString(NotificationUtils.CONFERENCE_JWT_KEY)
val callManagerModule: CallManagerModule = CallManagerModule.getInstance()

if (callManagerModule != null
&& channelId != null
&& serverId != null
&& conferenceJWT != null) {
Log.i("handleIntentExtras", "callmanager != null")
Log.i("handleIntentExtras", "serverId = " + serverId)
Log.i("handleIntentExtras", "channelId = " + channelId)
Log.i("handleIntentExtras", "conferenceJWT = " + conferenceJWT)
//callManagerModule.callAnswered(serverId, channelId, conferenceJWT)
}

if (conferenceId != null) {
Log.i("handleIntentExtras", "conferenceId == " + conferenceId)
Log.i("handleIntentExtras", "dismissCallNotification")
NotificationUtils.dismissCallNotification(this, conferenceId)
}
} else {
Log.i("handleIntentExtras", "intent extras null")
}
}
}
Loading

0 comments on commit 1405bc2

Please sign in to comment.