lib_google
lib_huawei
This commit is contained in:
parent
56ae033523
commit
238181deca
@ -34,14 +34,14 @@ public class ShareBuilder {
|
|||||||
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
||||||
anchorId,
|
anchorId,
|
||||||
shareUid,
|
shareUid,
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
) ;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createInviteLink(String shareUid) {
|
public static String createInviteLink(String shareUid) {
|
||||||
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
||||||
shareUid,
|
shareUid,
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InvitePopDialog setUrl(String data) {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,21 +26,21 @@
|
|||||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||||
},
|
},
|
||||||
"client":{
|
"client":{
|
||||||
"cp_id":"30086000612391734",
|
"cp_id":"30852000032486141",
|
||||||
"product_id":"99536292102564216",
|
"product_id":"388421841221767494",
|
||||||
"client_id":"964994320723627840",
|
"client_id":"1283893262452580800",
|
||||||
"client_secret":"6D5FE29D85B967D3A66BDCD473641E4C7B5524F7F4935CA0EF4A842730C3402D",
|
"client_secret":"17BC070420691D35650C694230D6348075CB549F7BBA94EDD49FA9E61A9E5434",
|
||||||
"project_id":"99536292102564216",
|
"project_id":"388421841221767494",
|
||||||
"app_id":"106936673",
|
"app_id":"109612651",
|
||||||
"api_key":"DAEDADYGta/0O4ZSdrnug52NgC67/w/RIyTq9A8LyAY0+mp6g6XeJDbxugpluFPLAhaqjaMs5c0PLnRx14UzWbPPADgi1EqihbWLoA==",
|
"api_key":"DAEDAAlBbTFuTuyQWQsyYBZLuyjALH9Y9BNFkVZl1GhI0tRaa6HF1LgzXWy2MZiSFrmpbn1aAvcvzP6aKZtR6MVikS8V4SbBlYUPfQ==",
|
||||||
"package_name":"com.pdlive.shayu"
|
"package_name":"com.pdlive.shayu"
|
||||||
},
|
},
|
||||||
"oauth_client":{
|
"oauth_client":{
|
||||||
"client_id":"106936673",
|
"client_id":"109612651",
|
||||||
"client_type":1
|
"client_type":1
|
||||||
},
|
},
|
||||||
"app_info":{
|
"app_info":{
|
||||||
"app_id":"106936673",
|
"app_id":"109612651",
|
||||||
"package_name":"com.pdlive.shayu"
|
"package_name":"com.pdlive.shayu"
|
||||||
},
|
},
|
||||||
"service":{
|
"service":{
|
||||||
@ -53,6 +53,10 @@
|
|||||||
"resource_id":"p1",
|
"resource_id":"p1",
|
||||||
"channel_id":""
|
"channel_id":""
|
||||||
},
|
},
|
||||||
|
"edukit":{
|
||||||
|
"edu_url":"edukit.cloud.huawei.com.cn",
|
||||||
|
"dh_url":"edukit.cloud.huawei.com.cn"
|
||||||
|
},
|
||||||
"search":{
|
"search":{
|
||||||
"url":"https://search-drcn.cloud.huawei.com"
|
"url":"https://search-drcn.cloud.huawei.com"
|
||||||
},
|
},
|
||||||
@ -77,15 +81,15 @@
|
|||||||
{
|
{
|
||||||
"package_name":"com.pdlive.shayu",
|
"package_name":"com.pdlive.shayu",
|
||||||
"client":{
|
"client":{
|
||||||
"app_id":"106936673"
|
"app_id":"109612651"
|
||||||
},
|
},
|
||||||
"app_info":{
|
"app_info":{
|
||||||
"package_name":"com.pdlive.shayu",
|
"package_name":"com.pdlive.shayu",
|
||||||
"app_id":"106936673"
|
"app_id":"109612651"
|
||||||
},
|
},
|
||||||
"oauth_client":{
|
"oauth_client":{
|
||||||
"client_type":1,
|
"client_type":1,
|
||||||
"client_id":"106936673"
|
"client_id":"109612651"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -170,8 +170,10 @@ android {
|
|||||||
}
|
}
|
||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
def isGoogle = "link"
|
def isGoogle = "link"
|
||||||
if (rootProject.ext.manifestPlaceholders.isGooglePlay) {
|
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) {
|
||||||
isGoogle = "Google"
|
isGoogle = "Google"
|
||||||
|
} else if(rootProject.ext.manifestPlaceholders.isGooglePlay == 2){
|
||||||
|
isGoogle = "Huawei"
|
||||||
}
|
}
|
||||||
def isPlugin = "all"
|
def isPlugin = "all"
|
||||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
@ -266,8 +268,8 @@ dependencies {
|
|||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||||
|
|
||||||
implementation platform('com.google.firebase:firebase-bom:30.5.0')
|
//implementation platform('com.google.firebase:firebase-bom:30.5.0')
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
//implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
|
|
||||||
//直播
|
//直播
|
||||||
api project(':main')
|
api project(':main')
|
||||||
|
@ -194,12 +194,13 @@
|
|||||||
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<!-- <meta-data-->
|
|
||||||
<!-- android:name="com.huawei.hms.client.appid"-->
|
<meta-data
|
||||||
<!-- android:value="106936673"/>-->
|
android:name="com.huawei.hms.client.appid"
|
||||||
<!-- <meta-data-->
|
android:value="109612651" />
|
||||||
<!-- android:name="com.huawei.hms.client.cpid"-->
|
<meta-data
|
||||||
<!-- android:value="30086000612391734"/>-->
|
android:name="com.huawei.hms.client.cpid"
|
||||||
|
android:value="30852000032486141" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -24,9 +24,6 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.blankj.utilcode.util.Utils;
|
import com.blankj.utilcode.util.Utils;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.fm.openinstall.OpenInstall;
|
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.shayu.phonelive.utils.LogUtils;
|
||||||
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
||||||
import com.tencent.imsdk.v2.V2TIMManager;
|
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.RecommendLiveRoom;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
|
import com.yunbao.common.utils.GoogleUtils;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.SpUtil;
|
import com.yunbao.common.utils.SpUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.live.socket.SocketReceiveBean;
|
import com.yunbao.live.socket.SocketReceiveBean;
|
||||||
import com.yunbao.live.socket.SocketRyClient;
|
import com.yunbao.live.socket.SocketRyClient;
|
||||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||||
@ -145,7 +142,6 @@ public class AppContext extends CommonAppContext {
|
|||||||
sInstance = this;
|
sInstance = this;
|
||||||
L.setDeBug(BuildConfig.DEBUG);
|
L.setDeBug(BuildConfig.DEBUG);
|
||||||
AppEventsLogger.activateApp(this);
|
AppEventsLogger.activateApp(this);
|
||||||
FirebaseAnalytics.getInstance(this);
|
|
||||||
|
|
||||||
File httpCacheDir = new File(getCacheDir(), "https");
|
File httpCacheDir = new File(getCacheDir(), "https");
|
||||||
try {
|
try {
|
||||||
@ -170,8 +166,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
|
|
||||||
|
|
||||||
//友盟正式初始化
|
//友盟正式初始化
|
||||||
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE,
|
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
|
||||||
"64e40ee55488fe7b3afa2c96");
|
|
||||||
|
|
||||||
//集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能
|
//集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能
|
||||||
MobclickAgent.setCatchUncaughtExceptions(false);
|
MobclickAgent.setCatchUncaughtExceptions(false);
|
||||||
@ -212,9 +207,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
if (content.getContent().contains("_method_")) {
|
if (content.getContent().contains("_method_")) {
|
||||||
msg.obj = content.getContent();
|
msg.obj = content.getContent();
|
||||||
//观众页面
|
//观众页面
|
||||||
if (SocketRyClient.mSocketHandler != null
|
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
||||||
&& (TextUtils.equals("__system__", message.getTargetId())
|
|
||||||
|| ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
|
||||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||||
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
||||||
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
|
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
|
||||||
@ -313,40 +306,37 @@ public class AppContext extends CommonAppContext {
|
|||||||
* 注册全局异常捕获,有需要时可以在onCreate调用
|
* 注册全局异常捕获,有需要时可以在onCreate调用
|
||||||
*/
|
*/
|
||||||
private void registerError() {
|
private void registerError() {
|
||||||
NeverCrashUtils.getInstance()
|
NeverCrashUtils.getInstance().setDebugMode(BuildConfig.DEBUG).setMainCrashHandler((t, e) -> {
|
||||||
.setDebugMode(BuildConfig.DEBUG)
|
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
.setMainCrashHandler((t, e) -> {
|
e.printStackTrace();
|
||||||
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
AppManager.runDebugCode(() -> {
|
||||||
e.printStackTrace();
|
//闪退后finish所有Activity并且杀死进程
|
||||||
AppManager.runDebugCode(() -> {
|
for (WeakReference<Activity> activity : activities) {
|
||||||
//闪退后finish所有Activity并且杀死进程
|
if (activity != null && activity.get() != null) {
|
||||||
for (WeakReference<Activity> activity : activities) {
|
activity.get().finish();
|
||||||
if (activity != null && activity.get() != null) {
|
}
|
||||||
activity.get().finish();
|
}
|
||||||
}
|
Process.killProcess(Process.myPid());
|
||||||
}
|
System.exit(0);
|
||||||
Process.killProcess(Process.myPid());
|
setFirebaseCrashData();
|
||||||
System.exit(0);
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||||
setFirebaseCrashData();
|
throw new RuntimeException(e);
|
||||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
}, 100);
|
||||||
throw new RuntimeException(e);
|
});
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
}).setUncaughtCrashHandler((t, e) -> {
|
||||||
.setUncaughtCrashHandler((t, e) -> {
|
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}).register(this);
|
||||||
})
|
|
||||||
.register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerFirebaseCrash() {
|
public void registerFirebaseCrash() {
|
||||||
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
|
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FirebaseAnalytics.getInstance(this);
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
FirebaseApp.initializeApp(this);
|
GoogleUtils.newInstance(this).initializeApp(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,21 +345,5 @@ public class AppContext extends CommonAppContext {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String uid = CommonAppConfig.getInstance().getUid();
|
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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import android.os.Looper;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
||||||
import com.yunbao.common.BuildConfig;
|
import com.yunbao.common.BuildConfig;
|
||||||
import com.yunbao.common.bean.CrashSaveBean;
|
import com.yunbao.common.bean.CrashSaveBean;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
@ -108,7 +107,6 @@ public class NeverCrashUtils {
|
|||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
AppContext.setFirebaseCrashData();
|
AppContext.setFirebaseCrashData();
|
||||||
FirebaseCrashlytics.getInstance().recordException(e);
|
|
||||||
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
|
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");
|
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
|
||||||
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
package com.shayu.phonelive.utils;
|
package com.shayu.phonelive.utils;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
@ -108,3 +109,4 @@ public class MyNotificationService extends FirebaseMessagingService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -12,6 +12,7 @@ buildscript {
|
|||||||
maven { url 'https://maven.fabric.io/public' }
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
maven { url 'http://maven.faceunity.com/repository/maven-public/' }//美颜库
|
maven { url 'http://maven.faceunity.com/repository/maven-public/' }//美颜库
|
||||||
maven { url 'https://repo1.maven.org/maven2/' }//埋点
|
maven { url 'https://repo1.maven.org/maven2/' }//埋点
|
||||||
|
maven {url 'https://developer.huawei.com/repo/'}
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
@ -24,6 +25,7 @@ buildscript {
|
|||||||
classpath 'com.google.gms:google-services:4.3.3'
|
classpath 'com.google.gms:google-services:4.3.3'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
||||||
classpath "com.alibaba:arouter-register:1.0.2"
|
classpath "com.alibaba:arouter-register:1.0.2"
|
||||||
|
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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.squareup.picasso:picasso:2.5.2'
|
||||||
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
||||||
api files('libs/liteavsdk.jar')
|
api files('libs/liteavsdk.jar')
|
||||||
@ -180,8 +184,7 @@ dependencies {
|
|||||||
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
||||||
//loading样式库
|
//loading样式库
|
||||||
api 'com.wang.avi:library:2.1.3'
|
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'
|
// api 'com.huawei.hms:push:4.0.2.300'
|
||||||
implementation 'com.github.tajchert:WaitingDots:0.6.1'
|
implementation 'com.github.tajchert:WaitingDots:0.6.1'
|
||||||
//悬浮窗
|
//悬浮窗
|
||||||
@ -206,4 +209,11 @@ dependencies {
|
|||||||
|
|
||||||
// 多语言语音识别扩展库(可选)
|
// 多语言语音识别扩展库(可选)
|
||||||
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
||||||
|
|
||||||
|
//华为支付插件包
|
||||||
|
api project(':lib_huawei')
|
||||||
|
|
||||||
|
//google插件包
|
||||||
|
api project(':lib_google')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class CommonAppConfig {
|
|||||||
//域名
|
//域名
|
||||||
public static final String HOST = getMetaDataString("SERVER_HOST");
|
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");
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人中心功能列表
|
* 个人中心功能列表
|
||||||
*/
|
*/
|
||||||
|
@ -173,106 +173,97 @@ public class CommonHttpUtil {
|
|||||||
}
|
}
|
||||||
Log.i("来了", lang);
|
Log.i("来了", lang);
|
||||||
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
||||||
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
|
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG).params("langue", lang).params("version", "" + VersionUtil.getVersion()).params("from", "android").params("appType", "1").execute(new HttpCallback() {
|
||||||
.params("langue", lang)
|
@Override
|
||||||
.params("version", "" + VersionUtil.getVersion())
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
.params("from", "android")
|
if (code == 0 && info.length > 0) {
|
||||||
.params("appType", "1")
|
try {
|
||||||
.execute(new HttpCallback() {
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
@Override
|
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
CommonAppConfig.getInstance().setConfig(bean);
|
||||||
if (code == 0 && info.length > 0) {
|
CommonAppConfig.getInstance().setLevel(obj.getString("level"));
|
||||||
try {
|
CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor"));
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time");
|
||||||
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time");
|
||||||
CommonAppConfig.getInstance().setConfig(bean);
|
//解析粉丝徽章
|
||||||
CommonAppConfig.getInstance().setLevel(obj.getString("level"));
|
CommonAppConfig.getInstance().setAnchorFansMedal(obj.getString("levelfans"));
|
||||||
CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor"));
|
SpUtil.getInstance().setStringValue(SpUtil.CONFIG, info[0]);
|
||||||
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() {
|
|
||||||
if (commonCallback != null) {
|
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端互通的时候用
|
* QQ登录的时候 获取unionID 与PC端互通的时候用
|
||||||
*/
|
*/
|
||||||
public static void getQQLoginUnionID(String accessToken, final CommonCallback<String> commonCallback) {
|
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")
|
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() {
|
||||||
.tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID)
|
@Override
|
||||||
.execute(new StringCallback() {
|
public void onSuccess(Response<String> response) {
|
||||||
@Override
|
if (commonCallback != null) {
|
||||||
public void onSuccess(Response<String> response) {
|
String data = response.body();
|
||||||
if (commonCallback != null) {
|
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
||||||
String data = response.body();
|
L.e("getQQLoginUnionID------>" + data);
|
||||||
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
JSONObject obj = JSON.parseObject(data);
|
||||||
L.e("getQQLoginUnionID------>" + data);
|
commonCallback.callback(obj.getString("unionid"));
|
||||||
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));
|
ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HttpClient.getInstance().get("User.setAttents", tag)
|
HttpClient.getInstance().get("User.setAttents", tag).params("touid", touid).execute(new HttpCallback() {
|
||||||
.params("touid", touid)
|
@Override
|
||||||
.execute(new HttpCallback() {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
@Override
|
if (code == 0 && info.length > 0 || code == 1001) {
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
||||||
if (code == 0 && info.length > 0 || code == 1001) {
|
|
||||||
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
|
||||||
/* if (code == 1001) {
|
/* if (code == 1001) {
|
||||||
if (WordUtil.isNewZh()) {
|
if (WordUtil.isNewZh()) {
|
||||||
ToastUtil.show("粉絲團等級已清零,待領取獎勵已自動領取至【個性裝扮】");
|
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]");
|
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));
|
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.callback(isAttention);
|
callback.callback(isAttention);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,15 +327,14 @@ public class CommonHttpUtil {
|
|||||||
*/
|
*/
|
||||||
public static void getBalance(HttpCallback callback) {
|
public static void getBalance(HttpCallback callback) {
|
||||||
String isGoogle;
|
String isGoogle;
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
isGoogle = "1";
|
isGoogle = "1";
|
||||||
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
|
isGoogle = "2";
|
||||||
} else {
|
} else {
|
||||||
isGoogle = "-1";
|
isGoogle = "-1";
|
||||||
}
|
}
|
||||||
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE)
|
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE).params("type", 0).params("isGooglePay", isGoogle).execute(callback);
|
||||||
.params("type", 0)
|
|
||||||
.params("isGooglePay", isGoogle)
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,8 +343,7 @@ public class CommonHttpUtil {
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public static void getAliOrder(String parmas, HttpCallback callback) {
|
public static void getAliOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -367,8 +352,7 @@ public class CommonHttpUtil {
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public static void getWxOrder(String parmas, HttpCallback callback) {
|
public static void getWxOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -379,8 +363,7 @@ public class CommonHttpUtil {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static void getCashierOrder(String parmas, HttpCallback callback) {
|
public static void getCashierOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -392,8 +375,7 @@ public class CommonHttpUtil {
|
|||||||
|
|
||||||
|
|
||||||
public static void getWxH5Order(String parmas, HttpCallback callback) {
|
public static void getWxH5Order(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -401,8 +383,7 @@ public class CommonHttpUtil {
|
|||||||
* 检查token是否失效
|
* 检查token是否失效
|
||||||
*/
|
*/
|
||||||
public static void checkTokenInvalid() {
|
public static void checkTokenInvalid() {
|
||||||
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID)
|
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID).execute(NO_CALLBACK);
|
||||||
.execute(NO_CALLBACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,32 +391,15 @@ public class CommonHttpUtil {
|
|||||||
* 谷歌支付成功后,通知自己服务器
|
* 谷歌支付成功后,通知自己服务器
|
||||||
*/
|
*/
|
||||||
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
|
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
|
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);
|
||||||
.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) {
|
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)
|
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);
|
||||||
.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) {
|
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")
|
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);
|
||||||
.params("purchaseToken", purchaseToken)
|
|
||||||
.params("orderno", orderNo)
|
|
||||||
.params("trade_no", tradeNo)
|
|
||||||
.params("package_name", "com.pdlive.shayu")
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//不做任何操作的HttpCallback
|
//不做任何操作的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) {
|
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;
|
PostRequest<JsonBean> request;
|
||||||
if ("2".equals(community_type)) {
|
if ("2".equals(community_type)) {
|
||||||
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
|
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);
|
||||||
.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 {
|
} else {
|
||||||
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
|
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);
|
||||||
.isMultipart(true)
|
|
||||||
.params("dynamic_id", dynamic_id)
|
|
||||||
.params("report_type", report_type)
|
|
||||||
.params("content", content)
|
|
||||||
.params("community_type", community_type);
|
|
||||||
}
|
}
|
||||||
if (file1 != null) {
|
if (file1 != null) {
|
||||||
request.params("file1", file1);
|
request.params("file1", file1);
|
||||||
@ -483,9 +436,7 @@ public class CommonHttpUtil {
|
|||||||
* 用户个人主页信息
|
* 用户个人主页信息
|
||||||
*/
|
*/
|
||||||
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO)
|
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
|
||||||
.params("touid", touid)
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// //埋点唯一性
|
// //埋点唯一性
|
||||||
|
62
common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java
Normal file
62
common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -134,7 +134,6 @@ public class GoogleBillingUtilNew {
|
|||||||
Log.e(TAG, "支付失败:code = " + code + " msg = " + msg);
|
Log.e(TAG, "支付失败:code = " + code + " msg = " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
public class GoogleCallBack {
|
||||||
|
public void processResponse() {
|
||||||
|
L.e("___GoogleCallBack___processResponse");
|
||||||
|
}
|
||||||
|
}
|
212
common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
Normal file
212
common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -99,50 +99,41 @@ public class LogUtil {
|
|||||||
} else {
|
} else {
|
||||||
time = System.currentTimeMillis() + "";
|
time = System.currentTimeMillis() + "";
|
||||||
}
|
}
|
||||||
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report")
|
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() {
|
||||||
.params("log", err)
|
String TAG = "异常上传";
|
||||||
.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
|
@Override
|
||||||
public void onSuccess(Response<String> response) {
|
public void onSuccess(Response<String> response) {
|
||||||
Log.i(TAG, "onSuccess: " + response.message());
|
Log.i(TAG, "onSuccess: " + response.message());
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
UploadTask<String> task = OkUpload.request("errorLog", request)
|
UploadTask<String> task = OkUpload.request("errorLog", request).save().register(new UploadListener<String>("errorLog") {
|
||||||
.save()
|
|
||||||
.register(new UploadListener<String>("errorLog") {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Progress progress) {
|
public void onStart(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(Progress progress) {
|
public void onProgress(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Progress progress) {
|
public void onError(Progress progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(String s, Progress progress) {
|
public void onFinish(String s, Progress progress) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemove(Progress progress) {
|
public void onRemove(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
task.start();
|
task.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,12 +151,12 @@ public class LogUtil {
|
|||||||
public static void shareFile(Context context) {
|
public static void shareFile(Context context) {
|
||||||
try {
|
try {
|
||||||
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
|
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
|
||||||
boolean isAnchor=false;
|
boolean isAnchor = false;
|
||||||
if(bean!=null){
|
if (bean != null) {
|
||||||
isAnchor=bean.anchorUserType();
|
isAnchor = bean.anchorUserType();
|
||||||
}
|
}
|
||||||
//有debug文件或主播才允许
|
//有debug文件或主播才允许
|
||||||
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists()&&!isAnchor) {
|
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists() && !isAnchor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -225,7 +216,7 @@ public class LogUtil {
|
|||||||
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
context.startActivity(Intent.createChooser(share, "分享文件"));
|
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()) {
|
if (!Environment.isExternalStorageManager()) {
|
||||||
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
||||||
context.startActivity(intent);
|
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) {
|
private static void uploadLog(File log) {
|
||||||
|
|
||||||
JSONObject body = new JSONObject();
|
JSONObject body = new JSONObject();
|
||||||
|
|
||||||
MultipartBody requestBody = new MultipartBody.Builder()
|
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)) //上报日志文件
|
||||||
.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();
|
.build();
|
||||||
|
|
||||||
body.put("uid", CommonAppConfig.getInstance().getUid());
|
body.put("uid", CommonAppConfig.getInstance().getUid());
|
||||||
@ -262,28 +250,23 @@ public class LogUtil {
|
|||||||
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
||||||
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
|
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = new OkHttpClient.Builder().connectTimeout(3, TimeUnit.SECONDS).build();
|
||||||
.connectTimeout(3, TimeUnit.SECONDS)
|
Request request = new Request.Builder().url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
||||||
.build();
|
.post(requestBody).build();
|
||||||
Request request = new Request.Builder()
|
client.newCall(request).enqueue(new Callback() {
|
||||||
.url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
@Override
|
||||||
.post(requestBody)
|
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||||
.build();
|
Log.e(TAG, "error", e);
|
||||||
client.newCall(request)
|
}
|
||||||
.enqueue(new Callback() {
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
|
||||||
Log.e(TAG, "error",e );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
||||||
String body = response.body().string();
|
String body = response.body().string();
|
||||||
Log.i(TAG, "onResponse: "+body);
|
Log.i(TAG, "onResponse: " + body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,11 +40,61 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//是否是谷歌版本
|
//是否是谷歌版本
|
||||||
public void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
|
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) {
|
if (configBean.getForceUpdate() != 1) {
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
@ -103,55 +153,6 @@ public class VersionUtil {
|
|||||||
.build()
|
.build()
|
||||||
.show();
|
.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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
if (!mInside) {
|
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);
|
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);
|
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() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dialog_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
if (mInside){
|
if (mInside) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}else {
|
} else {
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() != 1) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||||
dismiss();
|
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();
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,8 +106,16 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
//不是谷歌
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
if (!CommonAppConfig.IS_GOOGLE_PLAY) {
|
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);
|
versionImmediateUse.setVisibility(GONE);
|
||||||
updateLine.setVisibility(VISIBLE);
|
updateLine.setVisibility(VISIBLE);
|
||||||
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
|
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
|
||||||
@ -113,13 +124,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
ToastUtil.show(error);
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -9,20 +9,18 @@ ext {
|
|||||||
]
|
]
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式、
|
//正式、
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
// 测试
|
// 测试
|
||||||
// serverHost : " https://ceshi.yaoulive.com",
|
serverHost : " https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//百度语音识别
|
//百度语音识别
|
||||||
|
|
||||||
baiduAppId : "23774720",
|
baiduAppId : "23774720",
|
||||||
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnR B",
|
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB",
|
||||||
|
|
||||||
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
||||||
// true表示谷歌支付 false
|
// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包
|
||||||
isGooglePlay : true,
|
isGooglePlay : 2,
|
||||||
//是否上报异常日志
|
//是否上报异常日志
|
||||||
isUploadLog : true,
|
isUploadLog : true,
|
||||||
//是否打包成插件包模式
|
//是否打包成插件包模式
|
||||||
|
@ -16,11 +16,13 @@ org.gradle.daemon=true
|
|||||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
|
|
||||||
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
systemProp.http.proxyHost=127.0.0.1
|
systemProp.http.proxyHost=127.0.0.1
|
||||||
systemProp.https.proxyHost=127.0.0.1
|
systemProp.https.proxyHost=127.0.0.1
|
||||||
systemProp.https.proxyPort=10809
|
systemProp.https.proxyPort=49528
|
||||||
systemProp.http.proxyPort=10809
|
systemProp.http.proxyPort=49528
|
||||||
#android.enableR8.fullMode=true
|
#android.enableR8.fullMode=true
|
@ -25,10 +25,10 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
minSdkVersion minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
targetSdkVersion targetSdkVersion
|
||||||
versionCode rootProject.ext.android.versionCode
|
versionCode versionCode
|
||||||
versionName rootProject.ext.android.versionName
|
versionName versionName
|
||||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
1
lib_google/.gitignore
vendored
Normal file
1
lib_google/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
37
lib_google/build.gradle
Normal file
37
lib_google/build.gradle
Normal 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'
|
||||||
|
}
|
0
lib_google/consumer-rules.pro
Normal file
0
lib_google/consumer-rules.pro
Normal file
21
lib_google/proguard-rules.pro
vendored
Normal file
21
lib_google/proguard-rules.pro
vendored
Normal 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
|
5
lib_google/src/main/AndroidManifest.xml
Normal file
5
lib_google/src/main/AndroidManifest.xml
Normal 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>
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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, "onPurchasesUpdated:code = " + 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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里可以直接获取到ID,name,和头像
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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
1
lib_huawei/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
32
lib_huawei/build.gradle
Normal file
32
lib_huawei/build.gradle
Normal 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'
|
||||||
|
}
|
0
lib_huawei/consumer-rules.pro
Normal file
0
lib_huawei/consumer-rules.pro
Normal file
21
lib_huawei/proguard-rules.pro
vendored
Normal file
21
lib_huawei/proguard-rules.pro
vendored
Normal 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
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
5
lib_huawei/src/main/AndroidManifest.xml
Normal file
5
lib_huawei/src/main/AndroidManifest.xml
Normal 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>
|
@ -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 {
|
||||||
|
// 其他外部错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,11 @@
|
|||||||
package="com.yunbao.live">
|
package="com.yunbao.live">
|
||||||
<!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"-->
|
<!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"-->
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<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.VIBRATE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.blankj.utilcode.util.GsonUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.core.BasePopupView;
|
import com.lxj.xpopup.core.BasePopupView;
|
||||||
import com.lxj.xpopup.enums.PopupPosition;
|
import com.lxj.xpopup.enums.PopupPosition;
|
||||||
@ -1596,7 +1595,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
.putExtra("headImg", ""));
|
.putExtra("headImg", ""));
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
|
||||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||||
if (bean.getLink() != null && !"".equals(bean.getLink())) {
|
if (bean.getLink() != null && !"".equals(bean.getLink())) {
|
||||||
WebViewActivity.forward(mContext, bean.getLink(), true);
|
WebViewActivity.forward(mContext, bean.getLink(), true);
|
||||||
|
@ -14,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.yunbao.common.activity.WebViewActivity;
|
import com.yunbao.common.activity.WebViewActivity;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
@ -88,7 +87,6 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (model1.getContent().equals("在線客服")) {
|
if (model1.getContent().equals("在線客服")) {
|
||||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
|
||||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import android.widget.LinearLayout;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||||
import com.yunbao.common.utils.FileUtil;
|
import com.yunbao.common.utils.FileUtil;
|
||||||
import com.yunbao.common.utils.TimeUtils;
|
import com.yunbao.common.utils.TimeUtils;
|
||||||
@ -172,7 +171,6 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(Message message) {
|
public void onSuccess(Message message) {
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
FirebaseAnalytics.getInstance(getContext()).logEvent("FS_director_chat", null);
|
|
||||||
AppEventsLogger.newLogger(getContext()).logEvent("FB_director_chat");
|
AppEventsLogger.newLogger(getContext()).logEvent("FB_director_chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,6 @@ dependencies {
|
|||||||
//抽屉菜单
|
//抽屉菜单
|
||||||
implementation 'com.justkiddingbaby:slidemenu:1.3.0'
|
implementation 'com.justkiddingbaby:slidemenu:1.3.0'
|
||||||
implementation 'com.xj.marqueeView:marqueeView:0.1.20'
|
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 'com.binioter:guideview:1.0.0'
|
||||||
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
||||||
|
@ -47,12 +47,6 @@ import com.facebook.login.LoginResult;
|
|||||||
import com.fm.openinstall.OpenInstall;
|
import com.fm.openinstall.OpenInstall;
|
||||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||||
import com.fm.openinstall.model.AppData;
|
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.Scope;
|
||||||
import com.linecorp.linesdk.auth.LineAuthenticationParams;
|
import com.linecorp.linesdk.auth.LineAuthenticationParams;
|
||||||
import com.linecorp.linesdk.auth.LineLoginApi;
|
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.NoviceInstructorManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.GoogleUtils;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.http.LiveHttpUtil;
|
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.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@ -124,12 +120,13 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
private static boolean mShowInvite;//显示邀请码弹窗
|
private static boolean mShowInvite;//显示邀请码弹窗
|
||||||
private static Context Contexts;
|
private static Context Contexts;
|
||||||
private ImageView img_view;
|
private ImageView img_view;
|
||||||
private GoogleSignInClient mGoogleSignInClient;
|
|
||||||
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
||||||
private String kefuUrl = "";
|
private String kefuUrl = "";
|
||||||
private boolean mBtnClick = false;
|
private boolean mBtnClick = false;
|
||||||
private Dialog loginLoadingDialog;
|
private Dialog loginLoadingDialog;
|
||||||
|
|
||||||
|
GoogleUtils googleUtils;
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void close(String str) {
|
public void close(String str) {
|
||||||
if ("close_login".equals(str)) {
|
if ("close_login".equals(str)) {
|
||||||
@ -180,6 +177,9 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
IMLoginManager.get(this).logout(this);
|
IMLoginManager.get(this).logout(this);
|
||||||
ToastUtil.show(R.string.login_invalid);
|
ToastUtil.show(R.string.login_invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
googleUtils = new GoogleUtils(EntryActivity.this);
|
||||||
|
|
||||||
Get_hash_key();
|
Get_hash_key();
|
||||||
activity = this;
|
activity = this;
|
||||||
Contexts = this;
|
Contexts = this;
|
||||||
@ -209,14 +209,14 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
btn_tip1.setOnClickListener(new View.OnClickListener() {
|
btn_tip1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
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() {
|
btn_tip.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
timerOutBtn(view);
|
timerOutBtn(view);
|
||||||
MainNetManager.get(EntryActivity.this)
|
MainNetManager.get(EntryActivity.this).FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||||
.FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
@Override
|
||||||
@Override
|
public void onSuccess(FaceBookUpModel data) {
|
||||||
public void onSuccess(FaceBookUpModel data) {
|
if (data.getType().equals("0")) {
|
||||||
if (data.getType().equals("0")) {
|
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
} else {
|
||||||
} else {
|
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?", false);
|
||||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?",false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -300,7 +299,6 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
googleLoginSet();
|
|
||||||
twitterLoginSet();
|
twitterLoginSet();
|
||||||
|
|
||||||
btn_google.setOnClickListener(new View.OnClickListener() {
|
btn_google.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -310,8 +308,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
timerOutBtn(v);
|
timerOutBtn(v);
|
||||||
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
|
startActivityForResult(googleUtils.getIntent(), 1002);
|
||||||
startActivityForResult(signInIntent, 1002);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -365,13 +362,9 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
timerOutBtn(view);
|
timerOutBtn(view);
|
||||||
try {
|
try {
|
||||||
// App-to-app login
|
// App-to-app login
|
||||||
Intent loginIntent = LineLoginApi.getLoginIntent(
|
Intent loginIntent = LineLoginApi.getLoginIntent(view.getContext(), "1656399535", new LineAuthenticationParams.Builder().scopes(Arrays.asList(Scope.PROFILE))
|
||||||
view.getContext(),
|
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||||
"1656399535",
|
.build());
|
||||||
new LineAuthenticationParams.Builder()
|
|
||||||
.scopes(Arrays.asList(Scope.PROFILE))
|
|
||||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
|
||||||
.build());
|
|
||||||
startActivityForResult(loginIntent, 1001);
|
startActivityForResult(loginIntent, 1001);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("ERROR", e.toString());
|
Log.e("ERROR", e.toString());
|
||||||
@ -388,7 +381,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (!"".equals(kefuUrl)) {
|
if (!"".equals(kefuUrl)) {
|
||||||
Constants.LoginKefu = true;
|
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() {
|
private void twitterLoginSet() {
|
||||||
TwitterConfig config = new TwitterConfig.Builder(this)
|
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();
|
||||||
.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);
|
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() {
|
private void requestPermission() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {//30
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {//30
|
||||||
// 先判断有没有权限
|
// 先判断有没有权限
|
||||||
@ -481,8 +458,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else if (requestCode == 1002) {//google登录
|
} else if (requestCode == 1002) {//google登录
|
||||||
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
handleSignInResult(data);
|
||||||
handleSignInResult(task);
|
|
||||||
} else {
|
} else {
|
||||||
tt_login_button.onActivityResult(requestCode, resultCode, data);//twitter登录回调
|
tt_login_button.onActivityResult(requestCode, resultCode, data);//twitter登录回调
|
||||||
callbackManager.onActivityResult(requestCode, resultCode, data);//facebook登录回调
|
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 {
|
try {
|
||||||
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
|
|
||||||
//account里可以直接获取到ID,name,和头像
|
|
||||||
String idToken = account.getIdToken();
|
|
||||||
account.getFamilyName();
|
|
||||||
account.getGivenName();
|
|
||||||
|
|
||||||
LoginData data = new LoginData();
|
LoginData data = new LoginData();
|
||||||
data.setAvatar("");
|
data.setAvatar("");
|
||||||
data.setNickName(account.getDisplayName());
|
data.setNickName(jsonObject.getString("displayName"));
|
||||||
data.setOpenID(account.getId());
|
data.setOpenID(jsonObject.getString("openId"));
|
||||||
data.setType("google");
|
data.setType("google");
|
||||||
|
|
||||||
loginBuyThird(data);
|
loginBuyThird(data);
|
||||||
} catch (ApiException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.i("Log", "ApiException = " + e);
|
Log.i("Log", "ApiException = " + e);
|
||||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
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());
|
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
|
||||||
//获取自定义数据
|
//获取自定义数据
|
||||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
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 {
|
} else {
|
||||||
JSONObject data = JSON.parseObject(appData.getData());
|
JSONObject data = JSON.parseObject(appData.getData());
|
||||||
@ -598,7 +568,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
*/
|
*/
|
||||||
private void loginBuyThird(LoginData data) {
|
private void loginBuyThird(LoginData data) {
|
||||||
mLoginType = data.getType();
|
mLoginType = data.getType();
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
mPromoCode = "";
|
mPromoCode = "";
|
||||||
}
|
}
|
||||||
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
|
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) {
|
public void callback(UserBean bean) {
|
||||||
|
|
||||||
if (mFirstLogin) {
|
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));
|
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
|
||||||
} else {
|
} else {
|
||||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").execute(new HttpCallback() {
|
||||||
.execute(new HttpCallback() {
|
@Override
|
||||||
@Override
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
if (info[0] != null) {
|
||||||
if (info[0] != null) {
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
|
||||||
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
|
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
|
||||||
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
|
MainActivity.forward(EntryActivity.this, false);
|
||||||
MainActivity.forward(EntryActivity.this, false);
|
gotoLive(obj.getString("anchor_id"));
|
||||||
gotoLive(obj.getString("anchor_id"));
|
if (obj.containsKey("home_zdy_img_us")) {
|
||||||
if (obj.containsKey("home_zdy_img_us")) {
|
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
if (obj.containsKey("home_zdy_pop")) {
|
||||||
|
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MainActivity.forward(EntryActivity.this, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MainActivity.forward(EntryActivity.this, false);
|
MainActivity.forward(EntryActivity.this, false);
|
||||||
|
@ -15,27 +15,19 @@ import android.webkit.WebSettings;
|
|||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.facebook.appevents.AppEventsConstants;
|
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.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
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.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.views.TestWebViewClient;
|
import com.yunbao.main.views.TestWebViewClient;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressLint("ValidFragment")
|
@SuppressLint("ValidFragment")
|
||||||
public class GoogleFragment extends Fragment {
|
public class GoogleFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
public static String mOrderid, mProductId, MoneyUsds;
|
public static String mOrderid, mProductId, MoneyUsds;
|
||||||
|
|
||||||
@ -43,6 +35,8 @@ public class GoogleFragment extends Fragment {
|
|||||||
private String url;
|
private String url;
|
||||||
String adid = null;
|
String adid = null;
|
||||||
|
|
||||||
|
GoogleUtils googleUtils;
|
||||||
|
|
||||||
public GoogleFragment() {
|
public GoogleFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,33 +49,20 @@ public class GoogleFragment extends Fragment {
|
|||||||
assert getArguments() != null;
|
assert getArguments() != null;
|
||||||
url = getArguments().getString("url");
|
url = getArguments().getString("url");
|
||||||
|
|
||||||
|
if (StringUtil.isEmpty(url)) {
|
||||||
if(StringUtil.isEmpty(url)){
|
Log.e(TAG, "URL为空");
|
||||||
Log.e(TAG, "URL为空" );
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
|
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
|
||||||
Log.e("ttt", url);
|
Log.e("ttt", url);
|
||||||
rlWebview.loadUrl(url);
|
rlWebview.loadUrl(url);
|
||||||
initGooglePay();
|
initGooglePay();
|
||||||
new Thread(new Runnable() {
|
new Thread() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
adid = googleUtils.getAdid();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).start();
|
}.start();
|
||||||
WebSettings webSettings = rlWebview.getSettings();
|
WebSettings webSettings = rlWebview.getSettings();
|
||||||
|
|
||||||
webSettings.setDomStorageEnabled(true);
|
webSettings.setDomStorageEnabled(true);
|
||||||
@ -95,7 +76,6 @@ public class GoogleFragment extends Fragment {
|
|||||||
webSettings.setSupportZoom(true); // 是否支持缩放
|
webSettings.setSupportZoom(true); // 是否支持缩放
|
||||||
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦,前提是支持缩放
|
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦,前提是支持缩放
|
||||||
|
|
||||||
|
|
||||||
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
|
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||||
|
|
||||||
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
|
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
|
||||||
@ -105,71 +85,64 @@ public class GoogleFragment extends Fragment {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String TAG = "GooglePay";
|
String TAG = "GooglePay";
|
||||||
|
|
||||||
private void initGooglePay() {
|
private void initGooglePay() {
|
||||||
GoogleBillingUtilNew.getInstance().initGooglePay(getActivity());
|
googleUtils = new GoogleUtils(getActivity());
|
||||||
|
googleUtils.initGooglePay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Handler payHandler = new Handler();
|
private Handler payHandler = new Handler();
|
||||||
|
|
||||||
//js调用原生
|
//js调用原生
|
||||||
public class JsInteration {
|
public class JsInteration {
|
||||||
|
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
||||||
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
|
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
|
||||||
mProductId = ProductId;
|
mProductId = ProductId;
|
||||||
mOrderid = OrderNumber;
|
mOrderid = OrderNumber;
|
||||||
MoneyUsds = MoneyUsd;
|
MoneyUsds = MoneyUsd;
|
||||||
// googleBillingUtil.purchaseInApp(getActivity(), mProductId);
|
|
||||||
GoogleBillingUtilNew.getInstance().setBillingListener(new GoogleBillingUtilNew.GoogleBillingListener() {
|
googleUtils.setBillingListener(new GoogleUtils.GoogleBillingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPaySuccess(List<Purchase> list) {
|
public void onPaySuccess(String token, String orderId) {
|
||||||
for (Purchase purchase : list) {
|
payHandler.post(new Runnable() {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
@Override
|
||||||
int finalI = i;
|
public void run() {
|
||||||
payHandler.post(new Runnable() {
|
CommonHttpUtil.notifyGoogle(token, orderId, mProductId, mOrderid, adid, new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
CommonHttpUtil.notifyGoogle(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), mProductId, mOrderid, adid, new HttpCallback() {
|
if (code == 0) {
|
||||||
@Override
|
Bundle params = new Bundle();
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
params.putString("currency", "HKD");
|
||||||
if (code == 0) {
|
params.putString("money", MoneyUsds);
|
||||||
Bundle params = new Bundle();
|
Bundle fb_params = new Bundle();
|
||||||
params.putString("currency", "HKD");
|
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
||||||
params.putString("money", MoneyUsds);
|
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
|
||||||
Bundle fb_params = new Bundle();
|
//Google官方充值通知
|
||||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
Bundle google_params = new Bundle();
|
||||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
|
google_params.putString("currency", "HKD");
|
||||||
//Google官方充值通知
|
google_params.putString("product_id", mProductId);
|
||||||
Bundle google_params = new Bundle();
|
google_params.putString("transaction_id", mOrderid);
|
||||||
google_params.putString("currency", "HKD");
|
google_params.putString("value", MoneyUsds);
|
||||||
google_params.putString("product_id", mProductId);
|
google_params.putString("price", MoneyUsds);
|
||||||
google_params.putString("transaction_id", mOrderid);
|
google_params.putString("quantity", "1");
|
||||||
google_params.putString("value", MoneyUsds);
|
dis();
|
||||||
google_params.putString("price", MoneyUsds);
|
ToastUtil.show("支付成功");
|
||||||
google_params.putString("quantity", "1");
|
}
|
||||||
dis();
|
|
||||||
ToastUtil.show("支付成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Log.e("谷歌支付", purchase.toString());
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPayFailed(int code, String msg) {
|
public void onPayFailed(String msg) {
|
||||||
|
ToastUtil.show(msg);
|
||||||
}
|
}
|
||||||
}).checkSku(ProductId);
|
});
|
||||||
|
googleUtils.purchase(mProductId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
|
111
main/src/main/java/com/yunbao/main/activity/HuaWeiFragment.java
Normal file
111
main/src/main/java/com/yunbao/main/activity/HuaWeiFragment.java
Normal 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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -93,6 +93,8 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
|||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.GiftCacheUtil;
|
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.LiveRoomCheckLivePresenter;
|
||||||
import com.yunbao.common.utils.LocationUtil;
|
import com.yunbao.common.utils.LocationUtil;
|
||||||
import com.yunbao.common.utils.ProcessResultUtil;
|
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")) {
|
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
||||||
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true, false);
|
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
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
String token = task.getResult();
|
GoogleUtils.newInstance(MainActivity.this).setFirebaseTokenListener(MainActivity.this, new GoogleUtils.FirebaseTokenListener() {
|
||||||
|
@Override
|
||||||
// Log and toast
|
public void onResultToken(String token) {
|
||||||
Log.d(TAG, token);
|
L.e("GoogleUtils.newInstance:onResultToken:" + token);
|
||||||
PushManager.getInstance()
|
PushManager.getInstance().onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
|
||||||
.onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
|
}
|
||||||
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
|
});
|
||||||
}
|
GoogleUtils.newInstance(MainActivity.this).initFireToken(MainActivity.this);
|
||||||
});
|
}
|
||||||
|
|
||||||
//华为推送
|
//华为推送
|
||||||
// getToken();
|
// getToken();
|
||||||
@ -460,51 +454,49 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RxView.clicks(findViewById(R.id.banner_click))
|
RxView.clicks(findViewById(R.id.banner_click)).throttleFirst(2, TimeUnit.SECONDS).subscribe(new Observer<Unit>() {
|
||||||
.throttleFirst(2, TimeUnit.SECONDS)
|
@Override
|
||||||
.subscribe(new Observer<Unit>() {
|
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
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
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
|
@Override
|
||||||
public void onNext(Unit unit) {
|
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||||
MobclickAgent.onEvent(mContext, "home_page_to_recommend", "首页点击右下角去推荐直播间按钮");
|
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onCheckError(String contextError) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
RouteUtil.forwardUserHome(mContext, Uid, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//选中监听
|
//选中监听
|
||||||
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
|
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
|
||||||
@ -517,8 +509,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
floatRedPacket.setVisibility(View.GONE);
|
floatRedPacket.setVisibility(View.GONE);
|
||||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||||
isfloatBannernet = false;
|
isfloatBannernet = false;
|
||||||
if (mainMessageViewHolder != null)
|
if (mainMessageViewHolder != null) mainMessageViewHolder.onResume();
|
||||||
mainMessageViewHolder.onResume();
|
|
||||||
} else {
|
} else {
|
||||||
floatBanner.setVisibility(View.GONE);
|
floatBanner.setVisibility(View.GONE);
|
||||||
floatRedPacket.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<String, Object> map = new HashMap<>();
|
||||||
map.put("num", "10");
|
map.put("num", "10");
|
||||||
map.put("live_recommend", "quick_look");
|
map.put("live_recommend", "quick_look");
|
||||||
MainNetManager.get(mContext)
|
MainNetManager.get(mContext).anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||||
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
@SuppressLint("SetTextI18n")
|
||||||
@SuppressLint("SetTextI18n")
|
@Override
|
||||||
@Override
|
public void onSuccess(AnchorRecommendModel data) {
|
||||||
public void onSuccess(AnchorRecommendModel data) {
|
if (isFinishing()) return;
|
||||||
if (isFinishing()) return;
|
if (data.getListShow() == 1 && data.getList().size() > 2) {
|
||||||
if (data.getListShow() == 1 && data.getList().size() > 2) {
|
floatBanner.setVisibility(View.VISIBLE);
|
||||||
floatBanner.setVisibility(View.VISIBLE);
|
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
||||||
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
floatBanner.showBanner(data.getList());
|
||||||
floatBanner.showBanner(data.getList());
|
} else {
|
||||||
} else {
|
floatBanner.setVisibility(View.GONE);
|
||||||
floatBanner.setVisibility(View.GONE);
|
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
}
|
||||||
}
|
if (data.getShowRedPacket() == 0) {
|
||||||
if (data.getShowRedPacket() == 0) {
|
floatRedPacket.setVisibility(View.GONE);
|
||||||
floatRedPacket.setVisibility(View.GONE);
|
} else {
|
||||||
} else {
|
floatRedPacket.setVisibility(View.VISIBLE);
|
||||||
floatRedPacket.setVisibility(View.VISIBLE);
|
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
|
||||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
|
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
|
||||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
|
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
|
||||||
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
ToastUtil.show(mContext.getString(R.string.net_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 (!VersionUtil.isLatest(configBean.getVersion())) {
|
||||||
if (!APKManager.get().getApkVerNew()) {
|
if (!APKManager.get().getApkVerNew()) {
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext).isDestroyOnDismiss(true).dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
|
||||||
.isDestroyOnDismiss(true)
|
|
||||||
.dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
|
|
||||||
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
|
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
|
||||||
.asCustom(new APKUpdateCustomPopup(mContext, false))
|
.asCustom(new APKUpdateCustomPopup(mContext, false)).show();
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
requestBonus();
|
requestBonus();
|
||||||
@ -1087,14 +1074,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
private void notifyLiveFlot() {
|
private void notifyLiveFlot() {
|
||||||
if (startListNotifyList.iterator().hasNext()) {
|
if (startListNotifyList.iterator().hasNext()) {
|
||||||
AnchorStartLiveBean bean = startListNotifyList.iterator().next();
|
AnchorStartLiveBean bean = startListNotifyList.iterator().next();
|
||||||
new AnchorStartLiveNotifyDialog(mContext, bean)
|
new AnchorStartLiveNotifyDialog(mContext, bean).setOnDismissListener(dialog -> {
|
||||||
.setOnDismissListener(dialog -> {
|
startListNotifyList.remove(bean);
|
||||||
startListNotifyList.remove(bean);
|
if (startListNotifyList.iterator().hasNext()) {
|
||||||
if (startListNotifyList.iterator().hasNext()) {
|
notifyLiveFlot();
|
||||||
notifyLiveFlot();
|
}
|
||||||
}
|
}).showDialog();
|
||||||
})
|
|
||||||
.showDialog();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1448,9 +1433,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onLiveFloatEvent(LiveFloatEvent event) {
|
public void onLiveFloatEvent(LiveFloatEvent event) {
|
||||||
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
|
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
|
||||||
new Handler().post(() -> LiveFloatView.getInstance()
|
new Handler().post(() -> LiveFloatView.getInstance().cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()).builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
||||||
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
|
|
||||||
.builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,11 @@ package com.yunbao.main.activity;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -62,6 +64,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
private String mCoinName;
|
private String mCoinName;
|
||||||
private String mGoldCoinName;
|
private String mGoldCoinName;
|
||||||
List<CoinBean> listPro;//商品列表
|
List<CoinBean> listPro;//商品列表
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.activity_coin;
|
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));
|
goldCoinNameTV.setText(String.format(mContext.getString(R.string.wallet_gold_name), mGoldCoinName));
|
||||||
mBalance = findViewById(R.id.coin);
|
mBalance = findViewById(R.id.coin);
|
||||||
mTvGoldCoinNum = findViewById(R.id.tvGoldCoinNum);
|
mTvGoldCoinNum = findViewById(R.id.tvGoldCoinNum);
|
||||||
View btnChargeExplain= findViewById(R.id.btn_charge_explain);
|
View btnChargeExplain = findViewById(R.id.btn_charge_explain);
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY){
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
btnChargeExplain.setVisibility(View.GONE);
|
btnChargeExplain.setVisibility(View.GONE);
|
||||||
}else {
|
} else {
|
||||||
btnChargeExplain.setVisibility(View.VISIBLE);
|
btnChargeExplain.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +142,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
mPayPresenter.checkPayResult();
|
mPayPresenter.checkPayResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed() {
|
public void onFailed() {
|
||||||
}
|
}
|
||||||
@ -167,24 +171,26 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
String goldNum = obj.getString("gold");
|
String goldNum = obj.getString("gold");
|
||||||
mGoldCoinNum = Long.parseLong(goldNum);
|
mGoldCoinNum = Long.parseLong(goldNum);
|
||||||
mTvGoldCoinNum.setText(goldNum);
|
mTvGoldCoinNum.setText(goldNum);
|
||||||
}catch (Exception e){e.printStackTrace();}
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
//支付方式列表
|
//支付方式列表
|
||||||
List<CoinPayBean> payList = JSON.parseArray(obj.getString("paylist"), CoinPayBean.class);
|
List<CoinPayBean> payList = JSON.parseArray(obj.getString("paylist"), CoinPayBean.class);
|
||||||
if (mPayAdapter != null) {
|
if (mPayAdapter != null) {
|
||||||
mPayAdapter.setList(payList);
|
mPayAdapter.setList(payList);
|
||||||
}
|
}
|
||||||
//商品列表
|
//商品列表
|
||||||
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
|
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
|
||||||
if (mAdapter != null) {
|
if (mAdapter != null) {
|
||||||
mAdapter.setList(listPro);
|
mAdapter.setList(listPro);
|
||||||
}
|
}
|
||||||
if (payList != null && payList.size()>0){
|
if (payList != null && payList.size() > 0) {
|
||||||
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()){
|
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()) {
|
||||||
EventBus.getDefault().post(payList.get(0));
|
EventBus.getDefault().post(payList.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (mPayPresenter != null){
|
if (mPayPresenter != null) {
|
||||||
mPayPresenter.setBalanceValue(mBalanceValue);
|
mPayPresenter.setBalanceValue(mBalanceValue);
|
||||||
mPayPresenter.setAliPartner(obj.getString("aliapp_partner"));
|
mPayPresenter.setAliPartner(obj.getString("aliapp_partner"));
|
||||||
mPayPresenter.setAliSellerId(obj.getString("aliapp_seller_id"));
|
mPayPresenter.setAliSellerId(obj.getString("aliapp_seller_id"));
|
||||||
@ -223,10 +229,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
if (TextUtils.isEmpty(href)) {
|
if (TextUtils.isEmpty(href)) {
|
||||||
String money = bean.getMoney();
|
String money = bean.getMoney();
|
||||||
String goodsName = StringUtil.contact(bean.getCoin(), mCoinName);
|
String goodsName = StringUtil.contact(bean.getCoin(), mCoinName);
|
||||||
String orderParams = StringUtil.contact(
|
String orderParams = StringUtil.contact("&uid=", CommonAppConfig.getInstance().getUid(), "&changeid=", bean.getId(), "&coin=", bean.getCoin());
|
||||||
"&uid=", CommonAppConfig.getInstance().getUid(),
|
|
||||||
"&changeid=", bean.getId(),
|
|
||||||
"&coin=", bean.getCoin());
|
|
||||||
// if(coinPayBean.getId().equals(Constants.PAY_TYPE_HW)
|
// if(coinPayBean.getId().equals(Constants.PAY_TYPE_HW)
|
||||||
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYSSION)
|
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYSSION)
|
||||||
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYPAL)
|
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYPAL)
|
||||||
@ -240,8 +243,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
orderParams=StringUtil.contact(orderParams,
|
orderParams = StringUtil.contact(orderParams, "&money=", bean.getMoney_usd());
|
||||||
"&money=", bean.getMoney_usd());
|
|
||||||
mPayPresenter.pay(coinPayBean.getId(), "5", goodsName, orderParams);
|
mPayPresenter.pay(coinPayBean.getId(), "5", goodsName, orderParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -253,7 +255,6 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onCoinChangeEvent(CoinChangeEvent e) {
|
public void onCoinChangeEvent(CoinChangeEvent e) {
|
||||||
if (mBalance != null) {
|
if (mBalance != null) {
|
||||||
@ -267,28 +268,32 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onGoogleLimitEvent(CoinPayBean bean) {
|
public void onGoogleLimitEvent(CoinPayBean bean) {
|
||||||
if (listPro==null || listPro.size()<=0){
|
if (listPro == null || listPro.size() <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int size=listPro.size();
|
int size = listPro.size();
|
||||||
int indexTmp;
|
int indexTmp;
|
||||||
if (bean!=null){
|
if (bean != null) {
|
||||||
//谷歌支付不显示大额价格
|
//谷歌支付不显示大额价格
|
||||||
if ("google".equals(bean.getId())){
|
if ("google".equals(bean.getId())) {
|
||||||
String numS= bean.getPriceNum();
|
String numS = bean.getPriceNum();
|
||||||
int num = 7;
|
int num = 7;
|
||||||
if (numS != null && !numS.isEmpty()){
|
if (numS != null && !numS.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
num= Integer.parseInt(bean.getPriceNum());
|
num = Integer.parseInt(bean.getPriceNum());
|
||||||
}catch (Exception e){ e.printStackTrace(); }
|
} catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
indexTmp=num;
|
}
|
||||||
}else { indexTmp=size; }
|
}
|
||||||
if (indexTmp <= size){
|
indexTmp = num;
|
||||||
List<CoinBean> listTmp=listPro.subList(0,indexTmp);
|
} else {
|
||||||
mAdapter.setList(listTmp);
|
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();
|
int i = v.getId();
|
||||||
if (i == R.id.btn_tip) {
|
if (i == R.id.btn_tip) {
|
||||||
//充值协议
|
//充值协议
|
||||||
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_PRIVCAY + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),false);
|
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) {
|
} 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
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -12,6 +12,7 @@ import android.view.animation.DecelerateInterpolator;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
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.BillingResult;
|
||||||
import com.android.billingclient.api.Purchase;
|
import com.android.billingclient.api.Purchase;
|
||||||
import com.android.billingclient.api.PurchasesResponseListener;
|
import com.android.billingclient.api.PurchasesResponseListener;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.umeng.analytics.MobclickAgent;
|
import com.umeng.analytics.MobclickAgent;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
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.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.pay.hw.HwBuilder;
|
||||||
import com.yunbao.common.utils.GoogleBillingUtilNew;
|
import com.yunbao.common.utils.GoogleBillingUtilNew;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
import com.yunbao.main.utils.HXLinePagerIndicator;
|
import com.yunbao.main.utils.HXLinePagerIndicator;
|
||||||
|
|
||||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
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.indicators.LinePagerIndicator;
|
||||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -52,6 +59,10 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
static MyWalletActivity mw;
|
static MyWalletActivity mw;
|
||||||
Fragment[] fragments = null;
|
Fragment[] fragments = null;
|
||||||
private Handler payHandler = new Handler();
|
private Handler payHandler = new Handler();
|
||||||
|
public static String orderId;
|
||||||
|
|
||||||
|
HwBuilder hwBuilder;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -64,7 +75,11 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
super.main();
|
super.main();
|
||||||
mw = MyWalletActivity.this;
|
mw = MyWalletActivity.this;
|
||||||
setTitle(mContext.getString(R.string.wallet));
|
setTitle(mContext.getString(R.string.wallet));
|
||||||
|
|
||||||
GoogleBillingUtilNew.getInstance().initGooglePay(mContext);
|
GoogleBillingUtilNew.getInstance().initGooglePay(mContext);
|
||||||
|
|
||||||
|
hwBuilder = new HwBuilder(MyWalletActivity.this);
|
||||||
|
|
||||||
vp_content = (ViewPager) findViewById(R.id.vp_content);
|
vp_content = (ViewPager) findViewById(R.id.vp_content);
|
||||||
TextView rView = (TextView) findViewById(R.id.rView);
|
TextView rView = (TextView) findViewById(R.id.rView);
|
||||||
findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE);
|
findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE);
|
||||||
@ -75,69 +90,62 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
LoadingDialog loadingDialog = new LoadingDialog();
|
LoadingDialog loadingDialog = new LoadingDialog();
|
||||||
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
|
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
|
||||||
loadingDialog.setShowText(getString(R.string.order_query));
|
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;
|
WalletFragment walletFragment = null;
|
||||||
GoogleFragment googleFragment1;
|
|
||||||
GoogleFragment googleFragment2;
|
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)};
|
final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)};
|
||||||
if (getIntent().getStringExtra("tag") != null) {
|
if (getIntent().getStringExtra("tag") != null) {
|
||||||
Log.i("tss", "首充");
|
Log.i("tss", "首充");
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
walletFragment = new WalletFragment();
|
//google
|
||||||
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 {
|
|
||||||
rView.setVisibility(View.VISIBLE);
|
rView.setVisibility(View.VISIBLE);
|
||||||
walletFragment = new WalletFragment();
|
walletFragment = new WalletFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@ -153,9 +161,75 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
Bundle bundle2 = new Bundle();
|
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"));
|
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);
|
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 {
|
} 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", "不是首充");
|
Log.i("tss", "不是首充");
|
||||||
//链接版本
|
//链接版本
|
||||||
|
|
||||||
@ -173,30 +247,16 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
Bundle bundle2 = new Bundle();
|
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"));
|
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);
|
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,
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
googleFragment2,
|
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
|
||||||
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);
|
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
|
||||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||||
@ -266,10 +326,69 @@ public class MyWalletActivity extends AbsActivity {
|
|||||||
magicIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
|
magicIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
|
||||||
vp_content.setCurrentItem(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() {
|
public static void dis() {
|
||||||
mw.finish();
|
mw.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.binioter.guideview.Guide;
|
import com.binioter.guideview.Guide;
|
||||||
import com.binioter.guideview.GuideBuilder;
|
import com.binioter.guideview.GuideBuilder;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.lzf.easyfloat.EasyFloat;
|
import com.lzf.easyfloat.EasyFloat;
|
||||||
import com.opensource.svgaplayer.SVGADrawable;
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
import com.opensource.svgaplayer.SVGAImageView;
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
@ -322,7 +321,6 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
|||||||
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
|
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
|
||||||
type = userBean.getType();
|
type = userBean.getType();
|
||||||
netHandler.post(systemNumberRunnable);
|
netHandler.post(systemNumberRunnable);
|
||||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
|
||||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||||
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
||||||
WebViewActivity.forward(mContext, userBean.getLink(),false);
|
WebViewActivity.forward(mContext, userBean.getLink(),false);
|
||||||
|
@ -123,8 +123,8 @@ public class RegisterActivity extends AbsActivity {
|
|||||||
getUuidDevice();
|
getUuidDevice();
|
||||||
getPromoCode();
|
getPromoCode();
|
||||||
|
|
||||||
mGetCode =mContext.getString(R.string.reg_get_code);
|
mGetCode = mContext.getString(R.string.reg_get_code);
|
||||||
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
|
mGetCodeAgain = mContext.getString(R.string.reg_get_code_again);
|
||||||
mTvCountryCodeClick();
|
mTvCountryCodeClick();
|
||||||
mEditPhone.addTextChangedListener(new TextWatcher() {
|
mEditPhone.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
@ -240,7 +240,7 @@ public class RegisterActivity extends AbsActivity {
|
|||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
||||||
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
|
// 也可以加载本地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) {
|
} else if (i == R.id.btn_register) {
|
||||||
register();
|
register();
|
||||||
} else if (i == R.id.btn_tip2) {
|
} 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) {
|
} 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();
|
mDialog.show();
|
||||||
}
|
}
|
||||||
String ti = "";
|
String ti = "";
|
||||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){
|
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")) {
|
||||||
ti = "";
|
ti = "";
|
||||||
}else{
|
} else {
|
||||||
ti = edit_invitecode_2.getText().toString().trim();
|
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
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
@ -404,25 +404,25 @@ public class RegisterActivity extends AbsActivity {
|
|||||||
//获取自定义数据
|
//获取自定义数据
|
||||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||||
JSONObject data = JSON.parseObject(appData.getData());
|
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);
|
yqm_view.setVisibility(View.VISIBLE);
|
||||||
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
|
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if(code == 201){
|
if (code == 201) {
|
||||||
edit_invitecode_2.setText("此設備已註冊");
|
edit_invitecode_2.setText("此設備已註冊");
|
||||||
edit_invitecode_2.setEnabled(false);
|
edit_invitecode_2.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
yqm_view.setVisibility(View.GONE);
|
yqm_view.setVisibility(View.GONE);
|
||||||
//推广的码
|
//推广的码
|
||||||
mPromoCode = data.getString("admin_id") + "";
|
mPromoCode = data.getString("admin_id") + "";
|
||||||
//用户的码
|
//用户的码
|
||||||
UserID = data.getString("user_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
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
|
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
|
||||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").params("uid", userInfo.getId()).params("token", userInfo.getToken()).execute(new HttpCallback() {
|
||||||
.params("uid", userInfo.getId())
|
@Override
|
||||||
.params("token", userInfo.getToken())
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
.execute(new HttpCallback() {
|
if (info[0] != null) {
|
||||||
@Override
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||||
if (info[0] != null) {
|
IMLoginManager.get(activity).setNewUserGif(true);
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
if (obj.containsKey("home_zdy_img_us")) {
|
||||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||||
IMLoginManager.get(activity).setNewUserGif(true);
|
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
});
|
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());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.yunbao.common.activity.WebViewActivity;
|
import com.yunbao.common.activity.WebViewActivity;
|
||||||
import com.yunbao.common.bean.ImUserInfoModel;
|
import com.yunbao.common.bean.ImUserInfoModel;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
@ -86,7 +85,6 @@ public class SystemMessageAdapter extends RecyclerView.Adapter {
|
|||||||
type = model1.getType();
|
type = model1.getType();
|
||||||
netHandler.post(updataRunable);
|
netHandler.post(updataRunable);
|
||||||
if (model1.getTitle().equals("在線客服")) {
|
if (model1.getTitle().equals("在線客服")) {
|
||||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
|
||||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(model1.getLink())) {
|
if (!TextUtils.isEmpty(model1.getLink())) {
|
||||||
|
@ -60,10 +60,16 @@ public class MainHttpUtil {
|
|||||||
*/
|
*/
|
||||||
public static void loginByThird(String openid, String nicename, String avatar, String type, HttpCallback callback) {
|
public static void loginByThird(String openid, String nicename, String avatar, String type, HttpCallback callback) {
|
||||||
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
|
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)
|
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
|
||||||
.params("openid", openid)
|
.params("openid", openid)
|
||||||
.params("nicename", nicename)
|
.params("nicename", nicename)
|
||||||
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
|
.params("app_source", appSource)
|
||||||
.params("avatar", avatar)
|
.params("avatar", avatar)
|
||||||
.params("type", type)
|
.params("type", type)
|
||||||
.params("source", DEVICE)
|
.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) {
|
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 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)
|
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
|
||||||
.params("openid", openid)
|
.params("openid", openid)
|
||||||
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
|
.params("app_source", appSource)
|
||||||
.params("admin_id", promoCode)
|
.params("admin_id", promoCode)
|
||||||
.params("uuid_Device", uuidDevice)
|
.params("uuid_Device", uuidDevice)
|
||||||
.params("nicename", nicename)
|
.params("nicename", nicename)
|
||||||
@ -93,7 +105,7 @@ public class MainHttpUtil {
|
|||||||
.params("sign", sign)
|
.params("sign", sign)
|
||||||
.params("lastlogindevice", "Android")
|
.params("lastlogindevice", "Android")
|
||||||
.params("pushid", "")
|
.params("pushid", "")
|
||||||
.params("langue", WordUtil.isNewZh()?"chinese":"english")
|
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
|
||||||
.execute(callback);
|
.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) {
|
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)
|
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
|
||||||
.params("user_login", user_login)
|
.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("user_activation_key", promo_code)
|
||||||
.params("admin_id", promo_code)
|
.params("admin_id", promo_code)
|
||||||
@ -590,7 +608,7 @@ public class MainHttpUtil {
|
|||||||
.params("code", code)
|
.params("code", code)
|
||||||
.params("source", DEVICE)
|
.params("source", DEVICE)
|
||||||
.params("invitation_code", invitecode)
|
.params("invitation_code", invitecode)
|
||||||
.params("langue", WordUtil.isNewZh()?"chinese":"english")
|
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
|
||||||
.execute(callback);
|
.execute(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,6 +758,18 @@ public class MainHttpUtil {
|
|||||||
.execute(callback);
|
.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.binioter.guideview.Guide;
|
import com.binioter.guideview.Guide;
|
||||||
import com.binioter.guideview.GuideBuilder;
|
import com.binioter.guideview.GuideBuilder;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.opensource.svgaplayer.SVGADrawable;
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
import com.opensource.svgaplayer.SVGAImageView;
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
import com.opensource.svgaplayer.SVGAParser;
|
import com.opensource.svgaplayer.SVGAParser;
|
||||||
@ -277,7 +276,6 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
|||||||
MobclickAgent.onEvent(mContext, "information_system_service", "在線客服");
|
MobclickAgent.onEvent(mContext, "information_system_service", "在線客服");
|
||||||
type = userBean.getType();
|
type = userBean.getType();
|
||||||
netHandler.post(systemNumberRunnable);
|
netHandler.post(systemNumberRunnable);
|
||||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
|
||||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||||
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
||||||
// WebViewActivity.forward(mContext, userBean.getLink());
|
// WebViewActivity.forward(mContext, userBean.getLink());
|
||||||
|
@ -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 ':FaceUnity'
|
||||||
//include ':baidu'
|
//include ':baidu'
|
||||||
//include ':recognizer'//融云语音转文字模块
|
//include ':recognizer'//融云语音转文字模块
|
||||||
include ':Share'
|
include ':Share'
|
||||||
include ':pluginsForAnchor'
|
include ':pluginsForAnchor'
|
||||||
|
include ':lib_huawei'
|
||||||
|
include ':lib_google'
|
||||||
|
Loading…
Reference in New Issue
Block a user