Commit 25eadc52 by Kim Peace

Fixed hardcoding to final static

parent 2bf4c869
...@@ -14,10 +14,10 @@ import com.google.firebase.messaging.RemoteMessage; ...@@ -14,10 +14,10 @@ import com.google.firebase.messaging.RemoteMessage;
import org.json.adf.JSONObject; import org.json.adf.JSONObject;
import java.util.Map; import java.util.Map;
import java.util.Objects;
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.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto; import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic; import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
...@@ -33,7 +33,8 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -33,7 +33,8 @@ 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 INVITE_COLLABORATION = "inviteCollaboration<::split>"; private final String CHAT_MESSAGE_SEPERATOR = "<::split>";
private final String INVITE_COLLABORATION = "inviteCollaboration" + CHAT_MESSAGE_SEPERATOR;
@Override @Override
public void onCreate() { public void onCreate() {
...@@ -61,7 +62,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -61,7 +62,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
// Check pushmessage by chat // Check pushmessage by chat
String tempMsg = msg.get(AppDefType.PushMessageKey.message); String tempMsg = msg.get(AppDefType.PushMessageKey.message);
String pushMsg = ""; String pushMsg;
Long roomId = null; Long roomId = null;
String roomName = ""; String roomName = "";
String pushSendLoginId = ""; String pushSendLoginId = "";
...@@ -69,20 +70,20 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -69,20 +70,20 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
Integer insertId = 0; Integer insertId = 0;
Integer messageType = 0; Integer messageType = 0;
Integer messageId = 0; Integer messageId = 0;
String roomType = ""; String roomType;
Log.d(TAG,"tempMsg : "+ tempMsg); Log.d(TAG,"tempMsg : "+ tempMsg);
if (tempMsg.indexOf("pushSendLoginId") > 0) { if (Objects.requireNonNull(tempMsg).indexOf(AppDefType.ChatPushMessageKey.pushSendLoginId) > 0) {
JSONObject json = new JSONObject(tempMsg); JSONObject json = new JSONObject(tempMsg);
Object Obj = json.getString("pushSendLoginId"); Object Obj = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
roomId = json.getLong("roomId"); roomId = json.getLong(AppDefType.ChatPushMessageKey.roomId);
roomName = json.getString("roomName"); roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
pushSendLoginId = json.getString("pushSendLoginId"); pushSendLoginId = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
pushSendDate = json.getLong("pushSendDate"); pushSendDate = json.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
pushMsg = json.getString("message"); pushMsg = json.getString(AppDefType.PushMessageKey.message);
//TODO pushメッセージが到着した際、新着メッセージかルーム招待か判別してDB格納が必要 //TODO pushメッセージが到着した際、新着メッセージかルーム招待か判別してDB格納が必要
//insertId = json.getString("insertId"); //insertId = json.getString("insertId");
...@@ -98,8 +99,8 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -98,8 +99,8 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
} }
if (pushMsg.contains(INVITE_COLLABORATION)) { if (pushMsg.contains(INVITE_COLLABORATION)) {
roomType = Integer.toString(json.getInt("roomType")); roomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
String[] inviteMessage = pushMsg.split("<::split>"); String[] inviteMessage = pushMsg.split(CHAT_MESSAGE_SEPERATOR);
tempMsg = getString(R.string.msg_invite_collaboration); tempMsg = getString(R.string.msg_invite_collaboration);
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);
...@@ -162,16 +163,16 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -162,16 +163,16 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
long pushSendDate = 0; long pushSendDate = 0;
Log.d(TAG,"tempMsg : "+ tempMsg); Log.d(TAG,"tempMsg : "+ tempMsg);
if (tempMsg.indexOf("pushSendLoginId") > 0) { if (Objects.requireNonNull(tempMsg).indexOf(AppDefType.ChatPushMessageKey.pushSendLoginId) > 0) {
JSONObject json = new JSONObject(tempMsg); JSONObject json = new JSONObject(tempMsg);
Object Obj = json.getString("pushSendLoginId"); Object Obj = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
roomId = json.getLong("roomId"); roomId = json.getLong(AppDefType.ChatPushMessageKey.roomId);
roomName = json.getString("roomName"); roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
pushSendLoginId = json.getString("pushSendLoginId"); pushSendLoginId = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
pushSendDate = json.getLong("pushSendDate"); pushSendDate = json.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
pushMsg = json.getString("message"); pushMsg = json.getString(AppDefType.PushMessageKey.message);
message.put(AppDefType.PushMessageKey.message, pushMsg); message.put(AppDefType.PushMessageKey.message, pushMsg);
...@@ -247,6 +248,4 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -247,6 +248,4 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
} }
return downloadUrl; return downloadUrl;
} }
} }
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