Skip to content

Commit b032be5

Browse files
authored
Merge branch 'develop' into react-native-81
2 parents 691fb63 + e1af190 commit b032be5

File tree

63 files changed

+4292
-1133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4292
-1133
lines changed

.github/actions/upload-android/action.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ runs:
5353
echo "${{ inputs.FASTLANE_GOOGLE_SERVICE_ACCOUNT }}" | base64 --decode > service_account.json
5454
shell: bash
5555

56+
- uses: actions/download-artifact@v4
57+
if: ${{ inputs.trigger == 'develop' }}
58+
with:
59+
name: release-changelog
60+
path: .
61+
62+
- name: Prepare Play Store changelog metadata
63+
if: ${{ inputs.trigger == 'develop' }}
64+
run: |
65+
mkdir -p android/fastlane/metadata/android/en-US/changelogs
66+
67+
if [ -f changelog.txt ]; then
68+
node .github/scripts/prepare-changelog.js
69+
else
70+
printf "Internal improvements and bug fixes" > "android/fastlane/metadata/android/en-US/changelogs/${BUILD_VERSION}.txt"
71+
fi
72+
shell: bash
73+
env:
74+
BUILD_VERSION: ${{ inputs.BUILD_VERSION }}
75+
5676
- name: Fastlane Play Store Upload
5777
working-directory: android
5878
run: |
@@ -65,7 +85,6 @@ runs:
6585
if [[ ${{ inputs.trigger }} == "develop" ]] && [[ ${{ inputs.type }} == 'official' ]]; then
6686
bundle exec fastlane android official_open_testing
6787
fi
68-
6988
shell: bash
7089

7190
- name: Leave a comment on PR

.github/actions/upload-ios/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ runs:
109109
yarn pod-install
110110
shell: bash
111111

112+
- uses: actions/download-artifact@v4
113+
if: ${{ inputs.type == 'official' && inputs.trigger == 'develop' }}
114+
with:
115+
name: release-changelog
116+
path: .
117+
112118
- name: Fastlane Submit to TestFlight
113119
working-directory: ios
114120
run: |
@@ -157,4 +163,4 @@ runs:
157163
message="**iOS Build Available**"$'\n\n'"$app_name $VERSION_NAME.$BUILD_VERSION"
158164
159165
gh pr comment "$PR_NUMBER" --body "$message"
160-
shell: bash
166+
shell: bash
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const fs = require("fs");
2+
3+
const buildVersion = process.env.BUILD_VERSION;
4+
const input = fs.readFileSync("changelog.txt", "utf8");
5+
6+
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
7+
const chars = Array.from(segmenter.segment(input), s => s.segment);
8+
9+
let output;
10+
if (chars.length > 500) {
11+
output = chars.slice(0, 497).join("") + "...";
12+
} else {
13+
output = input;
14+
}
15+
16+
fs.writeFileSync(
17+
`android/fastlane/metadata/android/en-US/changelogs/${buildVersion}.txt`,
18+
output,
19+
"utf8"
20+
);

.github/workflows/build-develop.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,26 @@ on:
88
branches:
99
- 'develop'
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
run-eslint-and-test:
1317
name: ESLint and Test
1418
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
1519
uses: ./.github/workflows/eslint.yml
1620

21+
generate-changelog:
22+
name: Generate Release Changelog
23+
needs: [run-eslint-and-test]
24+
uses: ./.github/workflows/generate-changelog.yml
25+
1726
android-build-experimental-store:
1827
name: Build Android Experimental
1928
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
2029
uses: ./.github/workflows/build-android.yml
21-
needs: [run-eslint-and-test]
30+
needs: [run-eslint-and-test, generate-changelog]
2231
secrets: inherit
2332
with:
2433
type: experimental
@@ -28,7 +37,7 @@ jobs:
2837
name: Build Android Official
2938
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
3039
uses: ./.github/workflows/build-official-android.yml
31-
needs: [run-eslint-and-test]
40+
needs: [run-eslint-and-test, generate-changelog]
3241
secrets: inherit
3342
with:
3443
type: official
@@ -38,7 +47,7 @@ jobs:
3847
name: Build iOS Experimental
3948
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
4049
uses: ./.github/workflows/build-ios.yml
41-
needs: [run-eslint-and-test]
50+
needs: [run-eslint-and-test, generate-changelog]
4251
secrets: inherit
4352
with:
4453
type: experimental
@@ -48,7 +57,7 @@ jobs:
4857
name: Build iOS Official
4958
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
5059
uses: ./.github/workflows/build-official-ios.yml
51-
needs: [run-eslint-and-test]
60+
needs: [run-eslint-and-test, generate-changelog]
5261
secrets: inherit
5362
with:
5463
type: official

.github/workflows/build-official-android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
upload-android:
7373
name: Upload
7474
runs-on: ubuntu-latest
75-
needs: [upload-hold]
75+
needs: [build-android, upload-hold]
7676
if: ${{ inputs.type == 'official' && (always() && (needs.upload-hold.result == 'success' || needs.upload-hold.result == 'skipped')) }}
7777
steps:
7878
- name: Checkout Repository
@@ -85,7 +85,7 @@ jobs:
8585
trigger: ${{ inputs.trigger }}
8686
FASTLANE_GOOGLE_SERVICE_ACCOUNT: ${{ secrets.FASTLANE_GOOGLE_SERVICE_ACCOUNT }}
8787
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
BUILD_VERSION: ${{ needs.upload-hold.outputs.BUILD_VERSION }}
88+
BUILD_VERSION: ${{ needs.build-android.outputs.BUILD_VERSION }}
8989

