1. Home
  2. Docs
  3. Infrastructure
  4. Rocket.Chat
  5. Push Notifications / Mobile App

Push Notifications / Mobile App

Reference:

Requirements

Android

  1. Fork / pull from RocketChat’s single-server branch to Soluvas GitHub repository single-server branch, e.g. from https://github.com/RocketChat/Rocket.Chat.ReactNative/tree/single-server to https://github.com/soluvas/Rocket.Chat.ReactNative/tree/single-server
  2. Open Gitpod on specific branch, e.g. https://gitpod.io/#https://github.com/soluvas/Rocket.Chat.ReactNative/tree/single-server

Run: (first ensure you have an emulator or a connected device, you can use adb devices to check)

yarn
yarn run react-native run-android
yarn run react-native start
# now you can launch the app in device

If you don’t run react-native start, you’ll get error in device: “Unable to load script. Make sure you’re either running a Metro server…”

Customizations

config.js (note: This file is originally committed to Git, but we now gitignore this file)

export default {
	BUGSNAG_API_KEY: 'our own'
};

android/gradle.properties (note: This file is originally committed to Git, but we now gitignore this file)

APPLICATIONID=com.soluvas.chat.reactnative
VERSIONNAME=4.9.0 # first 3 numbers follow Rocket.Chat.ReactNative stable, then our own build number
VERSIONCODE=1 # follows Soluvas own release schedule
BugsnagAPIKey=our own

Change strings/app_name and strings/share_extension_name on ./android/app/src/main/res/values/strings.xml

To change icons on the folders ./android/app/src/main/res/mipmap*, use Android Asset Studio.

  • Launcher icon generator -> mipmap-*/ic_launcher.png (square bevel), mipmap-*/ic_launcher_foreground.png (round white bevel 45% padding), mipmap-*/ic_launcher_round.png (round bevel)
  • Launcher icon generator -> mipmap-*/logo.png (no bevel, no padding) (you need to delete upstream drawable-*/logo.png)
  • Notification icon generator -> mipmap-*/ic_notification.png (Android Asset Studio generates drawable-* folders, you need to move them into mipmap-*/ instead; else you’ll get “java.lang.IllegalArgumentExceptionNotificationManager.java:516 Invalid notification (no valid small icon)” when receiving push notification)
  • drawable-xxxhdpi/splash.png (384 px height)

./android/app/google-services.json from Firebase project soluvas-production

./app.json

“server”: “https://chat.soluvas.com“,

Change all applicationId (chat.rocket.reactnative) references as on this commit (compare it against play folder): https://github.com/RocketChat/Rocket.Chat.ReactNative/commit/518e56379d88937d7f9a572c7bd61716a4d0b7fe plus additionally:

  • change package of MainPlayApplication, Encryption, LoadNotification
  • anything that refers to Ejson, MainApplication, CustomPushNotification must import com.soluvas.chat.reactnative

Disable Gateway

You’ll need to Administration > Setup Wizard > Terms (accept) and Register Server, before you can disable the gateway. See issue #18893. The relevant settings in collection rocketchat_settings are:

  • Push_enable_gateway
  • Push_gcm_api_key
  • Push_gcm_project_number

Alternatively you can use Managing settings using environment variables.

Debugging Push Notifications

Rocket.Chat Server

Use Gitpod to launch workspace on soluvas/Rocket.Chat branch soluvas-3.x.

Requirements: Meteor. See: Using Gitpod.io for your Meteor project, Meteor apps on gitpod.io.

meteor npm install
meteor npm start

Build Debug APK & Publish Release APK

See React Native. Size 4.9.0 APK is 46 MiB, 4.12.0 AAB is 46 MiB.

Since 4.12, instead of assembleRelease, probably try bundlePlayRelease or assemblePlayRelease.

Merge Changes from Latest Stable Rocket.Chat.ReactNative Mobile App

Make sure your (local) working tree is clean. Then try merging from upstream/single-server, which likely will cause conflicts.

git fetch upstream
git merge upstream/single-server

Then you need to resolve conflicts.

If there are deleted or missing files that need to be re-implemented, make a note of that in Soluvas Board > Chat in Notion, so it doesn’t get lost.

Then commit and push.

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *