Commit b8a88eca authored by mengcuiguang's avatar mengcuiguang

添加应用报文加密,更新聚乐云sdk,新闻sdk,代码优化等

parent c40e42a0
...@@ -5,6 +5,7 @@ local.properties ...@@ -5,6 +5,7 @@ local.properties
/.idea /.idea
/.gradle /.gradle
/build /build
/gradle
#lib project #lib project
app/build app/build
shareSdkLib/build shareSdkLib/build
......
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.mints.goodmoney" applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 21 versionCode 22
versionName "1.2.0" versionName "1.2.1"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
...@@ -245,14 +245,18 @@ dependencies { ...@@ -245,14 +245,18 @@ dependencies {
// 瑞狮新闻 // 瑞狮新闻
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
implementation(name: 'xrsdk-release_tbs', ext: 'aar') implementation(name: 'xrsdk-release_tbs', ext: 'aar')
implementation(name: 'xrsharesdk-release_tbs', ext: 'aar')
implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3'
implementation 'com.scwang.smart:refresh-header-classics:2.0.3'
implementation 'com.scwang.smart:refresh-footer-classics:2.0.3'
// 枫岚 // 枫岚
implementation(name: 'mh-adsdk', ext: 'aar') implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar') implementation(name: 'mh-adsdk-ext', ext: 'aar')
// implementation(name: 'ks_3.3.5.3', ext: 'aar') // implementation(name: 'ks_3.3.5.3', ext: 'aar')
// 聚乐云 // 聚乐云
implementation(name: 'okgo-4.0', ext: 'aar') implementation(name: 'okgo-5.0', ext: 'aar')
implementation(name: 'scenemodule-4.1-hzq', ext: 'aar') implementation(name: 'scenemodule-5.0-hzq', ext: 'aar')
implementation(name: 'scenead-4.0', ext: 'aar') implementation(name: 'scenead-5.0', ext: 'aar')
implementation 'com.just.agentweb:agentweb:4.1.2' implementation 'com.just.agentweb:agentweb:4.1.2'
// 喜马拉雅 已集成 // 喜马拉雅 已集成
// 微转阅读(接入h5方式) // 微转阅读(接入h5方式)
...@@ -270,7 +274,7 @@ dependencies { ...@@ -270,7 +274,7 @@ dependencies {
// 抖音滑动LayoutManager // 抖音滑动LayoutManager
implementation(name: 'LayoutManagerGroup', ext: 'aar') implementation(name: 'LayoutManagerGroup', ext: 'aar')
// 蘑菇星球 // 蘑菇星球
implementation(name: 'moku-planet-api-native-sdk-1.1.10', ext: 'aar') implementation(name: 'moku-planet-api-native-sdk-1.2.1', ext: 'aar')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1' implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
......
No preview for this file type
...@@ -495,9 +495,24 @@ ...@@ -495,9 +495,24 @@
# ===================== 瑞狮新闻 START ================ # ===================== 瑞狮新闻 START ================
-keep class com.xr.xrsdk.** { *;}
-keep class com.xr.sharesdk.** { *;}
-keep class com.tencent.** {*;} -keep class com.tencent.** {*;}
-keep class com.qq.e.** {public protected *;} -keep class com.qq.e.** {public protected *;}
-keep class com.xr.xrsdk.** { *;} -keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class com.baidu.mobads.** { *; }
-keep class com.baidu.mobad.** { *; }
-keep class com.bun.miitmdid.core.** {*;}
# WindAd
-keep class sun.misc.Unsafe { *; }
-dontwarn com.sigmob.**
-keep class com.sigmob.**.**{*;}
# ======================= 瑞狮新闻 END ================ # ======================= 瑞狮新闻 END ================
......
...@@ -159,6 +159,10 @@ ...@@ -159,6 +159,10 @@
<activity <activity
android:name=".ui.activitys.AwardActivity" android:name=".ui.activitys.AwardActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.MokuGuideActivity"
android:theme="@style/AppTheme.NoActionBarTranslucent"
android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activitys.SettingsActivity" android:name=".ui.activitys.SettingsActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
......
...@@ -138,7 +138,7 @@ public class MintsApplication extends MultiDexApplication { ...@@ -138,7 +138,7 @@ public class MintsApplication extends MultiDexApplication {
LiebaoManager.getInstance().initCmGameSdk(); LiebaoManager.getInstance().initCmGameSdk();
// 瑞狮新闻 // 瑞狮新闻
RsNewsManager.INSTANCE.initX5Environment(this); RsNewsManager.INSTANCE.init(this);
// 喜马拉雅 // 喜马拉雅
initXmly(); initXmly();
......
...@@ -95,6 +95,7 @@ object KsPreLoadExpressManager { ...@@ -95,6 +95,7 @@ object KsPreLoadExpressManager {
} }
override fun onVideoPlayError(what: Int, extra: Int) { override fun onVideoPlayError(what: Int, extra: Int) {
LogUtil.d("KsPreLoadExpressManager","id=${what} extra=${extra}")
} }
}) })
......
...@@ -10,7 +10,7 @@ import androidx.annotation.NonNull; ...@@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
import com.mints.goodmoney.MintsApplication; import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.TTNativeExpressManager; import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.utils.ToastUtil; import com.mints.goodmoney.utils.LogUtil;
public class TTPreLoadCarrierExpressManager { public class TTPreLoadCarrierExpressManager {
...@@ -48,6 +48,8 @@ public class TTPreLoadCarrierExpressManager { ...@@ -48,6 +48,8 @@ public class TTPreLoadCarrierExpressManager {
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg); super.handleMessage(msg);
LogUtil.d("TTPreLoadCarrierExpressManager", "Thread:" + Thread.currentThread());
// 工作线程进行加载数据 // 工作线程进行加载数据
if (msg.what == mTTPreLoadWhat) { if (msg.what == mTTPreLoadWhat) {
loadTtFrameLayoutInThread((String) msg.obj); loadTtFrameLayoutInThread((String) msg.obj);
......
...@@ -80,7 +80,7 @@ public class AppConfig { ...@@ -80,7 +80,7 @@ public class AppConfig {
/** /**
* wnVideo 剩余广告播放数 * wnVideo 剩余广告播放数
*/ */
public static int wnVideoAdCount = 5; public static int wnVideoAdCount = 0;
/** /**
* csjFull 剩余广告播放数 * csjFull 剩余广告播放数
*/ */
...@@ -92,15 +92,15 @@ public class AppConfig { ...@@ -92,15 +92,15 @@ public class AppConfig {
/** /**
* shVideo 剩余广告播放数 * shVideo 剩余广告播放数
*/ */
public static int shVideoAdCount = 5; public static int shVideoAdCount = 0;
/** /**
* ksVideo 剩余广告播放数 * ksVideo 剩余广告播放数
*/ */
public static int ksVideoAdCount = 5; public static int ksVideoAdCount = 0;
/** /**
* rtaVideo 剩余广告播放数 * rtaVideo 剩余广告播放数
*/ */
public static int rtaVideoAdCount = 5; public static int rtaVideoAdCount = 0;
/** /**
* 高额试玩任务标识 * 高额试玩任务标识
......
...@@ -245,4 +245,7 @@ object Constant { ...@@ -245,4 +245,7 @@ object Constant {
// 外网IP地址 // 外网IP地址
const val OUT_NET_IP = "out_net_ip" const val OUT_NET_IP = "out_net_ip"
// 蘑菇星球引导页
const val MOKU_FLAG_GUIDE = "moku_flag_guide"
} }
...@@ -17,11 +17,6 @@ object RsNewsManager { ...@@ -17,11 +17,6 @@ object RsNewsManager {
* 初始化 * 初始化
*/ */
fun init(application: Application) { fun init(application: Application) {
XRNewsManager.getInstance().init(application, APP_ID, UserManager.getInstance().userID,WX_APP_ID) XRNewsManager.getInstance().init(application, APP_ID,WX_APP_ID)
}
fun initX5Environment(application: Application){
QbSdk.initX5Environment(application, null)
XRNewsManager.getInstance().init(application, APP_ID, UserManager.getInstance().userID,WX_APP_ID)
} }
} }
...@@ -7,6 +7,7 @@ import com.fly.scenemodule.model.GDTInfo ...@@ -7,6 +7,7 @@ import com.fly.scenemodule.model.GDTInfo
import com.fly.scenemodule.model.TTInfo import com.fly.scenemodule.model.TTInfo
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.utils.LogUtil
/** /**
* 描述:聚乐云SDK * 描述:聚乐云SDK
...@@ -46,6 +47,7 @@ object SceneManager { ...@@ -46,6 +47,7 @@ object SceneManager {
*/ */
fun signIn(activity: Activity) { fun signIn(activity: Activity) {
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) { if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
LogUtil.d("SceneManager","signIn 账号同步")
SceneUtil.syncAccount(activity, SCENE_CHANNEL_Id, UserManager.getInstance().userID, MintsApplication.OAID) SceneUtil.syncAccount(activity, SCENE_CHANNEL_Id, UserManager.getInstance().userID, MintsApplication.OAID)
AppConfig.scene_flag = true AppConfig.scene_flag = true
} }
......
...@@ -125,4 +125,10 @@ public class TrackManager { ...@@ -125,4 +125,10 @@ public class TrackManager {
trackPresenter.reportAddCoinMsg(activity, vo); trackPresenter.reportAddCoinMsg(activity, vo);
} }
} }
public void reportErrornterface(String url, String request) {
if (trackPresenter != null ) {
trackPresenter.reportErrornterface(url, request);
}
}
} }
...@@ -37,8 +37,7 @@ public class TtCsjAdManager { ...@@ -37,8 +37,7 @@ public class TtCsjAdManager {
public static String TT_AD_VEDIO_OFFINELINE = "945562040";// 离线弹框 public static String TT_AD_VEDIO_OFFINELINE = "945562040";// 离线弹框
public static String TT_AD_VEDIO_GAME = "945562067";// 猎豹 public static String TT_AD_VEDIO_GAME = "945562067";// 猎豹
// public static String TT_AD_VEDIO_JULEYUN = "945675529";// 聚乐云 public static String TT_AD_VEDIO_JULEYUN = "945675529";// 聚乐云
public static String TT_AD_VEDIO_JULEYUN = "945562040";// 聚乐云
public static String TT_AD_VEDIO_BIANXIANMAO = "945743459";// 变现猫 public static String TT_AD_VEDIO_BIANXIANMAO = "945743459";// 变现猫
public static String TT_AD_VEDIO_BLESSINGBAG = "945730117";// 福袋 public static String TT_AD_VEDIO_BLESSINGBAG = "945730117";// 福袋
public static String TT_AD_VEDIO_HOMEVEDIO = "945744137";// 首页视频翻倍 public static String TT_AD_VEDIO_HOMEVEDIO = "945744137";// 首页视频翻倍
...@@ -136,39 +135,6 @@ public class TtCsjAdManager { ...@@ -136,39 +135,6 @@ public class TtCsjAdManager {
TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getCsjv3(); TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getCsjv3();
// banner // banner
TT_AD_BANNER_MY = idBean.getCsjv4(); TT_AD_BANNER_MY = idBean.getCsjv4();
// return;
}
// 对象为空,加载本地头条包
// loadLocalChannel();
}
/**
* 加载本地头条包
*/
private static void loadLocalChannel() {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
if (channel.contains(ChannelManager.CHANNEL_TOUTIAO)) {
// 信息流
TT_AD_NATIVEEXPRESS_AWARD = "945666217";
TT_AD_NATIVEEXPRESS_WALK = "945666097";
TT_AD_NATIVEEXPRESS_WATER = "945666097";
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = "945666097";
TT_AD_NATIVEEXPRESS_EAT = "945666097";
// 激励视频
TT_AD_VEDIO_DRINK = "945562040";
TT_AD_VEDIO_MAIN = "945562040";
TT_AD_VEDIO_ERASE = "945562040";
TT_AD_VEDIO_TURNABLE = "945562040";
TT_AD_VEDIO_MOREDIALOG = "945562040";
TT_AD_VEDIO_OFFINELINE = "945562040";
TT_AD_VEDIO_SIGN = "945562040";
TT_AD_VEDIO_BLESSINGBAG = "945562040";
TT_AD_VEDIO_HOMEVEDIO = "945562040";
TT_AD_VEDIO_SMALLHOMEVEDIO = "945562040";
// banner
TT_AD_BANNER_MY = "945666042";
} }
} }
} }
...@@ -31,8 +31,7 @@ object YlhAdManager { ...@@ -31,8 +31,7 @@ object YlhAdManager {
var YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626" //离线弹框 var YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626" //离线弹框
var YLH_AD_VEDIO_GAME_POSTID = "9051646750686770" //猎豹游戏 var YLH_AD_VEDIO_GAME_POSTID = "9051646750686770" //猎豹游戏
// var YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云 var YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云
var YLH_AD_VEDIO_JULEYUN_POSTID = "9001346780383626" //聚乐云
var YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388" //福袋 var YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388" //福袋
var YLH_AD_VEDIO_HOMEVEDIO_POSTID= "4051451341464487" // 首页视频翻倍 var YLH_AD_VEDIO_HOMEVEDIO_POSTID= "4051451341464487" // 首页视频翻倍
var YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID= "9051152341362610" // 短视频翻倍 var YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID= "9051152341362610" // 短视频翻倍
...@@ -73,35 +72,6 @@ object YlhAdManager { ...@@ -73,35 +72,6 @@ object YlhAdManager {
YLH_AD_VEDIO_OFFINELINE_POSTID = idBean.ylhv2 YLH_AD_VEDIO_OFFINELINE_POSTID = idBean.ylhv2
YLH_AD_VEDIO_HOMEVEDIO_POSTID = idBean.ylhv2 YLH_AD_VEDIO_HOMEVEDIO_POSTID = idBean.ylhv2
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = idBean.ylhv2 YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = idBean.ylhv2
// return
}
// 对象为空,加载本地头条包
// loadLocalChannel()
}
/**
* 加载本地头条包
*/
private fun loadLocalChannel() {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (channel.contains(ChannelManager.CHANNEL_TOUTIAO)) {
// 头条
// 开屏
YLH_AD_SPLASH_POSTID = "4031840694338658"
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID = "9001346780383626"
YLH_AD_VEDIO_MAIN_POSTID = "9001346780383626"
YLH_AD_VEDIO_ERASE_POSTID = "9001346780383626"
YLH_AD_VEDIO_TURNABLE_POSTID = "9001346780383626"
YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626"
YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626"
YLH_AD_VEDIO_BLESSINGBAG_POSTID = "9001346780383626"
YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626"
YLH_AD_VEDIO_HOMEVEDIO_POSTID = "9001346780383626"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = "9001346780383626"
} }
} }
} }
\ No newline at end of file
...@@ -278,4 +278,26 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -278,4 +278,26 @@ public class TrackPresenter extends BaseTrackPresenter {
}); });
} }
public void reportErrornterface(String url, String request) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("url", url);
vo.put("request", request);
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportErrornterface(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
}
});
}
} }
...@@ -569,6 +569,14 @@ public interface LoanService { ...@@ -569,6 +569,14 @@ public interface LoanService {
@POST("api/getCpdUseAppModelMsg") @POST("api/getCpdUseAppModelMsg")
Observable<BaseResponse<TaskCpdBean>> getCpdUseAppModelMsg(); Observable<BaseResponse<TaskCpdBean>> getCpdUseAppModelMsg();
/**
* 临时使用-接口加密异常时调用
*
* @return
*/
@POST("common/reportErrornterface")
Observable<BaseResponse<JsonObject>> reportErrornterface(@Body Map<String, Object> vo);
/** /**
* 默认http工厂 * 默认http工厂
*/ */
......
...@@ -6,14 +6,19 @@ import com.bytedance.hume.readapk.HumeSDK; ...@@ -6,14 +6,19 @@ import com.bytedance.hume.readapk.HumeSDK;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.mints.goodmoney.BuildConfig; import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication; import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.model.AppRequest; import com.mints.goodmoney.mvp.model.AppRequest;
import com.mints.goodmoney.utils.AESUtils; import com.mints.goodmoney.utils.AESUtils;
import com.mints.goodmoney.utils.Base64; import com.mints.goodmoney.utils.Base64;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.MD5; import com.mints.goodmoney.utils.MD5;
import com.mints.library.utils.CommonUtils; import com.mints.library.utils.CommonUtils;
import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import okhttp3.Interceptor; import okhttp3.Interceptor;
...@@ -22,6 +27,9 @@ import okhttp3.MultipartBody; ...@@ -22,6 +27,9 @@ import okhttp3.MultipartBody;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
/** /**
* 用拦截器对传输数据加密 * 用拦截器对传输数据加密
...@@ -41,9 +49,26 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -41,9 +49,26 @@ public class OkHttpInterceptor implements Interceptor {
@Override @Override
public Response intercept(Chain chain) throws IOException { public Response intercept(Chain chain) throws IOException {
String tokenID = UserManager.getInstance().getTokenID(); String tokenID = UserManager.getInstance().getTokenID();
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String channel = createChannel();
Request request = chain.request();
// 加密
request = encrypt(request, tokenID, time, channel);
// header
Request builder = addHeader(request, tokenID, time, channel);
// 解密
Response response = chain.proceed(builder);
response = decrypt(response);
return response;
}
/**
* 创建渠道
*
* @return
*/
private String createChannel() {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"); String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
try { try {
// 穿山甲分包渠道 // 穿山甲分包渠道
...@@ -55,31 +80,39 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -55,31 +80,39 @@ public class OkHttpInterceptor implements Interceptor {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return channel;
}
Request request = chain.request(); /**
request = encrypt(request, tokenID, time, channel);//加密方法 * 添加header
Request builder = request.newBuilder(). *
* @param request
* @param tokenID
* @param time
* @param channel
* @return
*/
private Request addHeader(Request request, String tokenID, long time, String channel) throws UnsupportedEncodingException {
return request.newBuilder().
addHeader("version", BuildConfig.VERSION_NAME). addHeader("version", BuildConfig.VERSION_NAME).
addHeader("token", tokenID). addHeader("token", tokenID).
addHeader("channel", channel). addHeader("channel", channel).
addHeader("new-session", MD5.GetMD5Code(String.valueOf(time))). addHeader("new-session", MD5.GetMD5Code(String.valueOf(time))).
addHeader("last-session", Base64.encode(String.valueOf(time).getBytes("UTF-8"))). addHeader("last-session", Base64.encode(String.valueOf(time).getBytes("UTF-8"))).
build(); build();
return chain.proceed(builder);
} }
// json加密 /**
* json加密
*
* @param request
* @param tokenID
* @param time
* @param channel
* @return
* @throws IOException
*/
private Request encrypt(Request request, String tokenID, long time, String channel) throws IOException { private Request encrypt(Request request, String tokenID, long time, String channel) throws IOException {
//这个是请求的url,也就是咱们前面配置的baseUrl
String url = request.url().toString();
//是否加密标识
boolean isSign = true;
if (!TextUtils.isEmpty(url)) {
isSign = !url.contains("common/");
}
//获取请求body,只有@Body 参数的requestBody 才不会为 null //获取请求body,只有@Body 参数的requestBody 才不会为 null
RequestBody requestBody = request.body(); RequestBody requestBody = request.body();
if (requestBody != null) { if (requestBody != null) {
...@@ -96,7 +129,7 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -96,7 +129,7 @@ public class OkHttpInterceptor implements Interceptor {
String checkStr = valueStr; String checkStr = valueStr;
//加密 //加密
if (isSign && !TextUtils.isEmpty(valueStr)) { if (isSign(request) && !TextUtils.isEmpty(valueStr)) {
valueStr = AESUtils.encrypt(valueStr, aesKey); valueStr = AESUtils.encrypt(valueStr, aesKey);
} }
...@@ -123,74 +156,61 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -123,74 +156,61 @@ public class OkHttpInterceptor implements Interceptor {
return request; return request;
} }
// json解密
// private Response decrypt(Response response) throws IOException {
// if (response.isSuccessful()) {
// //the response data
// ResponseBody body = response.body();
// BufferedSource source = body.source();
// source.request(Long.MAX_VALUE); // Buffer the entire body.
// Buffer buffer = source.buffer();
// Charset charset = Charset.defaultCharset();
// MediaType contentType = body.contentType();
// if (contentType != null) {
// charset = contentType.charset(charset);
// }
// String string = buffer.clone().readString(charset);
// //解密方法,需要自己去实现
// String bodyString = AESUtils.decrypt(string, aesKey);
// ResponseBody responseBody = ResponseBody.create(contentType, bodyString);
// response = response.newBuilder().body(responseBody).build();
// }
// return response;
// }
// 表单加密
// @Override
// public Response intercept(Chain chain) throws IOException {
// Request request = chain.request();
//
// Request.Builder requestBuilder = request.newBuilder();
// RequestBody requestBody = request.body();
// URL url = request.url().url();
// String urlString = url.toString();
//
// //是否加密标识
// boolean isSign = true;
// if (!TextUtils.isEmpty(urlString)) {
// isSign = !urlString.contains("common/");
// }
//
//// UserManage instance = UserManage.getInstance();
//// String mobile = instance.getMobile();
//// if (!TextUtils.isEmpty(mobile) && isSign) {
//// mobile =AESUtils;
//// }
//
// if (requestBody instanceof FormBody) {
// FormBody.Builder newFormBody = new FormBody.Builder();
// FormBody oldFormBody = (FormBody) requestBody;
//
// for (int i = 0; i < oldFormBody.size(); i++) {
// String name_e = oldFormBody.encodedName(i);
// String value = oldFormBody.value(i);
// String value_e = "";
// if (!TextUtils.isEmpty(value) && isSign) {
// value_e = AESUtils.encrypt(value, aesKey);
// } else {
// value_e = oldFormBody.value(i);
// }
// newFormBody.add(name_e, value_e);
// }
// requestBuilder.method(request.method(), newFormBody.build());
// }
//
// Request newRequest = requestBuilder
// .addHeader("mobile", "18311400069")
// .build();
// Response originalResponse = chain.proceed(newRequest);
//
// return originalResponse;
// }
/**
* json解密
*
* @param response
* @return
* @throws IOException
*/
private Response decrypt(Response response) throws IOException {
if (response.isSuccessful() && isSign(response.request())) {
//the response data
ResponseBody body = response.body();
BufferedSource source = body.source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.buffer();
Charset charset = Charset.defaultCharset();
MediaType contentType = body.contentType();
if (contentType != null) {
charset = contentType.charset(charset);
}
String rspString = buffer.clone().readString(charset);
// 解密
try {
JSONObject json = new JSONObject(rspString);
if (!json.isNull("data")) {
Object data = json.get("data");
rspString = AESUtils.detrypt(data.toString(), aesKey);
JSONObject jsonArray = new JSONObject(rspString);
json.put("data", jsonArray);
rspString = json.toString().replace("\\", "");
}
} catch (Exception e) {
LogUtil.d("OkHttpInterceptor", "json解密失败。url:" + response.request().url().toString() + "\n\n 响应报文:" + buffer.clone().readString(charset));
TrackManager.getInstance().reportErrornterface(response.request().url().toString(), buffer.clone().readString(charset));
e.printStackTrace();
}
ResponseBody responseBody = ResponseBody.create(contentType, rspString);
response = response.newBuilder().body(responseBody).build();
}
return response;
}
/**
* 是否加/解密 - 接口非common都加/解密
*
* @param request
* @return true=加/解密
*/
private boolean isSign(Request request) {
String url = request.url().toString();
//是否加密标识
boolean isSign = true;
if (!TextUtils.isEmpty(url)) {
isSign = !url.contains("common/");
}
return isSign;
}
} }
...@@ -147,7 +147,6 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV ...@@ -147,7 +147,6 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
showToast("账号合并成功!") showToast("账号合并成功!")
SceneManager.signIn(this) SceneManager.signIn(this)
RsNewsManager.init(baseApplication)
BxmManager.bindUserData() BxmManager.bindUserData()
......
...@@ -320,12 +320,7 @@ class DrawcashActivity : BaseActivity(), ...@@ -320,12 +320,7 @@ class DrawcashActivity : BaseActivity(),
// 广告视频数 // 广告视频数
AppConfig.csjVideoAdCount = 10 AppConfig.csjVideoAdCount = 10
AppConfig.ylhAdCount = 10 AppConfig.ylhAdCount = 10
AppConfig.wnVideoAdCount = 10
AppConfig.flVideoAdCount = 10
AppConfig.shVideoAdCount = 10
AppConfig.csjFullVideoAdCount = 10 AppConfig.csjFullVideoAdCount = 10
AppConfig.ksVideoAdCount = 10
AppConfig.rtaVideoAdCount = 10
} }
/** /**
......
...@@ -101,7 +101,6 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener { ...@@ -101,7 +101,6 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
TrackManager.getInstance().innerApp() TrackManager.getInstance().innerApp()
SceneManager.signIn(this) SceneManager.signIn(this)
RsNewsManager.init(baseApplication)
BxmManager.bindUserData() BxmManager.bindUserData()
// false-登录 true-绑定手机号 // false-登录 true-绑定手机号
......
package com.mints.goodmoney.ui.activitys
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_moku_guide.*
/**
* 描述:蘑菇引导页
* 作者:孟崔广
* 时间:2021/3/12 17:16
*/
class MokuGuideActivity : BaseActivity(), View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_moku_guide
override fun isApplyKitKatTranslucency() = false
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.BOTTOM
override fun finish() {
super.finish()
//关闭窗体动画显示
overridePendingTransition(0, R.anim.bottom_out)
}
override fun initViewsAndEvents() {
initListener()
}
override fun onClick(v: View?) {
finish()
}
private fun initListener() {
ivMokuGuide.setOnClickListener(this)
}
}
...@@ -49,6 +49,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener { ...@@ -49,6 +49,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
var currentFragment: Fragment? var currentFragment: Fragment?
when (wrapperType) { when (wrapperType) {
Constant.WRAPPER_TYPE_NEWS -> { Constant.WRAPPER_TYPE_NEWS -> {
layoutWrapper.visibility = View.GONE
tv_title.text = "新闻" tv_title.text = "新闻"
currentFragment = RsNewsFragment() currentFragment = RsNewsFragment()
} }
......
...@@ -124,7 +124,6 @@ class WxLoginActivity : BaseActivity() ...@@ -124,7 +124,6 @@ class WxLoginActivity : BaseActivity()
TrackManager.getInstance().innerApp() TrackManager.getInstance().innerApp()
SceneManager.signIn(this) SceneManager.signIn(this)
RsNewsManager.init(baseApplication)
BxmManager.bindUserData() BxmManager.bindUserData()
AppConfig.scene_idiom_flag = true AppConfig.scene_idiom_flag = true
......
...@@ -387,6 +387,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -387,6 +387,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
private fun destoryTimerRedbox() { private fun destoryTimerRedbox() {
mRedBoxTimer?.stop() mRedBoxTimer?.stop()
mRedBoxTimer?.setOnCountDownTimerListener(null)
mRedBoxTimer = null mRedBoxTimer = null
} }
} }
\ No newline at end of file
...@@ -670,6 +670,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -670,6 +670,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onFinish() { override fun onFinish() {
if (isAdded && !requireActivity().isFinishing) { if (isAdded && !requireActivity().isFinishing) {
LogUtil.d(TAG,"onFinish")
tv_fragment_main_redbox.text = "可拆开" tv_fragment_main_redbox.text = "可拆开"
rl_fragment_main_redbox.isClickable = true rl_fragment_main_redbox.isClickable = true
showRedbox(rl_fragment_main_redbox) showRedbox(rl_fragment_main_redbox)
...@@ -686,6 +687,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -686,6 +687,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private fun destroyTimerRedbox() { private fun destroyTimerRedbox() {
mRedBoxTimer?.stop() mRedBoxTimer?.stop()
mRedBoxTimer?.setOnCountDownTimerListener(null)
mRedBoxTimer = null mRedBoxTimer = null
} }
} }
\ No newline at end of file
...@@ -299,7 +299,6 @@ class MyFragment : BaseFragment(), ...@@ -299,7 +299,6 @@ class MyFragment : BaseFragment(),
override fun userLoginSuc() { override fun userLoginSuc() {
SceneManager.signIn(requireActivity()) SceneManager.signIn(requireActivity())
RsNewsManager.init(baseApplication)
myPresenter.getAutoUserHallBaseMsg() myPresenter.getAutoUserHallBaseMsg()
myPresenter.getHallBaseMsg() myPresenter.getHallBaseMsg()
...@@ -1457,6 +1456,11 @@ class MyFragment : BaseFragment(), ...@@ -1457,6 +1456,11 @@ class MyFragment : BaseFragment(),
.subscribe { granted: Boolean -> .subscribe { granted: Boolean ->
if (granted) { if (granted) {
MokuManager.gotoMoku(requireContext()) MokuManager.gotoMoku(requireContext())
if (ps.getBoolean(Constant.MOKU_FLAG_GUIDE, true)) {
readyGo(MokuGuideActivity::class.java)
ps.put(Constant.MOKU_FLAG_GUIDE, false)
}
} else { } else {
showMissingPermissionDialog("设备,存储") showMissingPermissionDialog("设备,存储")
} }
......
...@@ -3,10 +3,12 @@ package com.mints.goodmoney.ui.fragment ...@@ -3,10 +3,12 @@ package com.mints.goodmoney.ui.fragment
import android.os.Bundle import android.os.Bundle
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.presenters.RsNewsPresenter import com.mints.goodmoney.mvp.presenters.RsNewsPresenter
import com.mints.goodmoney.mvp.views.RsNewsView import com.mints.goodmoney.mvp.views.RsNewsView
import com.mints.goodmoney.ui.activitys.AwardActivity import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.LogUtil
import com.xr.xrsdk.FinishReadNewsCallBack import com.xr.xrsdk.FinishReadNewsCallBack
import com.xr.xrsdk.XRNewsManager import com.xr.xrsdk.XRNewsManager
...@@ -25,7 +27,7 @@ class RsNewsFragment : LazyLoadBaseFragment(), RsNewsView, FinishReadNewsCallBac ...@@ -25,7 +27,7 @@ class RsNewsFragment : LazyLoadBaseFragment(), RsNewsView, FinishReadNewsCallBac
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
rsNewsPresenter.attachView(this) rsNewsPresenter.attachView(this)
XRNewsManager.getInstance().addNewsFragment(supportFragmentManager, R.id.flMainRsNews, Constant.FRAGMENT_TAG_RSNEWS, this) XRNewsManager.getInstance().addNewsFragment(supportFragmentManager, R.id.flMainRsNews, Constant.FRAGMENT_TAG_RSNEWS, UserManager.getInstance().userID, this)
} }
override fun onDestroy() { override fun onDestroy() {
...@@ -45,6 +47,7 @@ class RsNewsFragment : LazyLoadBaseFragment(), RsNewsView, FinishReadNewsCallBac ...@@ -45,6 +47,7 @@ class RsNewsFragment : LazyLoadBaseFragment(), RsNewsView, FinishReadNewsCallBac
} }
override fun finishRead(id: String, seconds: Int) { override fun finishRead(id: String, seconds: Int) {
LogUtil.d("RsNewsFragment","id:${id}")
rsNewsPresenter.addNewsSeconds(seconds) rsNewsPresenter.addNewsSeconds(seconds)
} }
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/ivMokuGuide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/bg_moku_guide"></ImageView>
</RelativeLayout>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
android:gravity="center" android:gravity="center"
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text="可拆开" android:text="--:--"
android:textColor="@color/color_F28335" android:textColor="@color/color_F28335"
android:textSize="8sp" /> android:textSize="8sp" />
</FrameLayout> </FrameLayout>
\ No newline at end of file
include ':demo'
include ':app' include ':app'
include ':shareSdkLib' include ':shareSdkLib'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment