Commit 25eadc52 by Kim Peace

Fixed hardcoding to final static

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