Commit 6285bd80 authored by fengruiyu's avatar fengruiyu

Merge branch 'branche_zsf' of http://39.97.65.143:81/android/android_street into branche_zsf

 Conflicts:
	shareSdkLib/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml
	shareSdkLib/build/intermediates/incremental/mergeDebugShaders/merger.xml
	shareSdkLib/build/intermediates/incremental/packageDebugAssets/merger.xml
	shareSdkLib/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
	shareSdkLib/build/intermediates/incremental/packageDebugResources/merger.xml
	shareSdkLib/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt
	shareSdkLib/build/outputs/logs/manifest-merger-debug-report.txt
parents 8ee8adb3 3cb0a246
......@@ -135,7 +135,6 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation rootProject.ext.support["junit"]
//下拉刷新
......@@ -174,5 +173,9 @@ dependencies {
implementation(name: 'open_ad_sdk_3.7.0.1', ext: 'aar')
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNormal.4.362.1232', ext: 'aar')
//RxPay
implementation 'com.cuieney:rxpay-api:2.2.3'
kapt 'com.cuieney:rxpay-compiler:2.1.1'
implementation 'com.romandanylyk:pageindicatorview:1.0.3'
}
\ No newline at end of file
......@@ -2,25 +2,18 @@ package com.mints.street;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.mints.goodnews", appContext.getPackageName());
}
}
\ No newline at end of file
//@RunWith(AndroidJUnit4.class)
//public class ExampleInstrumentedTest {
// @Test
// public void useAppContext() {
// // Context of the app under test.
// Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
// assertEquals("com.mints.goodnews", appContext.getPackageName());
// }
//}
\ No newline at end of file
......@@ -5,15 +5,27 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:name="com.mints.street.AppApplication"
......@@ -135,6 +147,30 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape"
tools:replace="android:screenOrientation" />
<!-- WX_APPID必填项 -->
<meta-data
android:name="WX_APPID"
android:value="wx8f26539eabfb04f2" />
<activity
android:name=".wxapi.WXPayEntryActivity"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<!-- 支付宝 -->
<activity
android:name="com.alipay.sdk.app.H5PayActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="com.alipay.sdk.app.H5AuthActivity"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
</application>
</manifest>
\ No newline at end of file
......@@ -4,6 +4,7 @@ import android.content.Context
import android.os.StrictMode
import android.os.StrictMode.VmPolicy
import android.util.Log
import com.cuieney.rxpay_annotation.WX
import com.fry.base.base.BaseApp
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UmengManager
......@@ -12,6 +13,7 @@ import java.util.concurrent.TimeoutException
/**
* Created by 冯瑞雨 on 2021/7/1.
*/
@WX(packageName = "com.mints.street")
class AppApplication : BaseApp() {
override fun onCreate() {
......@@ -39,6 +41,7 @@ class AppApplication : BaseApp() {
* 三方配置
*/
private fun thirdConfig() {
// 友盟预初始化
UmengManager.preInit()
// GroMore
......
......@@ -26,11 +26,6 @@ public class TTGroMoreAdManagerHolder {
doInit(context);
}
public static void initUnitySdkBanner(Activity activity) {
TTMediationAdSdk.initUnityForBanner(activity);
}
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private static void doInit(Context context) {
if (!sInit) {
......
package com.mints.street.api
import com.fry.base.netwrok.HttpManager
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import com.mints.street.netwrok.HttpManager
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
import retrofit2.Response
......
package com.mints.street.main
import android.media.AudioManager
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
......@@ -16,7 +18,9 @@ import com.mints.street.databinding.ActivityMainBinding
import com.mints.street.main.vr.VRFragment
import com.mints.street.main.my.MyFragment
import com.mints.street.main.home.HomeFragment
import com.mints.street.manager.UmengManager
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.ToastUtils
class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
......@@ -52,8 +56,26 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
)
// test
UmengManager.initUm()
}
var oldTime: Long = 0
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
// 设置为后台
val currentTime = System.currentTimeMillis()
if (currentTime - oldTime < 2 * 1000) {
AppManager.getAppManager().finishAllActivity()
} else {
ToastUtils.showLong("再次点击退出" + getString(R.string.app_name))
oldTime = currentTime
}
}
}
return true
}
}
......
package com.mints.street.manager
import android.text.TextUtils
import com.mints.street.bean.UserBean
import me.goldze.mvvmhabit.utils.SPUtils
import com.tencent.mmkv.MMKV
/**
* Created by 冯瑞雨 on 2021/7/6.
* 描述:管理用户信息
* 作者:孟崔广
* 时间:2021/7/9 14:48
*/
object UserManager {
private val spUtils = SPUtils.getInstance("user")
private const val USER_INFO = "user_info"
private var user :UserBean?=null
class UserManager {
companion object {
/**
* 游客 or 登录用户
*/
private const val IS_TEMP_USER = "is_temp_user"
/**
* 用户ID
*/
private const val USER_ID = "userId"
/**
* 用户CODE_ID
*/
private const val CODE_ID = "codeId"
/**
* 登陆状态ID
*/
private const val TOKEN_ID = "tokenId"
/**
* 手机号
*/
private const val MOBILE = "mobile"
/**
* 姓名
*/
private const val REAL_NAME = "realName"
/**
* 支付宝
*/
private const val ALIPAY_ACCOUNT = "alipay_account"
/**
* 用户金币
*/
private const val USER_GOLD = "user_gold"
/**
* 用户总金币
*/
private const val USER_SUM_GOLD = "user_sum_gold"
/**
* 用户零钱
*/
private const val USER_CASH = "user_cash"
/**
* 是否老用户 true-老用户
*/
private const val USER_OLD = "user_old"
/**
* 猎豹游戏info
*/
private const val GAME_INFO = "game_info"
/**
* 广告隐藏标识
*/
private const val AD_SHOW_FLAG = "ad_show_flag"
/**
* 微信名称
*/
private const val WX_NAME = "wx_name"
/**
* 微信头像
*/
private const val WX_HEADER = "wx_header"
/**
* 微信id
*/
private const val WX_OPENID = "wx_openid"
val INSTANCE: UserManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
UserManager()
}
}
init {
}
/**
* 保存用户信息
*
* @param userInfo
*/
fun saveUserInfo(userInfo: UserBean) {
val user = userInfo.consumer
val token = userInfo.token
if (token != null) {
MMKV.mmkvWithID(TOKEN_ID).encode(TOKEN_ID, token)
}
if (user != null) {
val mobile: String? = user.mobile
val openid: String? = user.openid
if (mobile == null && openid == null) {
MMKV.mmkvWithID(IS_TEMP_USER).remove(IS_TEMP_USER)
} else {
MMKV.mmkvWithID(IS_TEMP_USER).encode(IS_TEMP_USER, mobile + openid)
}
MMKV.mmkvWithID(USER_ID).encode(USER_ID, user.pk_id.toString())
MMKV.mmkvWithID(CODE_ID).encode(CODE_ID, user.idcode.toString())
MMKV.mmkvWithID(MOBILE).encode(MOBILE, mobile)
MMKV.mmkvWithID(ALIPAY_ACCOUNT)
.encode(ALIPAY_ACCOUNT, user.alipay_account.toString())
MMKV.mmkvWithID(USER_GOLD).encode(USER_GOLD, user.coin.toString())
MMKV.mmkvWithID(USER_CASH)
.encode(USER_CASH, String.format("%.2f", user.surplus))
MMKV.mmkvWithID(USER_SUM_GOLD).encode(USER_SUM_GOLD, user.sumCoin.toString())
MMKV.mmkvWithID(USER_OLD).encode(USER_OLD, !user.isFirstSignInApp)
MMKV.mmkvWithID(WX_NAME).encode(WX_NAME, user.nickname.toString())
MMKV.mmkvWithID(WX_HEADER).encode(WX_HEADER, user.head)
MMKV.mmkvWithID(WX_OPENID).encode(WX_OPENID, openid)
MMKV.mmkvWithID(GAME_INFO).encode(GAME_INFO, user.gameInfo)
MMKV.mmkvWithID(REAL_NAME).encode(REAL_NAME, user.real_name)
}
}
/**
* 单独获取用户id
*/
fun getMobile(): String {
val kv = MMKV.mmkvWithID(MOBILE)
return kv.decodeString(MOBILE, "")
}
/**
* 判断用户是否已登录
*
* @return true为已登录 false 为未登录
*/
fun userIsLogin(): Boolean {
val kv = MMKV.mmkvWithID(IS_TEMP_USER).decodeString(IS_TEMP_USER, "")
return !TextUtils.isEmpty(kv)
}
/**
* 单独获取用户id
*/
fun getUserID(): String {
val kv = MMKV.mmkvWithID(USER_ID)
return kv.decodeString(USER_ID, "")
}
/**
* 获取用户登陆状态
*/
fun getTokenID(): String {
val kv = MMKV.mmkvWithID(TOKEN_ID)
return kv.decodeString(TOKEN_ID, "")
}
/**
* 获取用户邀请码
*/
fun getCodeID(): String {
val kv = MMKV.mmkvWithID(CODE_ID)
return kv.decodeString(CODE_ID, "")
}
/**
* 获取真实姓名
*/
fun getRealName(): String {
val kv = MMKV.mmkvWithID(REAL_NAME)
return kv.decodeString(REAL_NAME, "")
}
/**
* 设置真实姓名
*
* @param name
*/
fun setRealName(name: String?) {
val kv = MMKV.mmkvWithID(REAL_NAME)
kv.encode(REAL_NAME, name)
}
/**
* 是否老用户 true-老用户
*/
fun getUserOld(): Boolean {
val kv = MMKV.mmkvWithID(USER_OLD)
return kv.decodeBool(USER_OLD, false)
}
fun getAdShowFlag(): Boolean {
val kv = MMKV.mmkvWithID(AD_SHOW_FLAG)
return kv.decodeBool(AD_SHOW_FLAG, false)
}
/**
* 设置真实姓名
*
* @param userOld
*/
fun setUserOld(userOld: Boolean) {
val kv = MMKV.mmkvWithID(USER_OLD)
kv.encode(USER_OLD, userOld)
}
/**
* 获取支付宝账户
*/
fun getAlipayAccount(): String {
val kv = MMKV.mmkvWithID(ALIPAY_ACCOUNT)
return kv.decodeString(ALIPAY_ACCOUNT, "")
}
/**
* 设置支付宝账户
*
* @param alipay
*/
fun setAlipayAccount(alipay: String?) {
val kv = MMKV.mmkvWithID(ALIPAY_ACCOUNT)
kv.encode(ALIPAY_ACCOUNT, alipay)
}
fun getUserSumGold(): String {
val kv = MMKV.mmkvWithID(USER_SUM_GOLD)
return kv.decodeString(USER_SUM_GOLD, "")
}
/**
* 获取用户金币/积分
*/
fun getUserGold(): String {
val kv = MMKV.mmkvWithID(USER_GOLD)
return kv.decodeString(USER_GOLD, "")
}
/**
* 设置用户金币/积分
*
* @param gold
*/
fun setUserGold(gold: String?) {
val kv = MMKV.mmkvWithID(USER_GOLD)
kv.encode(USER_GOLD, gold)
}
/**
* 获取用户零钱
*/
fun getUserCash(): String {
val kv = MMKV.mmkvWithID(USER_CASH)
return kv.decodeString(USER_CASH, "")
}
fun getGameInfo(): String {
val kv = MMKV.mmkvWithID(GAME_INFO)
return kv.decodeString(GAME_INFO, "")
}
fun getWxName(): String {
val kv = MMKV.mmkvWithID(WX_NAME)
return kv.decodeString(WX_NAME, "")
}
fun getWxHeader(): String {
val kv = MMKV.mmkvWithID(WX_HEADER)
return kv.decodeString(WX_HEADER, "")
}
fun getWxOpenid(): String {
val kv = MMKV.mmkvWithID(WX_OPENID)
return kv.decodeString(WX_OPENID, "")
}
/**
* 设置用户零钱
*
* @param cash
*/
fun setUserCash(cash: String?) {
val kv = MMKV.mmkvWithID(USER_CASH)
kv.encode(WX_OPENID, cash)
}
fun setGameInfo(gameInfo: String?) {
val kv = MMKV.mmkvWithID(GAME_INFO)
kv.encode(GAME_INFO, gameInfo)
}
fun setWxName(wxName: String?) {
val kv = MMKV.mmkvWithID(WX_NAME)
kv.encode(WX_NAME, wxName)
}
fun setWxHeader(wxHeader: String?) {
val kv = MMKV.mmkvWithID(WX_HEADER)
kv.encode(WX_HEADER, wxHeader)
}
/**
* mobile
*
* @param mobile
*/
fun setMobile(mobile: String?) {
val kv = MMKV.mmkvWithID(MOBILE)
kv.encode(MOBILE, mobile)
}
fun setAdShowFlag(adShowFlag: Boolean) {
val kv = MMKV.mmkvWithID(AD_SHOW_FLAG)
kv.encode(AD_SHOW_FLAG, adShowFlag)
}
fun userLogout() {
MMKV.mmkvWithID(USER_ID).remove(USER_ID)
MMKV.mmkvWithID(CODE_ID).remove(CODE_ID)
MMKV.mmkvWithID(TOKEN_ID).remove(TOKEN_ID)
MMKV.mmkvWithID(REAL_NAME).remove(REAL_NAME)
MMKV.mmkvWithID(IS_TEMP_USER).remove(IS_TEMP_USER)
MMKV.mmkvWithID(ALIPAY_ACCOUNT).remove(ALIPAY_ACCOUNT)
MMKV.mmkvWithID(USER_GOLD).remove(USER_GOLD)
MMKV.mmkvWithID(USER_CASH).remove(USER_CASH)
MMKV.mmkvWithID(USER_OLD).remove(USER_OLD)
MMKV.mmkvWithID(WX_OPENID).remove(WX_OPENID)
MMKV.mmkvWithID(WX_NAME).remove(WX_NAME)
MMKV.mmkvWithID(WX_HEADER).remove(WX_HEADER)
// MMKV.mmkvWithID(GAME_INFO).remove(GAME_INFO)
}
}
\ No newline at end of file
package com.mints.street.model
import com.fry.base.netwrok.HttpManager
import com.mints.street.api.MainApi
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import com.mints.street.netwrok.HttpManager
import com.trello.rxlifecycle2.LifecycleProvider
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
......
package com.fry.base.netwrok;
package com.mints.street.netwrok;
import android.os.Process;
import com.fry.base.R;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.functions.Function;
import me.goldze.mvvmhabit.base.AppManager;
import me.goldze.mvvmhabit.http.BaseResponse;
import me.goldze.mvvmhabit.utils.ToastUtils;
import me.goldze.mvvmhabit.utils.Utils;
import retrofit2.Response;
/**
......
package com.fry.base.netwrok;
package com.mints.street.netwrok;
import android.annotation.SuppressLint;
......@@ -6,7 +6,8 @@ import com.fry.base.basenetwork.HttpConfiguation;
import com.fry.base.basenetwork.IHttpResponseListener;
import com.fry.base.basenetwork.RetrofitClient;
import com.fry.base.global.Constants;
import com.fry.base.utils.encry.AESUtils;
import com.fry.base.netwrok.OkHttpInterceptor;
import com.mints.street.utils.encry.AESUtils;
import com.trello.rxlifecycle2.LifecycleProvider;
import io.reactivex.Observable;
......
......@@ -2,12 +2,16 @@ package com.fry.base.netwrok
import android.text.TextUtils
import android.util.Log
import com.fry.base.BuildConfig
import com.bytedance.hume.readapk.HumeSDK
import com.fry.base.bean.AppRequest
import com.fry.base.utils.encry.AESUtils
import com.fry.base.utils.encry.Base64
import com.fry.base.utils.encry.MD5
import com.google.gson.Gson
import com.mints.street.AppApplication
import com.mints.street.BuildConfig
import com.mints.street.manager.UserManager
import com.mints.street.utils.CommonUtils
import com.mints.street.utils.encry.AESUtils
import com.mints.street.utils.encry.Base64
import com.mints.street.utils.encry.MD5
import okhttp3.*
import okio.Buffer
import org.json.JSONObject
......@@ -30,8 +34,7 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
// val tokenID: String = UserManager.INSTANCE.getTokenID()
val tokenID: String = "647ECC8C40A7238E012703044D60D0D95599F1AD1833C4D29670487710D12D315F433703067DF5142735505C42F58997"
val tokenID: String = UserManager.INSTANCE.getTokenID()
val time = System.currentTimeMillis()
val channel = createChannel()
var request = chain.request()
......@@ -51,18 +54,17 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
* @return
*/
private fun createChannel(): String {
var channel: String = ""
// var channel: String = CommonUtils.getAppMetaData(App.instance, "CHANNEL_NAME")
// try {
// // 穿山甲分包渠道
// val ttChannel = HumeSDK.getChannel(App.instance)
// if (!TextUtils.isEmpty(ttChannel)) {
// // 此处方式不能修改,已和后端约定
// channel = channel + "_" + ttChannel
// }
// } catch (e: Exception) {
// e.printStackTrace()
// }
var channel: String = CommonUtils.getAppMetaData(AppApplication.getContext(), "CHANNEL_NAME")
try {
// 穿山甲分包渠道
val ttChannel = HumeSDK.getChannel(AppApplication.getContext())
if (!TextUtils.isEmpty(ttChannel)) {
// 此处方式不能修改,已和后端约定
channel = channel + "_" + ttChannel
}
} catch (e: Exception) {
e.printStackTrace()
}
return channel
}
......
......@@ -129,9 +129,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
}
override fun onSplashAdLoadSuccess() {
if (mTTSplashAd != null) {
mTTSplashAd!!.showAd(mSplashContainer)
}
mTTSplashAd?.showAd(mSplashContainer)
}
override fun onAdLoadTimeout() {
......
package com.fry.base.utils.encry;
import android.util.Log;
package com.mints.street.utils.encry;
import com.fry.base.BuildConfig;
......@@ -12,9 +10,10 @@ import javax.crypto.spec.SecretKeySpec;
import Decoder.BASE64Decoder;
import Decoder.BASE64Encoder;
public class AESUtils {
private static final String vis = MD5.GetMD5Code("goldcamera_2021").substring(8, 24);
private static final String vis = MD5.GetMD5Code("street_2021").substring(8, 24);
// public static final String key = "123456";
public static String CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding"; // optional value AES/DES/DESede
......
package com.fry.base.utils.encry;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Base64编码工具类
*
* @author
* @date 2012-10-11
*/
public class Base64 {
private static final char[] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static String encode(byte[] data) {
int start = 0;
int len = data.length;
StringBuffer buf = new StringBuffer(data.length * 3 / 2);
int end = len - 3;
int i = start;
int n = 0;
while (i <= end) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8) | (((int) data[i + 2]) & 0x0ff);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append(legalChars[d & 63]);
i += 3;
if (n++ >= 14) {
n = 0;
buf.append(" ");
}
}
if (i == start + len - 2) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 255) << 8);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append("=");
} else if (i == start + len - 1) {
int d = (((int) data[i]) & 0x0ff) << 16;
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append("==");
}
return buf.toString();
}
private static int decode(char c) {
if (c >= 'A' && c <= 'Z')
return ((int) c) - 65;
else if (c >= 'a' && c <= 'z')
return ((int) c) - 97 + 26;
else if (c >= '0' && c <= '9')
return ((int) c) - 48 + 26 + 26;
else
switch (c) {
case '+':
return 62;
case '/':
return 63;
case '=':
return 0;
default:
throw new RuntimeException("unexpected code: " + c);
}
}
/**
* Decodes the given Base64 encoded String to a new byte array. The byte array holding the decoded data is returned.
*/
public static byte[] decode(String s) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
decode(s, bos);
} catch (IOException e) {
throw new RuntimeException();
}
byte[] decodedBytes = bos.toByteArray();
try {
bos.close();
bos = null;
} catch (IOException ex) {
System.err.println("Error while decoding BASE64: " + ex.toString());
}
return decodedBytes;
}
private static void decode(String s, OutputStream os) throws IOException {
int i = 0;
int len = s.length();
while (true) {
while (i < len && s.charAt(i) <= ' ')
i++;
if (i == len)
break;
int tri = (decode(s.charAt(i)) << 18) + (decode(s.charAt(i + 1)) << 12) + (decode(s.charAt(i + 2)) << 6) + (decode(s.charAt(i + 3)));
os.write((tri >> 16) & 255);
if (s.charAt(i + 2) == '=')
break;
os.write((tri >> 8) & 255);
if (s.charAt(i + 3) == '=')
break;
os.write(tri & 255);
i += 4;
}
}
}
package com.mints.street.utils.encry;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Base64编码工具类
*
* @author
* @date 2012-10-11
*/
public class Base64 {
private static final char[] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static String encode(byte[] data) {
int start = 0;
int len = data.length;
StringBuffer buf = new StringBuffer(data.length * 3 / 2);
int end = len - 3;
int i = start;
int n = 0;
while (i <= end) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8) | (((int) data[i + 2]) & 0x0ff);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append(legalChars[d & 63]);
i += 3;
if (n++ >= 14) {
n = 0;
buf.append(" ");
}
}
if (i == start + len - 2) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 255) << 8);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append("=");
} else if (i == start + len - 1) {
int d = (((int) data[i]) & 0x0ff) << 16;
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append("==");
}
return buf.toString();
}
private static int decode(char c) {
if (c >= 'A' && c <= 'Z')
return ((int) c) - 65;
else if (c >= 'a' && c <= 'z')
return ((int) c) - 97 + 26;
else if (c >= '0' && c <= '9')
return ((int) c) - 48 + 26 + 26;
else
switch (c) {
case '+':
return 62;
case '/':
return 63;
case '=':
return 0;
default:
throw new RuntimeException("unexpected code: " + c);
}
}
/**
* Decodes the given Base64 encoded String to a new byte array. The byte array holding the decoded data is returned.
*/
public static byte[] decode(String s) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
decode(s, bos);
} catch (IOException e) {
throw new RuntimeException();
}
byte[] decodedBytes = bos.toByteArray();
try {
bos.close();
bos = null;
} catch (IOException ex) {
System.err.println("Error while decoding BASE64: " + ex.toString());
}
return decodedBytes;
}
private static void decode(String s, OutputStream os) throws IOException {
int i = 0;
int len = s.length();
while (true) {
while (i < len && s.charAt(i) <= ' ')
i++;
if (i == len)
break;
int tri = (decode(s.charAt(i)) << 18) + (decode(s.charAt(i + 1)) << 12) + (decode(s.charAt(i + 2)) << 6) + (decode(s.charAt(i + 3)));
os.write((tri >> 16) & 255);
if (s.charAt(i + 2) == '=')
break;
os.write((tri >> 8) & 255);
if (s.charAt(i + 3) == '=')
break;
os.write(tri & 255);
i += 4;
}
}
}
package com.fry.base.utils.encry;
import android.util.Log;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
/**
* 描述:3DES加密工具类
* 作者:孟崔广
* 时间:2018/3/29 17:51
* 邮箱:mengcga@163.com
*/
public class Des3 {
// crediteasec@lx100$#365#$
// 密钥
// private final static String secretKey = "mail.asiainfo.com@2x222$#bbb#2";
// 向量
private final static String iv = "01234567";
// 加解密统一使用的编码方式
private final static String encoding = "utf-8";
private static String TAG = "Des3";
/**
* 3DES加密
*
* @param plainText 普通文本
* @return
* @throws Exception
*/
public static String encode(String plainText, String secretKey) {
String ciphertext = "";
if (plainText != null && plainText.length() != 0) {
Key deskey = null;
byte[] encryptData = null;
try {
byte[] bytes = secretKey.getBytes();
DESedeKeySpec spec = new DESedeKeySpec(bytes);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);
encryptData = cipher.doFinal(plainText.getBytes(encoding));
ciphertext = Base64.encode(encryptData);
//这里需要对特殊字符串进行转码
ciphertext = URLEncoder.encode(ciphertext, "utf-8");
} catch (Exception e) {
Log.e(TAG, e.getMessage().toString());
e.printStackTrace();
}
}
return ciphertext;
}
/**
* 3DES解密
*
* @param encryptText 加密文本
* @return
* @throws Exception
*/
public static String decode(String encryptText, String secretKey) {
String clearText = "";
if (encryptText != null && encryptText.length() != 0) {
Key deskey = null;
byte[] decryptData;
try {
//这里需要对特殊字符串进行转码
encryptText = URLDecoder.decode(
encryptText, "utf-8");
DESedeKeySpec spec = new DESedeKeySpec(secretKey.getBytes());
SecretKeyFactory keyfactory = SecretKeyFactory
.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.DECRYPT_MODE, deskey, ips);
decryptData = cipher.doFinal(Base64.decode(encryptText));
clearText = new String(decryptData, encoding);
} catch (Exception e) {
e.printStackTrace();
}
}
return clearText;
}
}
package com.mints.street.utils.encry;
import android.util.Log;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
/**
* 描述:3DES加密工具类
* 作者:孟崔广
* 时间:2018/3/29 17:51
* 邮箱:mengcga@163.com
*/
public class Des3 {
// crediteasec@lx100$#365#$
// 密钥
// private final static String secretKey = "mail.asiainfo.com@2x222$#bbb#2";
// 向量
private final static String iv = "01234567";
// 加解密统一使用的编码方式
private final static String encoding = "utf-8";
private static String TAG = "Des3";
/**
* 3DES加密
*
* @param plainText 普通文本
* @return
* @throws Exception
*/
public static String encode(String plainText, String secretKey) {
String ciphertext = "";
if (plainText != null && plainText.length() != 0) {
Key deskey = null;
byte[] encryptData = null;
try {
byte[] bytes = secretKey.getBytes();
DESedeKeySpec spec = new DESedeKeySpec(bytes);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);
encryptData = cipher.doFinal(plainText.getBytes(encoding));
ciphertext = Base64.encode(encryptData);
//这里需要对特殊字符串进行转码
ciphertext = URLEncoder.encode(ciphertext, "utf-8");
} catch (Exception e) {
Log.e(TAG, e.getMessage().toString());
e.printStackTrace();
}
}
return ciphertext;
}
/**
* 3DES解密
*
* @param encryptText 加密文本
* @return
* @throws Exception
*/
public static String decode(String encryptText, String secretKey) {
String clearText = "";
if (encryptText != null && encryptText.length() != 0) {
Key deskey = null;
byte[] decryptData;
try {
//这里需要对特殊字符串进行转码
encryptText = URLDecoder.decode(
encryptText, "utf-8");
DESedeKeySpec spec = new DESedeKeySpec(secretKey.getBytes());
SecretKeyFactory keyfactory = SecretKeyFactory
.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.DECRYPT_MODE, deskey, ips);
decryptData = cipher.doFinal(Base64.decode(encryptText));
clearText = new String(decryptData, encoding);
} catch (Exception e) {
e.printStackTrace();
}
}
return clearText;
}
}
package com.fry.base.utils.encry;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/*
* MD5 算法
*/
public class MD5 {
// 全局数组
private final static String[] strDigits = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
// 返回形式为数字跟字符串
private static String byteToArrayString(byte bByte) {
int iRet = bByte;
// System.out.println("iRet="+iRet);
if (iRet < 0) {
iRet += 256;
}
int iD1 = iRet / 16;
int iD2 = iRet % 16;
return strDigits[iD1] + strDigits[iD2];
}
// 返回形式只为数字
private static String byteToNum(byte bByte) {
int iRet = bByte;
System.out.println("iRet1=" + iRet);
if (iRet < 0) {
iRet += 256;
}
return String.valueOf(iRet);
}
// 转换字节数组为16进制字串
private static String byteToString(byte[] bByte) {
StringBuffer sBuffer = new StringBuffer();
for (int i = 0; i < bByte.length; i++) {
sBuffer.append(byteToArrayString(bByte[i]));
}
return sBuffer.toString();
}
public static String GetMD5Code(String strObj) {
String resultString = null;
try {
resultString = new String(strObj);
MessageDigest md = MessageDigest.getInstance("MD5");
// md.digest() 该函数返回值为存放哈希值结果的byte数组
resultString = byteToString(md.digest(strObj.getBytes()));
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
return resultString;
}
public static void main(String[] args) {
MD5 getMD5 = new MD5();
System.out.println(GetMD5Code("136111111111231231231231e807f1fcf82d132f9bb018ca6738a19f"));
}
package com.mints.street.utils.encry;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/*
* MD5 算法
*/
public class MD5 {
// 全局数组
private final static String[] strDigits = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
// 返回形式为数字跟字符串
private static String byteToArrayString(byte bByte) {
int iRet = bByte;
// System.out.println("iRet="+iRet);
if (iRet < 0) {
iRet += 256;
}
int iD1 = iRet / 16;
int iD2 = iRet % 16;
return strDigits[iD1] + strDigits[iD2];
}
// 返回形式只为数字
private static String byteToNum(byte bByte) {
int iRet = bByte;
System.out.println("iRet1=" + iRet);
if (iRet < 0) {
iRet += 256;
}
return String.valueOf(iRet);
}
// 转换字节数组为16进制字串
private static String byteToString(byte[] bByte) {
StringBuffer sBuffer = new StringBuffer();
for (int i = 0; i < bByte.length; i++) {
sBuffer.append(byteToArrayString(bByte[i]));
}
return sBuffer.toString();
}
public static String GetMD5Code(String strObj) {
String resultString = null;
try {
resultString = new String(strObj);
MessageDigest md = MessageDigest.getInstance("MD5");
// md.digest() 该函数返回值为存放哈希值结果的byte数组
resultString = byteToString(md.digest(strObj.getBytes()));
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
return resultString;
}
public static void main(String[] args) {
MD5 getMD5 = new MD5();
System.out.println(GetMD5Code("136111111111231231231231e807f1fcf82d132f9bb018ca6738a19f"));
}
}
\ No newline at end of file
......@@ -33,4 +33,4 @@ RELEASE_SHARESDK_KEY=
RELEASE_SHARESDK_SECRET=
#友盟
RELEASE_UMENG_KEY=
\ No newline at end of file
RELEASE_UMENG_KEY=60e80209a6f90557b7b19aa7
......@@ -44,7 +44,7 @@ dependencies {
api project(':mvvmhabit')
//阿里路由框架
api rootProject.ext.dependencies["arouter-api"]
// api rootProject.ext.dependencies["arouter-api"]
//指示器
api rootProject.ext.dependencies["hackware1993"]
......
......@@ -3,8 +3,6 @@ package com.fry.base.base;
import android.app.Application;
import android.view.Gravity;
import com.alibaba.android.arouter.launcher.ARouter;
import me.goldze.mvvmhabit.utils.KLog;
import me.goldze.mvvmhabit.utils.ToastUtils;
import com.fry.base.BuildConfig;
......@@ -22,10 +20,10 @@ public class BaseModuleInit implements IModuleInit<Void> {
//开启打印日志
KLog.init(BuildConfig.DEBUG);
//初始化阿里路由框架
if (BuildConfig.DEBUG) {
ARouter.openLog(); // 打印日志
ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
}
// if (BuildConfig.DEBUG) {
// ARouter.openLog(); // 打印日志
// ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
// }
// 尽可能早,推荐在Application中初始化
// ARouter.init(application);
ToastUtils.setGravity(Gravity.CENTER,0,0);
......
......@@ -6,8 +6,6 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.fry.base.BuildConfig;
import com.fry.base.netwrok.OkHttpInterceptor;
import com.fry.base.utils.encry.AESUtils;
import java.util.concurrent.TimeUnit;
......@@ -34,7 +32,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
*/
public class RetrofitClient {
private HttpConfiguation mHttpConfig;
public HttpConfiguation mHttpConfig;
private Context mContext = Utils.getContext();
......
......@@ -16,22 +16,6 @@ public class Constants {
/***
* bugly配置信息
*/
public static final String BUGLY_APP_ID = "1aa21b8cc3";
public static final String UMENG_APP_KEY = "58c35e724544cb4fa8001acf";
public static final String JPUSH_KEY = "830808eb0ee65458c952891c";
public static final String WX_APP_ID = "wxff15efaf15adc6f8";
public static final String WX_APP_SECRET = "83d6dbe46f84bde4cf78d0b58764d797";
public static final String QQAppID = "1105708819";
public static final String QQAppKey = "J9olD7s7udx8rJ0E";
public static final String SinaAppKey = "824068500";
public static final String SinaAppSecret = "99dd08e9f7de660cb81ddc8f90e67e7c";
public static final String SinaCallBackURL = "http://sns.whalecloud.com/sina2/callback";
public static final String BUNDLE_ID = "bundleId";
public static final String ID = "id";
/**
......
package com.fry.base.provider
import android.content.Context
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
/**
* Description :
* Created by yue on 2021/3/10
*/
interface IFlutterProvider : IProvider {
companion object {
const val PROVIDER: String = "/flutter/provider"
@JvmStatic
fun getInstance(): IFlutterProvider {
return ARouter.getInstance().build(PROVIDER).navigation() as IFlutterProvider
}
}
fun toFlutter(context: Context, path: String, arguments: HashMap<String, Any>? = null, requestCode: Int = 0)
}
\ No newline at end of file
#Fri Jul 09 19:35:56 CST 2021
VERSION_BUILD=2722
#Fri Jul 09 19:56:02 CST 2021
VERSION_BUILD=2724
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