9090
upload-internal:
9191
name: Internal Sharing
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate Release Changelog
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
generate-changelog:
8+
name: Generate changelog
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Generate changelog
18+
shell: bash
19+
run: |
20+
LATEST_RELEASE_TAG=$(git tag --sort=-creatordate | head -n 1)
21+
22+
if [ -z "$LATEST_RELEASE_TAG" ]; then
23+
echo "- Improvements and bug fixes" > changelog.txt
24+
exit 0
25+
fi
26+
27+
git log "$LATEST_RELEASE_TAG"..HEAD --pretty=format:"- %s" --no-merges > changelog.txt
28+
29+
if [ ! -s changelog.txt ]; then
30+
echo "- Improvements and bug fixes" > changelog.txt
31+
fi
32+
33+
- name: Upload changelog artifact
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: release-changelog
37+
path: changelog.txt
38+
retention-days: 15

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ android {
9090
minSdkVersion rootProject.ext.minSdkVersion
9191
targetSdkVersion rootProject.ext.targetSdkVersion
9292
versionCode VERSIONCODE as Integer
93-
versionName "4.68.0"
93+
versionName "4.69.0"
9494
vectorDrawables.useSupportLibrary = true
9595
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
9696
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"

android/app/src/main/java/chat/rocket/reactnative/MainActivity.kt

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import android.os.Bundle
99
import com.zoontek.rnbootsplash.RNBootSplash
1010
import android.content.Intent
1111
import android.content.res.Configuration
12-
import chat.rocket.reactnative.notification.VideoConfModule
13-
import chat.rocket.reactnative.notification.VideoConfNotification
14-
import com.google.gson.GsonBuilder
12+
import chat.rocket.reactnative.notification.NotificationIntentHandler
1513

1614
class MainActivity : ReactActivity() {
1715

@@ -32,56 +30,16 @@ class MainActivity : ReactActivity() {
3230
RNBootSplash.init(this, R.style.BootTheme)
3331
super.onCreate(null)
3432

35-
// Handle video conf action from notification
36-
intent?.let { handleVideoConfIntent(it) }
33+
// Handle notification intents
34+
intent?.let { NotificationIntentHandler.handleIntent(this, it) }
3735
}
3836

3937
public override fun onNewIntent(intent: Intent) {
4038
super.onNewIntent(intent)
41-
// Handle video conf action when activity is already running
42-
handleVideoConfIntent(intent)
43-
}
44-
45-
private fun handleVideoConfIntent(intent: Intent) {
46-
if (intent.getBooleanExtra("videoConfAction", false)) {
47-
val notificationId = intent.getIntExtra("notificationId", 0)
48-
val event = intent.getStringExtra("event") ?: return
49-
val rid = intent.getStringExtra("rid") ?: ""
50-
val callerId = intent.getStringExtra("callerId") ?: ""
51-
val callerName = intent.getStringExtra("callerName") ?: ""
52-
val host = intent.getStringExtra("host") ?: ""
53-
val callId = intent.getStringExtra("callId") ?: ""
54-
55-
android.util.Log.d("RocketChat.MainActivity", "Handling video conf intent - event: $event, rid: $rid, host: $host, callId: $callId")
56-
57-
// Cancel the notification
58-
if (notificationId != 0) {
59-
VideoConfNotification.cancelById(this, notificationId)
60-
}
61-
62-
// Store action for JS to pick up - include all required fields
63-
val data = mapOf(
64-
"notificationType" to "videoconf",
65-
"rid" to rid,
66-
"event" to event,
67-
"host" to host,
68-
"callId" to callId,
69-
"caller" to mapOf(
70-
"_id" to callerId,
71-
"name" to callerName
72-
)
73-
)
74-
75-
val gson = GsonBuilder().create()
76-
val jsonData = gson.toJson(data)
77-
78-
android.util.Log.d("RocketChat.MainActivity", "Storing video conf action: $jsonData")
79-
80-
VideoConfModule.storePendingAction(this, jsonData)
81-
82-
// Clear the video conf flag to prevent re-processing
83-
intent.removeExtra("videoConfAction")
84-
}
39+
setIntent(intent)
40+
41+
// Handle notification intents when activity is already running
42+
NotificationIntentHandler.handleIntent(this, intent)
8543
}
8644

8745
override fun invokeDefaultOnBackPressed() {

android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import expo.modules.ApplicationLifecycleDispatcher
1919
import chat.rocket.reactnative.networking.SSLPinningTurboPackage;
2020
import chat.rocket.reactnative.storage.MMKVKeyManager;
2121
import chat.rocket.reactnative.storage.SecureStoragePackage;
22-
import chat.rocket.reactnative.notification.CustomPushNotification;
2322
import chat.rocket.reactnative.notification.VideoConfTurboPackage
23+
import chat.rocket.reactnative.notification.PushNotificationTurboPackage
2424

2525
/**
2626
* Main Application class.
@@ -43,6 +43,7 @@ open class MainApplication : Application(), ReactApplication {
4343
add(SSLPinningTurboPackage())
4444
add(WatermelonDBJSIPackage())
4545
add(VideoConfTurboPackage())
46+
add(PushNotificationTurboPackage())
4647
add(SecureStoragePackage())
4748
}
4849

@@ -69,13 +70,6 @@ open class MainApplication : Application(), ReactApplication {
6970
// Load the native entry point for the New Architecture
7071
loadReactNative(this)
7172

72-
// Register listener to set React context when initialized
73-
reactHost.addReactInstanceEventListener(object : ReactInstanceEventListener {
74-
override fun onReactContextInitialized(context: ReactContext) {
75-
CustomPushNotification.setReactContext(context as ReactApplicationContext)
76-
}
77-
})
78-
7973
ApplicationLifecycleDispatcher.onApplicationCreate(this)
8074
}
8175

0 commit comments

Comments
 (0)