From 2c248681cac680d3e3ce70cdecbd1b6bbd011141 Mon Sep 17 00:00:00 2001
From: 18142669586 <1669783059@qq.com>
Date: Wed, 17 Aug 2022 13:34:29 +0800
Subject: [PATCH] 111
---
app/src/main/AndroidManifest.xml | 14 +++++++++
.../java/com/shayu/phonelive/AppContext.java | 8 +++++
common/build.gradle | 4 ++-
.../views/weight/ViewClicksAntiShake.java | 2 +-
.../yunbao/main/activity/MainActivity.java | 29 +++++++++++++++----
.../main/activity/MyWebViewActivity.java | 2 +-
.../main/activity/MyWebViewActivity2.java | 2 +-
.../main/activity/ZhuangBanActivity.java | 3 +-
.../yunbao/main/views/MainMeViewHolder.java | 2 +-
9 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6e7a18b49..441c442ba 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,6 +91,14 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="theme,label,icon,allowBackup">
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java
index 0e1efa7ba..2c9571b8b 100644
--- a/app/src/main/java/com/shayu/phonelive/AppContext.java
+++ b/app/src/main/java/com/shayu/phonelive/AppContext.java
@@ -41,6 +41,8 @@ import io.rong.imlib.IRongCoreListener;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage;
+import io.rong.push.RongPushClient;
+import io.rong.push.pushconfig.PushConfig;
import static com.yunbao.live.socket.SocketClient.mSocketHandler;
@@ -116,6 +118,12 @@ public class AppContext extends CommonAppContext {
}
ARouter.init(this);
+ //谷歌推送
+ PushConfig gconfig = new PushConfig.Builder()
+ .enableFCM(true)
+ .build();
+ RongPushClient.setPushConfig(gconfig);
+
//初始化 邀请码库
if (isMainProcess()) {
OpenInstall.init(this);
diff --git a/common/build.gradle b/common/build.gradle
index dadb2a096..a7bff4708 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -166,7 +166,6 @@ dependencies {
api 'com.linecorp:linesdk:5.0.1'
api 'com.adjust.sdk:adjust-android:4.30.1'
api 'com.android.installreferrer:installreferrer:2.2'
- api 'com.google.firebase:firebase-analytics:15.0.0'
//Retrofit2库
api 'com.squareup.retrofit2:retrofit:2.3.0'
api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
@@ -177,4 +176,7 @@ dependencies {
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
//loading样式库
api 'com.wang.avi:library:2.1.3'
+ api 'com.google.firebase:firebase-messaging:23.0.6'
+ api 'com.google.firebase:firebase-analytics:21.1.0'
+
}
diff --git a/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java b/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java
index 850d8ba0e..09d20d132 100644
--- a/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java
+++ b/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java
@@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
-import kotlin.Unit;
+import kotlin.*;
/**
* View防抖
diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
index 21e454cd3..9f2fc8e66 100644
--- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
@@ -21,6 +21,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
@@ -31,6 +32,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.SkuDetails;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.messaging.FirebaseMessaging;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jakewharton.rxbinding3.view.RxView;
@@ -122,10 +126,9 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.rong.imlib.RongIMClient;
-import kotlin.Unit;
import static com.yunbao.common.CommonAppContext.isReady;
-
+import kotlin.*;
@Route(path = RouteUtil.PATH_MAIN)
public class MainActivity extends AbsActivity implements MainAppBarLayoutListener {
@@ -270,11 +273,27 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
Display mDisplay = getWindowManager().getDefaultDisplay();
Height = mDisplay.getHeight();
// IMLib 初始化
- RongIMClient.init(this, RongcloudIMManager.RONG_IM_KEY);
+ RongIMClient.init(this, RongcloudIMManager.RONG_IM_KEY,true);
// RTCLib 初始化
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
-
+// FirebaseMessaging.getInstance().getToken()
+// .addOnCompleteListener(new OnCompleteListener() {
+// @Override
+// public void onComplete(@NonNull Task task) {
+// if (!task.isSuccessful()) {
+// Log.w(TAG, "Fetching FCM registration token failed", task.getException());
+// return;
+// }
+//
+// // Get new FCM registration token
+// String token = task.getResult();
+//
+// // Log and toast
+// Log.d(TAG, token);
+// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
+// }
+// });
boolean showInvite = getIntent().getBooleanExtra(Constants.SHOW_INVITE, false);
mRootView = (ViewGroup) findViewById(R.id.rootView);
floatBanner = findViewById(R.id.float_banner_home);
@@ -380,7 +399,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
@Override
- public void onNext(Unit unit) {
+ public void onNext(kotlin.Unit unit) {
String Uid = floatBanner.getUid();
LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
@Override
diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java
index aad01ed6f..ff7f88a9c 100644
--- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java
@@ -127,7 +127,7 @@ public class MyWebViewActivity extends AbsActivity {
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- L.e("H5-------->" + url);
+ L.e("H5--------1>" + url);
if (url.startsWith(Constants.COPY_PREFIX)) {
String content = url.substring(Constants.COPY_PREFIX.length());
if (!TextUtils.isEmpty(content)) {
diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java
index 1e9881157..f2ac9cbf8 100644
--- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java
+++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java
@@ -100,7 +100,7 @@ public class MyWebViewActivity2 extends AbsActivity {
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- L.e("H5-------->" + url);
+ L.e("H5--------1>" + url);
if (url.startsWith(Constants.COPY_PREFIX)) {
String content = url.substring(Constants.COPY_PREFIX.length());
if (!TextUtils.isEmpty(content)) {
diff --git a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java
index c0368a248..30f1b3e1a 100644
--- a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java
@@ -150,6 +150,7 @@ public class ZhuangBanActivity extends AbsActivity {
});
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
+ mWebView.getSettings().setDomStorageEnabled(true);
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
@@ -336,7 +337,7 @@ public class ZhuangBanActivity extends AbsActivity {
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
}
Intent intent = new Intent(context, ZhuangBanActivity.class);
- Log.i("tag", url);
+ Log.i("tag1212", url);
intent.putExtra(Constants.URL, url);
context.startActivity(intent);
}
diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java
index 62b432047..4217724c5 100644
--- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java
+++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java
@@ -569,7 +569,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
if (!bean.getSlide_url().equals("")) {
Constants.isTitle = true;
String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
- ZhuangBanActivity.forward(mContext, url, false);
+ WebViewActivity.forward(mContext, url, false);
}
}
}