android: add the ability to make a "libre" build
A libre build will exclude the following: - Analytics modules - Google Play services GMS - Crashlytics - Firebase
This commit is contained in:
parent
6bbc2927ab
commit
2d45709a6a
|
@ -1,6 +1,7 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
boolean googleServicesEnabled = project.file('google-services.json').exists()
|
boolean googleServicesEnabled \
|
||||||
|
= project.file('google-services.json').exists() && !rootProject.ext.libreBuild
|
||||||
|
|
||||||
// Crashlytics integration is done as part of Firebase now, so it gets
|
// Crashlytics integration is done as part of Firebase now, so it gets
|
||||||
// automagically activated with google-services.json
|
// automagically activated with google-services.json
|
||||||
|
@ -36,11 +37,24 @@ android {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
|
||||||
buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
|
buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
|
||||||
|
buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
|
||||||
buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
|
buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
|
||||||
|
buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
if (rootProject.ext.libreBuild) {
|
||||||
|
srcDir "src"
|
||||||
|
exclude "**/GoogleServicesHelper.java"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +72,17 @@ dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
|
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
|
||||||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
||||||
implementation 'com.google.android.gms:play-services-auth:16.0.1'
|
|
||||||
|
if (!rootProject.ext.libreBuild) {
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:16.0.1'
|
||||||
|
|
||||||
|
// Firebase
|
||||||
|
// - Crashlytics
|
||||||
|
// - Dynamic Links
|
||||||
|
implementation 'com.google.firebase:firebase-core:16.0.6'
|
||||||
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
|
||||||
|
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
|
||||||
|
}
|
||||||
|
|
||||||
implementation project(':sdk')
|
implementation project(':sdk')
|
||||||
|
|
||||||
|
@ -73,13 +97,6 @@ dependencies {
|
||||||
exclude group: "com.android.support", module: "annotations"
|
exclude group: "com.android.support", module: "annotations"
|
||||||
}
|
}
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:${rootProject.ext.glideVersion}"
|
annotationProcessor "com.github.bumptech.glide:compiler:${rootProject.ext.glideVersion}"
|
||||||
|
|
||||||
// Firebase
|
|
||||||
// - Crashlytics
|
|
||||||
// - Dynamic Links
|
|
||||||
implementation 'com.google.firebase:firebase-core:16.0.6'
|
|
||||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
|
|
||||||
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
|
|
||||||
# Jisti Meet SDK
|
# Jisti Meet SDK
|
||||||
|
|
||||||
|
-keep class org.jitsi.meet.** { *; }
|
||||||
-keep class org.jitsi.meet.sdk.** { *; }
|
-keep class org.jitsi.meet.sdk.** { *; }
|
||||||
|
|
||||||
# We added the following when we switched minifyEnabled on. Probably because we
|
# We added the following when we switched minifyEnabled on. Probably because we
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.jitsi.meet;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks;
|
||||||
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
|
import org.jitsi.meet.sdk.JitsiMeetActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to initialize Google related services and functionality.
|
||||||
|
* This functionality is compiled conditionally and called via reflection, that's why it was
|
||||||
|
* extracted here.
|
||||||
|
*
|
||||||
|
* "Libre builds" (builds with the LIBRE_BUILD flag set) will not include this file.
|
||||||
|
*/
|
||||||
|
final class GoogleServicesHelper {
|
||||||
|
public static void initialize(JitsiMeetActivity activity) {
|
||||||
|
if (BuildConfig.GOOGLE_SERVICES_ENABLED) {
|
||||||
|
Log.d(activity.getClass().getSimpleName(), "Initializing Google Services");
|
||||||
|
|
||||||
|
Fabric.with(activity, new Crashlytics());
|
||||||
|
|
||||||
|
FirebaseDynamicLinks.getInstance().getDynamicLink(activity.getIntent())
|
||||||
|
.addOnSuccessListener(activity, pendingDynamicLinkData -> {
|
||||||
|
Uri dynamicLink = null;
|
||||||
|
|
||||||
|
if (pendingDynamicLinkData != null) {
|
||||||
|
dynamicLink = pendingDynamicLinkData.getLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dynamicLink != null) {
|
||||||
|
activity.join(dynamicLink.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,10 +29,7 @@ import org.jitsi.meet.sdk.JitsiMeet;
|
||||||
import org.jitsi.meet.sdk.JitsiMeetActivity;
|
import org.jitsi.meet.sdk.JitsiMeetActivity;
|
||||||
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions;
|
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import java.lang.reflect.Method;
|
||||||
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks;
|
|
||||||
import io.fabric.sdk.android.Fabric;
|
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -57,22 +54,16 @@ public class MainActivity extends JitsiMeetActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean extraInitialize() {
|
protected boolean extraInitialize() {
|
||||||
|
Log.d(this.getClass().getSimpleName(), "LIBRE_BUILD="+BuildConfig.LIBRE_BUILD);
|
||||||
|
|
||||||
// Setup Crashlytics and Firebase Dynamic Links
|
// Setup Crashlytics and Firebase Dynamic Links
|
||||||
if (BuildConfig.GOOGLE_SERVICES_ENABLED) {
|
// Here we are using reflection since it may have been disabled at compile time.
|
||||||
Fabric.with(this, new Crashlytics());
|
try {
|
||||||
|
Class<?> cls = Class.forName("org.jitsi.meet.GoogleServicesHelper");
|
||||||
FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent())
|
Method m = cls.getMethod("initialize", JitsiMeetActivity.class);
|
||||||
.addOnSuccessListener(this, pendingDynamicLinkData -> {
|
m.invoke(null, this);
|
||||||
Uri dynamicLink = null;
|
} catch (Exception e) {
|
||||||
|
// Ignore any error, the module is not compiled when LIBRE_BUILD is enabled.
|
||||||
if (pendingDynamicLinkData != null) {
|
|
||||||
dynamicLink = pendingDynamicLinkData.getLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dynamicLink != null) {
|
|
||||||
join(dynamicLink.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In Debug builds React needs permission to write over other apps in
|
// In Debug builds React needs permission to write over other apps in
|
||||||
|
|
|
@ -167,6 +167,9 @@ ext {
|
||||||
// Glide
|
// Glide
|
||||||
excludeAppGlideModule = true
|
excludeAppGlideModule = true
|
||||||
glideVersion = "4.7.1" // keep in sync with react-native-fast-image
|
glideVersion = "4.7.1" // keep in sync with react-native-fast-image
|
||||||
|
|
||||||
|
// Libre build
|
||||||
|
libreBuild = (System.env.LIBRE_BUILD ?: "true").toBoolean()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If Android SDK is not installed, accept its license so that it
|
// If Android SDK is not installed, accept its license so that it
|
||||||
|
|
|
@ -10,10 +10,25 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {}
|
debug {
|
||||||
|
buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
|
||||||
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
if (rootProject.ext.libreBuild) {
|
||||||
|
srcDir "src"
|
||||||
|
exclude "**/AmplitudeModule.java"
|
||||||
|
}
|
||||||
|
exclude "test/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,19 +39,23 @@ dependencies {
|
||||||
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
|
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
|
||||||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
||||||
|
|
||||||
implementation 'com.amplitude:android-sdk:2.14.1'
|
|
||||||
implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
|
|
||||||
api 'com.facebook.react:react-native:+'
|
api 'com.facebook.react:react-native:+'
|
||||||
|
|
||||||
|
implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
|
||||||
|
|
||||||
|
if (!rootProject.ext.libreBuild) {
|
||||||
|
implementation 'com.amplitude:android-sdk:2.14.1'
|
||||||
|
implementation(project(":react-native-google-signin")) {
|
||||||
|
exclude group: 'com.google.android.gms'
|
||||||
|
exclude group: 'com.android.support'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
implementation project(':react-native-background-timer')
|
implementation project(':react-native-background-timer')
|
||||||
implementation project(':react-native-calendar-events')
|
implementation project(':react-native-calendar-events')
|
||||||
implementation(project(':react-native-fast-image')) {
|
implementation(project(':react-native-fast-image')) {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
implementation(project(":react-native-google-signin")) {
|
|
||||||
exclude group: 'com.google.android.gms'
|
|
||||||
exclude group: 'com.android.support'
|
|
||||||
}
|
|
||||||
implementation project(':react-native-immersive')
|
implementation project(':react-native-immersive')
|
||||||
implementation project(':react-native-keep-awake')
|
implementation project(':react-native-keep-awake')
|
||||||
implementation project(':react-native-linear-gradient')
|
implementation project(':react-native-linear-gradient')
|
||||||
|
|
|
@ -75,6 +75,7 @@ class AppInfoModule
|
||||||
constants.put(
|
constants.put(
|
||||||
"version",
|
"version",
|
||||||
packageInfo == null ? "" : packageInfo.versionName);
|
packageInfo == null ? "" : packageInfo.versionName);
|
||||||
|
constants.put("LIBRE_BUILD", BuildConfig.LIBRE_BUILD);
|
||||||
|
|
||||||
return constants;
|
return constants;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.app.Application;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.facebook.react.ReactInstanceManager;
|
import com.facebook.react.ReactInstanceManager;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.react.bridge.NativeModule;
|
import com.facebook.react.bridge.NativeModule;
|
||||||
import com.facebook.react.bridge.ReactContext;
|
import com.facebook.react.bridge.ReactContext;
|
||||||
import com.facebook.react.bridge.ReactApplicationContext;
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
@ -28,6 +29,7 @@ import com.facebook.react.common.LifecycleState;
|
||||||
import com.facebook.react.devsupport.DevInternalSettings;
|
import com.facebook.react.devsupport.DevInternalSettings;
|
||||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -48,7 +50,6 @@ class ReactInstanceManagerHolder {
|
||||||
ReactApplicationContext reactContext) {
|
ReactApplicationContext reactContext) {
|
||||||
List<NativeModule> nativeModules
|
List<NativeModule> nativeModules
|
||||||
= new ArrayList<>(Arrays.<NativeModule>asList(
|
= new ArrayList<>(Arrays.<NativeModule>asList(
|
||||||
new AmplitudeModule(reactContext),
|
|
||||||
new AndroidSettingsModule(reactContext),
|
new AndroidSettingsModule(reactContext),
|
||||||
new AppInfoModule(reactContext),
|
new AppInfoModule(reactContext),
|
||||||
new AudioModeModule(reactContext),
|
new AudioModeModule(reactContext),
|
||||||
|
@ -64,6 +65,14 @@ class ReactInstanceManagerHolder {
|
||||||
nativeModules.add(new RNConnectionService(reactContext));
|
nativeModules.add(new RNConnectionService(reactContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class<?> amplitudeModuleClass = Class.forName("AmplitudeModule");
|
||||||
|
Constructor constructor = amplitudeModuleClass.getConstructor(ReactApplicationContext.class);
|
||||||
|
nativeModules.add((NativeModule)constructor.newInstance(reactContext));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ignore any error, the module is not compiled when LIBRE_BUILD is enabled.
|
||||||
|
}
|
||||||
|
|
||||||
return nativeModules;
|
return nativeModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,31 +137,39 @@ class ReactInstanceManagerHolder {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ReactPackage> packages
|
||||||
|
= new ArrayList<>(Arrays.asList(
|
||||||
|
new com.BV.LinearGradient.LinearGradientPackage(),
|
||||||
|
new com.calendarevents.CalendarEventsPackage(),
|
||||||
|
new com.corbt.keepawake.KCKeepAwakePackage(),
|
||||||
|
new com.dylanvann.fastimage.FastImageViewPackage(),
|
||||||
|
new com.facebook.react.shell.MainReactPackage(),
|
||||||
|
new com.oblador.vectoricons.VectorIconsPackage(),
|
||||||
|
new com.ocetnik.timer.BackgroundTimerPackage(),
|
||||||
|
new com.oney.WebRTCModule.WebRTCModulePackage(),
|
||||||
|
new com.rnimmersive.RNImmersivePackage(),
|
||||||
|
new com.zmxv.RNSound.RNSoundPackage(),
|
||||||
|
new ReactPackageAdapter() {
|
||||||
|
@Override
|
||||||
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||||
|
return ReactInstanceManagerHolder.createNativeModules(reactContext);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class<?> googlePackageClass = Class.forName("co.apptailor.googlesignin.RNGoogleSigninPackage");
|
||||||
|
Constructor constructor = googlePackageClass.getConstructor();
|
||||||
|
packages.add((ReactPackage)constructor.newInstance());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ignore any error, the module is not compiled when LIBRE_BUILD is enabled.
|
||||||
|
}
|
||||||
|
|
||||||
reactInstanceManager
|
reactInstanceManager
|
||||||
= ReactInstanceManager.builder()
|
= ReactInstanceManager.builder()
|
||||||
.setApplication(application)
|
.setApplication(application)
|
||||||
.setBundleAssetName("index.android.bundle")
|
.setBundleAssetName("index.android.bundle")
|
||||||
.setJSMainModulePath("index.android")
|
.setJSMainModulePath("index.android")
|
||||||
.addPackage(new co.apptailor.googlesignin.RNGoogleSigninPackage())
|
.addPackages(packages)
|
||||||
.addPackage(new com.BV.LinearGradient.LinearGradientPackage())
|
|
||||||
.addPackage(new com.calendarevents.CalendarEventsPackage())
|
|
||||||
.addPackage(new com.corbt.keepawake.KCKeepAwakePackage())
|
|
||||||
.addPackage(new com.dylanvann.fastimage.FastImageViewPackage())
|
|
||||||
.addPackage(new com.facebook.react.shell.MainReactPackage())
|
|
||||||
.addPackage(new com.oblador.vectoricons.VectorIconsPackage())
|
|
||||||
.addPackage(new com.ocetnik.timer.BackgroundTimerPackage())
|
|
||||||
.addPackage(new com.oney.WebRTCModule.WebRTCModulePackage())
|
|
||||||
.addPackage(new com.rnimmersive.RNImmersivePackage())
|
|
||||||
.addPackage(new com.zmxv.RNSound.RNSoundPackage())
|
|
||||||
.addPackage(new ReactPackageAdapter() {
|
|
||||||
@Override
|
|
||||||
public List<NativeModule> createNativeModules(
|
|
||||||
ReactApplicationContext reactContext) {
|
|
||||||
return
|
|
||||||
ReactInstanceManagerHolder.createNativeModules(
|
|
||||||
reactContext);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setUseDeveloperSupport(BuildConfig.DEBUG)
|
.setUseDeveloperSupport(BuildConfig.DEBUG)
|
||||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -13,6 +13,11 @@ class Amplitude {
|
||||||
* be used only for multi-project logging.
|
* be used only for multi-project logging.
|
||||||
*/
|
*/
|
||||||
constructor(instanceName) {
|
constructor(instanceName) {
|
||||||
|
// It might not have been included in the build.
|
||||||
|
if (!AmplitudeNative) {
|
||||||
|
throw new Error('Amplitude analytics is not supported');
|
||||||
|
}
|
||||||
|
|
||||||
this._instanceName = instanceName;
|
this._instanceName = instanceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* @flow */
|
// @flow
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import { NativeModules } from 'react-native';
|
||||||
|
|
||||||
|
export * from './functions.any';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all analytics related options from the given configuration, in case of a libre build.
|
||||||
|
*
|
||||||
|
* @param {*} config - The configuration which needs to be cleaned up.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function _cleanupConfig(config: Object) {
|
||||||
|
if (NativeModules.AppInfo.LIBRE_BUILD) {
|
||||||
|
config.analytics.scriptURLs = [];
|
||||||
|
delete config.analytics.amplitudeAPPKey;
|
||||||
|
delete config.analytics.googleAnalyticsTrackingId;
|
||||||
|
delete config.callStatsID;
|
||||||
|
delete config.callStatsSecret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
export * from './functions.any';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all analytics related options from the given configuration, in case of a libre build.
|
||||||
|
*
|
||||||
|
* @param {*} config - The configuration which needs to be cleaned up.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function _cleanupConfig(config: Object) { // eslint-disable-line no-unused-vars
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import _ from 'lodash';
|
||||||
import { equals, ReducerRegistry, set } from '../redux';
|
import { equals, ReducerRegistry, set } from '../redux';
|
||||||
|
|
||||||
import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
|
import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
|
||||||
|
import { _cleanupConfig } from './functions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initial state of the feature base/config when executing in a
|
* The initial state of the feature base/config when executing in a
|
||||||
|
@ -29,6 +30,8 @@ const INITIAL_NON_RN_STATE = {
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
const INITIAL_RN_STATE = {
|
const INITIAL_RN_STATE = {
|
||||||
|
analytics: {},
|
||||||
|
|
||||||
// FIXME The support for audio levels in lib-jitsi-meet polls the statistics
|
// FIXME The support for audio levels in lib-jitsi-meet polls the statistics
|
||||||
// of WebRTC at a short interval multiple times a second. Unfortunately,
|
// of WebRTC at a short interval multiple times a second. Unfortunately,
|
||||||
// React Native is slow to fetch these statistics from the native WebRTC
|
// React Native is slow to fetch these statistics from the native WebRTC
|
||||||
|
@ -135,6 +138,8 @@ function _setConfig(state, { config }) {
|
||||||
_getInitialState()
|
_getInitialState()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_cleanupConfig(newState);
|
||||||
|
|
||||||
return equals(state, newState) ? state : newState;
|
return equals(state, newState) ? state : newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import {
|
import { NativeModules } from 'react-native';
|
||||||
GoogleSignin
|
|
||||||
} from 'react-native-google-signin';
|
let GoogleSignin;
|
||||||
|
|
||||||
|
if (NativeModules.RNGoogleSignin) {
|
||||||
|
GoogleSignin = require('react-native-google-signin').GoogleSignin;
|
||||||
|
}
|
||||||
|
|
||||||
import {
|
import {
|
||||||
API_URL_BROADCAST_STREAMS,
|
API_URL_BROADCAST_STREAMS,
|
||||||
|
@ -26,7 +30,9 @@ class GoogleApi {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
configure(config: Object) {
|
configure(config: Object) {
|
||||||
GoogleSignin.configure(config);
|
if (GoogleSignin) {
|
||||||
|
GoogleSignin.configure(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,6 +64,10 @@ class GoogleApi {
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
hasPlayServices() {
|
hasPlayServices() {
|
||||||
|
if (!GoogleSignin) {
|
||||||
|
return Promise.reject(new Error('Google SignIn not supported'));
|
||||||
|
}
|
||||||
|
|
||||||
return GoogleSignin.hasPlayServices();
|
return GoogleSignin.hasPlayServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue