feat:移除Mob-SDK(分享|link)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.tencent.vasdolly'
|
||||
apply from: '../mob.gradle'
|
||||
apply from: '../project.gradle'
|
||||
|
||||
def onlyArm64 = Boolean.parseBoolean(only_arm64)
|
||||
|
@@ -152,31 +152,31 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity> <!-- 刘海屏适配 end -->
|
||||
<activity
|
||||
android:name="com.mob.tools.MobUIShell"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" /> <!-- 云信配置 begin ##################################################### -->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="com.mob.tools.MobUIShell"-->
|
||||
<!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
|
||||
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar"-->
|
||||
<!-- android:windowSoftInputMode="stateHidden|adjustResize" /> <!– 云信配置 begin ##################################################### –>-->
|
||||
<!--
|
||||
APP key, 可以在这里设置,也可以在 SDKOptions 中提供。
|
||||
如果 SDKOptions 中提供了,取 SDKOptions 中的值。
|
||||
-->
|
||||
<activity
|
||||
android:name="com.vele.habuplay.lineapi.LineAuthenticationCallbackActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:noHistory="true">
|
||||
<!-- <activity-->
|
||||
<!-- android:name="com.vele.habuplay.lineapi.LineAuthenticationCallbackActivity"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- android:launchMode="singleTask"-->
|
||||
<!-- android:noHistory="true">-->
|
||||
|
||||
<!-- 集成line客户端登录授权,需要添如下格式的过滤器 -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<!-- <!– 集成line客户端登录授权,需要添如下格式的过滤器 –>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.VIEW" />-->
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||
|
||||
<data android:scheme="lineauth" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- <data android:scheme="lineauth" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!--
|
||||
声明云信后台服务,如需保持后台推送,使用独立进程效果会更好。
|
||||
ca46478c438dda51d25306f52fe7506b
|
||||
@@ -1015,9 +1015,9 @@
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<meta-data
|
||||
android:name="Mob-Https"
|
||||
android:value="yes" />
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="Mob-Https"-->
|
||||
<!-- android:value="yes" />-->
|
||||
|
||||
<provider
|
||||
android:name="com.netease.nimlib.ipc.NIMContentProvider"
|
||||
|
@@ -19,7 +19,6 @@ import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.example.lib_utils.LanguageUtils;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.mob.MobSDK;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
@@ -268,9 +267,9 @@ public class XChatApplication extends BaseApp {
|
||||
lifeCycleHelper = new AppLifeCycleHelper();
|
||||
}
|
||||
registerActivityLifecycleCallback(lifeCycleHelper);
|
||||
initLinkedMe();
|
||||
MobSDK.init(context);
|
||||
MobSDK.submitPolicyGrantResult(true);
|
||||
// initLinkedMe();
|
||||
// MobSDK.init(context);
|
||||
// MobSDK.submitPolicyGrantResult(true);
|
||||
}
|
||||
|
||||
LogUtils.d("init time = " + (System.currentTimeMillis() - startTime) + "ms");
|
||||
@@ -281,11 +280,11 @@ public class XChatApplication extends BaseApp {
|
||||
((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext()).registerActivityLifecycleCallbacks(callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化linkedMe
|
||||
*/
|
||||
private static void initLinkedMe() {
|
||||
MobSDK.init(instance, "32fd2f8457880", "ef796ca85e8cd95a76929663de133214");
|
||||
// /**
|
||||
// * 初始化linkedMe
|
||||
// */
|
||||
// private static void initLinkedMe() {
|
||||
// MobSDK.init(instance, "32fd2f8457880", "ef796ca85e8cd95a76929663de133214");
|
||||
// MobLink.setRestoreSceneListener(new RestoreSceneListener() {
|
||||
// @Override
|
||||
// public Class<? extends Activity> willRestoreScene(Scene scene) {
|
||||
@@ -300,7 +299,7 @@ public class XChatApplication extends BaseApp {
|
||||
// public void notFoundScene(Scene scene) {
|
||||
// }
|
||||
// });
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
private static void initEnv() {
|
||||
|
@@ -55,7 +55,6 @@ import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.manager.RoomEvent;
|
||||
import com.chwl.core.praise.PraiseModel;
|
||||
import com.chwl.core.room.bean.RoomInfo;
|
||||
import com.chwl.core.room.bean.RoomModeType;
|
||||
import com.chwl.core.room.game.GameInfo;
|
||||
import com.chwl.core.room.game.GameModel;
|
||||
import com.chwl.core.room.queuing_mic.event.HasAnimationEffect;
|
||||
|
@@ -153,9 +153,9 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
// case SpConstants.FACEBOOK:
|
||||
// findViewById(R.id.tv_facebook_last_login).setVisibility(View.VISIBLE);
|
||||
// break;
|
||||
case SpConstants.LINE:
|
||||
findViewById(R.id.tv_line_last_login).setVisibility(View.VISIBLE);
|
||||
break;
|
||||
// case SpConstants.LINE:
|
||||
// findViewById(R.id.tv_line_last_login).setVisibility(View.VISIBLE);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,36 +250,36 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
// reportLoginType(IReportConstants.ONE);
|
||||
// LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile"));
|
||||
// break;
|
||||
case R.id.cs_line:
|
||||
reportLoginType(IReportConstants.TWO);
|
||||
getDialogManager().showProgressDialog(this);
|
||||
AuthModel.get().lineLogin()
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
reportLoginResult(IReportConstants.TWO, IReportConstants.ONE, "");
|
||||
// HashMap<String, Object> map = new HashMap<>(2);
|
||||
// map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_line));
|
||||
// ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
|
||||
// ReportManager.get().reportAdjustEvent(IReportConstants.ADJUST_LOGIN);
|
||||
getDialogManager().dismissDialog();
|
||||
SPUtils.putString(SpConstants.LOGIN_TYPE, SpConstants.LINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
reportLoginResult(IReportConstants.TWO, IReportConstants.ZERO, e.getMessage());
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
break;
|
||||
// case R.id.cs_line:
|
||||
// reportLoginType(IReportConstants.TWO);
|
||||
// getDialogManager().showProgressDialog(this);
|
||||
// AuthModel.get().lineLogin()
|
||||
// .compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
// .subscribe(new SingleObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(String result) {
|
||||
// reportLoginResult(IReportConstants.TWO, IReportConstants.ONE, "");
|
||||
//// HashMap<String, Object> map = new HashMap<>(2);
|
||||
//// map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_line));
|
||||
//// ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
|
||||
//// ReportManager.get().reportAdjustEvent(IReportConstants.ADJUST_LOGIN);
|
||||
// getDialogManager().dismissDialog();
|
||||
// SPUtils.putString(SpConstants.LOGIN_TYPE, SpConstants.LINE);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// reportLoginResult(IReportConstants.TWO, IReportConstants.ZERO, e.getMessage());
|
||||
// getDialogManager().dismissDialog();
|
||||
// dealWithLoginError(e);
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
|
||||
case R.id.cs_google:
|
||||
reportLoginType(IReportConstants.THREE);
|
||||
|
@@ -434,46 +434,46 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
|
||||
@Override
|
||||
public void onSharePlatformClick(Platform platform) {
|
||||
if (mWebJsBeanInfo != null && mWebJsBeanInfo.getData() != null) {
|
||||
if (platform.getName().equals("GooglePlus")) {
|
||||
try {
|
||||
ClipboardManager cm = (ClipboardManager) this.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText("text", mWebJsBeanInfo.getData().getLink()));
|
||||
toast(getString(R.string.have_copy));
|
||||
} catch (Exception e) {
|
||||
Logger.i("copyText", String.valueOf(e));
|
||||
toast(String.valueOf(e));
|
||||
}
|
||||
} else {
|
||||
switch (mWebJsBeanInfo.getType()) {
|
||||
case WebJsBeanInfo.IMAGE:
|
||||
if (TextUtils.isEmpty(mWebJsBeanInfo.getData().getImgUrl())) {
|
||||
break;
|
||||
}
|
||||
ShareModel.get().shareImage(platform, mWebJsBeanInfo.getData().getImgUrl());
|
||||
break;
|
||||
default:
|
||||
ShareModel.get().shareH5(mWebJsBeanInfo.getData(), platform).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
toast(ResUtil.getString(R.string.ui_webview_commonwebviewactivity_011));
|
||||
}
|
||||
// if (mWebJsBeanInfo != null && mWebJsBeanInfo.getData() != null) {
|
||||
// if (platform.getName().equals("GooglePlus")) {
|
||||
// try {
|
||||
// ClipboardManager cm = (ClipboardManager) this.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
// cm.setPrimaryClip(ClipData.newPlainText("text", mWebJsBeanInfo.getData().getLink()));
|
||||
// toast(getString(R.string.have_copy));
|
||||
// } catch (Exception e) {
|
||||
// Logger.i("copyText", String.valueOf(e));
|
||||
// toast(String.valueOf(e));
|
||||
// }
|
||||
// } else {
|
||||
// switch (mWebJsBeanInfo.getType()) {
|
||||
// case WebJsBeanInfo.IMAGE:
|
||||
// if (TextUtils.isEmpty(mWebJsBeanInfo.getData().getImgUrl())) {
|
||||
// break;
|
||||
// }
|
||||
// ShareModel.get().shareImage(platform, mWebJsBeanInfo.getData().getImgUrl());
|
||||
// break;
|
||||
// default:
|
||||
// ShareModel.get().shareH5(mWebJsBeanInfo.getData(), platform).subscribe(new SingleObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(String s) {
|
||||
// toast(s);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// toast(e.getMessage());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// toast(ResUtil.getString(R.string.ui_webview_commonwebviewactivity_011));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@@ -12,15 +12,9 @@ import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.application.ReportManager;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import cn.sharesdk.framework.ShareSDK;
|
||||
import cn.sharesdk.google.GooglePlus;
|
||||
import cn.sharesdk.line.Line;
|
||||
|
||||
/**
|
||||
* @author xiaoyu
|
||||
@@ -104,15 +98,15 @@ public class ShareDialog extends BottomSheetDialog implements View.OnClickListen
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.tv_line:
|
||||
if (onShareDialogItemClick != null) {
|
||||
// case R.id.tv_line:
|
||||
// if (onShareDialogItemClick != null) {
|
||||
// HashMap<String, Object> map = new HashMap<>(2);
|
||||
// map.put(FirebaseAnalytics.Param.CONTENT_TYPE, getString(R.string.share_line));
|
||||
// ReportManager.get().reportEvent(FirebaseAnalytics.Event.SHARE, map);
|
||||
onShareDialogItemClick.onSharePlatformClick(ShareSDK.getPlatform(Line.NAME));
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
// onShareDialogItemClick.onSharePlatformClick(ShareSDK.getPlatform(Line.NAME));
|
||||
// }
|
||||
// dismiss();
|
||||
// break;
|
||||
// case R.id.tv_facebook:
|
||||
// if (onShareDialogItemClick != null) {
|
||||
// HashMap<String, Object> map = new HashMap<>(2);
|
||||
@@ -127,7 +121,7 @@ public class ShareDialog extends BottomSheetDialog implements View.OnClickListen
|
||||
// HashMap<String, Object> map = new HashMap<>(2);
|
||||
// map.put(FirebaseAnalytics.Param.CONTENT_TYPE, getString(R.string.share_link));
|
||||
// ReportManager.get().reportEvent(FirebaseAnalytics.Event.SHARE, map);
|
||||
onShareDialogItemClick.onSharePlatformClick(ShareSDK.getPlatform(GooglePlus.NAME));
|
||||
// onShareDialogItemClick.onSharePlatformClick(ShareSDK.getPlatform(GooglePlus.NAME));
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.vele.habuplay.lineapi;
|
||||
|
||||
import cn.sharesdk.line.LineHandlerActivity;
|
||||
//import cn.sharesdk.line.LineHandlerActivity;
|
||||
|
||||
public class LineAuthenticationCallbackActivity extends LineHandlerActivity {
|
||||
}
|
||||
//public class LineAuthenticationCallbackActivity extends LineHandlerActivity {
|
||||
//}
|
||||
|
@@ -13,7 +13,6 @@ buildscript {
|
||||
google()
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://mvn.mob.com/android" }
|
||||
maven { url 'https://repo1.maven.org/maven2/' }
|
||||
}
|
||||
|
||||
@@ -26,9 +25,6 @@ buildscript {
|
||||
// android 资源混淆插件
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.tencent.vasdolly:plugin:3.0.3'
|
||||
classpath "com.mob.sdk:MobSDK:2018.0319.1724"
|
||||
// classpath 'com.google.gms:google-services:4.3.13'
|
||||
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'realm-android'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
apply from: '../mob.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
|
||||
|
4
core/src/main/java/cn/sharesdk/framework/Platform.java
Normal file
4
core/src/main/java/cn/sharesdk/framework/Platform.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package cn.sharesdk.framework;
|
||||
|
||||
public class Platform {
|
||||
}
|
@@ -69,10 +69,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import cn.sharesdk.framework.PlatformActionListener;
|
||||
import cn.sharesdk.framework.ShareSDK;
|
||||
import cn.sharesdk.google.GooglePlus;
|
||||
import cn.sharesdk.line.Line;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
@@ -330,127 +326,127 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* facebook登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> facebookLogin(JSONObject object) {
|
||||
return Single.create((SingleOnSubscribe<JSONObject>) e -> {
|
||||
String name = object.optString("name");
|
||||
String gender = object.optString("gender"); //性别
|
||||
//获取用户头像
|
||||
JSONObject object_pic = object.optJSONObject("picture");
|
||||
JSONObject object_data = object_pic.optJSONObject("data");
|
||||
String photo = object_data.optString("url");
|
||||
|
||||
thirdUserInfo = new ThirdUserInfo();
|
||||
thirdUserInfo.setType(ThirdUserInfo.TYPE_FACEBOOK);
|
||||
thirdUserInfo.setPlatform("Facebook");
|
||||
thirdUserInfo.setUserName(name);
|
||||
thirdUserInfo.setUserGender(gender);
|
||||
thirdUserInfo.setUserIcon(photo);
|
||||
e.onSuccess(object);
|
||||
})
|
||||
.flatMap(platform -> {
|
||||
String openid = platform.optString("id");
|
||||
String unionid = platform.optString("id");
|
||||
String avatar = thirdUserInfo.getUserIcon();
|
||||
if (avatar != null && avatar.equals("null")) {
|
||||
avatar = null;
|
||||
}
|
||||
thirdUserInfo.setUserIcon(avatar);
|
||||
String gender = thirdUserInfo.getUserGender();
|
||||
if (gender != null && !gender.trim().isEmpty()) {
|
||||
gender = gender.replace("m", "1").replace("f", "2");
|
||||
}
|
||||
thirdUserInfo.setUserGender(gender);
|
||||
EventBus.getDefault().post(new LoginReportEvent(1));
|
||||
return thirdLogin(openid, unionid, TYPE_FACEBOOK_LOGIN, "", "");
|
||||
})
|
||||
.flatMap(s -> imLogin(currentAccountInfo))
|
||||
.subscribeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * facebook登录
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public Single<String> facebookLogin(JSONObject object) {
|
||||
// return Single.create((SingleOnSubscribe<JSONObject>) e -> {
|
||||
// String name = object.optString("name");
|
||||
// String gender = object.optString("gender"); //性别
|
||||
// //获取用户头像
|
||||
// JSONObject object_pic = object.optJSONObject("picture");
|
||||
// JSONObject object_data = object_pic.optJSONObject("data");
|
||||
// String photo = object_data.optString("url");
|
||||
//
|
||||
// thirdUserInfo = new ThirdUserInfo();
|
||||
// thirdUserInfo.setType(ThirdUserInfo.TYPE_FACEBOOK);
|
||||
// thirdUserInfo.setPlatform("Facebook");
|
||||
// thirdUserInfo.setUserName(name);
|
||||
// thirdUserInfo.setUserGender(gender);
|
||||
// thirdUserInfo.setUserIcon(photo);
|
||||
// e.onSuccess(object);
|
||||
// })
|
||||
// .flatMap(platform -> {
|
||||
// String openid = platform.optString("id");
|
||||
// String unionid = platform.optString("id");
|
||||
// String avatar = thirdUserInfo.getUserIcon();
|
||||
// if (avatar != null && avatar.equals("null")) {
|
||||
// avatar = null;
|
||||
// }
|
||||
// thirdUserInfo.setUserIcon(avatar);
|
||||
// String gender = thirdUserInfo.getUserGender();
|
||||
// if (gender != null && !gender.trim().isEmpty()) {
|
||||
// gender = gender.replace("m", "1").replace("f", "2");
|
||||
// }
|
||||
// thirdUserInfo.setUserGender(gender);
|
||||
// EventBus.getDefault().post(new LoginReportEvent(1));
|
||||
// return thirdLogin(openid, unionid, TYPE_FACEBOOK_LOGIN, "", "");
|
||||
// })
|
||||
// .flatMap(s -> imLogin(currentAccountInfo))
|
||||
// .subscribeOn(AndroidSchedulers.mainThread())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||
// }
|
||||
|
||||
/**
|
||||
* line
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> lineLogin() {
|
||||
return Single.create(new SingleOnSubscribe<Platform>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
||||
line = ShareSDK.getPlatform(Line.NAME);
|
||||
//是否安装客户端
|
||||
if (!DeviceUtils.isAppInstalled(getContext(), PackageNameConstants.LINE_NAME)) {
|
||||
e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_06)));
|
||||
return;
|
||||
}
|
||||
if (line.isAuthValid()) {
|
||||
line.removeAccount(true);
|
||||
}
|
||||
line.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
if (i == Platform.ACTION_USER_INFOR) {
|
||||
String openid = platform.getDb().getUserId();
|
||||
String unionid = platform.getDb().get("unionid");
|
||||
Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
||||
|
||||
thirdUserInfo = new ThirdUserInfo();
|
||||
thirdUserInfo.setType(ThirdUserInfo.TYPE_LINE);
|
||||
thirdUserInfo.setPlatform("LINE");
|
||||
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||
e.onSuccess(platform);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_07) + i));
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_08)));
|
||||
}
|
||||
});
|
||||
line.SSOSetting(false);
|
||||
line.showUser(null);
|
||||
|
||||
}
|
||||
})
|
||||
.flatMap(platform -> {
|
||||
String openid = platform.getDb().getUserId();
|
||||
String unionid = platform.getDb().getUserId();
|
||||
String avatar = thirdUserInfo.getUserIcon();
|
||||
if (avatar != null && avatar.equals("null")) {
|
||||
avatar = null;
|
||||
}
|
||||
thirdUserInfo.setUserIcon(avatar);
|
||||
String gender = thirdUserInfo.getUserGender();
|
||||
if (gender != null && !gender.trim().isEmpty()) {
|
||||
gender = gender.replace("m", "1").replace("f", "2");
|
||||
}
|
||||
thirdUserInfo.setUserGender(gender);
|
||||
EventBus.getDefault().post(new LoginReportEvent(2));
|
||||
return thirdLogin(openid, unionid, TYPE_LINE_LOGIN, "", "");
|
||||
})
|
||||
.flatMap(s -> imLogin(currentAccountInfo))
|
||||
.subscribeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxHelper.handleException())
|
||||
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||
}
|
||||
// @Override
|
||||
// public Single<String> lineLogin() {
|
||||
// return Single.create(new SingleOnSubscribe<Platform>() {
|
||||
// @Override
|
||||
// public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
||||
// line = ShareSDK.getPlatform(Line.NAME);
|
||||
// //是否安装客户端
|
||||
// if (!DeviceUtils.isAppInstalled(getContext(), PackageNameConstants.LINE_NAME)) {
|
||||
// e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_06)));
|
||||
// return;
|
||||
// }
|
||||
// if (line.isAuthValid()) {
|
||||
// line.removeAccount(true);
|
||||
// }
|
||||
// line.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// if (i == Platform.ACTION_USER_INFOR) {
|
||||
// String openid = platform.getDb().getUserId();
|
||||
// String unionid = platform.getDb().get("unionid");
|
||||
// Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
||||
//
|
||||
// thirdUserInfo = new ThirdUserInfo();
|
||||
// thirdUserInfo.setType(ThirdUserInfo.TYPE_LINE);
|
||||
// thirdUserInfo.setPlatform("LINE");
|
||||
// thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||
// thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||
// thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||
// e.onSuccess(platform);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_07) + i));
|
||||
// throwable.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_08)));
|
||||
// }
|
||||
// });
|
||||
// line.SSOSetting(false);
|
||||
// line.showUser(null);
|
||||
//
|
||||
// }
|
||||
// })
|
||||
// .flatMap(platform -> {
|
||||
// String openid = platform.getDb().getUserId();
|
||||
// String unionid = platform.getDb().getUserId();
|
||||
// String avatar = thirdUserInfo.getUserIcon();
|
||||
// if (avatar != null && avatar.equals("null")) {
|
||||
// avatar = null;
|
||||
// }
|
||||
// thirdUserInfo.setUserIcon(avatar);
|
||||
// String gender = thirdUserInfo.getUserGender();
|
||||
// if (gender != null && !gender.trim().isEmpty()) {
|
||||
// gender = gender.replace("m", "1").replace("f", "2");
|
||||
// }
|
||||
// thirdUserInfo.setUserGender(gender);
|
||||
// EventBus.getDefault().post(new LoginReportEvent(2));
|
||||
// return thirdLogin(openid, unionid, TYPE_LINE_LOGIN, "", "");
|
||||
// })
|
||||
// .flatMap(s -> imLogin(currentAccountInfo))
|
||||
// .subscribeOn(AndroidSchedulers.mainThread())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .compose(RxHelper.handleException())
|
||||
// .doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Single<String> googleLogin(Activity activity) {
|
||||
|
@@ -64,9 +64,9 @@ public interface IAuthModel extends IModel {
|
||||
*/
|
||||
Single<String> login(String phoneAreaCode, String account, String password, String code, String yiDunToken, String shuMeiDeviceId);
|
||||
|
||||
Single<String> facebookLogin(JSONObject object);
|
||||
// Single<String> facebookLogin(JSONObject object);
|
||||
|
||||
Single<String> lineLogin();
|
||||
// Single<String> lineLogin();
|
||||
|
||||
// Single<String> googleLogin();
|
||||
|
||||
|
@@ -4,7 +4,6 @@ import com.chwl.core.share.bean.ShareCommonInfo;
|
||||
import com.chwl.core.web.bean.WebJsBeanInfo;
|
||||
import com.chwl.library.coremanager.IBaseCore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import io.reactivex.Single;
|
||||
|
@@ -33,9 +33,6 @@ import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import cn.sharesdk.framework.PlatformActionListener;
|
||||
import cn.sharesdk.google.GooglePlus;
|
||||
import cn.sharesdk.line.Line;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
@@ -70,71 +67,72 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
return Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
if (null != webViewInfo && platform != null) {
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
if (httpsUrl) {
|
||||
sp.setImageUrl(webViewInfo.getImgUrl().replace("http:", "https:"));
|
||||
} else {
|
||||
sp.setImageUrl(webViewInfo.getImgUrl());
|
||||
}
|
||||
String siteUrl = webViewInfo.getShowUrl();
|
||||
String params = "shareUid=" + String.valueOf(AuthModel.get().getCurrentUid());
|
||||
if (siteUrl.contains("?")) {
|
||||
if (siteUrl.endsWith("?")) {
|
||||
siteUrl += params;
|
||||
} else {
|
||||
siteUrl += "&" + params;
|
||||
}
|
||||
} else {
|
||||
siteUrl += "?" + params;
|
||||
}
|
||||
// //facebook
|
||||
// if (platform.getName().equals(Facebook.NAME)) {
|
||||
// sp.setTitle(webViewInfo.getTitle());
|
||||
// sp.setText(webViewInfo.getDesc());
|
||||
// sp.setUrl(siteUrl);
|
||||
// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
emitter.onError(new Throwable());
|
||||
// if (null != webViewInfo && platform != null) {
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// if (httpsUrl) {
|
||||
// sp.setImageUrl(webViewInfo.getImgUrl().replace("http:", "https:"));
|
||||
// } else {
|
||||
// sp.setImageUrl(webViewInfo.getImgUrl());
|
||||
// }
|
||||
//line
|
||||
// else
|
||||
if (platform.getName().equals(Line.NAME)) {
|
||||
sp.setText(webViewInfo.getDesc() + "[" + webViewInfo.getLink() + "]");
|
||||
}
|
||||
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
String shareUrl = webViewInfo.getLink();
|
||||
if (!shareUrl.contains("?")) {
|
||||
shareUrl += "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid());
|
||||
}
|
||||
String url = UriProvider.getLotteryActivityPage();
|
||||
if (url.contains(XChatConstants.SHARE_H5_URL) &&
|
||||
webViewInfo.getShowUrl() != null &&
|
||||
webViewInfo.getShowUrl().contains(XChatConstants.SHARE_H5_URL)) {
|
||||
reportShare(null, 888, platform, shareUrl);
|
||||
} else {
|
||||
reportShare(null, 1, platform, shareUrl);
|
||||
}
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
String errorMsg = MSG.failed;
|
||||
if (throwable.getMessage().contains("not installed")) {
|
||||
errorMsg = ResUtil.getString(R.string.not_install_app);
|
||||
}
|
||||
emitter.onError(new Throwable(errorMsg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
}
|
||||
// String siteUrl = webViewInfo.getShowUrl();
|
||||
// String params = "shareUid=" + String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// if (siteUrl.contains("?")) {
|
||||
// if (siteUrl.endsWith("?")) {
|
||||
// siteUrl += params;
|
||||
// } else {
|
||||
// siteUrl += "&" + params;
|
||||
// }
|
||||
// } else {
|
||||
// siteUrl += "?" + params;
|
||||
// }
|
||||
//// //facebook
|
||||
//// if (platform.getName().equals(Facebook.NAME)) {
|
||||
//// sp.setTitle(webViewInfo.getTitle());
|
||||
//// sp.setText(webViewInfo.getDesc());
|
||||
//// sp.setUrl(siteUrl);
|
||||
//// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
//// }
|
||||
// //line
|
||||
//// else
|
||||
//// if (platform.getName().equals(Line.NAME)) {
|
||||
//// sp.setText(webViewInfo.getDesc() + "[" + webViewInfo.getLink() + "]");
|
||||
//// }
|
||||
//
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// String shareUrl = webViewInfo.getLink();
|
||||
// if (!shareUrl.contains("?")) {
|
||||
// shareUrl += "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// }
|
||||
// String url = UriProvider.getLotteryActivityPage();
|
||||
// if (url.contains(XChatConstants.SHARE_H5_URL) &&
|
||||
// webViewInfo.getShowUrl() != null &&
|
||||
// webViewInfo.getShowUrl().contains(XChatConstants.SHARE_H5_URL)) {
|
||||
// reportShare(null, 888, platform, shareUrl);
|
||||
// } else {
|
||||
// reportShare(null, 1, platform, shareUrl);
|
||||
// }
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// String errorMsg = MSG.failed;
|
||||
// if (throwable.getMessage().contains("not installed")) {
|
||||
// errorMsg = ResUtil.getString(R.string.not_install_app);
|
||||
// }
|
||||
// emitter.onError(new Throwable(errorMsg));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
@@ -155,65 +153,66 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
return Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
emitter.onError(new Throwable());
|
||||
//无UI API
|
||||
if (platform != null) {
|
||||
String name = platform.getName();
|
||||
final String siteUrl = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_ROOM_URL +
|
||||
AuthModel.get().getCurrentUid() + "&uid=" + roomUid + "&room_name=" +
|
||||
URLEncoder.encode(title, "utf8") + "&room_id=" + roomId + "&room_avatar=" +
|
||||
URLEncoder.encode(room_avatar, "utf8") + "&share_name=" +
|
||||
URLEncoder.encode(UserModel.get().getCacheLoginUserInfo().getNick(), "utf8");
|
||||
if (name.equals("GooglePlus")) {
|
||||
try {
|
||||
ClipboardManager cm = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText("text", siteUrl));
|
||||
emitter.onSuccess("已複製");
|
||||
} catch (Exception e) {
|
||||
Logger.info("copyText", String.valueOf(e));
|
||||
emitter.onError(new Throwable(String.valueOf(e)));
|
||||
}
|
||||
} else {
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setImageUrl(room_avatar);
|
||||
|
||||
//facebook
|
||||
// if (platform.getName().equals(Facebook.NAME)) {
|
||||
// sp.setTitle(XChatConstants.SHARE_ROOM_TITLE);
|
||||
// sp.setText(XChatConstants.SHARE_ROOM_TEXT);
|
||||
// sp.setUrl(siteUrl);
|
||||
// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
// if (platform != null) {
|
||||
// String name = platform.getName();
|
||||
// final String siteUrl = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_ROOM_URL +
|
||||
// AuthModel.get().getCurrentUid() + "&uid=" + roomUid + "&room_name=" +
|
||||
// URLEncoder.encode(title, "utf8") + "&room_id=" + roomId + "&room_avatar=" +
|
||||
// URLEncoder.encode(room_avatar, "utf8") + "&share_name=" +
|
||||
// URLEncoder.encode(UserModel.get().getCacheLoginUserInfo().getNick(), "utf8");
|
||||
// if (name.equals("GooglePlus")) {
|
||||
// try {
|
||||
// ClipboardManager cm = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
// cm.setPrimaryClip(ClipData.newPlainText("text", siteUrl));
|
||||
// emitter.onSuccess("已複製");
|
||||
// } catch (Exception e) {
|
||||
// Logger.info("copyText", String.valueOf(e));
|
||||
// emitter.onError(new Throwable(String.valueOf(e)));
|
||||
// }
|
||||
//line
|
||||
// else
|
||||
if (platform.getName().equals(Line.NAME)) {
|
||||
sp.setText(XChatConstants.SHARE_ROOM_TEXT + "[" + siteUrl + "]");
|
||||
}
|
||||
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
sendShareRoomTipMsg(roomUid);
|
||||
reportShare(String.valueOf(roomUid), 1, platform, siteUrl);
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
String errorMsg = MSG.failed;
|
||||
if (throwable.getMessage().contains("not installed")) {
|
||||
errorMsg = ResUtil.getString(R.string.not_install_app);
|
||||
}
|
||||
emitter.onError(new Throwable(errorMsg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setImageUrl(room_avatar);
|
||||
//
|
||||
// //facebook
|
||||
//// if (platform.getName().equals(Facebook.NAME)) {
|
||||
//// sp.setTitle(XChatConstants.SHARE_ROOM_TITLE);
|
||||
//// sp.setText(XChatConstants.SHARE_ROOM_TEXT);
|
||||
//// sp.setUrl(siteUrl);
|
||||
//// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
//// }
|
||||
// //line
|
||||
//// else
|
||||
//// if (platform.getName().equals(Line.NAME)) {
|
||||
//// sp.setText(XChatConstants.SHARE_ROOM_TEXT + "[" + siteUrl + "]");
|
||||
//// }
|
||||
//
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// sendShareRoomTipMsg(roomUid);
|
||||
// reportShare(String.valueOf(roomUid), 1, platform, siteUrl);
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// String errorMsg = MSG.failed;
|
||||
// if (throwable.getMessage().contains("not installed")) {
|
||||
// errorMsg = ResUtil.getString(R.string.not_install_app);
|
||||
// }
|
||||
// emitter.onError(new Throwable(errorMsg));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -227,26 +226,26 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
* @param shareUrl
|
||||
*/
|
||||
private void reportShare(String roomUid, int sharePageId, Platform platform, String shareUrl) {
|
||||
int shareType = 0;
|
||||
if (platform.getName().equals(GooglePlus.NAME)) {
|
||||
shareType = 1;
|
||||
} else if (platform.getName().equals(Line.NAME)) {
|
||||
shareType = 2;
|
||||
// int shareType = 0;
|
||||
// if (platform.getName().equals(GooglePlus.NAME)) {
|
||||
// shareType = 1;
|
||||
// } else if (platform.getName().equals(Line.NAME)) {
|
||||
// shareType = 2;
|
||||
// } else if (platform.getName().equals(Facebook.NAME)) {
|
||||
// shareType = 3;
|
||||
}
|
||||
|
||||
api.getShareRedPacket(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
roomUid,
|
||||
String.valueOf(shareType),
|
||||
sharePageId + "",
|
||||
shareUrl,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe();
|
||||
// }
|
||||
//
|
||||
// api.getShareRedPacket(
|
||||
// String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
// roomUid,
|
||||
// String.valueOf(shareType),
|
||||
// sharePageId + "",
|
||||
// shareUrl,
|
||||
// AuthModel.get().getTicket()
|
||||
// )
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe();
|
||||
|
||||
}
|
||||
|
||||
@@ -258,41 +257,42 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
return Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
emitter.onError(new Throwable());
|
||||
//无UI API
|
||||
final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_FAMILY_URL;
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setText(XChatConstants.SHARE_FAMILY_TEXT);
|
||||
sp.setTitle(XChatConstants.SHARE_FAMILY_TITLE + "“" + title + "”");
|
||||
sp.setImageUrl(familyIcon);
|
||||
|
||||
sp.setSite(XChatConstants.SHARE_FAMILY_TEXT);
|
||||
final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
||||
+ "&familyId=" + familyId;
|
||||
sp.setSiteUrl(siteUrl);
|
||||
|
||||
sp.setTitleUrl(siteUrl);
|
||||
|
||||
sp.setUrl(siteUrl);
|
||||
|
||||
sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
reportShare(null, 1, platform, siteUrl);
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
emitter.onError(new Throwable(MSG.failed));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
// final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_FAMILY_URL;
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setText(XChatConstants.SHARE_FAMILY_TEXT);
|
||||
// sp.setTitle(XChatConstants.SHARE_FAMILY_TITLE + "“" + title + "”");
|
||||
// sp.setImageUrl(familyIcon);
|
||||
//
|
||||
// sp.setSite(XChatConstants.SHARE_FAMILY_TEXT);
|
||||
// final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
||||
// + "&familyId=" + familyId;
|
||||
// sp.setSiteUrl(siteUrl);
|
||||
//
|
||||
// sp.setTitleUrl(siteUrl);
|
||||
//
|
||||
// sp.setUrl(siteUrl);
|
||||
//
|
||||
// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// reportShare(null, 1, platform, siteUrl);
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// emitter.onError(new Throwable(MSG.failed));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -303,41 +303,42 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
return Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
//无UI API
|
||||
final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_TEAM_URL;
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setText(XChatConstants.SHARE_TEAM_TEXT);
|
||||
sp.setTitle(XChatConstants.SHARE_TEAM_TITLE + "“" + title + "”");
|
||||
sp.setImageUrl(teamIcon);
|
||||
|
||||
sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
||||
+ "&familyId=" + familyId;
|
||||
sp.setSiteUrl(siteUrl);
|
||||
|
||||
sp.setTitleUrl(siteUrl);
|
||||
|
||||
sp.setUrl(siteUrl);
|
||||
|
||||
sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
reportShare(null, 1, platform, siteUrl);
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
emitter.onError(new Throwable(MSG.failed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
emitter.onError(new Throwable());
|
||||
// //无UI API
|
||||
// final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_TEAM_URL;
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setText(XChatConstants.SHARE_TEAM_TEXT);
|
||||
// sp.setTitle(XChatConstants.SHARE_TEAM_TITLE + "“" + title + "”");
|
||||
// sp.setImageUrl(teamIcon);
|
||||
//
|
||||
// sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
// final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
||||
// + "&familyId=" + familyId;
|
||||
// sp.setSiteUrl(siteUrl);
|
||||
//
|
||||
// sp.setTitleUrl(siteUrl);
|
||||
//
|
||||
// sp.setUrl(siteUrl);
|
||||
//
|
||||
// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// reportShare(null, 1, platform, siteUrl);
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// emitter.onError(new Throwable(MSG.failed));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -347,28 +348,29 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
@Override
|
||||
public Single<String> shareText(Platform platform, String text) {
|
||||
return Single.create(emitter -> {
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setTitle("");
|
||||
sp.setText(text);
|
||||
sp.setImageUrl("");
|
||||
sp.setShareType(Platform.SHARE_TEXT);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
emitter.onError(new Throwable(MSG.failed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform1, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
emitter.onError(new Throwable());
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setTitle("");
|
||||
// sp.setText(text);
|
||||
// sp.setImageUrl("");
|
||||
// sp.setShareType(Platform.SHARE_TEXT);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
// emitter.onError(new Throwable(MSG.failed));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform1, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -408,55 +410,56 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
|
||||
public void shareImage(Platform platform, String url) {
|
||||
//无UI API
|
||||
final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_TEAM_URL;
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setImageUrl(url);
|
||||
|
||||
sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
|
||||
sp.setShareType(Platform.SHARE_IMAGE);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
// final String shareLink = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_TEAM_URL;
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setImageUrl(url);
|
||||
//
|
||||
// sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
//
|
||||
// sp.setShareType(Platform.SHARE_IMAGE);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform, int i, Throwable throwable) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform, int i) {
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
}
|
||||
|
||||
public Single<String> shareImageForSignIn(Platform platform, String url) {
|
||||
|
||||
return Single.create(emitter -> {
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setImageUrl(url);
|
||||
|
||||
sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
|
||||
sp.setShareType(Platform.SHARE_IMAGE);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
emitter.onError(new Throwable(MSG.failed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform1, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
emitter.onError(new Throwable());
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setImageUrl(url);
|
||||
//
|
||||
// sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||
//
|
||||
// sp.setShareType(Platform.SHARE_IMAGE);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
// emitter.onError(new Throwable(MSG.failed));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform1, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -465,36 +468,37 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
public Single<String> shareCommon(Platform platform, ShareCommonInfo info, boolean toast) {
|
||||
|
||||
return Single.create((SingleOnSubscribe<String>) emitter -> {
|
||||
Platform.ShareParams sp = new Platform.ShareParams();
|
||||
sp.setTitle(info.getTitle());
|
||||
sp.setText(info.getContent());
|
||||
sp.setImageUrl(info.getImageUrl());
|
||||
String siteUrl = info.getSiteUrl();
|
||||
|
||||
sp.setSite(info.getTitle());
|
||||
sp.setSiteUrl(siteUrl);
|
||||
|
||||
sp.setTitleUrl(siteUrl);
|
||||
|
||||
sp.setUrl(siteUrl);
|
||||
sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
emitter.onSuccess(MSG.success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
emitter.onError(new Throwable(MSG.failed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform1, int i) {
|
||||
emitter.onError(new Throwable(MSG.cancel));
|
||||
}
|
||||
});
|
||||
platform.share(sp);
|
||||
emitter.onError(new Throwable());
|
||||
// Platform.ShareParams sp = new Platform.ShareParams();
|
||||
// sp.setTitle(info.getTitle());
|
||||
// sp.setText(info.getContent());
|
||||
// sp.setImageUrl(info.getImageUrl());
|
||||
// String siteUrl = info.getSiteUrl();
|
||||
//
|
||||
// sp.setSite(info.getTitle());
|
||||
// sp.setSiteUrl(siteUrl);
|
||||
//
|
||||
// sp.setTitleUrl(siteUrl);
|
||||
//
|
||||
// sp.setUrl(siteUrl);
|
||||
// sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||
// platform.setPlatformActionListener(new PlatformActionListener() {
|
||||
// @Override
|
||||
// public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||
// emitter.onSuccess(MSG.success);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Platform platform1, int i, Throwable throwable) {
|
||||
// emitter.onError(new Throwable(MSG.failed));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(Platform platform1, int i) {
|
||||
// emitter.onError(new Throwable(MSG.cancel));
|
||||
// }
|
||||
// });
|
||||
// platform.share(sp);
|
||||
})
|
||||
.doOnSuccess(s -> {
|
||||
if (toast) {
|
||||
|
53
mob.gradle
53
mob.gradle
@@ -1,53 +0,0 @@
|
||||
apply plugin: 'com.mob.sdk'
|
||||
|
||||
MobSDK {
|
||||
// appKey "32fd2f8457880"
|
||||
// appSecret "ef796ca85e8cd95a76929663de133214"
|
||||
appKey ""
|
||||
appSecret ""
|
||||
appBundleMode true
|
||||
// MobLink {
|
||||
// uriScheme "ananplay://sharesdk"
|
||||
// appLinkHost "bvgw.t4m.cn"
|
||||
// }
|
||||
ShareSDK {
|
||||
version '3.10.9'
|
||||
//平台配置信息
|
||||
gui false
|
||||
devInfo {
|
||||
GooglePlus {
|
||||
appId "...com"
|
||||
callbackUri "http://localhost"
|
||||
officialVersion "default"
|
||||
enable true
|
||||
}
|
||||
// GooglePlus {
|
||||
// appId "280420698373-najdbkk7ju8lg8f6gg4bnll8nf7l0i2c.apps.googleusercontent.com"
|
||||
// callbackUri "http://localhost"
|
||||
// officialVersion "default"
|
||||
// enable true
|
||||
// }
|
||||
Line {
|
||||
appId ""
|
||||
appSecret ""
|
||||
enable true
|
||||
}
|
||||
// Line {
|
||||
// appId "1655904857"
|
||||
// appSecret "392a9cada6f63a88a0f34a8e479364e1"
|
||||
// enable true
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
permissions {
|
||||
exclude "android.permission.READ_PHONE_STATE", "android.permission.ACCESS_FINE_LOCATION",
|
||||
"android.permission.ACCESS_COARSE_LOCATION", "android.permission.QUERY_ALL_PACKAGES",
|
||||
"android.permission.GET_ACCOUNTS", "android.permission.ACCESS_WIFI_STATE",
|
||||
"android.permission.READ_SMS", "android.permission.RECEIVE_SMS",
|
||||
"android.permission.READ_CONTACTS"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,24 +0,0 @@
|
||||
package com.example.module_base
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.module_base.test", appContext.packageName)
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.example.module_base
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package com.example.module_google
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.module_google.test", appContext.packageName)
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.example.module_google
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@
|
||||
<Twitter Enable="false" />
|
||||
<Evernote Enable="false" />
|
||||
<FourSquare Enable="false" />
|
||||
<GooglePlus OfficialVersion="default" Enable="true" ClientID="...com" RedirectUrl="http://localhost" />
|
||||
<GooglePlus Enable="false" />
|
||||
<Instagram Enable="false" />
|
||||
<LinkedIn Enable="false" />
|
||||
<Tumblr Enable="false" />
|
||||
@@ -30,7 +30,7 @@
|
||||
<Yixin Enable="false" />
|
||||
<YixinMoments Enable="false" />
|
||||
<Mingdao Enable="false" />
|
||||
<Line Enable="true" ChannelID="" ChannelSecret="" />
|
||||
<Line Enable="false" />
|
||||
<WhatsApp Enable="false" />
|
||||
<KakaoTalk Enable="false" />
|
||||
<KakaoStory Enable="false" />
|
||||
|
Reference in New Issue
Block a user