|
|
@@ -6,6 +6,7 @@ package kr.co.zumo.app.lifeplus.tool;
|
|
|
import android.content.Context;
|
|
|
import android.util.Log;
|
|
|
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.kakao.kakaolink.v2.KakaoLinkResponse;
|
|
|
import com.kakao.kakaolink.v2.KakaoLinkService;
|
|
|
import com.kakao.message.template.ButtonObject;
|
|
|
@@ -19,6 +20,7 @@ import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.ContentsBean;
|
|
|
import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
|
|
|
/**
|
|
|
@@ -34,6 +36,7 @@ import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
public class ShareKakaoTalk extends Share<Context> {
|
|
|
|
|
|
public static final String RECOMMEND_KEY = "recommendKey";
|
|
|
+ public static final String CONTENTS_KEY = "contentsKey";
|
|
|
public static final int CLIENT_ERROR_CODE = -777;
|
|
|
|
|
|
public ShareKakaoTalk(Context context) {
|
|
|
@@ -42,13 +45,18 @@ public class ShareKakaoTalk extends Share<Context> {
|
|
|
|
|
|
@Override
|
|
|
public void shareContents(String contentsUrl, IShareListener listener) {
|
|
|
- String url = contentsUrl;
|
|
|
+ String jsonString = contentsUrl;
|
|
|
+ // contentsBean 의 모든 데이터를 가져온다.
|
|
|
+ // contentsUrl json 스트링으로 들어있다.
|
|
|
+ ContentsBean contentsBean = new Gson().fromJson(jsonString, ContentsBean.class);
|
|
|
+ String url = contentsBean.getContentUrl();
|
|
|
+
|
|
|
FeedTemplate params = FeedTemplate
|
|
|
.newBuilder(ContentObject.newBuilder(ResourceUtil.getString(R.string.life_plus),
|
|
|
ResourceUtil.getString(R.string.lifeplus_share_image_url),
|
|
|
LinkObject.newBuilder().setWebUrl(url)
|
|
|
.setMobileWebUrl(url).build())
|
|
|
- .setDescrption(contentsUrl)
|
|
|
+ .setDescrption(url)
|
|
|
.build())
|
|
|
//.setSocial(SocialObject.newBuilder().setLikeCount(10).setCommentCount(20)
|
|
|
//.setSharedCount(30).setViewCount(40).build())
|
|
|
@@ -59,8 +67,8 @@ public class ShareKakaoTalk extends Share<Context> {
|
|
|
.addButton(new ButtonObject(ResourceUtil.getString(R.string.view_in_app), LinkObject.newBuilder()
|
|
|
.setWebUrl(url)
|
|
|
.setMobileWebUrl(url)
|
|
|
-// .setAndroidExecutionParams(new StringBuilder(RECOMMEND_KEY).append("=").append(code).toString()) //kakao95448ff031e92087b5dbc44d56cff7bb://kakaolink?key=test
|
|
|
-// .setIosExecutionParams(new StringBuilder(RECOMMEND_KEY).append("=").append(code).toString())
|
|
|
+ .setAndroidExecutionParams(new StringBuilder(CONTENTS_KEY).append("=").append(jsonString).toString()) //kakao95448ff031e92087b5dbc44d56cff7bb://kakaolink?key=test
|
|
|
+ .setIosExecutionParams(new StringBuilder(CONTENTS_KEY).append("=").append(jsonString).toString())
|
|
|
.build()))
|
|
|
.build();
|
|
|
|