Commit 608d6491 by onuma

showChatRoomPopupMessage関数を共通化した。

parent b113f1a2
......@@ -46,11 +46,9 @@ public class ChatPushDataJSON extends AcmsCommonJSON {
if (pushMessagetJsonArray.getJSONObject(k).length() == 0) {
break;
}
PushMessageDto pushMessageDto = new PushMessageDto();
String tempDate = DateTimeUtil.toString(DateTimeUtil.toDate(pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate), DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmssSSS_none);
//Logger.d("messageId","messageId : " + pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate));
//Logger.d("oerationId","oerationId : " + pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate)+1);
//Logger.d("date","date : " + tempDate);
pushMessageDto.pushMessageId = Long.valueOf(tempDate);
pushMessageDto.operationId = Long.valueOf(tempDate+1);
pushMessageDto.pushSendLoginId = pushMessagetJsonArray.getJSONObject(k).getString(PushSendLoginId);
......
......@@ -5,6 +5,7 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
......@@ -25,6 +26,7 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.util.AppUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
......@@ -175,6 +177,18 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
startActivity(pushMsgDialog);
}
/**
* プッシュメッセージをダイアログ表示する
* @param textMessage プッシュメッセージ
* @param data Intentに付属するデータ
* @param operationID operationID
* @param roomID roomID
* @param roomName roomName
* @param roomType roomType
* @param pushSendLoginId pushSendLoginId
* @param pushSendDate pushSendDate
* @param collaborationType ABookCommConstants.COLLABORATION_TYPE のいずれか
*/
private void showChatRoomPopupMessage(
String textMessage,
String data,
......@@ -194,14 +208,14 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
return;
}
}
// プッシュメッセージは、受信した時のActivityで処理をわける(後処理が違うので)
String fromClassName = currentActivity.getClass().getName();
if (currentActivity.getClass().equals(HTMLWebViewActivity.class)){
((HTMLWebViewActivity)currentActivity).showChatRoomPopupMessage(textMessage, data, operationID, roomID, roomName, roomType, pushSendLoginId, pushSendDate, collaborationType);
} else if (currentActivity.getClass().equals(ContentViewActivity.class)){
((ContentViewActivity)currentActivity).showChatRoomPopupMessage(textMessage, data, operationID, roomID, roomName, roomType, pushSendLoginId, pushSendDate, collaborationType);
} else if (currentActivity.getClass().equals(OperationRelatedContentActivity.class)){
((ContentViewActivity)currentActivity).showChatRoomPopupMessage(textMessage, data, operationID, roomID, roomName, roomType, pushSendLoginId, pushSendDate, collaborationType);
if (currentActivity.getClass().equals(HTMLWebViewActivity.class) ||
currentActivity.getClass().equals(ContentViewActivity.class) ||
currentActivity.getClass().equals(OperationRelatedContentActivity.class) ||
currentActivity.getClass().equals(OperationListActivity.class)
){
((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, textMessage,
data, operationID, roomID, roomName, roomType, pushSendLoginId, pushSendDate, collaborationType, fromClassName);
} else {
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
......
......@@ -40,6 +40,7 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.AlertMessageLevel;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -158,6 +159,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
int PAYMENT = 3;
}
// ABookCommunicationで使用する。
private Long roomId = new Long(0);
private String roomName = "";
private String collaborationType = "";
private String roomType = "";
private String fromClassName = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -1235,4 +1243,62 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return existUnreadFlg;
}
/**
* プッシュメッセージ受信後のダイアログを表示する。
* @param context コンテキスト
* @param textMessage プッシュメッセージ
* @param data Intentに付属するデータ
* @param operationID operationID
* @param roomID roomID
* @param roomName roomName
* @param roomType roomType
* @param pushSendLoginId pushSendLoginId
* @param pushSendDate pushSendDate
* @param collaborationType ABookCommConstants.COLLABORATION_TYPE のいずれか
*/
public void showChatRoomPopupMessage(
Context context,
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType,
String fromClassName
) {
Intent pushMsgDialog = new Intent(context, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, fromClassName);
this.roomId = roomID;
this.roomName = roomName;
this.collaborationType = collaborationType;
this.roomType = roomType;
this.fromClassName = fromClassName;
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
/**
* チャットルームへ遷移する。
*/
public void goChatRoom() {
if (roomId <= 0 && StringUtil.isNullOrEmpty(roomName)) {
return;
}
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(fromClassName, roomId, roomName);
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(fromClassName, roomId, roomName, collaborationType, roomType);
}
}
}
......@@ -41,6 +41,7 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
......@@ -76,6 +77,7 @@ import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.NoPdfViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.PhotoEditActivity;
......
package jp.agentec.abook.abv.ui.common.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
......@@ -124,8 +125,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
isCollabration = MeetingManager.getInstance().isCollaboration();
Bundle extras = getIntent().getExtras();
if (extras != null && !isMeetingRoomConnected) {
moveChatRoom(extras);
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK);
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK, getIntent());
finish();
}
if (isMeetingRoomConnected || isCollabration) {
......@@ -136,7 +136,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.CANCEL);
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.CANCEL, getIntent());
finish();
}
});
......@@ -147,25 +147,6 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
}
/**
* チャットルームへ遷移するための処理
* @param extras
*/
private void moveChatRoom(Bundle extras) {
Long roomId = extras.getLong(AppDefType.ChatPushMessageKey.roomId, 0);
String roomName = extras.getString(AppDefType.ChatPushMessageKey.roomName);
String collaborationType = extras.getString(AppDefType.ChatPushMessageKey.collaborationType);
String roomType = extras.getString(AppDefType.ChatPushMessageKey.roomType);
String fromClassName = extras.getString(AppDefType.ChatPushMessageKey.fromClassName,"");
if (roomId > 0 && !StringUtil.isNullOrEmpty(roomName)) {
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(fromClassName, roomId, roomName);
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(fromClassName, roomId, roomName, collaborationType, roomType);
}
}
}
/**
* 遠隔支援中(会議室接続中)はチャットルームにはいけない。
*/
private void showCannotMoveChatRoomDialog() {
......@@ -184,7 +165,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
alertDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.CANCEL);
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.CANCEL, getIntent());
finish();
}
});
......
......@@ -54,6 +54,7 @@ import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.Constant.TaskReportLevel;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -1248,6 +1249,14 @@ public class OperationListActivity extends ABVUIActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
goChatRoom();
}
return;
}
activityResultFlg = true;
Uri result = (intent == null || resultCode != RESULT_OK) ? null : intent.getData();
//ベースファイル登録した後にシーン画像選択画面閉じた後に呼ばれる
......
......@@ -36,7 +36,6 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
......@@ -614,33 +613,9 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
backToHome();
goChatRoom();
}
return;
}
}
/**
* プッシュメッセージ受信後のダイアログを表示処理。
*/
public void showChatRoomPopupMessage(
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String pushSendLoginId,
long pushSendDate)
{
String fromClassName = getClass().getName();
Intent pushMsgDialog = new Intent(OperationRelatedContentActivity.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName ,fromClassName);
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
}
......@@ -1701,9 +1701,15 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
/**
* プシュメッセージからチャットに入る(協業)
* プシュメッセージからチャットに遷移する
* fromClassName の値によっては、作業一覧、コンテンツ一覧のどちらかに戻ってから、チャットに遷移する)
* @param fromClassName 呼び出し元のクラス名(
* @param roomId roomId
* @param roomName room
* @param roomType roomaType
* @param collaborationType ABookCommConstants.COLLABORATION_TYPE のいずれか
*/
public void startChatWebViewActivityWithCollaboration(String fromClassName, Long roomId, String roomName, String collaborationType, String roomType) {
public void startChatWebViewActivityWithCollaboration(String fromClassName, Long roomId, String roomName, String roomType, String collaborationType) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
......
......@@ -3831,6 +3831,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
// Activityを閉じて遷移する
exitActivity();
goChatRoom();
}
return;
}
......@@ -5539,32 +5540,4 @@ public class ContentViewActivity extends ABVContentViewActivity {
public void reloadPdfTaskIcon(String taskKey) {
operationTaskLayout.setIconStatus(taskKey,false);
}
/**
* プッシュメッセージ受信後のダイアログを表示処理。
*/
public void showChatRoomPopupMessage(
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType
) {
String fromClassName = getClass().getName();
Intent pushMsgDialog = new Intent(ContentViewActivity.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName ,fromClassName);
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
}
......@@ -691,8 +691,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
// Activityを閉じて遷移する
finishActivity();
goChatRoom();
}
return;
}
......@@ -739,32 +739,4 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
mUploadMessage = null;
}
/**
* プッシュメッセージ受信後のダイアログを表示処理。
*/
public void showChatRoomPopupMessage(
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType
) {
String fromClassName = getClass().getName();
Intent pushMsgDialog = new Intent(HTMLWebViewActivity.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName ,fromClassName);
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
}
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