1、相心美颜So文件静默加载,但是不显示下载弹窗

2、so未加载成功主播开播提示:请稍等....
3、app组件没有依赖公共组件,依赖了main组件,现直接使用组件之间通信了
This commit is contained in:
老皮 2024-09-25 15:46:52 +08:00
parent 80892b14e4
commit e69796e158
5 changed files with 21 additions and 7 deletions

View File

@ -82,6 +82,7 @@ import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import myname.pdlive.shayu.BuildConfig;
import myname.pdlive.shayu.R; import myname.pdlive.shayu.R;
@ -165,13 +166,12 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
Log.i("downLoad","架构: " + Build.CPU_ABI); Log.i("downLoad","架构: " + Build.CPU_ABI);
if(CommonAppConfig.IS_GOOGLE_PLAY == 0){ if(CommonAppConfig.IS_GOOGLE_PLAY == 0){
//链接包 下载so库 //链接包 下载美颜so库
checkFaceUnitySOFile(); checkFaceUnitySOFile();
// checkAgoraSOFile(); // checkAgoraSOFile();
}else {
//渠道包
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
} }
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
} }
@ -186,6 +186,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
//解压后的文件数量必须要有2个 //解压后的文件数量必须要有2个
//如果文件存在解压后 文件数量一致直接进入下一步 //如果文件存在解压后 文件数量一致直接进入下一步
if (fileSo.exists() && getFileCount(fileSoList.getAbsolutePath()) == 2){ if (fileSo.exists() && getFileCount(fileSoList.getAbsolutePath()) == 2){
MainActivity.faceSDKIsLoadSuceness = true;
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000); mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
return; return;
} }
@ -194,10 +195,10 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
Log.i("download", soUrl); Log.i("download", soUrl);
if (!fileSo.exists()) { if (!fileSo.exists()) {
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,true); downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,false);
}else if (fileSo.exists() && getFileCount(outputDir.getAbsolutePath()) < 3) { }else if (fileSo.exists() && getFileCount(outputDir.getAbsolutePath()) < 3) {
fileSo.delete(); fileSo.delete();
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,true); downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,false);
} }
} }
@ -282,6 +283,10 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
File fileSo = new File(outputDir, fileName); File fileSo = new File(outputDir, fileName);
try { try {
unzip(fileSo.getAbsolutePath(), outputDir); unzip(fileSo.getAbsolutePath(), outputDir);
MainActivity.faceSDKIsLoadSuceness = true;
if (BuildConfig.DEBUG){
ToastUtil.showDebug("美颜SDK加载成功...");
}
} catch (Exception e) { } catch (Exception e) {
Log.e("ZipCheck", "Error reading ZIP file", e); Log.e("ZipCheck", "Error reading ZIP file", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@ -316,7 +321,6 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath)); ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
ZipEntry entry = zipIn.getNextEntry(); ZipEntry entry = zipIn.getNextEntry();
while (entry != null) { while (entry != null) {
String filePath = destDirectory + File.separator + sanitizePath(entry.getName()); String filePath = destDirectory + File.separator + sanitizePath(entry.getName());
Log.d("Unzip", "Extracting: " + filePath); Log.d("Unzip", "Extracting: " + filePath);
if (!entry.isDirectory()) { if (!entry.isDirectory()) {

View File

@ -826,6 +826,7 @@
<string name="input_content_but">點此輸入回復內容</string> <string name="input_content_but">點此輸入回復內容</string>
<string name="only_open_anchor">暫時只對主播開放</string> <string name="only_open_anchor">暫時只對主播開放</string>
<string name="wait_face_sdk_load">請稍等美顏SDK加載中</string>
<string name="facebook_app_id">2011402032399020</string> <string name="facebook_app_id">2011402032399020</string>
<string name="facebook_client_token">959584e054a33614996361f0044e5253</string> <string name="facebook_client_token">959584e054a33614996361f0044e5253</string>

View File

@ -786,6 +786,7 @@
<string name="input_content_but">Click here to enter the reply</string> <string name="input_content_but">Click here to enter the reply</string>
<string name="only_open_anchor">For the time being, it is only open to the anchor</string> <string name="only_open_anchor">For the time being, it is only open to the anchor</string>
<string name="wait_face_sdk_load">Please wait, the beauty SDK is loading.</string>
<string name="facebook_app_id">2011402032399020</string> <string name="facebook_app_id">2011402032399020</string>
<string name="facebook_client_token">959584e054a33614996361f0044e5253</string> <string name="facebook_client_token">959584e054a33614996361f0044e5253</string>

View File

@ -206,6 +206,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private View floatWarOrder;//战令浮窗 private View floatWarOrder;//战令浮窗
private List<AnchorStartLiveBean> startListNotifyList = new ArrayList<>(); private List<AnchorStartLiveBean> startListNotifyList = new ArrayList<>();
private String[] libNameList = new String[]{"agora-core", "agora-ffmpeg", "agora-fdkaac", "agora-soundtouch","agora-rtc-sdk"}; private String[] libNameList = new String[]{"agora-core", "agora-ffmpeg", "agora-fdkaac", "agora-soundtouch","agora-rtc-sdk"};
// 美颜SDK是否已经加载成功
public static boolean faceSDKIsLoadSuceness = false;
@Override @Override

View File

@ -41,6 +41,7 @@ import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity; import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.MyWebViewActivity; import com.yunbao.main.activity.MyWebViewActivity;
import com.yunbao.main.interfaces.MainStartChooseCallback; import com.yunbao.main.interfaces.MainStartChooseCallback;
@ -167,6 +168,11 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
public void onLiveClick() { public void onLiveClick() {
boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType(); boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType();
if (isAnchor) { if (isAnchor) {
// 判断美颜SDK是否加载成功
if (!MainActivity.faceSDKIsLoadSuceness){
ToastUtil.show(getString(R.string.wait_face_sdk_load));
return;
}
String[] permissions; String[] permissions;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
permissions = new String[]{ permissions = new String[]{