feat(android) adds initializer for SoLoader.init

This commit is contained in:
tmoldovan8x8 2021-10-07 11:56:19 +03:00 committed by GitHub
parent ddcb85a1d8
commit 3b33ba3f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 3 deletions

View File

@ -48,6 +48,7 @@ dependencies {
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.squareup.duktape:duktape-android:1.3.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "androidx.startup:startup-runtime:1.1.0"
if (rootProject.ext.libreBuild) {
implementation(project(':react-native-device-info')) {

View File

@ -57,6 +57,14 @@
android:enabled="false"
tools:replace="android:authorities">
</provider>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false">
<meta-data android:name="org.jitsi.meet.sdk.JitsiInitializer"
android:value="androidx.startup" />
</provider>
</application>
</manifest>

View File

@ -0,0 +1,42 @@
/*
* Copyright @ 2021-present 8x8, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.meet.sdk;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.startup.Initializer;
import com.facebook.soloader.SoLoader;
import java.util.ArrayList;
import java.util.List;
public class JitsiInitializer implements Initializer<Boolean> {
@NonNull
@Override
public Boolean create(@NonNull Context context) {
SoLoader.init(context, /* native exopackage */ false);
return true;
}
@NonNull
@Override
public List<Class<? extends Initializer<?>>> dependencies() {
return new ArrayList<>();
}
}

View File

@ -30,7 +30,6 @@ import com.facebook.react.devsupport.DevInternalSettings;
import com.facebook.react.jscexecutor.JSCExecutorFactory;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.soloader.SoLoader;
import com.oney.WebRTCModule.RTCVideoViewManager;
import com.oney.WebRTCModule.WebRTCModule;
@ -174,8 +173,6 @@ class ReactInstanceManagerHolder {
return;
}
SoLoader.init(activity.getApplication(), /* native exopackage */ false);
List<ReactPackage> packages
= new ArrayList<>(Arrays.asList(
new com.calendarevents.CalendarEventsPackage(),