Commit 1bb4f6ed by onuma

プッシュメッセージからチャットと協業に遷移する時、iOSと同じ遷移にした。

parent 09e97798
......@@ -169,8 +169,9 @@ public interface ABookCommConstants {
String CONTACT_URL = "file:///android_asset/chat/public_new/contact.html";
String COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration.html";
String DEFAULT_CHECKSUM = "0000000000";
String PLATFORM_NAME = "android";
String CHAT_MESSAGE_SEPERATOR = "<::split>";
String INVITE_COLLABORATION = "inviteCollaboration" + CHAT_MESSAGE_SEPERATOR;
int PUSH_MESSAGE_DLG_REQUEST_CODE = 200;
interface PUSH_MESSAGE_DLG_RESULT {
......
......@@ -19,6 +19,7 @@ import org.json.adf.JSONObject;
import java.util.Map;
import java.util.Objects;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
......@@ -42,8 +43,6 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
private static final String TAG = "ABVFcmListenerService";
private NotificationManager mNotificationManager;
private static int mNotificationConnect = 0;
private final String CHAT_MESSAGE_SEPERATOR = "<::split>";
private final String INVITE_COLLABORATION = "inviteCollaboration" + CHAT_MESSAGE_SEPERATOR;
@Override
public void onCreate() {
......@@ -260,9 +259,9 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
String roomType = "";
String collaborationType = "";
if (textMessage.contains(INVITE_COLLABORATION)) {
if (textMessage.contains(ABookCommConstants.INVITE_COLLABORATION)) {
roomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
String[] inviteMessage = textMessage.split(CHAT_MESSAGE_SEPERATOR);
String[] inviteMessage = textMessage.split(ABookCommConstants.CHAT_MESSAGE_SEPERATOR);
collaborationType = inviteMessage[1];
}
String roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
......@@ -315,7 +314,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
* @return 表示するテキスト
*/
private String getContentText(String textMessage) {
if (!StringUtil.isNullOrEmpty(textMessage) && textMessage.contains(INVITE_COLLABORATION)) {
if (!StringUtil.isNullOrEmpty(textMessage) && textMessage.contains(ABookCommConstants.INVITE_COLLABORATION)) {
return getString(R.string.msg_invite_collaboration);
}
return textMessage;
......
package jp.agentec.abook.abv.cl.push;
import android.content.Intent;
import org.json.adf.JSONObject;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.adf.util.StringUtil;
/**
* プッシュメッセージをJSONにしたクラス
......@@ -56,7 +62,8 @@ public class PushMessageJSON {
public String getRoomType() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.roomType);
int roomType = jsonObject.getInt(AppDefType.ChatPushMessageKey.roomType);
return Integer.toString(roomType);
} catch (Exception e){
return "";
}
......@@ -78,8 +85,21 @@ public class PushMessageJSON {
}
}
public boolean isCollaboration() {
String message = getMessage();
if (message.contains(ABookCommConstants.INVITE_COLLABORATION)) {
return true;
}
return false;
}
public String getCollaborationType() {
try {
String message = getMessage();
if (message.contains(ABookCommConstants.INVITE_COLLABORATION)) {
String[] inviteMessage = message.split(ABookCommConstants.CHAT_MESSAGE_SEPERATOR);
return inviteMessage[1];
}
return jsonObject.getString(AppDefType.ChatPushMessageKey.collaborationType);
} catch (Exception e) {
return "";
......
......@@ -162,11 +162,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
// ABookCommunicationでチャットの情報を格納しておく
private Long roomId = new Long(0);
private String roomName = "";
private String collaborationType = "";
private String roomType = "";
private String fromClassName = "";
//private Long roomId = new Long(0);
//private String roomName = "";
//private String collaborationType = "";
//private String roomType = "";
//private String fromClassName = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -1309,7 +1309,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
/**
* ッシュメッセージがあるので、チャットルームに遷移する。
*/
public void goChatRoom(final Intent intent, final String fromClassName) {
public boolean goChatRoom(final Intent intent, final String nextActivity) {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
......@@ -1317,7 +1317,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
public void run() {
Logger.d(TAG,"fromClassName = " + fromClassName);
Logger.d(TAG,"fromClassName = " + nextActivity);
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType)) &&
!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType))
......@@ -1328,15 +1328,18 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),
intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType),
intent.getStringExtra(AppDefType.ChatPushMessageKey.fromClassName));
nextActivity);
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),"");
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),
nextActivity);
}
}
}, 500);
return true;
}
return false;
}
/**
......@@ -1352,14 +1355,30 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
json = new PushMessageJSON(messageBody);
/**
String textMessage = json.getMessage();
if (textMessage.contains(ABookCommConstants.INVITE_COLLABORATION)) {
// 協業
textMessage = getString(R.string.msg_invite_collaboration);
}
*/
// 協業
String messageText = json.getMessage();
if (json.isCollaboration()) {
messageText = getString(R.string.msg_invite_collaboration);
}
Intent pushMsgDialog = new Intent(context, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, json.getMessage());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, messageText);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, json.getData());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, json.getOperationID());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, json.getRoomId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, json.getRoomName());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, json.getPushSendLoginId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, json.getPushSendDate());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomType, json.getRoomType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, json.getCollaborationType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, messageMap.get(AppDefType.ChatPushMessageKey.fromClassName));
/**
this.roomId = roomID;
......
......@@ -517,8 +517,9 @@ public class OperationListActivity extends ABVUIActivity {
refreshOperationList();
// プッシュメッセージがある場合の処理
getIntent().putExtra(AppDefType.ChatPushMessageKey.fromClassName, this.getClass().getName());
goChatRoom(getIntent(), "");
if (goChatRoom(getIntent(), ChatWebViewActivity.class.getName())) {
return;
}
// 報告画面から作業一覧へ戻った時の同期処理
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
......@@ -1284,7 +1285,7 @@ public class OperationListActivity extends ABVUIActivity {
// プッシュメッセージダイアログのリザルトだった場合
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
goChatRoom(intent, "");
goChatRoom(intent, ChatWebViewActivity.class.getName());
}
return;
}
......
......@@ -545,6 +545,9 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
updateCollaborationInfo();
refreshCollaborationUI();
super.onResume();
if(goChatRoom(getIntent(), ChatWebViewActivity.class.getName())) {
return;
}
showOperationRelatedContentList();
}
......@@ -602,9 +605,8 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
//backToHome();
finish();
goChatRoom(intent, "");
goChatRoom(intent, ChatWebViewActivity.class.getName());
}
return;
}
......
......@@ -1674,7 +1674,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
* @param roomName
*/
public void startChatWebViewActivity(Long roomId, String roomName, String nextActivityName) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
......@@ -1687,7 +1686,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
String nextActivity = className;
//String nextActivity = className;
//if (fromClassName.equals(HTMLWebViewActivity.class.getName())) {
// フォームからきたら
//nextActivity = OperationListActivity.class.getName();
......@@ -1698,7 +1697,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//intent.setClassName(mContext.getPackageName(), className);
intent.setClassName(mContext.getPackageName(), nextActivity);
intent.setClassName(mContext.getPackageName(), nextActivityName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
......@@ -1935,7 +1934,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
* @param collaborationType
* @param roomType
*/
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String fromClassName) {
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String nextActivityName) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
......
......@@ -3834,7 +3834,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
finishActivity();
goChatRoom(intent, "");
goChatRoom(intent, OperationRelatedContentActivity.class.getName());
}
return;
}
......
......@@ -51,6 +51,7 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
......@@ -694,7 +695,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
finishActivity();
goChatRoom(intent, this.getClass().getName());
goChatRoom(intent, OperationListActivity.class.getName());
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment