Merge branch 'develop' into single-server

# Conflicts:
#	android/app/build.gradle
#	app/sagas/login.js
This commit is contained in:
Diego Mello 2020-11-09 18:33:57 -03:00
commit 59bc3e8a46
590 changed files with 98952 additions and 30730 deletions

View File

@ -3,7 +3,7 @@ defaults: &defaults
macos: &macos
macos:
xcode: "11.5.0"
xcode: "12.1.0"
bash-env: &bash-env
BASH_ENV: "~/.nvm/nvm.sh"
@ -343,12 +343,11 @@ jobs:
agvtool new-version -all $CIRCLE_BUILD_NUM
/usr/libexec/PlistBuddy -c "Set BugsnagAPIKey $BUGSNAG_KEY" ./RocketChatRN/Info.plist
if [[ $MATCH_KEYCHAIN_NAME ]]; then
if [[ $APP_STORE_CONNECT_API_KEY ]]; then
echo $APP_STORE_CONNECT_API_KEY | base64 --decode > ./fastlane/app_store_connect_api_key.p8
bundle exec fastlane ios release
else
export MATCH_KEYCHAIN_NAME="temp"
export MATCH_KEYCHAIN_PASSWORD="temp"
bundle exec fastlane ios build
bundle exec fastlane ios build_fork
fi
working_directory: ios
@ -381,6 +380,7 @@ jobs:
- run:
name: Fastlane Tesflight Upload
command: |
echo $APP_STORE_CONNECT_API_KEY | base64 --decode > ./fastlane/app_store_connect_api_key.p8
bundle exec fastlane ios beta
working_directory: ios

4
.gitignore vendored
View File

@ -61,4 +61,6 @@ coverage
artifacts
.vscode/
e2e/docker/rc_test_env/docker-compose.yml
e2e/docker/data/db
e2e/docker/data/db
*.p8

View File

@ -7,7 +7,7 @@
- **Supported server versions:** 0.70.0+
- **Supported iOS versions**: 11+
- **Supported Android versions**: 5.0+
- **Supported Android versions**: 6.0+
## Download
@ -35,7 +35,7 @@ Do you want to make the app run on your own server only? [Follow our whitelabel
## Engage with us
### Share your story
Wed love to hear about [your experience](https://survey.zohopublic.com/zs/e4BUFG) and potentially feature it on our [Blog](https://rocket.chat/case-studies/?utm_source=github&utm_medium=readme&utm_campaign=community).
Wed love to hear about [your experience](https://survey.zohopublic.com/zs/e4BUFG) and potentially feature it on our [blog](https://rocket.chat/case-studies/?utm_source=github&utm_medium=readme&utm_campaign=community).
### Subscribe for Updates
Once a month our marketing team releases an email update with news about product releases, company related topics, events and use cases. [Sign Up!](https://rocket.chat/newsletter/?utm_source=github&utm_medium=readme&utm_campaign=community)
Once a month our marketing team releases an email update with news about product releases, company related topics, events and use cases. [Sign up!](https://rocket.chat/newsletter/?utm_source=github&utm_medium=readme&utm_campaign=community)

View File

@ -1,4 +1,4 @@
export default {
activateKeepAwake: () => '',
deactivateKeepAwake: () => ''
};
const activateKeepAwake = () => '';
const deactivateKeepAwake = () => '';
export { activateKeepAwake, deactivateKeepAwake };

View File

@ -1,5 +1,5 @@
export const RectButton = () => 'View';
export const RectButton = ({ children }) => children;
export const State = () => 'View';
export const LongPressGestureHandler = () => 'View';
export const BorderlessButton = () => 'View';
export const PanGestureHandler = () => 'View';
export const LongPressGestureHandler = ({ children }) => children;
export const BorderlessButton = ({ children }) => children;
export const PanGestureHandler = ({ children }) => children;

View File

@ -1,3 +1,6 @@
import initStoryshots from '@storybook/addon-storyshots';
jest.mock('../app/lib/database', () => jest.fn(() => null));
global.Date.now = jest.fn(() => new Date('2019-10-10').getTime());
initStoryshots();

File diff suppressed because it is too large Load Diff

View File

@ -148,8 +148,8 @@ android {
vectorDrawables.useSupportLibrary = true
if (isPlay) {
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" // See note below!
}
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" // See note below!
}
signingConfigs {
@ -195,14 +195,26 @@ android {
flavorDimensions "type"
productFlavors {
foss {
applicationId "chat.rocket.android"
dimension = "type"
buildConfigField "boolean", "FDROID_BUILD", "true"
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"
}
play {
dimension = "type"
buildConfigField "boolean", "FDROID_BUILD", "false"
}
}
sourceSets {
playDebug {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
playRelease {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
@ -233,9 +245,12 @@ android {
dependencies {
addUnimodulesDependencies()
implementation project(':watermelondb')
implementation project(':reactnativenotifications')
implementation project(":reactnativekeyboardinput")
implementation project(':@react-native-community_viewpager')
playImplementation project(':reactnativenotifications')
playImplementation project(':@react-native-firebase_app')
playImplementation project(':@react-native-firebase_analytics')
playImplementation project(':@react-native-firebase_crashlytics')
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,14 @@
package chat.rocket.reactnative;
import android.app.Application;
import com.facebook.react.ReactPackage;
import java.util.Arrays;
import java.util.List;
public class AdditionalModules {
public List<ReactPackage> getAdditionalModules(Application application) {
return Arrays.<ReactPackage>asList();
}
}

View File

@ -1,20 +0,0 @@
package chat.rocket.reactnative;
import android.content.Context;
import android.os.Bundle;
import com.facebook.react.bridge.ReactApplicationContext;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.notification.PushNotification;
public class CustomPushNotification extends PushNotification {
public static ReactApplicationContext reactApplicationContext;
public CustomPushNotification(Context context, Bundle bundle, AppLifecycleFacade appLifecycleFacade, AppLaunchHelper appLaunchHelper, JsIOHelper jsIoHelper) {
super(context, bundle, appLifecycleFacade, appLaunchHelper, jsIoHelper);
reactApplicationContext = new ReactApplicationContext(context);
}
}

View File

@ -1,12 +0,0 @@
package chat.rocket.reactnative;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class DismissNotification extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
}
}

View File

@ -1,97 +0,0 @@
package chat.rocket.reactnative;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.Callback;
import com.ammarahmed.mmkv.SecureKeystore;
import com.tencent.mmkv.MMKV;
import java.math.BigInteger;
class RNCallback implements Callback {
public void invoke(Object... args) {
}
}
class Utils {
static public String toHex(String arg) {
try {
return String.format("%x", new BigInteger(1, arg.getBytes("UTF-8")));
} catch (Exception e) {
return "";
}
}
}
public class Ejson {
String host;
String rid;
String type;
Sender sender;
String messageId;
String notificationType;
private MMKV mmkv;
private String TOKEN_KEY = "reactnativemeteor_usertoken-";
public Ejson() {
ReactApplicationContext reactApplicationContext = CustomPushNotification.reactApplicationContext;
// Start MMKV container
MMKV.initialize(reactApplicationContext);
SecureKeystore secureKeystore = new SecureKeystore(reactApplicationContext);
// https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/src/loader.js#L31
String alias = Utils.toHex("com.MMKV.default");
// Retrieve container password
secureKeystore.getSecureKey(alias, new RNCallback() {
@Override
public void invoke(Object... args) {
String error = (String) args[0];
if (error == null) {
String password = (String) args[1];
mmkv = MMKV.mmkvWithID("default", MMKV.SINGLE_PROCESS_MODE, password);
}
}
});
}
public String getAvatarUri() {
if (type == null) {
return null;
}
return serverURL() + "/avatar/" + this.sender.username + "?rc_token=" + token() + "&rc_uid=" + userId();
}
public String token() {
String userId = userId();
if (mmkv != null && userId != null) {
return mmkv.decodeString(TOKEN_KEY.concat(userId));
}
return "";
}
public String userId() {
String serverURL = serverURL();
if (mmkv != null && serverURL != null) {
return mmkv.decodeString(TOKEN_KEY.concat(serverURL));
}
return "";
}
public String serverURL() {
String url = this.host;
if (url != null && url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
return url;
}
public class Sender {
String username;
String _id;
}
}

View File

@ -1,13 +0,0 @@
package chat.rocket.reactnative;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class ReplyBroadcast extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -3,7 +3,10 @@
android:height="108dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M0,0h512v512h-512z"
android:fillColor="#ffffff"/>
<group>
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
<path
android:pathData="M0,0h512v512h-512z"
android:fillColor="#F5455C"/>
</group>
</vector>

View File

@ -1,19 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="512"
android:viewportHeight="512">
<group>
<clip-path android:pathData="M145,160h218v191.345h-218z M 0,0"/>
<path
android:pathData="M336.076,234.105L336.079,234.11C336.079,234.109 336.078,234.108 336.078,234.108C336.077,234.107 336.077,234.106 336.076,234.105ZM210.509,167.831C217.233,171.56 223.589,176.278 229.017,181.523C237.766,179.94 246.788,179.142 255.94,179.142C283.338,179.142 309.314,186.319 329.078,199.348C339.313,206.098 347.448,214.107 353.255,223.155C359.722,233.237 363,244.078 363,255.695C363,266.999 359.722,277.845 353.255,287.925C347.448,296.977 339.313,304.983 329.078,311.734C309.314,324.762 283.341,331.935 255.94,331.935C246.788,331.935 237.768,331.137 229.017,329.557C223.587,334.799 217.233,339.519 210.509,343.249C174.584,361.216 144.792,343.671 144.792,343.671C144.792,343.671 172.491,320.188 167.986,299.602C155.593,286.917 148.878,271.619 148.878,255.387C148.878,239.461 155.595,224.162 167.986,211.475C172.49,190.895 144.801,167.416 144.792,167.408C144.801,167.403 174.589,149.864 210.509,167.831Z"
android:fillColor="#DB2323"/>
<path
android:pathData="M189.04,291.26C176.71,281.543 169.31,269.108 169.31,255.555C169.31,224.456 208.278,199.245 256.348,199.245C304.418,199.245 343.386,224.456 343.386,255.555C343.386,286.655 304.418,311.866 256.348,311.866C244.501,311.866 233.206,310.335 222.912,307.561L215.386,314.82C211.296,318.765 206.503,322.334 201.507,325.147C194.884,328.399 188.345,330.174 181.875,330.715C182.24,330.052 182.576,329.379 182.937,328.715C190.478,314.822 192.512,302.337 189.04,291.26Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<path
android:pathData="M214.708,268.127C207.625,268.127 201.883,262.413 201.883,255.364C201.883,248.316 207.625,242.602 214.708,242.602C221.791,242.602 227.533,248.316 227.533,255.364C227.533,262.413 221.791,268.127 214.708,268.127ZM255.998,268.127C248.915,268.127 243.173,262.413 243.173,255.364C243.173,248.316 248.915,242.602 255.998,242.602C263.08,242.602 268.822,248.316 268.822,255.364C268.822,262.413 263.08,268.127 255.998,268.127ZM297.287,268.127C290.204,268.127 284.462,262.413 284.462,255.364C284.462,248.316 290.204,242.602 297.287,242.602C304.37,242.602 310.112,248.316 310.112,255.364C310.112,262.413 304.37,268.127 297.287,268.127Z"
android:fillColor="#DB2323"/>
android:viewportWidth="731.4286"
android:viewportHeight="731.4286">
<group android:translateX="109.71429"
android:translateY="109.71429">
<group>
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
<path
android:pathData="M402.671,207.348C394.08,194.006 382.038,182.196 366.9,172.234C337.652,153.016 299.222,142.43 258.688,142.43C245.145,142.43 231.804,143.608 218.852,145.939C210.816,138.203 201.421,131.244 191.471,125.744C154.554,107.34 122.02,114.193 105.582,120.104C100.182,122.047 98.516,128.877 102.51,132.998C114.103,144.962 133.282,168.607 128.567,190.109C110.238,208.82 100.3,231.381 100.3,254.873C100.3,278.813 110.238,301.374 128.567,320.085C133.282,341.587 114.103,365.244 102.51,377.208C98.527,381.317 100.182,388.147 105.582,390.09C122.02,396.001 154.554,402.866 191.483,384.461C201.433,378.962 210.828,372.003 218.864,364.266C231.815,366.598 245.157,367.776 258.7,367.776C299.245,367.776 337.675,357.201 366.912,337.984C382.05,328.022 394.092,316.223 402.683,302.87C412.255,288.009 417.1,272.006 417.1,255.332C417.088,238.211 412.243,222.22 402.671,207.348ZM257.034,340.045C239.509,340.045 222.799,337.784 207.566,333.698L196.434,344.401C190.384,350.218 183.293,355.482 175.896,359.627C166.099,364.42 156.421,367.046 146.849,367.834C147.392,366.857 147.889,365.868 148.42,364.879C159.576,344.39 162.589,325.973 157.449,309.641C139.203,295.31 128.26,276.964 128.26,256.981C128.26,211.116 185.917,173.929 257.034,173.929C328.151,173.929 385.819,211.116 385.819,256.981C385.819,302.858 328.162,340.045 257.034,340.045Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M195.43,237.881C184.948,237.881 176.451,246.313 176.451,256.71C176.451,267.108 184.948,275.539 195.43,275.539C205.912,275.539 214.409,267.108 214.409,256.71C214.409,246.313 205.912,237.881 195.43,237.881Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M256.514,237.881C246.032,237.881 237.535,246.313 237.535,256.71C237.535,267.108 246.032,275.539 256.514,275.539C266.996,275.539 275.493,267.108 275.493,256.71C275.493,246.313 266.996,237.881 256.514,237.881Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M317.609,237.881C307.127,237.881 298.631,246.313 298.631,256.71C298.631,267.108 307.127,275.539 317.609,275.539C328.091,275.539 336.588,267.108 336.588,256.71C336.588,246.313 328.091,237.881 317.609,237.881Z"
android:fillColor="#ffffff"/>
</group>
</group>
</vector>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#660B0B0B</color>
<item name="splashBackground" type="color">#eeeff1</item>
<item name="notification_text" type="color">#CC3333</item>
</resources>
<item name="splashBackground" type="color">#F5455C</item>
<item name="notification_text" type="color">#F5455C</item>
</resources>

View File

@ -8,11 +8,12 @@
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config"
android:allowBackup="false"
tools:replace="android:allowBackup"
>
<activity
android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
@ -44,15 +45,6 @@
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<receiver
android:name=".ReplyBroadcast"
android:enabled="true"
android:exported="false" />
<receiver
android:name=".DismissNotification"
android:enabled="true"
android:exported="false" >
</receiver>
<activity
android:noHistory="true"
android:name=".share.ShareActivity"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,41 +1,27 @@
package chat.rocket.reactnative;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import chat.rocket.reactnative.generated.BasePackageList;
import com.nozbe.watermelondb.WatermelonDBPackage;
import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
import com.wix.reactnativenotifications.core.notification.IPushNotification;
import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
import com.nozbe.watermelondb.WatermelonDBPackage;
import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication, INotificationsApplication {
import chat.rocket.reactnative.generated.BasePackageList;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);
@ -49,17 +35,15 @@ public class MainApplication extends Application implements ReactApplication, IN
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
if (!BuildConfig.FDROID_BUILD) {
packages.add(new RNNotificationsPackage(MainApplication.this));
}
packages.add(new KeyboardInputPackage(MainApplication.this));
packages.add(new WatermelonDBPackage());
packages.add(new RNCViewPagerPackage());
// packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
packages.addAll(unimodules);
List<ReactPackage> additionalModules = new AdditionalModules().getAdditionalModules(MainApplication.this);
packages.addAll(additionalModules);
return packages;
}
@ -84,15 +68,4 @@ public class MainApplication extends Application implements ReactApplication, IN
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
@Override
public IPushNotification getPushNotification(Context context, Bundle bundle, AppLifecycleFacade defaultFacade, AppLaunchHelper defaultAppLaunchHelper) {
return new CustomPushNotification(
context,
bundle,
defaultFacade,
defaultAppLaunchHelper,
new JsIOHelper()
);
}
}

View File

@ -0,0 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="336.88116"
android:viewportHeight="336.88116"
android:tint="#FFFFFF">
<group android:translateX="-87.55942"
android:translateY="-87.55942">
<group>
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
<path
android:pathData="M402.671,207.348C394.08,194.006 382.038,182.196 366.9,172.234C337.652,153.016 299.222,142.43 258.688,142.43C245.145,142.43 231.804,143.608 218.852,145.939C210.816,138.203 201.421,131.244 191.471,125.744C154.554,107.34 122.02,114.193 105.582,120.104C100.182,122.047 98.516,128.877 102.51,132.998C114.103,144.962 133.282,168.607 128.567,190.109C110.238,208.82 100.3,231.381 100.3,254.873C100.3,278.813 110.238,301.374 128.567,320.085C133.282,341.587 114.103,365.244 102.51,377.208C98.527,381.317 100.182,388.147 105.582,390.09C122.02,396.001 154.554,402.866 191.483,384.461C201.433,378.962 210.828,372.003 218.864,364.266C231.815,366.598 245.157,367.776 258.7,367.776C299.245,367.776 337.675,357.201 366.912,337.984C382.05,328.022 394.092,316.223 402.683,302.87C412.255,288.009 417.1,272.006 417.1,255.332C417.088,238.211 412.243,222.22 402.671,207.348ZM257.034,340.045C239.509,340.045 222.799,337.784 207.566,333.698L196.434,344.401C190.384,350.218 183.293,355.482 175.896,359.627C166.099,364.42 156.421,367.046 146.849,367.834C147.392,366.857 147.889,365.868 148.42,364.879C159.576,344.39 162.589,325.973 157.449,309.641C139.203,295.31 128.26,276.964 128.26,256.981C128.26,211.116 185.917,173.929 257.034,173.929C328.151,173.929 385.819,211.116 385.819,256.981C385.819,302.858 328.162,340.045 257.034,340.045Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M195.43,237.881C184.948,237.881 176.451,246.313 176.451,256.71C176.451,267.108 184.948,275.539 195.43,275.539C205.912,275.539 214.409,267.108 214.409,256.71C214.409,246.313 205.912,237.881 195.43,237.881Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M256.514,237.881C246.032,237.881 237.535,246.313 237.535,256.71C237.535,267.108 246.032,275.539 256.514,275.539C266.996,275.539 275.493,267.108 275.493,256.71C275.493,246.313 266.996,237.881 256.514,237.881Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M317.609,237.881C307.127,237.881 298.631,246.313 298.631,256.71C298.631,267.108 307.127,275.539 317.609,275.539C328.091,275.539 336.588,267.108 336.588,256.71C336.588,246.313 328.091,237.881 317.609,237.881Z"
android:fillColor="#ffffff"/>
</group>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

BIN
android/app/src/main/res/drawable-hdpi/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
android/app/src/main/res/drawable-mdpi/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1,21 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M0,0h512v512h-512z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="0"
android:startX="256"
android:endY="512"
android:endX="256"
android:type="linear">
<item android:offset="0" android:color="#FF1C82FF"/>
<item android:offset="1" android:color="#FF0066E3"/>
</gradient>
</aapt:attr>
</path>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

BIN
android/app/src/main/res/drawable-xhdpi/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
android/app/src/main/res/drawable-xxhdpi/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
android/app/src/main/res/drawable-xxxhdpi/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="splashBackground" type="color">#000000</item>
<item name="notification_text" type="color">#1D74F5</item>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#660B0B0B</color>
<item name="splashBackground" type="color">#eeeff1</item>
<item name="notification_text" type="color">#CC3333</item>
<item name="splashBackground" type="color">#1D74F5</item>
<item name="notification_text" type="color">#1D74F5</item>
</resources>

View File

@ -1,49 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="chat.rocket.reactnative">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:name=".MainPlayApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config"
tools:replace="android:name"
>
<activity
android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
android:theme="@style/BootTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="go.rocket.chat" />
<data android:scheme="https" android:host="jitsi.rocket.chat" />
<data android:scheme="rocketchat" android:host="room" />
<data android:scheme="rocketchat" android:host="auth" />
<data android:scheme="rocketchat" android:host="jitsi.rocket.chat" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<receiver
android:name=".ReplyBroadcast"
android:enabled="true"
@ -53,23 +20,9 @@
android:enabled="true"
android:exported="false" >
</receiver>
<activity
android:noHistory="true"
android:name=".share.ShareActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/share_extension_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="${BugsnagAPIKey}" />
</application>
</manifest>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,24 @@
package chat.rocket.reactnative;
import android.app.Application;
import com.facebook.react.ReactPackage;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import java.util.Arrays;
import java.util.List;
import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage;
import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;
import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsPackage;
public class AdditionalModules {
public List<ReactPackage> getAdditionalModules(Application application) {
return Arrays.<ReactPackage>asList(
new ReactNativeFirebaseAnalyticsPackage(),
new ReactNativeFirebaseAppPackage(),
new ReactNativeFirebaseCrashlyticsPackage(),
new RNNotificationsPackage(application)
);
}
}

View File

@ -4,39 +4,36 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Person;
import android.app.RemoteInput;
import android.content.Intent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
import android.app.Person;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import java.util.concurrent.ExecutionException;
import java.lang.InterruptedException;
import com.facebook.react.bridge.ReactApplicationContext;
import com.google.gson.Gson;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.notification.PushNotification;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_EVENT_NAME;
@ -187,7 +184,7 @@ public class CustomPushNotification extends PushNotification {
private Bitmap largeIcon() {
final Resources res = mContext.getResources();
String packageName = mContext.getPackageName();
int largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
int largeIconResId = res.getIdentifier("ic_notification", "drawable", packageName);
Bitmap largeIconBitmap = BitmapFactory.decodeResource(res, largeIconResId);
return largeIconBitmap;
}
@ -196,7 +193,7 @@ public class CustomPushNotification extends PushNotification {
final Resources res = mContext.getResources();
String packageName = mContext.getPackageName();
int smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
int smallIconResId = res.getIdentifier("ic_notification", "drawable", packageName);
Gson gson = new Gson();
Ejson ejson = gson.fromJson(bundle.getString("ejson", "{}"), Ejson.class);
@ -213,9 +210,11 @@ public class CustomPushNotification extends PushNotification {
String CHANNEL_ID = "rocketchatrn_channel_01";
String CHANNEL_NAME = "All";
// User-visible importance level: Urgent - Makes a sound and appears as a heads-up notification
// https://developer.android.com/training/notify-user/channels#importance
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager.IMPORTANCE_HIGH);
final NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(channel);
@ -324,7 +323,7 @@ public class CustomPushNotification extends PushNotification {
final Resources res = mContext.getResources();
String packageName = mContext.getPackageName();
int smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
int smallIconResId = res.getIdentifier("ic_notification", "drawable", packageName);
Intent replyIntent = new Intent(mContext, ReplyBroadcast.class);
replyIntent.setAction(KEY_REPLY);

View File

@ -41,6 +41,10 @@ public class Ejson {
public Ejson() {
ReactApplicationContext reactApplicationContext = CustomPushNotification.reactApplicationContext;
if (reactApplicationContext == null) {
return;
}
// Start MMKV container
MMKV.initialize(reactApplicationContext);
SecureKeystore secureKeystore = new SecureKeystore(reactApplicationContext);

View File

@ -57,9 +57,16 @@ public class LoadNotification {
final OkHttpClient client = new OkHttpClient();
HttpUrl.Builder url = HttpUrl.parse(ejson.serverURL().concat("/api/v1/push.get")).newBuilder();
final String userId = ejson.userId();
final String userToken = ejson.token();
if (userId == null || userToken == null) {
return;
}
Request request = new Request.Builder()
.header("x-user-id", ejson.userId())
.header("x-auth-token", ejson.token())
.header("x-user-id", userId)
.header("x-auth-token", userToken)
.url(url.addQueryParameter("id", ejson.messageId).build())
.build();

View File

@ -0,0 +1,23 @@
package chat.rocket.reactnative;
import android.content.Context;
import android.os.Bundle;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
import com.wix.reactnativenotifications.core.notification.IPushNotification;
public class MainPlayApplication extends MainApplication implements INotificationsApplication {
@Override
public IPushNotification getPushNotification(Context context, Bundle bundle, AppLifecycleFacade defaultFacade, AppLaunchHelper defaultAppLaunchHelper) {
return new CustomPushNotification(
context,
bundle,
defaultFacade,
defaultAppLaunchHelper,
new JsIOHelper()
);
}
}

View File

@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="512"
android:viewportHeight="512">
<group>
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
<path
android:pathData="M0,0h512v512h-512z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="0"
android:startX="256"
android:endY="512"
android:endX="256"
android:type="linear">
<item android:offset="0" android:color="#FF1C82FF"/>
<item android:offset="1" android:color="#FF0066E3"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,14 +1,25 @@
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
def isPlay = !taskRequests.contains("foss")
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
minSdkVersion = 23
compileSdkVersion = 29
targetSdkVersion = 29
glideVersion = "4.9.0"
kotlin_version = "1.3.50"
supportLibVersion = "28.0.0"
libre_build = !(isPlay.toBoolean())
jitsi_url = isPlay ? "https://github.com/RocketChat/jitsi-maven-repository/raw/master/releases" : "https://github.com/RocketChat/jitsi-maven-repository/raw/libre/releases"
jitsi_version = isPlay ? "+" : "2.10.0-libre"
}
repositories {
mavenLocal()
google()
@ -18,9 +29,6 @@ buildscript {
}
}
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
def isPlay = !taskRequests.contains("foss")
dependencies {
if (isPlay) {
classpath 'com.google.gms:google-services:4.2.0'
@ -44,7 +52,7 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
url safeExtGet("jitsi_url", "https://github.com/RocketChat/jitsi-maven-repository/raw/master/releases")
}
google()

View File

@ -26,7 +26,7 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
APPLICATIONID=chat.rocket.reactnative
VERSIONNAME=4.11.0
VERSIONNAME=4.12.0
VERSIONCODE=1
BugsnagAPIKey=
KEYSTORE=my-upload-key.keystore

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Some files were not shown because too many files have changed in this diff Show More