Commit dd69043a by onuma

MRで指摘されたソースを修正した。

parent d901cb70
...@@ -110,31 +110,9 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -110,31 +110,9 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
} }
} }
/*
private void showCollaborationPopUpMessage(
Long roomId,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType)
{
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
String collaobrationInvitedMessage = getString(R.string.msg_invite_collaboration);
pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, collaobrationInvitedMessage);
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.collaborationType, collaborationType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
startActivity(pushMsgDialog);
}
*/
/** /**
* プッシュメッセージをダイアログ表示する * プッシュメッセージをダイアログ表示する
* @param messageMap 受信したメッセージを格納したMapオブジェクト
*/ */
private void showChatRoomPopupMessage(Map<String, String> messageMap) { private void showChatRoomPopupMessage(Map<String, String> messageMap) {
String messageBody = messageMap.get(AppDefType.PushMessageKey.message); String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
...@@ -161,12 +139,12 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -161,12 +139,12 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
currentActivity.getClass().equals(ImageViewActivity.class) || currentActivity.getClass().equals(ImageViewActivity.class) ||
currentActivity.getClass().equals(VideoViewActivity.class) currentActivity.getClass().equals(VideoViewActivity.class)
){ ){
// 呼び出し元のActivity名を保存しておく // 呼び出し元のActivityの名前をmessageMapに追加する
messageMap.put(AppDefType.ChatPushMessageKey.fromActivityName, fromClassName); messageMap.put(AppDefType.ChatPushMessageKey.fromActivityName, fromClassName);
messageMap.put(AppDefType.ChatPushMessageKey.isNewVersion, "true"); messageMap.put(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, "true");
((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, messageMap); ((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, messageMap);
} else { } else {
// 既存の処理 // それ以外のActivityの場合の処理
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class); Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, getContentText(json.getMessage())); pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, getContentText(json.getMessage()));
...@@ -326,13 +304,4 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -326,13 +304,4 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
} }
return textMessage; return textMessage;
} }
/**
* プッシュメッセージからJSONObjectを作成する。
* @param jsonText 受信したプッシュメッセージをJSONObjectにする。
* @return
*/
private JSONObject createMessageJsonObject(String jsonText) {
return new JSONObject(jsonText);
}
} }
...@@ -163,7 +163,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -163,7 +163,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// 遷移元のアクティビティ名 // 遷移元のアクティビティ名
// PushMessage受信時に直接ChatRoomへ行かずに、ひとつまえのActivityに戻る為に使用する。 // PushMessage受信時に直接ChatRoomへ行かずに、ひとつまえのActivityに戻る為に使用する。
public String fromActivityName; public String baseActivityName;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -1243,7 +1243,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -1243,7 +1243,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
/** /**
* ッシュメッセージがあるので、チャットルームに遷移する。 * ッシュメッセージがあるので、チャットルームに遷移する。
*/ */
public boolean goChatRoom(final Intent intent, final String nextActivityName, final String fromActivityName) { public boolean goChatRoom(final Intent intent, final String nextActivityName, final String fromActivityName) {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) && if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
...@@ -1284,11 +1284,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -1284,11 +1284,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
*/ */
public void showChatRoomPopupMessage(Context context, Map<String, String> messageMap) { public void showChatRoomPopupMessage(Context context, Map<String, String> messageMap) {
String messageBody = messageMap.get(AppDefType.PushMessageKey.message); String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
PushMessageJSON json;
if (StringUtil.isNullOrEmpty(messageBody)) { if (StringUtil.isNullOrEmpty(messageBody)) {
return; return;
} }
json = new PushMessageJSON(messageBody); PushMessageJSON json = new PushMessageJSON(messageBody);
// 協業 // 協業
String messageText = json.getMessage(); String messageText = json.getMessage();
...@@ -1308,11 +1307,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -1308,11 +1307,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, json.getCollaborationType()); pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, json.getCollaborationType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, messageMap.get(AppDefType.ChatPushMessageKey.fromActivityName)); pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, messageMap.get(AppDefType.ChatPushMessageKey.fromActivityName));
String newVersion = messageMap.get(AppDefType.ChatPushMessageKey.isNewVersion); String newVersion = messageMap.get(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen);
if (newVersion != null && newVersion.equals(new String("true"))) { if (newVersion != null && newVersion.equals(new String("true"))) {
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.isNewVersion, true); pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, true);
} else { } else {
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.isNewVersion, false); pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, false);
} }
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE); startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
......
...@@ -160,7 +160,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -160,7 +160,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1); mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1);
// 遷移元のActivity // 遷移元のActivity
fromActivityName = getIntent().getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName); baseActivityName = getIntent().getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName);
if (!isLinkedContent) { if (!isLinkedContent) {
operationDto = AbstractLogic.getLogic(OperationLogic.class).getOperation(mOperationId); operationDto = AbstractLogic.getLogic(OperationLogic.class).getOperation(mOperationId);
......
...@@ -125,7 +125,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity { ...@@ -125,7 +125,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
isCollabration = MeetingManager.getInstance().isCollaboration(); isCollabration = MeetingManager.getInstance().isCollaboration();
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null && !isMeetingRoomConnected) { if (extras != null && !isMeetingRoomConnected) {
boolean isNewVersion = extras.getBoolean(AppDefType.ChatPushMessageKey.isNewVersion); boolean isNewVersion = extras.getBoolean(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen);
if (isNewVersion) { if (isNewVersion) {
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK, getIntent()); setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK, getIntent());
finish(); finish();
......
...@@ -148,6 +148,6 @@ public interface AppDefType { ...@@ -148,6 +148,6 @@ public interface AppDefType {
String shopName = "shopName"; String shopName = "shopName";
String loginId = "loginId"; String loginId = "loginId";
String fromActivityName = "fromActivityName"; String fromActivityName = "fromActivityName";
String isNewVersion = "isNewVersion"; String needsDisplayOperationOrOperationRelatedContentScreen = "needsDisplayOperationOrOperationRelatedContentScreen";
} }
} }
...@@ -168,7 +168,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -168,7 +168,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
chatData.setIsMobile(!isNormalSize()); chatData.setIsMobile(!isNormalSize());
// どのアクティビティから遷移してきたか保存 // どのアクティビティから遷移してきたか保存
fromActivityName = intent.getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName); baseActivityName = intent.getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName);
} }
private void setupChatWebView() { private void setupChatWebView() {
...@@ -788,7 +788,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -788,7 +788,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
// 戻るの作業一覧か、関連資料のどちらかのActivityのみ // 戻るの作業一覧か、関連資料のどちらかのActivityのみ
Intent intent = new Intent(); Intent intent = new Intent();
if (OperationListActivity.class.getName().equals(fromActivityName)) { if (OperationListActivity.class.getName().equals(baseActivityName)) {
intent.setClass(ChatWebViewActivity.this, OperationListActivity.class); intent.setClass(ChatWebViewActivity.this, OperationListActivity.class);
} else { } else {
intent.setClass(ChatWebViewActivity.this, OperationRelatedContentActivity.class); intent.setClass(ChatWebViewActivity.this, OperationRelatedContentActivity.class);
......
...@@ -1632,7 +1632,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1632,7 +1632,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//プシュメッセージ一覧からチャットに入る //プシュメッセージ一覧からチャットに入る
public void startChatWebViewActivityWithPushMessage(PushMessageDto dto) { public void startChatWebViewActivityWithPushMessage(PushMessageDto dto) {
String className = ChatWebViewActivity.class.getName(); String className = ChatWebViewActivity.class.getName();
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/");
...@@ -1654,7 +1653,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1654,7 +1653,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//チャットに入る //チャットに入る
public void startChatWebViewActivity() { public void startChatWebViewActivity() {
String className = ChatWebViewActivity.class.getName(); String className = ChatWebViewActivity.class.getName();
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/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid; String sid = ABVDataCache.getInstance().getMemberInfo().sid;
...@@ -1670,11 +1668,12 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1670,11 +1668,12 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
/** /**
* プシュメッセージからチャットに遷移する * プシュメッセージからチャットに遷移する
* @param roomId * @param roomId chatRoom の Id
* @param roomName * @param roomName chatRoom の名前
* @param targetActivityName 直接chatRoom に遷移する場合は、ChatWebViewActivity名。chatRoomに遷移する前に、別のActivityを経由する場合は、そのActivity名
* @param fromActivityName この関数を呼び出したActivity名
*/ */
public void startChatWebViewActivity(Long roomId, String roomName, String nextActivityName, String fromActivityName) { public void startChatWebViewActivity(Long roomId, String roomName, String targetActivityName, String fromActivityName) {
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/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid; String sid = ABVDataCache.getInstance().getMemberInfo().sid;
...@@ -1686,7 +1685,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1686,7 +1685,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);
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, fromActivityName); intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, fromActivityName);
intent.setClassName(mContext.getPackageName(), nextActivityName); intent.setClassName(mContext.getPackageName(), targetActivityName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent); getCurrentActivity().startActivity(intent);
} }
...@@ -1924,9 +1923,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1924,9 +1923,8 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
* @param roomType * @param roomType
*/ */
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String nextActivityName, String fromActivityName) { public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String nextActivityName, String fromActivityName) {
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/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid; String sid = ABVDataCache.getInstance().getMemberInfo().sid;
intent.putExtra("sid", sid); intent.putExtra("sid", sid);
String loginId = ABVDataCache.getInstance().getMemberInfo().loginId; String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
......
...@@ -3828,9 +3828,9 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3828,9 +3828,9 @@ 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 && !StringUtil.isNullOrEmpty(fromActivityName)) { if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity(); finishActivity();
goChatRoom(intent, fromActivityName, ContentViewActivity.class.getName()); goChatRoom(intent, baseActivityName, ContentViewActivity.class.getName());
} }
return; return;
} }
......
...@@ -690,9 +690,9 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -690,9 +690,9 @@ 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 && !StringUtil.isNullOrEmpty(fromActivityName)) { if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity(); finishActivity();
goChatRoom(intent, fromActivityName, HTMLWebViewActivity.class.getName()); goChatRoom(intent, baseActivityName, HTMLWebViewActivity.class.getName());
} }
return; return;
} }
......
...@@ -215,9 +215,9 @@ public class NoPdfViewActivity extends ABVContentViewActivity { ...@@ -215,9 +215,9 @@ public class NoPdfViewActivity 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 && !StringUtil.isNullOrEmpty(fromActivityName)) { if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity(); finishActivity();
goChatRoom(intent, fromActivityName, getClass().getName()); goChatRoom(intent, baseActivityName, getClass().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