lib_google

lib_huawei
This commit is contained in:
hch 2023-11-27 17:12:27 +08:00
parent 56ae033523
commit 238181deca
56 changed files with 1915 additions and 843 deletions

View File

@ -34,14 +34,14 @@ public class ShareBuilder {
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
anchorId,
shareUid,
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
) ;
CommonAppConfig.IS_GOOGLE_PLAY
);
}
public static String createInviteLink(String shareUid) {
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
shareUid,
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
CommonAppConfig.IS_GOOGLE_PLAY
);
}

View File

@ -152,7 +152,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
}
public InvitePopDialog setUrl(String data) {
this.url = data + "&isGoogle=" + (CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0");
this.url = data + "&isGoogle=" + CommonAppConfig.IS_GOOGLE_PLAY;
return this;
}
}

View File

@ -26,21 +26,21 @@
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
},
"client":{
"cp_id":"30086000612391734",
"product_id":"99536292102564216",
"client_id":"964994320723627840",
"client_secret":"6D5FE29D85B967D3A66BDCD473641E4C7B5524F7F4935CA0EF4A842730C3402D",
"project_id":"99536292102564216",
"app_id":"106936673",
"api_key":"DAEDADYGta/0O4ZSdrnug52NgC67/w/RIyTq9A8LyAY0+mp6g6XeJDbxugpluFPLAhaqjaMs5c0PLnRx14UzWbPPADgi1EqihbWLoA==",
"cp_id":"30852000032486141",
"product_id":"388421841221767494",
"client_id":"1283893262452580800",
"client_secret":"17BC070420691D35650C694230D6348075CB549F7BBA94EDD49FA9E61A9E5434",
"project_id":"388421841221767494",
"app_id":"109612651",
"api_key":"DAEDAAlBbTFuTuyQWQsyYBZLuyjALH9Y9BNFkVZl1GhI0tRaa6HF1LgzXWy2MZiSFrmpbn1aAvcvzP6aKZtR6MVikS8V4SbBlYUPfQ==",
"package_name":"com.pdlive.shayu"
},
"oauth_client":{
"client_id":"106936673",
"client_id":"109612651",
"client_type":1
},
"app_info":{
"app_id":"106936673",
"app_id":"109612651",
"package_name":"com.pdlive.shayu"
},
"service":{
@ -53,6 +53,10 @@
"resource_id":"p1",
"channel_id":""
},
"edukit":{
"edu_url":"edukit.cloud.huawei.com.cn",
"dh_url":"edukit.cloud.huawei.com.cn"
},
"search":{
"url":"https://search-drcn.cloud.huawei.com"
},
@ -77,15 +81,15 @@
{
"package_name":"com.pdlive.shayu",
"client":{
"app_id":"106936673"
"app_id":"109612651"
},
"app_info":{
"package_name":"com.pdlive.shayu",
"app_id":"106936673"
"app_id":"109612651"
},
"oauth_client":{
"client_type":1,
"client_id":"106936673"
"client_id":"109612651"
}
}
]

View File

@ -170,8 +170,10 @@ android {
}
variant.outputs.all {
def isGoogle = "link"
if (rootProject.ext.manifestPlaceholders.isGooglePlay) {
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) {
isGoogle = "Google"
} else if(rootProject.ext.manifestPlaceholders.isGooglePlay == 2){
isGoogle = "Huawei"
}
def isPlugin = "all"
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
@ -266,8 +268,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation platform('com.google.firebase:firebase-bom:30.5.0')
implementation 'com.google.firebase:firebase-crashlytics'
//implementation platform('com.google.firebase:firebase-bom:30.5.0')
//implementation 'com.google.firebase:firebase-crashlytics'
//
api project(':main')

View File

@ -194,12 +194,13 @@
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- <meta-data-->
<!-- android:name="com.huawei.hms.client.appid"-->
<!-- android:value="106936673"/>-->
<!-- <meta-data-->
<!-- android:name="com.huawei.hms.client.cpid"-->
<!-- android:value="30086000612391734"/>-->
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="109612651" />
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="30852000032486141" />
</application>
</manifest>

View File

@ -24,9 +24,6 @@ import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.Utils;
import com.facebook.appevents.AppEventsLogger;
import com.fm.openinstall.OpenInstall;
import com.google.firebase.FirebaseApp;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.shayu.phonelive.utils.LogUtils;
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
import com.tencent.imsdk.v2.V2TIMManager;
@ -46,9 +43,9 @@ import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.socket.SocketReceiveBean;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
@ -145,7 +142,6 @@ public class AppContext extends CommonAppContext {
sInstance = this;
L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this);
FirebaseAnalytics.getInstance(this);
File httpCacheDir = new File(getCacheDir(), "https");
try {
@ -170,8 +166,7 @@ public class AppContext extends CommonAppContext {
//友盟正式初始化
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE,
"64e40ee55488fe7b3afa2c96");
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
//集成umeng-crash-vx.x.x.aar则需要关闭原有统计SDK异常捕获功能
MobclickAgent.setCatchUncaughtExceptions(false);
@ -212,9 +207,7 @@ public class AppContext extends CommonAppContext {
if (content.getContent().contains("_method_")) {
msg.obj = content.getContent();
//观众页面
if (SocketRyClient.mSocketHandler != null
&& (TextUtils.equals("__system__", message.getTargetId())
|| ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketRyClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
@ -313,40 +306,37 @@ public class AppContext extends CommonAppContext {
* 注册全局异常捕获有需要时可以在onCreate调用
*/
private void registerError() {
NeverCrashUtils.getInstance()
.setDebugMode(BuildConfig.DEBUG)
.setMainCrashHandler((t, e) -> {
Log.e("ApplicationError", "主线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
AppManager.runDebugCode(() -> {
//闪退后finish所有Activity并且杀死进程
for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) {
activity.get().finish();
}
}
Process.killProcess(Process.myPid());
System.exit(0);
setFirebaseCrashData();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
throw new RuntimeException(e);
}, 100);
});
NeverCrashUtils.getInstance().setDebugMode(BuildConfig.DEBUG).setMainCrashHandler((t, e) -> {
Log.e("ApplicationError", "主线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
AppManager.runDebugCode(() -> {
//闪退后finish所有Activity并且杀死进程
for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) {
activity.get().finish();
}
}
Process.killProcess(Process.myPid());
System.exit(0);
setFirebaseCrashData();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
throw new RuntimeException(e);
}, 100);
});
})
.setUncaughtCrashHandler((t, e) -> {
Log.e("ApplicationError", "子线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
})
.register(this);
}).setUncaughtCrashHandler((t, e) -> {
Log.e("ApplicationError", "子线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
}).register(this);
}
public void registerFirebaseCrash() {
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
return;
}
FirebaseAnalytics.getInstance(this);
FirebaseApp.initializeApp(this);
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
GoogleUtils.newInstance(this).initializeApp(this);
}
}
@ -355,21 +345,5 @@ public class AppContext extends CommonAppContext {
return;
}
String uid = CommonAppConfig.getInstance().getUid();
FirebaseCrashlytics.getInstance().setUserId(CommonAppConfig.getInstance().getUid());
if (uid != null && !uid.isEmpty()) {
FirebaseCrashlytics.getInstance().setCustomKey("uid", uid);
} else {
FirebaseCrashlytics.getInstance().setCustomKey("uid", "uid is null");
}
FirebaseCrashlytics.getInstance().setCustomKey("userData", SpUtil.getInstance().getStringValue(SpUtil.USER_INFO));
FirebaseCrashlytics.getInstance().setCustomKey("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
FirebaseCrashlytics.getInstance().setCustomKey("PhoneName", Build.BRAND);
FirebaseCrashlytics.getInstance().setCustomKey("Phone", Build.MODEL);
FirebaseCrashlytics.getInstance().setCustomKey("CPU", Arrays.toString(Build.SUPPORTED_ABIS));
FirebaseCrashlytics.getInstance().setCustomKey("RunTime", (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()));
FirebaseCrashlytics.getInstance().setCustomKey("enterRoom", CrashSaveBean.getInstance().getEnterRoom());
FirebaseCrashlytics.getInstance().setCustomKey("slidingRoom", CrashSaveBean.getInstance().getSlidingRoom());
FirebaseCrashlytics.getInstance().setCustomKey("playSvga", CrashSaveBean.getInstance().getPlaySvga());
FirebaseCrashlytics.getInstance().setCustomKey("ActivitySize", CrashSaveBean.getInstance().getActivitySize());
}
}

View File

@ -8,7 +8,6 @@ import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.yunbao.common.BuildConfig;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.utils.AppManager;
@ -108,7 +107,6 @@ public class NeverCrashUtils {
}
e.printStackTrace();
AppContext.setFirebaseCrashData();
FirebaseCrashlytics.getInstance().recordException(e);
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);

View File

@ -1,3 +1,4 @@
/*
package com.shayu.phonelive.utils;
import android.app.Notification;
@ -108,3 +109,4 @@ public class MyNotificationService extends FirebaseMessagingService {
// }
}
*/

View File

@ -12,6 +12,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://maven.faceunity.com/repository/maven-public/' }//
maven { url 'https://repo1.maven.org/maven2/' }//
maven {url 'https://developer.huawei.com/repo/'}
google()
mavenCentral()
}
@ -24,6 +25,7 @@ buildscript {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath "com.alibaba:arouter-register:1.0.2"
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
}

View File

@ -146,7 +146,11 @@ dependencies {
//
//
api 'com.android.billingclient:billing:5.0.0'
//api 'com.android.billingclient:billing:5.0.0'
//api 'com.google.firebase:firebase-messaging:23.0.6'
//api 'com.google.firebase:firebase-analytics:21.1.0'
api 'com.squareup.picasso:picasso:2.5.2'
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
api files('libs/liteavsdk.jar')
@ -180,8 +184,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'
// api 'com.huawei.hms:push:4.0.2.300'
implementation 'com.github.tajchert:WaitingDots:0.6.1'
//
@ -206,4 +209,11 @@ dependencies {
// ()
api 'tech.sud.mgp:SudASR:1.3.3.1158'
//
api project(':lib_huawei')
//google插件包
api project(':lib_google')
}

View File

@ -34,7 +34,7 @@ public class CommonAppConfig {
//域名
public static final String HOST = getMetaDataString("SERVER_HOST");
//是否使用谷歌支付
public static final boolean IS_GOOGLE_PLAY = getMetaDataBoolean("IS_GOOGLE_PLAY");
public static final int IS_GOOGLE_PLAY = getMetaDataInt("IS_GOOGLE_PLAY");
//是否开启上报错误日志功能
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
//是否为插件包模式
@ -470,6 +470,18 @@ public class CommonAppConfig {
}
private static int getMetaDataInt(String key) {
int res = 0;
try {
ApplicationInfo appInfo = CommonAppContext.sInstance.getPackageManager().getApplicationInfo(CommonAppContext.sInstance.getPackageName(), PackageManager.GET_META_DATA);
res = appInfo.metaData.getInt(key);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return res;
}
/**
* 个人中心功能列表
*/

View File

@ -173,106 +173,97 @@ public class CommonHttpUtil {
}
Log.i("来了", lang);
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
.params("langue", lang)
.params("version", "" + VersionUtil.getVersion())
.params("from", "android")
.params("appType", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
try {
JSONObject obj = JSON.parseObject(info[0]);
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
CommonAppConfig.getInstance().setConfig(bean);
CommonAppConfig.getInstance().setLevel(obj.getString("level"));
CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor"));
CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time");
CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time");
//解析粉丝徽章
CommonAppConfig.getInstance().setAnchorFansMedal(obj.getString("levelfans"));
SpUtil.getInstance().setStringValue(SpUtil.CONFIG, info[0]);
if (commonCallback != null) {
commonCallback.callback(bean);
}
if (obj.containsKey("is_chat")) {
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
}
if (obj.containsKey("levelfans")) {
JSONArray levelArray = obj.getJSONArray("levelfans");
new NewLevelManager(context).upDataFansLevel(levelArray.toJSONString());
}
if (obj.containsKey("level_new")) {//缓存等级数据
JSONArray levelArray = obj.getJSONArray("level_new");
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
}
if (obj.containsKey("levelanchor_new")) {//缓存等级数据
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
}
if (obj.containsKey("liveclass")) {//缓存直播间分类
JSONArray levelArray = obj.getJSONArray("liveclass");
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
}
if (obj.containsKey("apk_ver")) {
APKManager.get().setApkVer(obj.getString("apk_ver"));
}
if (obj.containsKey("apk_url")) {
APKManager.get().setAPKUrl(obj.getString("apk_url"));
}
if (obj.containsKey("apk_des")) {
APKManager.get().setAPKDes(obj.getString("apk_des"));
}
if (obj.containsKey("google_isup")) {
APKManager.get().setAPKGoogleIsUp(obj.getInteger("google_isup"));
}
if (obj.containsKey("isup")) {
APKManager.get().setAPKIsUp(obj.getInteger("isup"));
}
if (obj.containsKey("clarity")) {
IMLoginManager.get(context).setClarity(obj.getString("clarity"));
}
if (obj.containsKey("defaultBubbleUrl")) {
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
}
if (obj.containsKey("gift_quantity")) {
JSONArray giftQuantity = obj.getJSONArray("gift_quantity");
new GiftQuantityManager(context).UpGiftQuantity(giftQuantity.toJSONString());
}
} catch (Exception e) {
e.printStackTrace();
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
ErrorActivity.forward("GetConfig接口返回数据异常", error);
}
} else if (code == 1000) {
new DialogUitl
.Builder(context)
.setContent(msg)
.setCancelable(false)
.setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
AppManager.getInstance().AppExit();
}
@Override
public void onCancel() {
AppManager.getInstance().AppExit();
}
}).build().show();
} else {
ToastUtil.show(context.getString(R.string.net_error) + "code:" + code + " msg:" + msg);
}
}
@Override
public void onError() {
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG).params("langue", lang).params("version", "" + VersionUtil.getVersion()).params("from", "android").params("appType", "1").execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
try {
JSONObject obj = JSON.parseObject(info[0]);
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
CommonAppConfig.getInstance().setConfig(bean);
CommonAppConfig.getInstance().setLevel(obj.getString("level"));
CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor"));
CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time");
CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time");
//解析粉丝徽章
CommonAppConfig.getInstance().setAnchorFansMedal(obj.getString("levelfans"));
SpUtil.getInstance().setStringValue(SpUtil.CONFIG, info[0]);
if (commonCallback != null) {
commonCallback.callback(null);
commonCallback.callback(bean);
}
if (obj.containsKey("is_chat")) {
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
}
if (obj.containsKey("levelfans")) {
JSONArray levelArray = obj.getJSONArray("levelfans");
new NewLevelManager(context).upDataFansLevel(levelArray.toJSONString());
}
if (obj.containsKey("level_new")) {//缓存等级数据
JSONArray levelArray = obj.getJSONArray("level_new");
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
}
if (obj.containsKey("levelanchor_new")) {//缓存等级数据
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
}
if (obj.containsKey("liveclass")) {//缓存直播间分类
JSONArray levelArray = obj.getJSONArray("liveclass");
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
}
if (obj.containsKey("apk_ver")) {
APKManager.get().setApkVer(obj.getString("apk_ver"));
}
if (obj.containsKey("apk_url")) {
APKManager.get().setAPKUrl(obj.getString("apk_url"));
}
if (obj.containsKey("apk_des")) {
APKManager.get().setAPKDes(obj.getString("apk_des"));
}
if (obj.containsKey("google_isup")) {
APKManager.get().setAPKGoogleIsUp(obj.getInteger("google_isup"));
}
if (obj.containsKey("isup")) {
APKManager.get().setAPKIsUp(obj.getInteger("isup"));
}
if (obj.containsKey("clarity")) {
IMLoginManager.get(context).setClarity(obj.getString("clarity"));
}
if (obj.containsKey("defaultBubbleUrl")) {
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
}
if (obj.containsKey("gift_quantity")) {
JSONArray giftQuantity = obj.getJSONArray("gift_quantity");
new GiftQuantityManager(context).UpGiftQuantity(giftQuantity.toJSONString());
}
} catch (Exception e) {
e.printStackTrace();
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
ErrorActivity.forward("GetConfig接口返回数据异常", error);
}
});
} else if (code == 1000) {
new DialogUitl.Builder(context).setContent(msg).setCancelable(false).setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
AppManager.getInstance().AppExit();
}
@Override
public void onCancel() {
AppManager.getInstance().AppExit();
}
}).build().show();
} else {
ToastUtil.show(context.getString(R.string.net_error) + "code:" + code + " msg:" + msg);
}
}
@Override
public void onError() {
if (commonCallback != null) {
commonCallback.callback(null);
}
}
});
}
@ -280,20 +271,18 @@ public class CommonHttpUtil {
* QQ登录的时候 获取unionID 与PC端互通的时候用
*/
public static void getQQLoginUnionID(String accessToken, final CommonCallback<String> commonCallback) {
OkGo.<String>get("https://graph.qq.com/oauth2.0/me?access_token=" + accessToken + "&unionid=1")
.tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
if (commonCallback != null) {
String data = response.body();
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
L.e("getQQLoginUnionID------>" + data);
JSONObject obj = JSON.parseObject(data);
commonCallback.callback(obj.getString("unionid"));
}
}
});
OkGo.<String>get("https://graph.qq.com/oauth2.0/me?access_token=" + accessToken + "&unionid=1").tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
if (commonCallback != null) {
String data = response.body();
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
L.e("getQQLoginUnionID------>" + data);
JSONObject obj = JSON.parseObject(data);
commonCallback.callback(obj.getString("unionid"));
}
}
});
}
@ -312,13 +301,11 @@ public class CommonHttpUtil {
ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self));
return;
}
HttpClient.getInstance().get("User.setAttents", tag)
.params("touid", touid)
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0 || code == 1001) {
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
HttpClient.getInstance().get("User.setAttents", tag).params("touid", touid).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0 || code == 1001) {
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
/* if (code == 1001) {
if (WordUtil.isNewZh()) {
ToastUtil.show("粉絲團等級已清零,待領取獎勵已自動領取至【個性裝扮】");
@ -326,13 +313,13 @@ public class CommonHttpUtil {
ToastUtil.show("The level of the fan club has been cleared, and the rewards to be claimed have been automatically received to [Personalized Dressing]");
}
}*/
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
if (callback != null) {
callback.callback(isAttention);
}
}
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
if (callback != null) {
callback.callback(isAttention);
}
});
}
}
});
}
/**
@ -340,15 +327,14 @@ public class CommonHttpUtil {
*/
public static void getBalance(HttpCallback callback) {
String isGoogle;
if (CommonAppConfig.IS_GOOGLE_PLAY) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
isGoogle = "1";
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
isGoogle = "2";
} else {
isGoogle = "-1";
}
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE)
.params("type", 0)
.params("isGooglePay", isGoogle)
.execute(callback);
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE).params("type", 0).params("isGooglePay", isGoogle).execute(callback);
}
/**
@ -357,8 +343,7 @@ public class CommonHttpUtil {
* @param callback
*/
public static void getAliOrder(String parmas, HttpCallback callback) {
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER)
.execute(callback);
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER).execute(callback);
}
/**
@ -367,8 +352,7 @@ public class CommonHttpUtil {
* @param callback
*/
public static void getWxOrder(String parmas, HttpCallback callback) {
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER)
.execute(callback);
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER).execute(callback);
}
@ -379,8 +363,7 @@ public class CommonHttpUtil {
*/
public static void getCashierOrder(String parmas, HttpCallback callback) {
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER)
.execute(callback);
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER).execute(callback);
}
@ -392,8 +375,7 @@ public class CommonHttpUtil {
public static void getWxH5Order(String parmas, HttpCallback callback) {
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER)
.execute(callback);
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER).execute(callback);
}
@ -401,8 +383,7 @@ public class CommonHttpUtil {
* 检查token是否失效
*/
public static void checkTokenInvalid() {
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID)
.execute(NO_CALLBACK);
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID).execute(NO_CALLBACK);
}
@ -410,32 +391,15 @@ public class CommonHttpUtil {
* 谷歌支付成功后通知自己服务器
*/
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
.params("purchaseToken", purchaseToken)
.params("productId", productId)
.params("orderno", orderno)
.params("package_name", "com.pdlive.shayu")
.execute(callback);
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE).params("purchaseToken", purchaseToken).params("productId", productId).params("orderno", orderno).params("package_name", "com.pdlive.shayu").execute(callback);
}
public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, String gps_adid, HttpCallback callback) {
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
.params("purchaseToken", purchaseToken)
.params("orderno", orderNo)
.params("trade_no", tradeNo)
.params("allData", allData)
.params("gps_adid", gps_adid)
.params("package_name", "com.pdlive.shayu")
.execute(callback);
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE).params("purchaseToken", purchaseToken).params("orderno", orderNo).params("trade_no", tradeNo).params("allData", allData).params("gps_adid", gps_adid).params("package_name", "com.pdlive.shayu").execute(callback);
}
public static void Google_sec_pay(String purchaseToken, String orderNo, String tradeNo, HttpCallback callback) {
HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay")
.params("purchaseToken", purchaseToken)
.params("orderno", orderNo)
.params("trade_no", tradeNo)
.params("package_name", "com.pdlive.shayu")
.execute(callback);
HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay").params("purchaseToken", purchaseToken).params("orderno", orderNo).params("trade_no", tradeNo).params("package_name", "com.pdlive.shayu").execute(callback);
}
//不做任何操作的HttpCallback
@ -452,20 +416,9 @@ public class CommonHttpUtil {
public static void setCommunityReport(String community_type, String comment_id, String dynamic_id, String content, File file1, File file2, File file3, String report_type, HttpCallback callback) {
PostRequest<JsonBean> request;
if ("2".equals(community_type)) {
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
.isMultipart(true)
.params("dynamic_id", dynamic_id)
.params("report_type", report_type)
.params("content", content)
.params("community_type", community_type)
.params("comment_id", comment_id);
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT).isMultipart(true).params("dynamic_id", dynamic_id).params("report_type", report_type).params("content", content).params("community_type", community_type).params("comment_id", comment_id);
} else {
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
.isMultipart(true)
.params("dynamic_id", dynamic_id)
.params("report_type", report_type)
.params("content", content)
.params("community_type", community_type);
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT).isMultipart(true).params("dynamic_id", dynamic_id).params("report_type", report_type).params("content", content).params("community_type", community_type);
}
if (file1 != null) {
request.params("file1", file1);
@ -483,9 +436,7 @@ public class CommonHttpUtil {
* 用户个人主页信息
*/
public static void getUserBaseinfo(String touid, HttpCallback callback) {
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO)
.params("touid", touid)
.execute(callback);
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
}
//
// //埋点唯一性

View File

@ -0,0 +1,62 @@
package com.yunbao.common.pay.hw;
import android.app.Activity;
import android.content.Intent;
import org.json.JSONObject;
/**
* 华为支付
*/
public class HwBuilder {
private Activity mActivity;
public HwBuilder(Activity activity) {
mActivity = activity;
}
/**
* 支付
*/
public void pay(String changeid) {
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
invite.getClass().getMethod("pay", String.class).invoke(invite, changeid);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 消耗所有商品
*/
public void consume() {
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
invite.getClass().getMethod("consume").invoke(invite);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 获取支付结果
*
* @return
*/
public JSONObject getPayResult(Intent intent) {
JSONObject object;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
object = (JSONObject) invite.getClass().getMethod("getPayResult", Intent.class).invoke(invite, intent);
} catch (Exception e) {
throw new RuntimeException(e);
}
return object;
}
}

View File

@ -134,7 +134,6 @@ public class GoogleBillingUtilNew {
Log.e(TAG, "支付失败code = " + code + " msg = " + msg);
}
}
};

View File

@ -0,0 +1,7 @@
package com.yunbao.common.utils;
public class GoogleCallBack {
public void processResponse() {
L.e("___GoogleCallBack___processResponse");
}
}

View File

@ -0,0 +1,212 @@
package com.yunbao.common.utils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.android.billingclient.api.Purchase;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.shayu.lib_google.utils.GoogleBillingManage;
import org.json.JSONObject;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
* 谷歌工具类
*/
public class GoogleUtils {
Activity mActivity;
Context mContext;
Object googlePay;
public static GoogleUtils googleUtils;
public GoogleUtils(Activity activity) {
this.mActivity = activity;
}
public GoogleUtils(Context mContext) {
this.mContext = mContext;
}
public static GoogleUtils newInstance(Context mContext) {
if (googleUtils == null) {
googleUtils = new GoogleUtils(mContext);
}
return googleUtils;
}
public static GoogleUtils newInstance(Activity mContext) {
if (googleUtils == null) {
googleUtils = new GoogleUtils(mContext);
}
return googleUtils;
}
/**
* 获取登录Intnet
*
* @return
*/
public Intent getIntent() {
Intent intent;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
intent = (Intent) invite.getClass().getMethod("googleLogin").invoke(invite);
} catch (Exception e) {
throw new RuntimeException(e);
}
return intent;
}
/**
* 获取支付结果
*
* @return
*/
public JSONObject getLoginResult(Intent intent) {
JSONObject object;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
object = (JSONObject) invite.getClass().getMethod("getLoginResult", Intent.class).invoke(invite, intent);
} catch (Exception e) {
throw new RuntimeException(e);
}
return object;
}
/**
* 初始化谷歌支付
*/
public void initGooglePay() {
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
googlePay.getClass().getMethod("initGooglePay").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public String getAdid() {
String adId;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
adId = (String) invite.getClass().getMethod("getAdid").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
}
return adId;
}
/**
* 购买
*/
public void purchase(String skuId) {
try {
googlePay.getClass().getMethod("checkSku", String.class).invoke(googlePay, skuId);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void setBillingListener(GoogleBillingListener billingListener) {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
JSONObject resultCode = (JSONObject) googlePay.getClass().getMethod("getPayResult").invoke(googlePay);
int code = resultCode.getInt("resultCode");
String token = resultCode.getString("resultToken");
String orderId = resultCode.getString("resultOrderId");
if (code == 0) {
billingListener.onPaySuccess(token, orderId);
timer.cancel();
} else if (code == 1 || code == 2) {
billingListener.onPayFailed("支付失败");
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
timer.scheduleAtFixedRate(task, 60000, 1000);
}
public void initializeApp(Context context) {
try {
Class<?> clz = context.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
Object invite = clz.getConstructor(Context.class).newInstance(context);
invite.getClass().getMethod("initializeApp").invoke(invite);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void setFirebaseTokenListener(Activity activity, FirebaseTokenListener firebaseTokenListener) {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
Class<?> clz = activity.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
String token = (String) googlePay.getClass().getMethod("getToken").invoke(googlePay);
if (!StringUtil.isEmpty(token)) {
firebaseTokenListener.onResultToken(token);
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
timer.schedule(task, 10000, 1000);
}
public void initFireToken(Activity activity) {
try {
Class<?> clz = activity.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
googlePay.getClass().getMethod("initToken").invoke(googlePay);
} catch (Exception e) {
}
}
/**
* 定义接口返回支付结果
*/
public interface GoogleBillingListener {
void onPaySuccess(String token, String orderId);
void onPayFailed(String msg);
}
public interface FirebaseTokenListener {
void onResultToken(String token);
}
}

View File

@ -99,50 +99,41 @@ public class LogUtil {
} else {
time = System.currentTimeMillis() + "";
}
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report")
.params("log", err)
.params("uid", CommonAppConfig.getInstance().getUid())
.params("time", time)
.params("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY)
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.tag("errorLog")
.converter(new StringCallback() {
String TAG = "异常上传";
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report").params("log", err).params("uid", CommonAppConfig.getInstance().getUid()).params("time", time).params("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY).params("appVersion", CommonAppConfig.getInstance().getVersion()).tag("errorLog").converter(new StringCallback() {
String TAG = "异常上传";
@Override
public void onSuccess(Response<String> response) {
Log.i(TAG, "onSuccess: " + response.message());
file.delete();
}
});
UploadTask<String> task = OkUpload.request("errorLog", request)
.save()
.register(new UploadListener<String>("errorLog") {
@Override
public void onSuccess(Response<String> response) {
Log.i(TAG, "onSuccess: " + response.message());
file.delete();
}
});
UploadTask<String> task = OkUpload.request("errorLog", request).save().register(new UploadListener<String>("errorLog") {
@Override
public void onStart(Progress progress) {
@Override
public void onStart(Progress progress) {
}
}
@Override
public void onProgress(Progress progress) {
@Override
public void onProgress(Progress progress) {
}
}
@Override
public void onError(Progress progress) {
}
@Override
public void onError(Progress progress) {
}
@Override
public void onFinish(String s, Progress progress) {
file.delete();
}
@Override
public void onFinish(String s, Progress progress) {
file.delete();
}
@Override
public void onRemove(Progress progress) {
@Override
public void onRemove(Progress progress) {
}
});
}
});
task.start();
}
}
@ -160,12 +151,12 @@ public class LogUtil {
public static void shareFile(Context context) {
try {
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
boolean isAnchor=false;
if(bean!=null){
isAnchor=bean.anchorUserType();
boolean isAnchor = false;
if (bean != null) {
isAnchor = bean.anchorUserType();
}
//有debug文件或主播才允许
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists()&&!isAnchor) {
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists() && !isAnchor) {
return;
}
} catch (Exception e) {
@ -225,7 +216,7 @@ public class LogUtil {
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(share, "分享文件"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !CommonAppConfig.IS_GOOGLE_PLAY) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && CommonAppConfig.IS_GOOGLE_PLAY == 0) {
if (!Environment.isExternalStorageManager()) {
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
context.startActivity(intent);
@ -244,17 +235,14 @@ public class LogUtil {
}
}
private static String TAG="Upload";
private static String TAG = "Upload";
private static void uploadLog(File log) {
JSONObject body = new JSONObject();
MultipartBody requestBody = new MultipartBody.Builder()
.addFormDataPart("uid", CommonAppConfig.getInstance().getUid())
.addFormDataPart("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date()))
.addFormDataPart("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY+"")
.addFormDataPart("appVersion", CommonAppConfig.getInstance().getVersion())
.addFormDataPart("file","file", RequestBody.create(MediaType.parse("application/octet-stream"),log)) //上报日志文件
MultipartBody requestBody = new MultipartBody.Builder().addFormDataPart("uid", CommonAppConfig.getInstance().getUid()).addFormDataPart("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date())).addFormDataPart("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY + "").addFormDataPart("appVersion", CommonAppConfig.getInstance().getVersion()).addFormDataPart("file", "file", RequestBody.create(MediaType.parse("application/octet-stream"), log)) //上报日志文件
.build();
body.put("uid", CommonAppConfig.getInstance().getUid());
@ -262,28 +250,23 @@ public class LogUtil {
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(3, TimeUnit.SECONDS)
.build();
Request request = new Request.Builder()
.url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
.post(requestBody)
.build();
client.newCall(request)
.enqueue(new Callback() {
@Override
public void onFailure(@NonNull Call call, @NonNull IOException e) {
Log.e(TAG, "error",e );
}
OkHttpClient client = new OkHttpClient.Builder().connectTimeout(3, TimeUnit.SECONDS).build();
Request request = new Request.Builder().url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
.post(requestBody).build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(@NonNull Call call, @NonNull IOException e) {
Log.e(TAG, "error", e);
}
@Override
public void onResponse(Call call, okhttp3.Response response) throws IOException {
String body = response.body().string();
Log.i(TAG, "onResponse: "+body);
}
@Override
public void onResponse(Call call, okhttp3.Response response) throws IOException {
String body = response.body().string();
Log.i(TAG, "onResponse: " + body);
}
});
});
}

View File

@ -40,11 +40,61 @@ public class VersionUtil {
}
//是否是谷歌版本
public void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
//不是谷歌
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
//华为版本
if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
//todo
//谷歌版本
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
//谷歌强制更新
if (configBean.getGoogle_isup().equals("1")) {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
context.finish();
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
//谷歌不强制
} else {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
}
} else {
//不强更
if (configBean.getForceUpdate() != 1) {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
@ -103,55 +153,6 @@ public class VersionUtil {
.build()
.show();
}
//谷歌版本
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
//谷歌强制更新
if (configBean.getGoogle_isup().equals("1")) {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
context.finish();
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
//谷歌不强制
} else {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
}
}
}

View File

@ -69,10 +69,10 @@ public class APKUpdateCustomPopup extends CenterPopupView {
private void initView() {
if (!mInside) {
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() == 1) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
findViewById(R.id.dialog_close).setVisibility(GONE);
}
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() == 1) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
findViewById(R.id.dialog_close).setVisibility(GONE);
}
}
@ -86,13 +86,16 @@ public class APKUpdateCustomPopup extends CenterPopupView {
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dialog_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (mInside){
if (mInside) {
dismiss();
}else {
if (CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() != 1) {
} else {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 && APKManager.get().getAPKGoogleIsUp() != 1) {
dismiss();
}
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getApkIsUp() != 1) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 2 && APKManager.get().getAPKGoogleIsUp() != 1) {
dismiss();
}
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getApkIsUp() != 1) {
dismiss();
}
}
@ -103,8 +106,16 @@ public class APKUpdateCustomPopup extends CenterPopupView {
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
//不是谷歌
if (!CommonAppConfig.IS_GOOGLE_PLAY) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
mContext.startActivity(i);
mContext.finish();
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
//华为
//todo
} else {
versionImmediateUse.setVisibility(GONE);
updateLine.setVisibility(VISIBLE);
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
@ -113,13 +124,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
ToastUtil.show(error);
}
});
} else {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
mContext.startActivity(i);
mContext.finish();
}
}
});
}

View File

@ -9,20 +9,18 @@ ext {
]
manifestPlaceholders = [
//
serverHost : "https://napi.yaoulive.com",
// serverHost : "https://napi.yaoulive.com",
//
// serverHost : " https://ceshi.yaoulive.com",
serverHost : " https://ceshi.yaoulive.com",
//
baiduAppId : "23774720",
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnR B",
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB",
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false
isGooglePlay : true,
// true表示谷歌支付 false 0 1 2
isGooglePlay : 2,
//
isUploadLog : true,
//

View File

@ -16,11 +16,13 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=10809
systemProp.http.proxyPort=10809
systemProp.https.proxyPort=49528
systemProp.http.proxyPort=49528
#android.enableR8.fullMode=true

View File

@ -25,10 +25,10 @@ android {
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
minSdkVersion minSdkVersion
targetSdkVersion targetSdkVersion
versionCode versionCode
versionName versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

1
lib_google/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

37
lib_google/build.gradle Normal file
View File

@ -0,0 +1,37 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion minSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
versionCode versionCode
versionName versionName
targetSdkVersion targetSdkVersion
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation rootProject.ext.dependencies["appcompat-androidx"]
//
api 'com.android.billingclient:billing:5.0.0'
//
api 'com.google.android.gms:play-services-auth:15.0.0'
api 'com.google.android.gms:play-services-ads-identifier:15.0.1'
api 'com.google.firebase:firebase-messaging:23.0.6'
}

View File

21
lib_google/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shayu.lib_google">
</manifest>

View File

@ -0,0 +1,51 @@
package com.shayu.lib_google.utils;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseApp;
import com.google.firebase.messaging.FirebaseMessaging;
public class FirebaseManage {
private Activity mActivity;
private Context mContext;
public FirebaseManage(Activity activity) {
this.mActivity = activity;
}
public FirebaseManage(Context mContext) {
this.mContext = mContext;
}
String token = "";
public String getToken() {
return token;
}
public void initToken() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.w("TAG", "Fetching FCM registration token failed", task.getException());
return;
}
// Get new FCM registration token
token = task.getResult();
// Log and toast
Log.d("TAG", token);
}
});
}
public void initializeApp() {
FirebaseApp.initializeApp(mContext);
}
}

View File

@ -0,0 +1,214 @@
package com.shayu.lib_google.utils;
import android.app.Activity;
import android.os.Handler;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClientStateListener;
import com.android.billingclient.api.BillingFlowParams;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.ConsumeParams;
import com.android.billingclient.api.ConsumeResponseListener;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.PurchasesResponseListener;
import com.android.billingclient.api.PurchasesUpdatedListener;
import com.android.billingclient.api.QueryPurchasesParams;
import com.android.billingclient.api.SkuDetails;
import com.android.billingclient.api.SkuDetailsParams;
import com.android.billingclient.api.SkuDetailsResponseListener;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* 新写Google内付工具类做简单的封装
* 支付流程初始化Google支付服务-->查询商品-->购买-->支付成功回调-->消耗商品
*/
public class GoogleBillingManage implements PurchasesUpdatedListener {
private BillingClient billingClient;
private Activity mContext;
private String TAG = "GoogleBillingManage";
public GoogleBillingManage(Activity activity) {
this.mContext = activity;
}
public void initGooglePay() {
billingClient = BillingClient.newBuilder(mContext).setListener(this).enablePendingPurchases().build();
//请求连接到GooglePay
billingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
int code = billingResult.getResponseCode();
if (code != BillingClient.BillingResponseCode.OK) {
String msg = billingResult.getDebugMessage();
Log.e(TAG, "连接到GooglePay失败 code = " + code + " msg = " + msg);
return;
}
Log.e(TAG, "连接到GooglePay成功");
}
//连接失败
@Override
public void onBillingServiceDisconnected() {
Log.e(TAG, "连接到GooglePay失败请重试");
}
});
}
//查询商品
public void checkSku(String id) {
List<String> skuList = new ArrayList<>();
skuList.add(id);
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder().setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(), new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<SkuDetails> list) {
int code = billingResult.getResponseCode();
if (code != BillingClient.BillingResponseCode.OK || list == null || list.isEmpty()) {
String msg = billingResult.getDebugMessage();
Log.e(TAG, "查询商品失败 code = " + code + " msg = " + msg);
return;
}
Log.e(TAG, "查询商品成功");
buyIt(list.get(0));
}
});
}
//购买
private void buyIt(SkuDetails skuDetails) {
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder().setSkuDetails(skuDetails).build();
BillingResult billingResult = billingClient.launchBillingFlow(mContext, billingFlowParams);
int code = billingResult.getResponseCode();
if (code != BillingClient.BillingResponseCode.OK) {
String msg = billingResult.getDebugMessage();
Log.e(TAG, "购买商品失败 code = " + code + " msg = " + msg);
return;
}
Log.e(TAG, "购买商品" + skuDetails.toString());
}
//消耗商品
public void consume(List<Purchase> list) {
if (list == null || list.isEmpty() || billingClient == null) {
return;
}
for (Purchase purchase : list) {
billingClient.consumeAsync(ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build(), new ConsumeResponseListener() {
@Override
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
Log.e(TAG, "onConsumeResponse code = " + billingResult.getResponseCode() + " , msg = " + billingResult.getDebugMessage() + " , purchaseToken = " + purchaseToken);
}
});
}
}
/**
* 查询商品订单
*/
public void queryPurchasesAsync(PurchasesResponseListener responseListener) {
if (billingClient == null) return;
//内购商品交易查询
//内购商品交易查询
QueryPurchasesParams inAppPurchasesQurey = QueryPurchasesParams.newBuilder().setProductType(BillingClient.ProductType.INAPP).build();
billingClient.queryPurchasesAsync(inAppPurchasesQurey, responseListener);
}
public String getAdid() {
try {
return AdvertisingIdClient.getAdvertisingIdInfo(mContext).getId();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (GooglePlayServicesNotAvailableException e) {
throw new RuntimeException(e);
} catch (GooglePlayServicesRepairableException e) {
throw new RuntimeException(e);
}
}
int resultCode = -1;
String resultToken = "";
String resultOrderId = "";
public JSONObject getPayResult() {
JSONObject object = new JSONObject();
try {
object.put("resultCode", resultCode);
object.put("resultToken", resultToken);
object.put("resultOrderId", resultOrderId);
} catch (JSONException e) {
throw new RuntimeException(e);
}
return object;
}
@Override
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> list) {
int code = billingResult.getResponseCode();
String msg = billingResult.getDebugMessage();
Log.e(TAG, "onPurchasesUpdatedcode = " + code + " msg = " + msg);
if (list != null) {
for (Purchase purchase : list) {
Log.e(TAG, "onPurchasesUpdated" + purchase.toString());
}
if (list.get(0) != null) {
resultToken = list.get(0).getPurchaseToken();
resultOrderId = list.get(0).getOrderId();
}
}
if (code == BillingClient.BillingResponseCode.OK && list != null) {
consume(list);
resultCode = 0;
Log.e(TAG, "支付成功");
if (billingListener != null) {
billingListener.onPaySuccess(list);
}
} else if (code == BillingClient.BillingResponseCode.USER_CANCELED) {
Log.e(TAG, "支付取消");
resultCode = 1;
if (billingListener != null) {
billingListener.onPayFailed(code, msg);
}
} else {
resultCode = 2;
if (billingListener != null) {
billingListener.onPayFailed(code, msg);
}
Log.e(TAG, "支付失败code = " + code + " msg = " + msg);
}
}
/**
* 定义接口返回支付结果
*/
public interface GoogleBillingListener {
void onPaySuccess(List<Purchase> list);
void onPayFailed(int code, String msg);
}
private GoogleBillingListener billingListener;
public GoogleBillingManage setBillingListener(GoogleBillingListener billingListener) {
this.billingListener = billingListener;
return this;
}
}

View File

@ -0,0 +1,59 @@
package com.shayu.lib_google.utils;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
import org.json.JSONObject;
public class GoogleManage {
Activity mActivity;
public GoogleManage(Activity mContext) {
this.mActivity = mContext;
}
/**
* 谷歌登录
*
* @return
*/
public Intent googleLogin() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(mActivity, gso);
return mGoogleSignInClient.getSignInIntent();
}
/**
* 获取登录回调
*
* @return
*/
public JSONObject getLoginResult(Intent data) {
JSONObject object = new JSONObject();
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
//account里可以直接获取到IDname和头像
String idToken = account.getIdToken();
account.getFamilyName();
account.getGivenName();
object.put("displayName", account.getDisplayName());
object.put("openId", account.getId());
} catch (Exception e) {
Log.i("Log", "ApiException = " + e);
}
return object;
}
}

View File

@ -0,0 +1,17 @@
package com.shayu.lib_huawei;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

1
lib_huawei/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

32
lib_huawei/build.gradle Normal file
View File

@ -0,0 +1,32 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion minSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
versionCode versionCode
versionName versionName
targetSdkVersion targetSdkVersion
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation rootProject.ext.dependencies["appcompat-androidx"]
api 'com.huawei.hms:iap:4.0.4.301'
}

View File

21
lib_huawei/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package com.shayu.lib_huawei;
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.shayu.lib_huawei.test", appContext.getPackageName());
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shayu.lib_huawei">
</manifest>

View File

@ -0,0 +1,164 @@
package com.shayu.lib_huawei.utils;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import com.huawei.hmf.tasks.OnCanceledListener;
import com.huawei.hmf.tasks.OnFailureListener;
import com.huawei.hmf.tasks.OnSuccessListener;
import com.huawei.hmf.tasks.Task;
import com.huawei.hms.iap.Iap;
import com.huawei.hms.iap.IapApiException;
import com.huawei.hms.iap.IapClient;
import com.huawei.hms.iap.entity.ConsumeOwnedPurchaseReq;
import com.huawei.hms.iap.entity.ConsumeOwnedPurchaseResult;
import com.huawei.hms.iap.entity.InAppPurchaseData;
import com.huawei.hms.iap.entity.OwnedPurchasesReq;
import com.huawei.hms.iap.entity.OwnedPurchasesResult;
import com.huawei.hms.iap.entity.PurchaseIntentReq;
import com.huawei.hms.iap.entity.PurchaseIntentResult;
import com.huawei.hms.iap.entity.PurchaseResultInfo;
import com.huawei.hms.support.api.client.Status;
import org.json.JSONException;
import org.json.JSONObject;
public class HuaWeiPayManage {
IapClient mClient;
Activity mContext;
public HuaWeiPayManage(Activity mContext) {
this.mContext = mContext;
mClient = Iap.getIapClient(mContext);
}
@RequiresApi(api = Build.VERSION_CODES.DONUT)
public void pay(String changeid) {
Task<PurchaseIntentResult> task = mClient.createPurchaseIntent(createPurchaseIntentReq(0, changeid, "35ee54225cc803bb233d9ec2aa8ae65618f131de77c2a37761dda822f4debeee"));
task.addOnSuccessListener(new OnSuccessListener<PurchaseIntentResult>() {
@Override
public void onSuccess(PurchaseIntentResult result) {
result.getReturnCode();
if (result == null) {
Log.e("TAG", "result is null");
return;
}
Status status = result.getStatus();
if (status == null) {
Log.e("TAG", "status is null");
return;
}
if (status.hasResolution()) {
try {
status.startResolutionForResult(mContext, 6666);
} catch (IntentSender.SendIntentException exp) {
Log.e("TAG", exp.getMessage());
}
} else {
Log.e("TAG", "intent is null");
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}).addOnCanceledListener(new OnCanceledListener() {
@Override
public void onCanceled() {
Toast.makeText(mContext, "", Toast.LENGTH_SHORT).show();
}
});
}
private PurchaseIntentReq createPurchaseIntentReq(int type, String productId, String token) {
PurchaseIntentReq req = new PurchaseIntentReq();
req.setProductId(productId);
req.setPriceType(type);
req.setDeveloperPayload(token);
return req;
}
public JSONObject getPayResult(Intent data) {
JSONObject object = new JSONObject();
PurchaseResultInfo purchaseResultInfo = Iap.getIapClient(mContext).parsePurchaseResultInfoFromIntent(data);
try {
object.put("code", purchaseResultInfo.getReturnCode());
object.put("inAppPurchaseData", purchaseResultInfo.getInAppPurchaseData());
object.put("inAppPurchaseDataSignature", purchaseResultInfo.getInAppDataSignature());
} catch (JSONException e) {
throw new RuntimeException(e);
}
return object;
}
/**
* 消耗所有商品
*/
public void consume() {
OwnedPurchasesReq ownedPurchasesReq = new OwnedPurchasesReq();
// priceType: 0消耗型商品; 1非消耗型商品; 2订阅型商品
ownedPurchasesReq.setPriceType(0);
// 获取调用接口的Activity对象
// 调用obtainOwnedPurchases接口获取所有已购但未发货的消耗型商品的购买信息
Task<OwnedPurchasesResult> task = Iap.getIapClient(mContext).obtainOwnedPurchases(ownedPurchasesReq);
task.addOnSuccessListener(new OnSuccessListener<OwnedPurchasesResult>() {
@Override
public void onSuccess(OwnedPurchasesResult result) {
// 获取接口请求成功的结果
Log.e("TAG", "获取接口请求成功的结果");
if (result != null && result.getInAppPurchaseDataList() != null) {
for (int i = 0; i < result.getInAppPurchaseDataList().size(); i++) {
String inAppPurchaseData = result.getInAppPurchaseDataList().get(i);
Log.e("TAG", "未消耗订单:" + i + "___" + inAppPurchaseData);
ConsumeOwnedPurchaseReq req = new ConsumeOwnedPurchaseReq();
String purchaseToken = "";
try {
InAppPurchaseData inAppPurchaseDataBean = new InAppPurchaseData(inAppPurchaseData);
purchaseToken = inAppPurchaseDataBean.getPurchaseToken();
} catch (JSONException e) {
}
req.setPurchaseToken(purchaseToken);
Task<ConsumeOwnedPurchaseResult> task = mClient.consumeOwnedPurchase(req);
task.addOnSuccessListener(new OnSuccessListener<ConsumeOwnedPurchaseResult>() {
@Override
public void onSuccess(ConsumeOwnedPurchaseResult consumeOwnedPurchaseResult) {
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
if (e instanceof IapApiException) {
IapApiException apiException = (IapApiException) e;
Status status = apiException.getStatus();
int returnCode = apiException.getStatusCode();
}
}
});
}
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
if (e instanceof IapApiException) {
IapApiException apiException = (IapApiException) e;
Status status = apiException.getStatus();
int returnCode = apiException.getStatusCode();
} else {
// 其他外部错误
}
}
});
}
}

View File

@ -0,0 +1,17 @@
package com.shayu.lib_huawei;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -4,8 +4,11 @@
package="com.yunbao.live">
<!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"

View File

@ -31,7 +31,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.enums.PopupPosition;
@ -1596,7 +1595,6 @@ public class LiveAudienceActivity extends LiveActivity {
.putExtra("headImg", ""));
break;
case "3":
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
if (bean.getLink() != null && !"".equals(bean.getLink())) {
WebViewActivity.forward(mContext, bean.getLink(), true);

View File

@ -14,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
@ -88,7 +87,6 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter {
}
});
if (model1.getContent().equals("在線客服")) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
}

View File

@ -17,7 +17,6 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.utils.FileUtil;
import com.yunbao.common.utils.TimeUtils;
@ -172,7 +171,6 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
@Override
public void onSuccess(Message message) {
if (isAdmin) {
FirebaseAnalytics.getInstance(getContext()).logEvent("FS_director_chat", null);
AppEventsLogger.newLogger(getContext()).logEvent("FB_director_chat");
}

View File

@ -82,7 +82,6 @@ dependencies {
//
implementation 'com.justkiddingbaby:slidemenu:1.3.0'
implementation 'com.xj.marqueeView:marqueeView:0.1.20'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
//
implementation 'com.binioter:guideview:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'

View File

@ -47,12 +47,6 @@ import com.facebook.login.LoginResult;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.listener.AppInstallAdapter;
import com.fm.openinstall.model.AppData;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
import com.linecorp.linesdk.Scope;
import com.linecorp.linesdk.auth.LineAuthenticationParams;
import com.linecorp.linesdk.auth.LineLoginApi;
@ -84,6 +78,7 @@ import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.http.LiveHttpUtil;
@ -96,6 +91,7 @@ import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -124,12 +120,13 @@ public class EntryActivity extends AppCompatActivity {
private static boolean mShowInvite;//显示邀请码弹窗
private static Context Contexts;
private ImageView img_view;
private GoogleSignInClient mGoogleSignInClient;
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
private String kefuUrl = "";
private boolean mBtnClick = false;
private Dialog loginLoadingDialog;
GoogleUtils googleUtils;
@Subscribe(threadMode = ThreadMode.MAIN)
public void close(String str) {
if ("close_login".equals(str)) {
@ -180,6 +177,9 @@ public class EntryActivity extends AppCompatActivity {
IMLoginManager.get(this).logout(this);
ToastUtil.show(R.string.login_invalid);
}
googleUtils = new GoogleUtils(EntryActivity.this);
Get_hash_key();
activity = this;
Contexts = this;
@ -209,14 +209,14 @@ public class EntryActivity extends AppCompatActivity {
btn_tip1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
}
});
btn_tip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
}
});
@ -262,24 +262,23 @@ public class EntryActivity extends AppCompatActivity {
return;
}
timerOutBtn(view);
MainNetManager.get(EntryActivity.this)
.FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
@Override
public void onSuccess(FaceBookUpModel data) {
if (data.getType().equals("0")) {
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
} else {
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?",false);
}
MainNetManager.get(EntryActivity.this).FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
@Override
public void onSuccess(FaceBookUpModel data) {
if (data.getType().equals("0")) {
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
} else {
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?", false);
}
}
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
}
});
}
});
@ -300,7 +299,6 @@ public class EntryActivity extends AppCompatActivity {
}
});
googleLoginSet();
twitterLoginSet();
btn_google.setOnClickListener(new View.OnClickListener() {
@ -310,8 +308,7 @@ public class EntryActivity extends AppCompatActivity {
return;
}
timerOutBtn(v);
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, 1002);
startActivityForResult(googleUtils.getIntent(), 1002);
}
});
@ -365,13 +362,9 @@ public class EntryActivity extends AppCompatActivity {
timerOutBtn(view);
try {
// App-to-app login
Intent loginIntent = LineLoginApi.getLoginIntent(
view.getContext(),
"1656399535",
new LineAuthenticationParams.Builder()
.scopes(Arrays.asList(Scope.PROFILE))
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
.build());
Intent loginIntent = LineLoginApi.getLoginIntent(view.getContext(), "1656399535", new LineAuthenticationParams.Builder().scopes(Arrays.asList(Scope.PROFILE))
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
.build());
startActivityForResult(loginIntent, 1001);
} catch (Exception e) {
Log.e("ERROR", e.toString());
@ -388,7 +381,7 @@ public class EntryActivity extends AppCompatActivity {
public void onClick(View v) {
if (!"".equals(kefuUrl)) {
Constants.LoginKefu = true;
WebViewActivity.forward(EntryActivity.this, kefuUrl,false);
WebViewActivity.forward(EntryActivity.this, kefuUrl, false);
}
}
});
@ -408,26 +401,10 @@ public class EntryActivity extends AppCompatActivity {
}
private void twitterLoginSet() {
TwitterConfig config = new TwitterConfig.Builder(this)
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(new TwitterAuthConfig(getResources().getString(R.string.twitter_key), getResources().getString(R.string.twitter_secret)))
.debug(true)
.build();
TwitterConfig config = new TwitterConfig.Builder(this).logger(new DefaultLogger(Log.DEBUG)).twitterAuthConfig(new TwitterAuthConfig(getResources().getString(R.string.twitter_key), getResources().getString(R.string.twitter_secret))).debug(true).build();
Twitter.initialize(config);
}
private void googleLoginSet() {
//TODO Google登录
//配置登录以请求用户的ID,电子邮件地址和基本配置文件.ID和基本配置文件包含在DEFAULT_SIGN_IN中.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
// .requestIdToken("AIzaSyDVnuGnQzjI_vDrxh20Hv_S1OMUD7Vp3zU")
.build();
//使用gso指定的选项构建一个GoogleSignInClient.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
}
private void requestPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {//30
// 先判断有没有权限
@ -481,8 +458,7 @@ public class EntryActivity extends AppCompatActivity {
}
} else if (requestCode == 1002) {//google登录
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
handleSignInResult(data);
} else {
tt_login_button.onActivityResult(requestCode, resultCode, data);//twitter登录回调
callbackManager.onActivityResult(requestCode, resultCode, data);//facebook登录回调
@ -491,22 +467,16 @@ public class EntryActivity extends AppCompatActivity {
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
private void handleSignInResult(Intent intent) {
org.json.JSONObject jsonObject = googleUtils.getLoginResult(intent);
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
//account里可以直接获取到IDname和头像
String idToken = account.getIdToken();
account.getFamilyName();
account.getGivenName();
LoginData data = new LoginData();
data.setAvatar("");
data.setNickName(account.getDisplayName());
data.setOpenID(account.getId());
data.setNickName(jsonObject.getString("displayName"));
data.setOpenID(jsonObject.getString("openId"));
data.setType("google");
loginBuyThird(data);
} catch (ApiException e) {
} catch (JSONException e) {
e.printStackTrace();
Log.i("Log", "ApiException = " + e);
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
@ -562,7 +532,7 @@ public class EntryActivity extends AppCompatActivity {
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
//获取自定义数据
if (appData.getData() != null && !appData.getData().equals("")) {
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
} else {
JSONObject data = JSON.parseObject(appData.getData());
@ -598,7 +568,7 @@ public class EntryActivity extends AppCompatActivity {
*/
private void loginBuyThird(LoginData data) {
mLoginType = data.getType();
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
mPromoCode = "";
}
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
@ -646,33 +616,31 @@ public class EntryActivity extends AppCompatActivity {
public void callback(UserBean bean) {
if (mFirstLogin) {
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
} else {
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info[0] != null) {
JSONObject obj = JSON.parseObject(info[0]);
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
MainActivity.forward(EntryActivity.this, false);
gotoLive(obj.getString("anchor_id"));
if (obj.containsKey("home_zdy_img_us")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
}
if (obj.containsKey("home_zdy_pop")) {
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString(
"home_zdy_pop"));
}
} else {
MainActivity.forward(EntryActivity.this, false);
}
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info[0] != null) {
JSONObject obj = JSON.parseObject(info[0]);
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
MainActivity.forward(EntryActivity.this, false);
gotoLive(obj.getString("anchor_id"));
if (obj.containsKey("home_zdy_img_us")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
}
});
if (obj.containsKey("home_zdy_pop")) {
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString("home_zdy_pop"));
}
} else {
MainActivity.forward(EntryActivity.this, false);
}
}
});
}
} else {
MainActivity.forward(EntryActivity.this, false);

View File

@ -15,27 +15,19 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.fragment.app.Fragment;
import com.android.billingclient.api.Purchase;
import com.facebook.appevents.AppEventsConstants;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GoogleBillingUtilNew;
import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R;
import com.yunbao.main.views.TestWebViewClient;
import java.io.IOException;
import java.util.List;
@SuppressLint("ValidFragment")
public class GoogleFragment extends Fragment {
private View view;
public static String mOrderid, mProductId, MoneyUsds;
@ -43,6 +35,8 @@ public class GoogleFragment extends Fragment {
private String url;
String adid = null;
GoogleUtils googleUtils;
public GoogleFragment() {
}
@ -55,33 +49,20 @@ public class GoogleFragment extends Fragment {
assert getArguments() != null;
url = getArguments().getString("url");
if(StringUtil.isEmpty(url)){
Log.e(TAG, "URL为空" );
if (StringUtil.isEmpty(url)) {
Log.e(TAG, "URL为空");
return view;
}
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
Log.e("ttt", url);
rlWebview.loadUrl(url);
initGooglePay();
new Thread(new Runnable() {
new Thread() {
@Override
public void run() {
try {
try {
adid = AdvertisingIdClient.getAdvertisingIdInfo(getActivity()).getId();
Log.e("vssss", adid);
} catch (IOException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
adid = googleUtils.getAdid();
}
}).start();
}.start();
WebSettings webSettings = rlWebview.getSettings();
webSettings.setDomStorageEnabled(true);
@ -95,7 +76,6 @@ public class GoogleFragment extends Fragment {
webSettings.setSupportZoom(true); // 是否支持缩放
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
@ -105,71 +85,64 @@ public class GoogleFragment extends Fragment {
return view;
}
String TAG = "GooglePay";
private void initGooglePay() {
GoogleBillingUtilNew.getInstance().initGooglePay(getActivity());
googleUtils = new GoogleUtils(getActivity());
googleUtils.initGooglePay();
}
private Handler payHandler = new Handler();
//js调用原生
public class JsInteration {
@JavascriptInterface
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
mProductId = ProductId;
mOrderid = OrderNumber;
MoneyUsds = MoneyUsd;
// googleBillingUtil.purchaseInApp(getActivity(), mProductId);
GoogleBillingUtilNew.getInstance().setBillingListener(new GoogleBillingUtilNew.GoogleBillingListener() {
googleUtils.setBillingListener(new GoogleUtils.GoogleBillingListener() {
@Override
public void onPaySuccess(List<Purchase> list) {
for (Purchase purchase : list) {
for (int i = 0; i < list.size(); i++) {
int finalI = i;
payHandler.post(new Runnable() {
public void onPaySuccess(String token, String orderId) {
payHandler.post(new Runnable() {
@Override
public void run() {
CommonHttpUtil.notifyGoogle(token, orderId, mProductId, mOrderid, adid, new HttpCallback() {
@Override
public void run() {
CommonHttpUtil.notifyGoogle(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), mProductId, mOrderid, adid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
Bundle params = new Bundle();
params.putString("currency", "HKD");
params.putString("money", MoneyUsds);
Bundle fb_params = new Bundle();
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
//Google官方充值通知
Bundle google_params = new Bundle();
google_params.putString("currency", "HKD");
google_params.putString("product_id", mProductId);
google_params.putString("transaction_id", mOrderid);
google_params.putString("value", MoneyUsds);
google_params.putString("price", MoneyUsds);
google_params.putString("quantity", "1");
dis();
ToastUtil.show("支付成功");
}
}
});
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
Bundle params = new Bundle();
params.putString("currency", "HKD");
params.putString("money", MoneyUsds);
Bundle fb_params = new Bundle();
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
//Google官方充值通知
Bundle google_params = new Bundle();
google_params.putString("currency", "HKD");
google_params.putString("product_id", mProductId);
google_params.putString("transaction_id", mOrderid);
google_params.putString("value", MoneyUsds);
google_params.putString("price", MoneyUsds);
google_params.putString("quantity", "1");
dis();
ToastUtil.show("支付成功");
}
}
});
}
Log.e("谷歌支付", purchase.toString());
}
});
}
@Override
public void onPayFailed(int code, String msg) {
public void onPayFailed(String msg) {
ToastUtil.show(msg);
}
}).checkSku(ProductId);
});
googleUtils.purchase(mProductId);
}
@JavascriptInterface

View File

@ -0,0 +1,111 @@
package com.yunbao.main.activity;
import static com.yunbao.main.activity.MyWalletActivity.orderId;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.fragment.app.Fragment;
import com.yunbao.common.pay.hw.HwBuilder;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.main.R;
import com.yunbao.main.views.TestWebViewClient;
@SuppressLint("ValidFragment")
public class HuaWeiFragment extends Fragment {
private View view;
public static String mOrderid, mProductId, MoneyUsds;
private WebView rlWebview;
private String url;
String adid = null;
public HuaWeiFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//通过参数中的布局填充获取对应布局
view = inflater.inflate(R.layout.activity_recharge, container, false);
assert getArguments() != null;
url = getArguments().getString("url");
if (StringUtil.isEmpty(url)) {
Log.e(TAG, "URL为空");
return view;
}
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
Log.e("ttt", url);
rlWebview.loadUrl(url);
WebSettings webSettings = rlWebview.getSettings();
webSettings.setDomStorageEnabled(true);
webSettings.setTextZoom(100);
webSettings.setUseWideViewPort(true);
webSettings.setJavaScriptEnabled(true); // 是否开启JS支持
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕大小
webSettings.setSupportZoom(true); // 是否支持缩放
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
rlWebview.setWebViewClient(testWebViewClient);
return view;
}
String TAG = "HuaWeiPay";
//js调用原生
public class JsInteration {
@JavascriptInterface
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
Log.e(TAG, "ProductId:" + ProductId + " OrderNumber:" + OrderNumber + " MoneyUsd:" + MoneyUsd);
if (ProductId.equals("zs640")) {
ProductId = "zs0640";
}
mProductId = ProductId;
mOrderid = OrderNumber;
MoneyUsds = MoneyUsd;
orderId = OrderNumber;
HwBuilder hwBuilder = new HwBuilder(getActivity());
hwBuilder.pay(mProductId);
}
@JavascriptInterface
public void androidMethodBack() {
getActivity().onBackPressed();
}
@JavascriptInterface
public void androidGoBack() {
getActivity().onBackPressed();
}
}
public void release() {
}
}

View File

@ -93,6 +93,8 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.LocationUtil;
import com.yunbao.common.utils.ProcessResultUtil;
@ -291,25 +293,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true, false);
}
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> 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);
PushManager.getInstance()
.onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
}
});
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
GoogleUtils.newInstance(MainActivity.this).setFirebaseTokenListener(MainActivity.this, new GoogleUtils.FirebaseTokenListener() {
@Override
public void onResultToken(String token) {
L.e("GoogleUtils.newInstance:onResultToken:" + token);
PushManager.getInstance().onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
}
});
GoogleUtils.newInstance(MainActivity.this).initFireToken(MainActivity.this);
}
//华为推送
// getToken();
@ -460,51 +454,49 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
return null;
}
});
RxView.clicks(findViewById(R.id.banner_click))
.throttleFirst(2, TimeUnit.SECONDS)
.subscribe(new Observer<Unit>() {
RxView.clicks(findViewById(R.id.banner_click)).throttleFirst(2, TimeUnit.SECONDS).subscribe(new Observer<Unit>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Unit unit) {
MobclickAgent.onEvent(mContext, "home_page_to_recommend", "首页点击右下角去推荐直播间按钮");
String Uid = floatBanner.getUid();
LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Unit unit) {
MobclickAgent.onEvent(mContext, "home_page_to_recommend", "首页点击右下角去推荐直播间按钮");
String Uid = floatBanner.getUid();
LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
RouteUtil.forwardUserHome(mContext, Uid, 0);
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
}
});
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
@Override
public void onCheckError(String contextError) {
}
});
} else {
RouteUtil.forwardUserHome(mContext, Uid, 0);
}
}
});
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
//选中监听
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
@ -517,8 +509,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
floatRedPacket.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
isfloatBannernet = false;
if (mainMessageViewHolder != null)
mainMessageViewHolder.onResume();
if (mainMessageViewHolder != null) mainMessageViewHolder.onResume();
} else {
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
@ -592,37 +583,36 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "quick_look");
MainNetManager.get(mContext)
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@SuppressLint("SetTextI18n")
@Override
public void onSuccess(AnchorRecommendModel data) {
if (isFinishing()) return;
if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.setVisibility(View.VISIBLE);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
floatBanner.showBanner(data.getList());
} else {
floatBanner.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
}
if (data.getShowRedPacket() == 0) {
floatRedPacket.setVisibility(View.GONE);
} else {
floatRedPacket.setVisibility(View.VISIBLE);
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
}
MainNetManager.get(mContext).anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@SuppressLint("SetTextI18n")
@Override
public void onSuccess(AnchorRecommendModel data) {
if (isFinishing()) return;
if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.setVisibility(View.VISIBLE);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
floatBanner.showBanner(data.getList());
} else {
floatBanner.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
}
if (data.getShowRedPacket() == 0) {
floatRedPacket.setVisibility(View.GONE);
} else {
floatRedPacket.setVisibility(View.VISIBLE);
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
}
}
}
@Override
public void onError(String error) {
ToastUtil.show(mContext.getString(R.string.net_error));
}
});
@Override
public void onError(String error) {
ToastUtil.show(mContext.getString(R.string.net_error));
}
});
}
@ -778,12 +768,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
if (!VersionUtil.isLatest(configBean.getVersion())) {
if (!APKManager.get().getApkVerNew()) {
new XPopup.Builder(mContext)
.isDestroyOnDismiss(true)
.dismissOnBackPressed(false) // 按返回键是否关闭弹窗默认为true
new XPopup.Builder(mContext).isDestroyOnDismiss(true).dismissOnBackPressed(false) // 按返回键是否关闭弹窗默认为true
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗默认为true
.asCustom(new APKUpdateCustomPopup(mContext, false))
.show();
.asCustom(new APKUpdateCustomPopup(mContext, false)).show();
}
} else {
requestBonus();
@ -1087,14 +1074,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private void notifyLiveFlot() {
if (startListNotifyList.iterator().hasNext()) {
AnchorStartLiveBean bean = startListNotifyList.iterator().next();
new AnchorStartLiveNotifyDialog(mContext, bean)
.setOnDismissListener(dialog -> {
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot();
}
})
.showDialog();
new AnchorStartLiveNotifyDialog(mContext, bean).setOnDismissListener(dialog -> {
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot();
}
}).showDialog();
}
}
@ -1448,9 +1433,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveFloatEvent(LiveFloatEvent event) {
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
new Handler().post(() -> LiveFloatView.getInstance()
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
.builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
new Handler().post(() -> LiveFloatView.getInstance().cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()).builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
}
}

