房间分享文案修改
This commit is contained in:
@@ -128,12 +128,12 @@ public class XChatConstants {
|
|||||||
/**
|
/**
|
||||||
* 分享房间文本
|
* 分享房间文本
|
||||||
*/
|
*/
|
||||||
public static final String SHARE_ROOM_TEXT = "人美声甜带上分,一起来玩吧~";
|
public static final String SHARE_ROOM_TEXT = "这个房间很好玩,推荐给你,快来和我一起玩吧~";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享房间标题
|
* 分享房间标题
|
||||||
*/
|
*/
|
||||||
public static final String SHARE_ROOM_TITLE = "来魔力,用声音交真挚的朋友";
|
public static final String SHARE_ROOM_TITLE = "聆听声音,分享快乐";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享房间 URL
|
* 分享房间 URL
|
||||||
|
@@ -45,25 +45,15 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public class ShareModel extends BaseModel implements IShareModel {
|
public class ShareModel extends BaseModel implements IShareModel {
|
||||||
|
|
||||||
private interface MSG {
|
|
||||||
String success = "分享成功";
|
|
||||||
String failed = "分享失败,请重试";
|
|
||||||
String cancel = "分享取消";
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Api api = RxNet.create(Api.class);
|
private final Api api = RxNet.create(Api.class);
|
||||||
|
|
||||||
private static final class Helper {
|
private ShareModel() {
|
||||||
public static final ShareModel INSTANCE = new ShareModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ShareModel get() {
|
public static ShareModel get() {
|
||||||
return Helper.INSTANCE;
|
return Helper.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShareModel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<String> shareH5(final WebJsBeanInfo.DataBean webViewInfo, Platform platform) {
|
public Single<String> shareH5(final WebJsBeanInfo.DataBean webViewInfo, Platform platform) {
|
||||||
return shareH5(webViewInfo, platform, false);
|
return shareH5(webViewInfo, platform, false);
|
||||||
@@ -150,17 +140,17 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
//无UI API
|
//无UI API
|
||||||
if (userInfo != null && platform != null) {
|
if (userInfo != null && platform != null) {
|
||||||
Platform.ShareParams sp = new Platform.ShareParams();
|
Platform.ShareParams sp = new Platform.ShareParams();
|
||||||
sp.setText(XChatConstants.SHARE_ROOM_TEXT);
|
sp.setText(title + XChatConstants.SHARE_ROOM_TEXT);
|
||||||
sp.setTitle(XChatConstants.SHARE_ROOM_TITLE);
|
sp.setTitle(XChatConstants.SHARE_ROOM_TITLE);
|
||||||
sp.setImageUrl(userInfo.getAvatar());
|
sp.setImageUrl(userInfo.getAvatar());
|
||||||
final String siteUrl = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_ROOM_URL +
|
final String siteUrl = UriProvider.IM_SERVER_URL + XChatConstants.SHARE_ROOM_URL +
|
||||||
AuthModel.get().getCurrentUid() + "&uid=" + roomUid + "&room_name=" +
|
AuthModel.get().getCurrentUid() + "&uid=" + roomUid + "&room_name=" +
|
||||||
URLEncoder.encode(title, "utf8") + "&room_id=" + roomId + "&room_avatar=" +
|
URLEncoder.encode(title, "utf8") + "&room_id=" + roomId + "&room_avatar=" +
|
||||||
URLEncoder.encode(room_avatar, "utf8") + "&share_name=" +
|
URLEncoder.encode(room_avatar, "utf8") + "&share_name=" +
|
||||||
URLEncoder.encode( UserModel.get().getCacheLoginUserInfo().getNick(), "utf8");
|
URLEncoder.encode(UserModel.get().getCacheLoginUserInfo().getNick(), "utf8");
|
||||||
//QQ空间分享
|
//QQ空间分享
|
||||||
|
|
||||||
sp.setSite(XChatConstants.SHARE_ROOM_TEXT);
|
sp.setSite(title + XChatConstants.SHARE_ROOM_TEXT);
|
||||||
sp.setSiteUrl(siteUrl);
|
sp.setSiteUrl(siteUrl);
|
||||||
//QQ分享
|
//QQ分享
|
||||||
sp.setTitleUrl(siteUrl);
|
sp.setTitleUrl(siteUrl);
|
||||||
@@ -194,7 +184,6 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向我们服务器报告分享
|
* 向我们服务器报告分享
|
||||||
*
|
*
|
||||||
@@ -217,13 +206,13 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
|
|
||||||
|
|
||||||
api.getShareRedPacket(
|
api.getShareRedPacket(
|
||||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||||
roomUid,
|
roomUid,
|
||||||
String.valueOf(shareType),
|
String.valueOf(shareType),
|
||||||
sharePageId + "",
|
sharePageId + "",
|
||||||
shareUrl,
|
shareUrl,
|
||||||
AuthModel.get().getTicket()
|
AuthModel.get().getTicket()
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe();
|
.subscribe();
|
||||||
@@ -324,7 +313,6 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<String> shareText(Platform platform, String text) {
|
public Single<String> shareText(Platform platform, String text) {
|
||||||
return Single.create(emitter -> {
|
return Single.create(emitter -> {
|
||||||
@@ -450,42 +438,41 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<String> shareCommon(Platform platform, ShareCommonInfo info, boolean toast) {
|
public Single<String> shareCommon(Platform platform, ShareCommonInfo info, boolean toast) {
|
||||||
|
|
||||||
return Single.create((SingleOnSubscribe<String>) emitter -> {
|
return Single.create((SingleOnSubscribe<String>) emitter -> {
|
||||||
Platform.ShareParams sp = new Platform.ShareParams();
|
Platform.ShareParams sp = new Platform.ShareParams();
|
||||||
sp.setTitle(info.getTitle());
|
sp.setTitle(info.getTitle());
|
||||||
sp.setText(info.getContent());
|
sp.setText(info.getContent());
|
||||||
sp.setImageUrl(info.getImageUrl());
|
sp.setImageUrl(info.getImageUrl());
|
||||||
String siteUrl = info.getSiteUrl();
|
String siteUrl = info.getSiteUrl();
|
||||||
//QQ空间分享
|
//QQ空间分享
|
||||||
sp.setSite(info.getTitle());
|
sp.setSite(info.getTitle());
|
||||||
sp.setSiteUrl(siteUrl);
|
sp.setSiteUrl(siteUrl);
|
||||||
//QQ分享
|
//QQ分享
|
||||||
sp.setTitleUrl(siteUrl);
|
sp.setTitleUrl(siteUrl);
|
||||||
//微信朋友圈分享
|
//微信朋友圈分享
|
||||||
sp.setUrl(siteUrl);
|
sp.setUrl(siteUrl);
|
||||||
sp.setShareType(Platform.SHARE_WEBPAGE);
|
sp.setShareType(Platform.SHARE_WEBPAGE);
|
||||||
platform.setPlatformActionListener(new PlatformActionListener() {
|
platform.setPlatformActionListener(new PlatformActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
public void onComplete(Platform platform1, int i, HashMap<String, Object> hashMap) {
|
||||||
emitter.onSuccess(MSG.success);
|
emitter.onSuccess(MSG.success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Platform platform1, int i, Throwable throwable) {
|
public void onError(Platform platform1, int i, Throwable throwable) {
|
||||||
emitter.onError(new Throwable(MSG.failed));
|
emitter.onError(new Throwable(MSG.failed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(Platform platform1, int i) {
|
public void onCancel(Platform platform1, int i) {
|
||||||
emitter.onError(new Throwable(MSG.cancel));
|
emitter.onError(new Throwable(MSG.cancel));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
platform.share(sp);
|
platform.share(sp);
|
||||||
})
|
})
|
||||||
.doOnSuccess(s -> {
|
.doOnSuccess(s -> {
|
||||||
if (toast) {
|
if (toast) {
|
||||||
SingleToastUtil.showToast(s);
|
SingleToastUtil.showToast(s);
|
||||||
@@ -498,6 +485,13 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private interface MSG {
|
||||||
|
String success = "分享成功";
|
||||||
|
String failed = "分享失败,请重试";
|
||||||
|
String cancel = "分享取消";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
interface Api {
|
interface Api {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -520,4 +514,8 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
@Query("ticket") String ticket);
|
@Query("ticket") String ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class Helper {
|
||||||
|
public static final ShareModel INSTANCE = new ShareModel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user