Commit 1bb4f6ed by onuma

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

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