View File

@ -2,9 +2,11 @@ package com.yunbao.main.activity;
import android.content.Intent;
import android.net.Uri;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
@ -62,6 +64,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
private String mCoinName;
private String mGoldCoinName;
List<CoinBean> listPro;//商品列表
@Override
protected int getLayoutId() {
return R.layout.activity_coin;
@ -105,10 +108,10 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
goldCoinNameTV.setText(String.format(mContext.getString(R.string.wallet_gold_name), mGoldCoinName));
mBalance = findViewById(R.id.coin);
mTvGoldCoinNum = findViewById(R.id.tvGoldCoinNum);
View btnChargeExplain= findViewById(R.id.btn_charge_explain);
if (CommonAppConfig.IS_GOOGLE_PLAY){
View btnChargeExplain = findViewById(R.id.btn_charge_explain);
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
btnChargeExplain.setVisibility(View.GONE);
}else {
} else {
btnChargeExplain.setVisibility(View.VISIBLE);
}
@ -139,6 +142,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
mPayPresenter.checkPayResult();
}
}
@Override
public void onFailed() {
}
@ -167,24 +171,26 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
String goldNum = obj.getString("gold");
mGoldCoinNum = Long.parseLong(goldNum);
mTvGoldCoinNum.setText(goldNum);
}catch (Exception e){e.printStackTrace();}
} catch (Exception e) {
e.printStackTrace();
}
//支付方式列表
List<CoinPayBean> payList = JSON.parseArray(obj.getString("paylist"), CoinPayBean.class);
if (mPayAdapter != null) {
mPayAdapter.setList(payList);
}
//商品列表
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
if (mAdapter != null) {
mAdapter.setList(listPro);
}
if (payList != null && payList.size()>0){
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()){
if (payList != null && payList.size() > 0) {
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()) {
EventBus.getDefault().post(payList.get(0));
}
}
if (mPayPresenter != null){
if (mPayPresenter != null) {
mPayPresenter.setBalanceValue(mBalanceValue);
mPayPresenter.setAliPartner(obj.getString("aliapp_partner"));
mPayPresenter.setAliSellerId(obj.getString("aliapp_seller_id"));
@ -223,10 +229,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
if (TextUtils.isEmpty(href)) {
String money = bean.getMoney();
String goodsName = StringUtil.contact(bean.getCoin(), mCoinName);
String orderParams = StringUtil.contact(
"&uid=", CommonAppConfig.getInstance().getUid(),
"&changeid=", bean.getId(),
"&coin=", bean.getCoin());
String orderParams = StringUtil.contact("&uid=", CommonAppConfig.getInstance().getUid(), "&changeid=", bean.getId(), "&coin=", bean.getCoin());
// if(coinPayBean.getId().equals(Constants.PAY_TYPE_HW)
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYSSION)
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYPAL)
@ -240,8 +243,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
// );
// }
orderParams=StringUtil.contact(orderParams,
"&money=", bean.getMoney_usd());
orderParams = StringUtil.contact(orderParams, "&money=", bean.getMoney_usd());
mPayPresenter.pay(coinPayBean.getId(), "5", goodsName, orderParams);
} else {
@ -253,7 +255,6 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCoinChangeEvent(CoinChangeEvent e) {
if (mBalance != null) {
@ -267,28 +268,32 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGoogleLimitEvent(CoinPayBean bean) {
if (listPro==null || listPro.size()<=0){
if (listPro == null || listPro.size() <= 0) {
return;
}
int size=listPro.size();
int size = listPro.size();
int indexTmp;
if (bean!=null){
if (bean != null) {
//谷歌支付不显示大额价格
if ("google".equals(bean.getId())){
String numS= bean.getPriceNum();
int num = 7;
if (numS != null && !numS.isEmpty()){
try {
num= Integer.parseInt(bean.getPriceNum());
}catch (Exception e){ e.printStackTrace(); }
}
indexTmp=num;
}else { indexTmp=size; }
if (indexTmp <= size){
List<CoinBean> listTmp=listPro.subList(0,indexTmp);
mAdapter.setList(listTmp);
}
}
if ("google".equals(bean.getId())) {
String numS = bean.getPriceNum();
int num = 7;
if (numS != null && !numS.isEmpty()) {
try {
num = Integer.parseInt(bean.getPriceNum());
} catch (Exception e) {
e.printStackTrace();
}
}
indexTmp = num;
} else {
indexTmp = size;
}
if (indexTmp <= size) {
List<CoinBean> listTmp = listPro.subList(0, indexTmp);
mAdapter.setList(listTmp);
}
}
}
@ -297,16 +302,14 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
int i = v.getId();
if (i == R.id.btn_tip) {
//充值协议
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_PRIVCAY + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),false);
}else if (i == R.id.btn_charge_explain) {
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_PRIVCAY + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), false);
} else if (i == R.id.btn_charge_explain) {
//充值说明
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_EXPLAIN + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),false);
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_EXPLAIN + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), false);
}
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);

View File

@ -1,7 +1,7 @@
package com.yunbao.main.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
@ -12,6 +12,7 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
@ -20,6 +21,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.PurchasesResponseListener;
import com.google.gson.Gson;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.activity.AbsActivity;
@ -27,10 +29,12 @@ import com.yunbao.common.fragment.LoadingDialog;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.pay.hw.HwBuilder;
import com.yunbao.common.utils.GoogleBillingUtilNew;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R;
import com.yunbao.main.http.MainHttpUtil;
import com.yunbao.main.utils.HXLinePagerIndicator;
import net.lucode.hackware.magicindicator.MagicIndicator;
@ -43,6 +47,9 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTit
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.List;
import java.util.Locale;
@ -52,6 +59,10 @@ public class MyWalletActivity extends AbsActivity {
static MyWalletActivity mw;
Fragment[] fragments = null;
private Handler payHandler = new Handler();
public static String orderId;
HwBuilder hwBuilder;
@Override
protected int getLayoutId() {
@ -64,7 +75,11 @@ public class MyWalletActivity extends AbsActivity {
super.main();
mw = MyWalletActivity.this;
setTitle(mContext.getString(R.string.wallet));
GoogleBillingUtilNew.getInstance().initGooglePay(mContext);
hwBuilder = new HwBuilder(MyWalletActivity.this);
vp_content = (ViewPager) findViewById(R.id.vp_content);
TextView rView = (TextView) findViewById(R.id.rView);
findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE);
@ -75,69 +90,62 @@ public class MyWalletActivity extends AbsActivity {
LoadingDialog loadingDialog = new LoadingDialog();
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
loadingDialog.setShowText(getString(R.string.order_query));
GoogleBillingUtilNew.getInstance().queryPurchasesAsync(new PurchasesResponseListener() {
@Override
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
if (list.size() == 0) {
loadingDialog.setShowText(getString(R.string.order_query_success));
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
} else {
loadingDialog.setShowText(getString(R.string.order_query));
//消费订单
GoogleBillingUtilNew.getInstance().consume(list);
for (int i = 0; i < list.size(); i++) {
int finalI = i;
payHandler.post(new Runnable() {
@Override
public void run() {
//谷歌掉单处理
CommonHttpUtil
.Google_sec_pay(list.get(finalI).getPurchaseToken(),
list.get(finalI).getOrderId(),
list.get(finalI).getProducts().get(0),
new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (finalI == list.size() - 1) {
loadingDialog.setShowText(getString(R.string.order_query_success));
loadingDialog.dismiss();
}
ToastUtil.show("充值已到账");
finish();
}
});
}
});
}
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
GoogleBillingUtilNew.getInstance().queryPurchasesAsync(new PurchasesResponseListener() {
@Override
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
if (list.size() == 0) {
loadingDialog.setShowText(getString(R.string.order_query_success));
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
} else {
loadingDialog.setShowText(getString(R.string.order_query));
//消费订单
GoogleBillingUtilNew.getInstance().consume(list);
for (int i = 0; i < list.size(); i++) {
int finalI = i;
payHandler.post(new Runnable() {
@Override
public void run() {
//谷歌掉单处理
CommonHttpUtil.Google_sec_pay(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), list.get(finalI).getProducts().get(0), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (finalI == list.size() - 1) {
loadingDialog.setShowText(getString(R.string.order_query_success));
loadingDialog.dismiss();
}
ToastUtil.show("充值已到账");
finish();
}
});
}
});
}
}
}
}
});
});
} else {
hwBuilder.consume();
loadingDialog.setShowText(getString(R.string.order_query_success));
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
}
});
WalletFragment walletFragment;
GoogleFragment googleFragment1;
GoogleFragment googleFragment2;
WalletFragment walletFragment = null;
GoogleFragment googleFragment1 = null;
GoogleFragment googleFragment2 = null;
HuaWeiFragment huaWeiFragment1 = null;
HuaWeiFragment huaWeiFragment2 = null;
final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)};
if (getIntent().getStringExtra("tag") != null) {
Log.i("tss", "首充");
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
googleFragment1 = new GoogleFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment1.setArguments(bundle1);
googleFragment2 = new GoogleFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
} else {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
//google
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
@ -153,9 +161,75 @@ public class MyWalletActivity extends AbsActivity {
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
//华为
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
huaWeiFragment1 = new HuaWeiFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment1.setArguments(bundle1);
huaWeiFragment2 = new HuaWeiFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment2.setArguments(bundle2);
} else {
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
googleFragment1 = new GoogleFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment1.setArguments(bundle1);
googleFragment2 = new GoogleFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
}
} else {
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
googleFragment1 = new GoogleFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment1.setArguments(bundle1);
googleFragment2 = new GoogleFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
huaWeiFragment1 = new HuaWeiFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment1.setArguments(bundle1);
huaWeiFragment2 = new HuaWeiFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment2.setArguments(bundle2);
} else {
Log.i("tss", "不是首充");
//链接版本
@ -173,30 +247,16 @@ public class MyWalletActivity extends AbsActivity {
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
} else {
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
googleFragment1 = new GoogleFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment1.setArguments(bundle1);
googleFragment2 = new GoogleFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
googleFragment2.setArguments(bundle2);
}
}
fragments = new Fragment[]{googleFragment1,
googleFragment2,
walletFragment};
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
fragments = new Fragment[]{huaWeiFragment1, huaWeiFragment2, walletFragment};
} else {
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
}
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
CommonNavigator commonNavigator = new CommonNavigator(this);
@ -266,10 +326,69 @@ public class MyWalletActivity extends AbsActivity {
magicIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
vp_content.setCurrentItem(getIntent().getIntExtra("p", 0));
if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
if (hwBuilder != null) {
hwBuilder.consume();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 6666) {
if (data == null) {
Log.e("TAG", "onActivityResult__data is null");
return;
}
JSONObject object = hwBuilder.getPayResult(data);
int code;
String inAppPurchaseData;
String inAppPurchaseDataSignature;
try {
code = object.getInt("code");
Log.e("TAG", "code:" + code);
if (hwBuilder != null) {
hwBuilder.consume();
}
switch (code) {
case 60000:
ToastUtil.show("支付取消");
break;
case -1:
case 60051:
ToastUtil.show("支付失败");
break;
case 0:
ToastUtil.show("支付成功");
inAppPurchaseData = object.getString("inAppPurchaseData");
inAppPurchaseDataSignature = object.getString("inAppPurchaseDataSignature");
MainHttpUtil.hwNotify(inAppPurchaseData, inAppPurchaseDataSignature, orderId, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
finish();
}
}
});
break;
default:
break;
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
}
public static void dis() {
mw.finish();
}
}

View File

@ -25,7 +25,6 @@ import com.alibaba.fastjson.JSON;
import com.binioter.guideview.Guide;
import com.binioter.guideview.GuideBuilder;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.lzf.easyfloat.EasyFloat;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
@ -322,7 +321,6 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
WebViewActivity.forward(mContext, userBean.getLink(),false);

View File

@ -123,8 +123,8 @@ public class RegisterActivity extends AbsActivity {
getUuidDevice();
getPromoCode();
mGetCode =mContext.getString(R.string.reg_get_code);
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
mGetCode = mContext.getString(R.string.reg_get_code);
mGetCodeAgain = mContext.getString(R.string.reg_get_code_again);
mTvCountryCodeClick();
mEditPhone.addTextChangedListener(new TextWatcher() {
@Override
@ -240,7 +240,7 @@ public class RegisterActivity extends AbsActivity {
webSettings.setJavaScriptEnabled(true);
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html"+ "?isZh=" + (WordUtil.isNewZh() ? "1" : 0));
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html" + "?isZh=" + (WordUtil.isNewZh() ? "1" : 0));
}
@ -282,9 +282,9 @@ public class RegisterActivity extends AbsActivity {
} else if (i == R.id.btn_register) {
register();
} else if (i == R.id.btn_tip2) {
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
} else if (i == R.id.btn_tip3) {
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
}
}
@ -364,12 +364,12 @@ public class RegisterActivity extends AbsActivity {
mDialog.show();
}
String ti = "";
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")) {
ti = "";
}else{
} else {
ti = edit_invitecode_2.getText().toString().trim();
}
MainHttpUtil.register(UserID,ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
MainHttpUtil.register(UserID, ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
@ -404,25 +404,25 @@ public class RegisterActivity extends AbsActivity {
//获取自定义数据
if (appData.getData() != null && !appData.getData().equals("")) {
JSONObject data = JSON.parseObject(appData.getData());
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
yqm_view.setVisibility(View.VISIBLE);
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if(code == 201){
if (code == 201) {
edit_invitecode_2.setText("此設備已註冊");
edit_invitecode_2.setEnabled(false);
}
}
});
}else{
yqm_view.setVisibility(View.GONE);
//推广的码
} else {
yqm_view.setVisibility(View.GONE);
//推广的码
mPromoCode = data.getString("admin_id") + "";
//用户的码
UserID = data.getString("user_id") + "";
}
Log.d("OpenInstall", UserID+"appData.getData()1111= " + mPromoCode);
Log.d("OpenInstall", UserID + "appData.getData()1111= " + mPromoCode);
}
}
});
@ -485,31 +485,28 @@ public class RegisterActivity extends AbsActivity {
@Override
public void run() {
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
.params("uid", userInfo.getId())
.params("token", userInfo.getToken())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info[0] != null) {
JSONObject obj = JSON.parseObject(info[0]);
IMLoginManager.get(activity).setisNewUserOne(true);
IMLoginManager.get(activity).setNewUserGif(true);
if (obj.containsKey("home_zdy_img_us")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
}
gotoLive(obj.getString("anchor_id"));
if (obj.containsKey("home_zdy_pop")) {
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
}
jumpMain(false);
} else {
jumpMain(false);
}
EventBus.getDefault().post(new RegSuccessEvent());
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").params("uid", userInfo.getId()).params("token", userInfo.getToken()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info[0] != null) {
JSONObject obj = JSON.parseObject(info[0]);
IMLoginManager.get(activity).setisNewUserOne(true);
IMLoginManager.get(activity).setNewUserGif(true);
if (obj.containsKey("home_zdy_img_us")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
}
});
gotoLive(obj.getString("anchor_id"));
if (obj.containsKey("home_zdy_pop")) {
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
}
jumpMain(false);
} else {
jumpMain(false);
}
EventBus.getDefault().post(new RegSuccessEvent());
}
});
}
};

View File

@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.glide.ImgLoader;
@ -86,7 +85,6 @@ public class SystemMessageAdapter extends RecyclerView.Adapter {
type = model1.getType();
netHandler.post(updataRunable);
if (model1.getTitle().equals("在線客服")) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
}
if (!TextUtils.isEmpty(model1.getLink())) {

View File

@ -60,10 +60,16 @@ public class MainHttpUtil {
*/
public static void loginByThird(String openid, String nicename, String avatar, String type, HttpCallback callback) {
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
String appSource = "3";
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
appSource = "1";
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
appSource = "2";
}
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
.params("openid", openid)
.params("nicename", nicename)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
.params("app_source", appSource)
.params("avatar", avatar)
.params("type", type)
.params("source", DEVICE)
@ -80,9 +86,15 @@ public class MainHttpUtil {
public static void loginByThird(String UserID, String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) {
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
String appSource = "3";
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
appSource = "1";
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
appSource = "2";
}
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
.params("openid", openid)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
.params("app_source", appSource)
.params("admin_id", promoCode)
.params("uuid_Device", uuidDevice)
.params("nicename", nicename)
@ -93,7 +105,7 @@ public class MainHttpUtil {
.params("sign", sign)
.params("lastlogindevice", "Android")
.params("pushid", "")
.params("langue", WordUtil.isNewZh()?"chinese":"english")
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
.execute(callback);
}
@ -574,9 +586,15 @@ public class MainHttpUtil {
* 手机注册接口---增加参数推广码,手机唯一标识,国家代码
*/
public static void register(String UserID, String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) {
String appSource = "3";
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
appSource = "1";
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
appSource = "2";
}
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
.params("user_login", user_login)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
.params("app_source", appSource)
//增加参数推广码
.params("user_activation_key", promo_code)
.params("admin_id", promo_code)
@ -590,7 +608,7 @@ public class MainHttpUtil {
.params("code", code)
.params("source", DEVICE)
.params("invitation_code", invitecode)
.params("langue", WordUtil.isNewZh()?"chinese":"english")
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
.execute(callback);
}
@ -740,6 +758,18 @@ public class MainHttpUtil {
.execute(callback);
}
/**
* 订单通知
*/
public static void hwNotify(String InAppPurchaseData, String Signature, String orderId, HttpCallback callback) {
HttpClient.getInstance().get("Charge.HuaweiNotify", "Charge.HuaweiNotify")
.params("InAppPurchaseData", InAppPurchaseData)
.params("InAppDataSignature", Signature)
.params("SelfOrderId", orderId)
.params("PackageName", "pd")
.execute(callback);
}
}

View File

@ -20,7 +20,6 @@ import com.alibaba.fastjson.JSON;
import com.binioter.guideview.Guide;
import com.binioter.guideview.GuideBuilder;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
@ -277,7 +276,6 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
MobclickAgent.onEvent(mContext, "information_system_service", "在線客服");
type = userBean.getType();
netHandler.post(systemNumberRunnable);
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
// WebViewActivity.forward(mContext, userBean.getLink());

View File

@ -1,6 +1,8 @@
include ':app', ':video', ':common', ':main', ':live', ':lib_country_code'
include ':app', ':video', ':common', ':main', ':live', ':lib_country_code'
include ':FaceUnity'
//include ':baidu'
//include ':recognizer'//
include ':Share'
include ':pluginsForAnchor'
include ':lib_huawei'
include ':lib_google'