Bessere Sortierung der Chatnachrichten
@@ -66,14 +66,6 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||||
@@ -82,6 +74,14 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||||
|
|||||||
@@ -303,7 +303,16 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
Cursor cursor = readableDatabase.query(
|
Cursor cursor = readableDatabase.query(
|
||||||
TABLE_CHATMESSAGE,
|
TABLE_CHATMESSAGE,
|
||||||
new String[] {KEY_ID_CHATMESSAGE, KEY_SENDER_PERSON_OID_CHATMESSAGE, KEY_RECIPIENT_PERSON_OID_CHATMESSAGE, KEY_INSTS_CHATMESSAGE, KEY_CHAT_TEXT_CHATMESSAGE, KEY_IS_DELIVERED_CHATMESSAGE, KEY_SERVERSEITIGE_OID_CHATMESSAGE, KEY_IS_TEAM_CHATMESSAGE},
|
new String[] {
|
||||||
|
KEY_ID_CHATMESSAGE,
|
||||||
|
KEY_SENDER_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_RECIPIENT_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_INSTS_CHATMESSAGE,
|
||||||
|
KEY_CHAT_TEXT_CHATMESSAGE,
|
||||||
|
KEY_IS_DELIVERED_CHATMESSAGE,
|
||||||
|
KEY_SERVERSEITIGE_OID_CHATMESSAGE,
|
||||||
|
KEY_IS_TEAM_CHATMESSAGE
|
||||||
|
},
|
||||||
KEY_ID_CHATMESSAGE + "=?",
|
KEY_ID_CHATMESSAGE + "=?",
|
||||||
new String[]{String.valueOf(id)},
|
new String[]{String.valueOf(id)},
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
@@ -334,8 +343,22 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
Cursor cursor = readableDatabase.query(
|
Cursor cursor = readableDatabase.query(
|
||||||
TABLE_CHATMESSAGE,
|
TABLE_CHATMESSAGE,
|
||||||
new String[] {KEY_ID_CHATMESSAGE, KEY_SENDER_PERSON_OID_CHATMESSAGE, KEY_RECIPIENT_PERSON_OID_CHATMESSAGE, KEY_INSTS_CHATMESSAGE, KEY_CHAT_TEXT_CHATMESSAGE, KEY_IS_DELIVERED_CHATMESSAGE, KEY_SERVERSEITIGE_OID_CHATMESSAGE, KEY_IS_TEAM_CHATMESSAGE},
|
new String[] {
|
||||||
KEY_SENDER_PERSON_OID_CHATMESSAGE + "=? AND " + KEY_RECIPIENT_PERSON_OID_CHATMESSAGE + "=? OR " + KEY_RECIPIENT_PERSON_OID_CHATMESSAGE + "=? AND " + KEY_SENDER_PERSON_OID_CHATMESSAGE + "=?",
|
KEY_ID_CHATMESSAGE,
|
||||||
|
KEY_SENDER_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_RECIPIENT_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_INSTS_CHATMESSAGE,
|
||||||
|
KEY_CHAT_TEXT_CHATMESSAGE,
|
||||||
|
KEY_IS_DELIVERED_CHATMESSAGE,
|
||||||
|
KEY_SERVERSEITIGE_OID_CHATMESSAGE,
|
||||||
|
KEY_IS_TEAM_CHATMESSAGE
|
||||||
|
},
|
||||||
|
KEY_IS_TEAM_CHATMESSAGE + " = 0 AND " +
|
||||||
|
KEY_SENDER_PERSON_OID_CHATMESSAGE + "=? AND " +
|
||||||
|
KEY_RECIPIENT_PERSON_OID_CHATMESSAGE + "=? OR " +
|
||||||
|
KEY_RECIPIENT_PERSON_OID_CHATMESSAGE + "=? AND " +
|
||||||
|
KEY_SENDER_PERSON_OID_CHATMESSAGE + "=?"
|
||||||
|
,
|
||||||
new String[] {String.valueOf(SoapConnectionManager.User.getPersonOid()), String.valueOf(recipientOid), String.valueOf(SoapConnectionManager.User.getPersonOid()), String.valueOf(recipientOid)},
|
new String[] {String.valueOf(SoapConnectionManager.User.getPersonOid()), String.valueOf(recipientOid), String.valueOf(SoapConnectionManager.User.getPersonOid()), String.valueOf(recipientOid)},
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
|
|
||||||
@@ -587,6 +610,28 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean GetIsMessageInDatabase(int pServerseitigeOid) {
|
||||||
|
|
||||||
|
SQLiteDatabase readableDatabase = this.getReadableDatabase();
|
||||||
|
|
||||||
|
Cursor cursor = readableDatabase.query(TABLE_CHATMESSAGE,
|
||||||
|
new String[] {
|
||||||
|
KEY_ID_CHATMESSAGE,
|
||||||
|
KEY_SENDER_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_RECIPIENT_PERSON_OID_CHATMESSAGE,
|
||||||
|
KEY_INSTS_CHATMESSAGE,
|
||||||
|
KEY_CHAT_TEXT_CHATMESSAGE,
|
||||||
|
KEY_IS_DELIVERED_CHATMESSAGE,
|
||||||
|
KEY_SERVERSEITIGE_OID_CHATMESSAGE,
|
||||||
|
KEY_IS_TEAM_CHATMESSAGE
|
||||||
|
},
|
||||||
|
KEY_SERVERSEITIGE_OID_CHATMESSAGE + " =?",
|
||||||
|
new String[] {String.valueOf(pServerseitigeOid)},
|
||||||
|
null, null, null, null);
|
||||||
|
|
||||||
|
return cursor != null && cursor.moveToFirst();
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<ChatMessage> getUnsentChatMessages() {
|
public ArrayList<ChatMessage> getUnsentChatMessages() {
|
||||||
ArrayList<ChatMessage> messages = new ArrayList<>();
|
ArrayList<ChatMessage> messages = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,20 @@ import util.ConnectivityReceiver;
|
|||||||
* Created by JettenM on 24.08.2016.
|
* Created by JettenM on 24.08.2016.
|
||||||
*/
|
*/
|
||||||
public class BeWoChatApplication extends Application {
|
public class BeWoChatApplication extends Application {
|
||||||
|
private static boolean activityVisible;
|
||||||
|
|
||||||
|
public static boolean isActivityVisible() {
|
||||||
|
return activityVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void activityResumed() {
|
||||||
|
activityVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void activityPaused() {
|
||||||
|
activityVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
|
private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
|
||||||
|
|
||||||
private static final SpiceManager spiceManager = new SpiceManager(UncachedSpiceService.class);
|
private static final SpiceManager spiceManager = new SpiceManager(UncachedSpiceService.class);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.AbsListView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -46,12 +47,10 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import Database.DatabaseHandler;
|
import Database.DatabaseHandler;
|
||||||
import entities.ChatEntity;
|
import entities.ChatEntity;
|
||||||
import entities.ChatMessage;
|
import entities.ChatMessage;
|
||||||
import entities.NotificationLog;
|
|
||||||
import soapConnection.DataIdentifier;
|
import soapConnection.DataIdentifier;
|
||||||
import soapConnection.JsonSoapPrimitiveRequest;
|
import soapConnection.JsonSoapPrimitiveRequest;
|
||||||
import soapConnection.Packet;
|
import soapConnection.Packet;
|
||||||
@@ -119,6 +118,21 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
listView = (ListView)findViewById(R.id.list_msg);
|
listView = (ListView)findViewById(R.id.list_msg);
|
||||||
|
|
||||||
|
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||||
|
if(scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
|
||||||
|
Log.i("ON_SCROLL_STATE_CHANGED", "Berühre das Ende");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||||
|
Log.i("ON_SCROLL", "Scrolle... firstVisibleItem: " + firstVisibleItem + "; visibleItemCount: " + visibleItemCount + "; totalItemCount" + totalItemCount);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Bundle zielkorb = getIntent().getExtras();
|
Bundle zielkorb = getIntent().getExtras();
|
||||||
recipientName = zielkorb.getString("Name");
|
recipientName = zielkorb.getString("Name");
|
||||||
recipientPersonOid = zielkorb.getInt("RecipientOid");
|
recipientPersonOid = zielkorb.getInt("RecipientOid");
|
||||||
@@ -158,9 +172,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
chatMessages = isTeam ? databaseHandler.getMessagesForTeam(recipientPersonOid) : databaseHandler.getMessagesForRecipient(recipientPersonOid);
|
chatMessages = isTeam ? databaseHandler.getMessagesForTeam(recipientPersonOid) : databaseHandler.getMessagesForRecipient(recipientPersonOid);
|
||||||
|
|
||||||
Collections.sort(chatMessages, DATE_COMPARATOR);
|
|
||||||
|
|
||||||
adapter = new MessageAdapter(this, R.layout.item_chat_left, chatMessages);
|
adapter = new MessageAdapter(this, R.layout.item_chat_left, chatMessages);
|
||||||
|
adapter.sort(DATE_COMPARATOR);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
chatUIHandler = new UIHandler() {
|
chatUIHandler = new UIHandler() {
|
||||||
@@ -172,8 +185,9 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
listView.post(new Runnable() {
|
listView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(chatPacket.SenderPersonOid == recipientPersonOid) {
|
if(chatPacket.SenderPersonOid == recipientPersonOid && BeWoChatApplication.isActivityVisible()) {
|
||||||
chatMessages.add(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, false));
|
chatMessages.add(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, false));
|
||||||
|
adapter.sort(DATE_COMPARATOR);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
} else {
|
} else {
|
||||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
||||||
@@ -210,8 +224,9 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
listView.post(new Runnable() {
|
listView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(isTeam && chatPacket.RecipientPersonOid == recipientPersonOid) {
|
if(isTeam && chatPacket.RecipientPersonOid == recipientPersonOid && BeWoChatApplication.isActivityVisible()) {
|
||||||
chatMessages.add(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, true));
|
chatMessages.add(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, true));
|
||||||
|
adapter.sort(DATE_COMPARATOR);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
} else {
|
} else {
|
||||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, teamMemberOids, teamMemberNames, getApplicationContext());
|
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, teamMemberOids, teamMemberNames, getApplicationContext());
|
||||||
@@ -250,7 +265,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
final ChatMessage message = new ChatMessage(packet.SenderPersonOid, packet.RecipientPersonOid, packet.MessageTimeStamp, packet.ChatMessage, false, 0, isTeam);
|
final ChatMessage message = new ChatMessage(packet.SenderPersonOid, packet.RecipientPersonOid, packet.MessageTimeStamp, packet.ChatMessage, false, 0, isTeam);
|
||||||
|
|
||||||
Log.i("MESSAGE_TRACER", "ChatActivity: Speichere Nachricht in der Datenbank " + message.ChatText);
|
|
||||||
long coid = databaseHandler.addChatMessage(message);
|
long coid = databaseHandler.addChatMessage(message);
|
||||||
|
|
||||||
packet.ClientseitigeOid = Long.valueOf(coid).intValue();
|
packet.ClientseitigeOid = Long.valueOf(coid).intValue();
|
||||||
@@ -261,7 +275,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
chatMessages.add(message);
|
chatMessages.add(message);
|
||||||
|
adapter.sort(DATE_COMPARATOR);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
text.setText("");
|
text.setText("");
|
||||||
@@ -275,8 +289,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
ArrayList<Integer> test = isTeam ? databaseHandler.getExistingTeamChatMessageIds() : databaseHandler.getExistingChatMessageIds();
|
ArrayList<Integer> test = isTeam ? databaseHandler.getExistingTeamChatMessageIds() : databaseHandler.getExistingChatMessageIds();
|
||||||
|
|
||||||
Log.i(LOGTAG, "Chat-Messages in der Datenbank: " + test.size());
|
|
||||||
|
|
||||||
String pExceptions = "";
|
String pExceptions = "";
|
||||||
for(int i = 0; i < test.size(); i++) {
|
for(int i = 0; i < test.size(); i++) {
|
||||||
pExceptions += test.get(i);
|
pExceptions += test.get(i);
|
||||||
@@ -292,6 +304,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
propertyInfos.add(SoapConnectionManager.BuildProperty("pExceptions", pExceptions, String.class));
|
propertyInfos.add(SoapConnectionManager.BuildProperty("pExceptions", pExceptions, String.class));
|
||||||
propertyInfos.add(SoapConnectionManager.BuildProperty("pIsForTeam", isTeam, Boolean.class));
|
propertyInfos.add(SoapConnectionManager.BuildProperty("pIsForTeam", isTeam, Boolean.class));
|
||||||
|
|
||||||
|
Log.i(LOGTAG, "IsTeam: " + isTeam);
|
||||||
|
|
||||||
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_ALL_CHAT_MESSAGES, propertyInfos);
|
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_ALL_CHAT_MESSAGES, propertyInfos);
|
||||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
||||||
|
|
||||||
@@ -308,6 +322,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
BeWoChatApplication.activityResumed();
|
||||||
|
|
||||||
SocketManager.uiHandler = chatUIHandler;
|
SocketManager.uiHandler = chatUIHandler;
|
||||||
|
|
||||||
BeWoChatApplication.getInstance().setConnectivityListener(this);
|
BeWoChatApplication.getInstance().setConnectivityListener(this);
|
||||||
@@ -324,6 +340,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
BeWoChatApplication.activityPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -421,27 +438,13 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
|||||||
|
|
||||||
final ArrayList<ChatMessage> result = gson.fromJson(soapPrimitive.toString(), listType);
|
final ArrayList<ChatMessage> result = gson.fromJson(soapPrimitive.toString(), listType);
|
||||||
|
|
||||||
Log.i(LOGTAG, "Chat-Messages aus der Serveranfrage: " + result.size());
|
|
||||||
String abc = "";
|
|
||||||
for(ChatMessage m : result) {
|
|
||||||
|
|
||||||
abc += "\t" + m.ChatText;
|
|
||||||
|
|
||||||
if(result.indexOf(m) < result.size() - 1) {
|
|
||||||
abc += "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.i(LOGTAG, "Heruntergeladene Nachrichten:\n" + abc);
|
|
||||||
|
|
||||||
databaseHandler.addChatMessages(result);
|
databaseHandler.addChatMessages(result);
|
||||||
|
|
||||||
listView.post(new Runnable() {
|
listView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Collections.sort(result, DATE_COMPARATOR);
|
|
||||||
|
|
||||||
chatMessages.addAll(result);
|
chatMessages.addAll(result);
|
||||||
|
adapter.sort(DATE_COMPARATOR);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ public class ContactListItem {
|
|||||||
public String teamMemberOids;
|
public String teamMemberOids;
|
||||||
public String teamMemberNames;
|
public String teamMemberNames;
|
||||||
|
|
||||||
|
private String messagePreview;
|
||||||
|
private boolean isNewMessage2Preview;
|
||||||
|
|
||||||
public ContactListItem(){}
|
public ContactListItem(){}
|
||||||
|
|
||||||
public ContactListItem(int id, String kontaktname, int personOid, byte[] picture, boolean isTeam, String teamMemberOids, String teamMemberNames, int version){
|
public ContactListItem(int id, String kontaktname, int personOid, byte[] picture, boolean isTeam, String teamMemberOids, String teamMemberNames, int version){
|
||||||
@@ -87,6 +90,22 @@ public class ContactListItem {
|
|||||||
this.mVersion = mVersion;
|
this.mVersion = mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMessagePreview() {
|
||||||
|
return messagePreview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessagePreview(String message) {
|
||||||
|
messagePreview = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsNewMessage2Preview() {
|
||||||
|
return isNewMessage2Preview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsNewMessage2Preview(boolean isNewMessage2Preview) {
|
||||||
|
this.isNewMessage2Preview = isNewMessage2Preview;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|||||||
@@ -26,20 +26,18 @@ import java.util.ArrayList;
|
|||||||
public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
public final ArrayList<ContactListItem> values;
|
final ArrayList<ContactListItem> values;
|
||||||
|
|
||||||
private Bitmap bitmaping;
|
private Bitmap bitmaping;
|
||||||
ImageView imageView;
|
private ImageView imageView;
|
||||||
|
private TextView messagePreview;
|
||||||
|
private TextView minitext;
|
||||||
|
|
||||||
public void setMinitext(TextView minitext) {
|
public void setMinitext(TextView minitext) {
|
||||||
this.minitext = minitext;
|
this.minitext = minitext;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView minitext;
|
KontaktAdapter(Context context, ArrayList<ContactListItem> values) {
|
||||||
|
|
||||||
Thread getPic;
|
|
||||||
|
|
||||||
public KontaktAdapter(Context context, ArrayList<ContactListItem> values) {
|
|
||||||
super(context, R.layout.kontakt_list_chat, values);
|
super(context, R.layout.kontakt_list_chat, values);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.values = values;
|
this.values = values;
|
||||||
@@ -52,16 +50,20 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
|||||||
View rowView = inflater.inflate(R.layout.contact_listview_item, parent, false);
|
View rowView = inflater.inflate(R.layout.contact_listview_item, parent, false);
|
||||||
TextView textView = (TextView) rowView.findViewById(R.id.label);
|
TextView textView = (TextView) rowView.findViewById(R.id.label);
|
||||||
minitext = (TextView) rowView.findViewById(R.id.subtitle);
|
minitext = (TextView) rowView.findViewById(R.id.subtitle);
|
||||||
|
messagePreview = (TextView) rowView.findViewById(R.id.messagePreview);
|
||||||
ImageView onlinestats = (ImageView)rowView.findViewById(R.id.status);
|
ImageView onlinestats = (ImageView) rowView.findViewById(R.id.status);
|
||||||
imageView = (ImageView) rowView.findViewById(R.id.logo);
|
imageView = (ImageView) rowView.findViewById(R.id.logo);
|
||||||
|
|
||||||
textView.setText(values.get(position).getChatName());
|
textView.setText(values.get(position).getChatName());
|
||||||
|
|
||||||
|
messagePreview.setText(values.get(position).getMessagePreview());
|
||||||
|
messagePreview.setTypeface(messagePreview.getTypeface(), values.get(position).getIsNewMessage2Preview() ? 1 : 0);
|
||||||
|
|
||||||
if(values.get(position).isTeam) {
|
if(values.get(position).isTeam) {
|
||||||
minitext.setText(values.get(position).teamMemberNames);
|
minitext.setText(values.get(position).teamMemberNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thread getPic;
|
||||||
if(values.get(position).getPicture() != null) {
|
if(values.get(position).getPicture() != null) {
|
||||||
|
|
||||||
byte[] imageAsByteArray = values.get(position).getPicture();
|
byte[] imageAsByteArray = values.get(position).getPicture();
|
||||||
@@ -82,7 +84,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
|||||||
return rowView;
|
return rowView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CircleBitmapCreator implements Runnable{
|
private class CircleBitmapCreator implements Runnable{
|
||||||
|
|
||||||
Bitmap bitmap;
|
Bitmap bitmap;
|
||||||
CircleBitmapCreator(Bitmap _bitmap){
|
CircleBitmapCreator(Bitmap _bitmap){
|
||||||
@@ -119,7 +121,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
|
private static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
|
||||||
final BitmapFactory.Options options = new BitmapFactory.Options();
|
final BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inJustDecodeBounds = true;
|
options.inJustDecodeBounds = true;
|
||||||
BitmapFactory.decodeResource(res, resId, options);
|
BitmapFactory.decodeResource(res, resId, options);
|
||||||
@@ -130,7 +132,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
|||||||
return BitmapFactory.decodeResource(res, resId, options);
|
return BitmapFactory.decodeResource(res, resId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
|
private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
|
||||||
final int height = options.outHeight;
|
final int height = options.outHeight;
|
||||||
final int width = options.outWidth;
|
final int width = options.outWidth;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.ksoap2.serialization.PropertyInfo;
|
|||||||
import org.ksoap2.serialization.SoapPrimitive;
|
import org.ksoap2.serialization.SoapPrimitive;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -34,6 +35,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import Database.DatabaseHandler;
|
import Database.DatabaseHandler;
|
||||||
import entities.ChatEntity;
|
import entities.ChatEntity;
|
||||||
|
import entities.ChatMessage;
|
||||||
import entities.ChatPerson;
|
import entities.ChatPerson;
|
||||||
import soapConnection.JsonSoapPrimitiveRequest;
|
import soapConnection.JsonSoapPrimitiveRequest;
|
||||||
import soapConnection.OnRequestSuccessCallback;
|
import soapConnection.OnRequestSuccessCallback;
|
||||||
@@ -42,6 +44,7 @@ import soapConnection.SoapCalls;
|
|||||||
import soapConnection.SoapConnectionManager;
|
import soapConnection.SoapConnectionManager;
|
||||||
import tcpConnection.SocketManager;
|
import tcpConnection.SocketManager;
|
||||||
import tcpConnection.UIHandler;
|
import tcpConnection.UIHandler;
|
||||||
|
import util.ChatMessageDeserializer;
|
||||||
import util.ConnectivityReceiver;
|
import util.ConnectivityReceiver;
|
||||||
import util.Util;
|
import util.Util;
|
||||||
|
|
||||||
@@ -122,12 +125,6 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
if(SocketManager.uiHandler == null ||! SocketManager.uiHandler.equals(kontaktChatActivityUIHandler)) {
|
if(SocketManager.uiHandler == null ||! SocketManager.uiHandler.equals(kontaktChatActivityUIHandler)) {
|
||||||
SocketManager.uiHandler = kontaktChatActivityUIHandler;
|
SocketManager.uiHandler = kontaktChatActivityUIHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
|
||||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pPersonOid", SoapConnectionManager.User.getPersonOid(), Long.class));
|
|
||||||
//
|
|
||||||
// JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_CONTACTS_FOR_PERSON, propertyInfos);
|
|
||||||
// spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -148,6 +145,12 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
Util.sendStatusRequest();
|
Util.sendStatusRequest();
|
||||||
|
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
|
||||||
|
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
||||||
|
propertyInfos.add(SoapConnectionManager.BuildProperty("pRecipientPersonOid", SoapConnectionManager.User.getPersonOid(), Long.class));
|
||||||
|
|
||||||
|
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest("GetNewestMessages", propertyInfos);
|
||||||
|
spiceManager.execute(request, new JsonSoapPrimitiveRequestListenerForNewestMessages());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -158,15 +161,53 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
try {
|
try {
|
||||||
switch(chatPacket.ChatDataIdentifier) {
|
switch(chatPacket.ChatDataIdentifier) {
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
|
//TODO: Statt Notification Nachricht fett in der Liste darstellen? Oder beides?
|
||||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
KontaktAdapter ka =((KontaktAdapter) listView.getAdapter());
|
||||||
|
|
||||||
|
for(ContactListItem item : ka.values) {
|
||||||
|
if(item.getPersonOid() == chatPacket.SenderPersonOid && !item.isTeam) {
|
||||||
|
item.setMessagePreview(chatPacket.ChatMessage);
|
||||||
|
item.setIsNewMessage2Preview(true);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ka.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEAM:
|
case TEAM:
|
||||||
ContactListItem cli = DatabaseHandler.getInstance(getApplicationContext()).getContactByPersonOid(chatPacket.RecipientPersonOid, true);
|
ContactListItem cli = DatabaseHandler.getInstance(getApplicationContext()).getContactByPersonOid(chatPacket.RecipientPersonOid, true);
|
||||||
|
|
||||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, cli.teamMemberOids, cli.teamMemberNames, getApplicationContext());
|
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, cli.teamMemberOids, cli.teamMemberNames, getApplicationContext());
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
KontaktAdapter ka =((KontaktAdapter) listView.getAdapter());
|
||||||
|
|
||||||
|
for(ContactListItem item : ka.values) {
|
||||||
|
if(item.getPersonOid() == chatPacket.RecipientPersonOid && !item.isTeam) {
|
||||||
|
item.setMessagePreview(chatPacket.ChatMessage);
|
||||||
|
item.setIsNewMessage2Preview(true);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ka.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case STATUS_NOTIFICATION_LOGIN:
|
case STATUS_NOTIFICATION_LOGIN:
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@@ -223,9 +264,6 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STATUS_REQUEST:
|
case STATUS_REQUEST:
|
||||||
|
|
||||||
Log.i(LOGTAG, "Aktualisiere die Kontaktliste");
|
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -278,6 +316,8 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
BeWoChatApplication.activityResumed();
|
||||||
|
|
||||||
SocketManager.uiHandler = kontaktChatActivityUIHandler;
|
SocketManager.uiHandler = kontaktChatActivityUIHandler;
|
||||||
|
|
||||||
BeWoChatApplication.getInstance().setConnectivityListener(this);
|
BeWoChatApplication.getInstance().setConnectivityListener(this);
|
||||||
@@ -305,6 +345,7 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
BeWoChatApplication.activityPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -324,9 +365,47 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final class JsonSoapPrimitiveRequestListenerForNewestMessages implements RequestListener<SoapPrimitive> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestFailure(SpiceException spiceException) {
|
||||||
|
Toast.makeText(KontaktChatActivity.this, "Ein Fehler ist beim laden der neuesten Nachrichten aufgetreten.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
|
||||||
|
if(soapPrimitive == null) {
|
||||||
|
Log.e("KONTAKT_CHAT_ACTIVITY", "Neueste Nachrichten ist NULL!");
|
||||||
|
}
|
||||||
|
|
||||||
|
GsonBuilder builder = new GsonBuilder();
|
||||||
|
builder.registerTypeAdapter(ChatMessage.class, new ChatMessageDeserializer());
|
||||||
|
|
||||||
|
Gson gson = builder.create();
|
||||||
|
|
||||||
|
Type listType = new TypeToken<ArrayList<ChatMessage>>(){}.getType();
|
||||||
|
ArrayList<ChatMessage> result = gson.fromJson(soapPrimitive.toString(), listType);
|
||||||
|
|
||||||
|
KontaktAdapter adapter = (KontaktAdapter) listView.getAdapter();
|
||||||
|
|
||||||
|
for(ChatMessage message : result) {
|
||||||
|
if(adapter != null) {
|
||||||
|
for(ContactListItem item : adapter.values) {
|
||||||
|
|
||||||
|
if(item.getPersonOid() == message.SenderPersonOid && !item.isTeam && !message.IsTeam || item.isTeam && message.IsTeam && item.getPersonOid() == message.RecipientPersonOid) {
|
||||||
|
item.setMessagePreview(message.ChatText);
|
||||||
|
item.setIsNewMessage2Preview(!databaseHandler.GetIsMessageInDatabase(message.ServerseitigeOid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
|
private final class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
|
||||||
|
|
||||||
//TODO: zusätzliches onRequestSuccess-Callback einbauen
|
|
||||||
OnRequestSuccessCallback callback;
|
OnRequestSuccessCallback callback;
|
||||||
|
|
||||||
JsonSoapPrimitiveRequestListener(OnRequestSuccessCallback callback) {
|
JsonSoapPrimitiveRequestListener(OnRequestSuccessCallback callback) {
|
||||||
@@ -344,8 +423,6 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
|||||||
Log.e("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
Log.e("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(LOGTAG, "Lade Kontakte vom Server herunter");
|
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().create();
|
Gson gson = new GsonBuilder().create();
|
||||||
|
|
||||||
Type listType = new TypeToken<ArrayList<ChatPerson>>(){}.getType();
|
Type listType = new TypeToken<ArrayList<ChatPerson>>(){}.getType();
|
||||||
|
|||||||
@@ -257,61 +257,83 @@ public class LoginActivity extends ActionBarActivity {
|
|||||||
String abc = soapPrimitive.toString();
|
String abc = soapPrimitive.toString();
|
||||||
|
|
||||||
if(abc != null) {
|
if(abc != null) {
|
||||||
String[] blubb = abc.split(";");
|
|
||||||
SoapConnectionManager.User = new ApplicationUser(blubb[1], blubb[2], Long.valueOf(blubb[0]), Long.valueOf(blubb[3]));
|
|
||||||
|
|
||||||
DatabaseHandler databaseHandler = DatabaseHandler.getInstance(getApplicationContext());
|
Log.i("LOGIN", abc);
|
||||||
|
|
||||||
int owner = databaseHandler.getOwnerOid();
|
if(abc.contains(";")) {
|
||||||
if(owner == 0) {
|
String[] blubb = abc.split(";");
|
||||||
databaseHandler.insertOwnerOid(SoapConnectionManager.User.getPersonOid().intValue());
|
SoapConnectionManager.User = new ApplicationUser(blubb[1], blubb[2], Long.valueOf(blubb[0]), Long.valueOf(blubb[3]));
|
||||||
} else if(owner != SoapConnectionManager.User.getPersonOid().intValue()) {
|
|
||||||
databaseHandler.clearDatabase();
|
|
||||||
databaseHandler.insertOwnerOid(SoapConnectionManager.User.getPersonOid().intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
SoapConnectionManager.User.setTenant(mTenantView.getText().toString());
|
DatabaseHandler databaseHandler = DatabaseHandler.getInstance(getApplicationContext());
|
||||||
|
|
||||||
if(mRememberMeCheckBoxView.isChecked()) {
|
int owner = databaseHandler.getOwnerOid();
|
||||||
ByteArrayOutputStream tokenOutputStream = new ByteArrayOutputStream();
|
if(owner == 0) {
|
||||||
ByteArrayOutputStream tenantOutputStream = new ByteArrayOutputStream();
|
databaseHandler.insertOwnerOid(SoapConnectionManager.User.getPersonOid().intValue());
|
||||||
ByteArrayOutputStream usernameOutputStream = new ByteArrayOutputStream();
|
} else if(owner != SoapConnectionManager.User.getPersonOid().intValue()) {
|
||||||
ByteArrayOutputStream passwordOutputStream = new ByteArrayOutputStream();
|
databaseHandler.clearDatabase();
|
||||||
|
databaseHandler.insertOwnerOid(SoapConnectionManager.User.getPersonOid().intValue());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
SoapConnectionManager.User.setTenant(mTenantView.getText().toString());
|
||||||
SecurityUtils.encrypt(mChatCodeView.getText().toString(), tokenOutputStream);
|
|
||||||
SecurityUtils.encrypt(mTenantView.getText().toString(), tenantOutputStream);
|
|
||||||
SecurityUtils.encrypt(mUsernameView.getText().toString(), usernameOutputStream);
|
|
||||||
SecurityUtils.encrypt(mPasswordView.getText().toString(), passwordOutputStream);
|
|
||||||
|
|
||||||
SharedPreferences settings = getSharedPreferences(Util.PREFS_NAME, 0);
|
if(mRememberMeCheckBoxView.isChecked()) {
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
ByteArrayOutputStream tokenOutputStream = new ByteArrayOutputStream();
|
||||||
|
ByteArrayOutputStream tenantOutputStream = new ByteArrayOutputStream();
|
||||||
|
ByteArrayOutputStream usernameOutputStream = new ByteArrayOutputStream();
|
||||||
|
ByteArrayOutputStream passwordOutputStream = new ByteArrayOutputStream();
|
||||||
|
|
||||||
editor.putString(Util.PREFS_TOKEN_KEY, Base64.encodeToString(tokenOutputStream.toByteArray(), Base64.DEFAULT));
|
try {
|
||||||
editor.putString(Util.PREFS_TENANT_KEY, Base64.encodeToString(tenantOutputStream.toByteArray(), Base64.DEFAULT));
|
SecurityUtils.encrypt(mChatCodeView.getText().toString(), tokenOutputStream);
|
||||||
editor.putString(Util.PREFS_USERNAME_KEY, Base64.encodeToString(usernameOutputStream.toByteArray(), Base64.DEFAULT));
|
SecurityUtils.encrypt(mTenantView.getText().toString(), tenantOutputStream);
|
||||||
editor.putString(Util.PREFS_PASSWORD, Base64.encodeToString(passwordOutputStream.toByteArray(), Base64.DEFAULT));
|
SecurityUtils.encrypt(mUsernameView.getText().toString(), usernameOutputStream);
|
||||||
|
SecurityUtils.encrypt(mPasswordView.getText().toString(), passwordOutputStream);
|
||||||
|
|
||||||
editor.apply();
|
SharedPreferences settings = getSharedPreferences(Util.PREFS_NAME, 0);
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
|
||||||
} catch (IOException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException e) {
|
editor.putString(Util.PREFS_TOKEN_KEY, Base64.encodeToString(tokenOutputStream.toByteArray(), Base64.DEFAULT));
|
||||||
e.printStackTrace();
|
editor.putString(Util.PREFS_TENANT_KEY, Base64.encodeToString(tenantOutputStream.toByteArray(), Base64.DEFAULT));
|
||||||
|
editor.putString(Util.PREFS_USERNAME_KEY, Base64.encodeToString(usernameOutputStream.toByteArray(), Base64.DEFAULT));
|
||||||
|
editor.putString(Util.PREFS_PASSWORD, Base64.encodeToString(passwordOutputStream.toByteArray(), Base64.DEFAULT));
|
||||||
|
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
} catch (IOException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketManager.tenant = mTenantView.getText().toString();
|
||||||
|
|
||||||
|
SocketManager.loginCallback = new LoginCallback() {
|
||||||
|
@Override
|
||||||
|
public void doCallback() {
|
||||||
|
Log.e("LOGIN_CALLBACK", "LoginCallback aufgerufen. Ist verbunden und ruft die ChatActivity nun auf.");
|
||||||
|
|
||||||
|
Intent kontaktChatActivity = new Intent(LoginActivity.this, KontaktChatActivity.class);
|
||||||
|
LoginActivity.this.startActivity(kontaktChatActivity);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SocketManager.connectToServer();
|
||||||
|
} else {
|
||||||
|
showProgress(false);
|
||||||
|
|
||||||
|
switch(abc) {
|
||||||
|
case "WrongTenant":
|
||||||
|
showLoginUIErrors(false, true, false, false);
|
||||||
|
break;
|
||||||
|
case "WrongCredentials":
|
||||||
|
showLoginUIErrors(false, false, true, true);
|
||||||
|
break;
|
||||||
|
case "Unauthorized":
|
||||||
|
Toast.makeText(getApplicationContext(), "Sie sind nicht zum Chatten autorisiert. Bitte wenden Sie sich an Ihren Administrator.", Toast.LENGTH_LONG).show();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Toast.makeText(getApplicationContext(), "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.", Toast.LENGTH_LONG).show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketManager.tenant = mTenantView.getText().toString();
|
|
||||||
|
|
||||||
SocketManager.loginCallback = new LoginCallback() {
|
|
||||||
@Override
|
|
||||||
public void doCallback() {
|
|
||||||
Log.e("LOGIN_CALLBACK", "LoginCallback aufgerufen. Ist verbunden und ruft die ChatActivity nun auf.");
|
|
||||||
|
|
||||||
Intent kontaktChatActivity = new Intent(LoginActivity.this, KontaktChatActivity.class);
|
|
||||||
LoginActivity.this.startActivity(kontaktChatActivity);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SocketManager.connectToServer();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showProgress(false);
|
showProgress(false);
|
||||||
|
|||||||
@@ -45,16 +45,14 @@ public class ChatMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String asString = "";
|
String asString = "Id: " + Id;
|
||||||
|
asString += "\nSenderPersonOid: " + SenderPersonOid;
|
||||||
asString += "Id: " + Id;
|
asString += "\nRecipientPersonOid: " + RecipientPersonOid;
|
||||||
asString += "\nSenderPersonOid: " + SenderPersonOid;
|
asString += "\nInsTs: " + getInsTsAsString();
|
||||||
asString += "\nRecipientPersonOid: " + RecipientPersonOid;
|
asString += "\nChatText: " + ChatText;
|
||||||
asString += "\nInsTs: " + getInsTsAsString();
|
asString += "\nIsDelivered: " + IsDelivered;
|
||||||
asString += "\nChatText: " + ChatText;
|
asString += "\nServerseitigeOid: " + ServerseitigeOid;
|
||||||
asString += "\nIsDelivered: " + IsDelivered;
|
asString += "\nIsTeam: " + IsTeam;
|
||||||
asString += "\nServerseitigeOid: " + ServerseitigeOid;
|
|
||||||
asString += "\nIsTeam: " + IsTeam;
|
|
||||||
|
|
||||||
return asString;
|
return asString;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,24 +12,24 @@ public class SoapCalls {
|
|||||||
public static String KEEP_ALIVE = "KeepAlive";
|
public static String KEEP_ALIVE = "KeepAlive";
|
||||||
|
|
||||||
//TODO: "app4.bewoplaner.de";//
|
//TODO: "app4.bewoplaner.de";//
|
||||||
// public static String DESTINATION_ADDRESS = "app4.bewoplaner.de";
|
public static String DESTINATION_ADDRESS = "app4.bewoplaner.de";
|
||||||
// public static int DESTINATION_PORT = 5000;
|
|
||||||
//
|
|
||||||
// public static String TOKEN_CHECK_URL = "https://" + DESTINATION_ADDRESS + "/mobil/main/checktoken?token=";
|
|
||||||
//
|
|
||||||
// public static String WEB_DOKU_URL = "https://" + DESTINATION_ADDRESS + "/mobil/login/demo";
|
|
||||||
//
|
|
||||||
// public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
|
||||||
// public static String SOAP_ADDRESS = "https://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
|
||||||
|
|
||||||
|
|
||||||
public static String DESTINATION_ADDRESS = "192.168.1.103";
|
|
||||||
public static int DESTINATION_PORT = 5000;
|
public static int DESTINATION_PORT = 5000;
|
||||||
|
|
||||||
public static String TOKEN_CHECK_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/main/checktoken?token=";
|
public static String TOKEN_CHECK_URL = "https://" + DESTINATION_ADDRESS + "/mobil/main/checktoken?token=";
|
||||||
|
|
||||||
public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/login/demo";
|
public static String WEB_DOKU_URL = "https://" + DESTINATION_ADDRESS + "/mobil/login/demo";
|
||||||
|
|
||||||
public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||||
public static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
public static String SOAP_ADDRESS = "https://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||||
|
|
||||||
|
|
||||||
|
// public static String DESTINATION_ADDRESS = "192.168.1.103";
|
||||||
|
// public static int DESTINATION_PORT = 5000;
|
||||||
|
//
|
||||||
|
// public static String TOKEN_CHECK_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/main/checktoken?token=";
|
||||||
|
//
|
||||||
|
// public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/login/demo";
|
||||||
|
//
|
||||||
|
// static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||||
|
// static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package tcpConnection;
|
package tcpConnection;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -25,7 +24,6 @@ import entities.NotificationLog;
|
|||||||
import soapConnection.DataIdentifier;
|
import soapConnection.DataIdentifier;
|
||||||
import soapConnection.Packet;
|
import soapConnection.Packet;
|
||||||
import soapConnection.SoapCalls;
|
import soapConnection.SoapCalls;
|
||||||
import soapConnection.SoapConnectionManager;
|
|
||||||
import util.Util;
|
import util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +31,7 @@ import util.Util;
|
|||||||
*/
|
*/
|
||||||
public class SocketManager {
|
public class SocketManager {
|
||||||
|
|
||||||
private static final String TAG = "SOCKET_MANAGER";
|
private static final String LOGTAG = "SOCKET_MANAGER";
|
||||||
|
|
||||||
private static DatabaseHandler databaseHandler = DatabaseHandler.getInstance(BeWoChatApplication.getInstance());
|
private static DatabaseHandler databaseHandler = DatabaseHandler.getInstance(BeWoChatApplication.getInstance());
|
||||||
|
|
||||||
@@ -216,7 +214,7 @@ public class SocketManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(chatPacket.ChatDataIdentifier.equals(DataIdentifier.LOGIN_SUCCESS) && loginCallback != null) {
|
if(chatPacket.ChatDataIdentifier.equals(DataIdentifier.LOGIN_SUCCESS) && loginCallback != null) {
|
||||||
Log.i(TAG, "Der Login war erfolgreich");
|
Log.i(LOGTAG, "Der Login war erfolgreich");
|
||||||
loginCallback.doCallback();
|
loginCallback.doCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +223,8 @@ public class SocketManager {
|
|||||||
switch (chatPacket.ChatDataIdentifier) {
|
switch (chatPacket.ChatDataIdentifier) {
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
|
|
||||||
|
Log.i(LOGTAG, "Empfange Nacahricht");
|
||||||
|
|
||||||
databaseHandler.addChatMessage(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, false));
|
databaseHandler.addChatMessage(new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, true, chatPacket.ServerseitigeOid, false));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -249,17 +249,6 @@ public class SocketManager {
|
|||||||
SocketManager.onlinePersonOids.add(chatPacket.SenderPersonOid);
|
SocketManager.onlinePersonOids.add(chatPacket.SenderPersonOid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(!SocketManager.onlineEntities.)
|
|
||||||
|
|
||||||
/*
|
|
||||||
for(Map.Entry<ChatEntity, NotificationLog> entry : SocketManager.notificationEntities.entrySet()) {
|
|
||||||
if(!(entry.getKey().equals(chatEntity) && entry.getValue().equals(notificationLog))) {
|
|
||||||
mNotifyMgr.cancel(entry.getValue().getNotificationId());
|
|
||||||
entities2remove.add(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
boolean isAlreadyLoggedIn = false;
|
boolean isAlreadyLoggedIn = false;
|
||||||
for(ChatEntity entity : SocketManager.onlineEntities)
|
for(ChatEntity entity : SocketManager.onlineEntities)
|
||||||
{
|
{
|
||||||
|
|||||||
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 654 B |
|
After Width: | Height: | Size: 718 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 654 B |
|
After Width: | Height: | Size: 718 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 654 B |
|
After Width: | Height: | Size: 718 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 296 B |
|
After Width: | Height: | Size: 300 B |
|
After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 1013 B |
|
After Width: | Height: | Size: 296 B |
|
After Width: | Height: | Size: 300 B |
|
After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 1013 B |
|
After Width: | Height: | Size: 296 B |
|
After Width: | Height: | Size: 300 B |
|
After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 1013 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 272 B |
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 938 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 272 B |
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 938 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 272 B |
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 938 B |
@@ -2,44 +2,44 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_checked="true" android:state_window_focused="false"
|
<item android:state_checked="true" android:state_window_focused="false"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on" />
|
android:drawable="@drawable/chk_on" />
|
||||||
<item android:state_checked="false" android:state_window_focused="false"
|
<item android:state_checked="false" android:state_window_focused="false"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off" />
|
android:drawable="@drawable/chk_off" />
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_pressed="true"
|
<item android:state_checked="true" android:state_pressed="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on_pressed" />
|
android:drawable="@drawable/chk_on" />
|
||||||
<item android:state_checked="false" android:state_pressed="true"
|
<item android:state_checked="false" android:state_pressed="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off_pressed" />
|
android:drawable="@drawable/chk_off_pressed" />
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_focused="true"
|
<item android:state_checked="true" android:state_focused="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on_selected" />
|
android:drawable="@drawable/chk_on" />
|
||||||
<item android:state_checked="false" android:state_focused="true"
|
<item android:state_checked="false" android:state_focused="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off_selected" />
|
android:drawable="@drawable/chk_off" />
|
||||||
|
|
||||||
<item android:state_checked="false"
|
<item android:state_checked="false"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off" />
|
android:drawable="@drawable/chk_off" />
|
||||||
<item android:state_checked="true"
|
<item android:state_checked="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on" />
|
android:drawable="@drawable/chk_on" />
|
||||||
|
|
||||||
|
|
||||||
<!-- Disabled states -->
|
<!--<!– Disabled states –>-->
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_window_focused="false"
|
<item android:state_checked="true" android:state_window_focused="false"
|
||||||
android:drawable="@drawable/btn_check_on_disable" />
|
android:drawable="@drawable/chk_on_disabled" />
|
||||||
<item android:state_checked="false" android:state_window_focused="false"
|
<item android:state_checked="false" android:state_window_focused="false"
|
||||||
android:drawable="@drawable/btn_check_off_disable" />
|
android:drawable="@drawable/chk_off_disabled" />
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_focused="true"
|
<item android:state_checked="true" android:state_focused="true"
|
||||||
android:drawable="@drawable/btn_check_on_disable_focused" />
|
android:drawable="@drawable/chk_on_disabled" />
|
||||||
<item android:state_checked="false" android:state_focused="true"
|
<item android:state_checked="false" android:state_focused="true"
|
||||||
android:drawable="@drawable/btn_check_off_disable_focused" />
|
android:drawable="@drawable/chk_off_disabled" />
|
||||||
|
|
||||||
<item android:state_checked="false" android:drawable="@drawable/btn_check_off_disable" />
|
<item android:state_checked="false" android:drawable="@drawable/chk_off_disabled" />
|
||||||
</selector>
|
</selector>
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
<item android:state_pressed="true" >
|
<item android:state_pressed="true" >
|
||||||
<shape>
|
<shape>
|
||||||
<solid
|
<solid
|
||||||
android:color="#ef4444" />
|
android:color="#FF9B60" />
|
||||||
<stroke
|
<stroke
|
||||||
android:width="1dp"
|
android:width="0dp"
|
||||||
android:color="#992f2f" />
|
android:color="#FF5E00" />
|
||||||
<corners
|
<corners
|
||||||
android:radius="6dp" />
|
android:radius="30dp" />
|
||||||
<padding
|
<padding
|
||||||
android:left="10dp"
|
android:left="10dp"
|
||||||
android:top="10dp"
|
android:top="10dp"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<shape>
|
<shape>
|
||||||
<gradient
|
<gradient
|
||||||
android:startColor="#ff6e1a"
|
android:startColor="#FF6E1A"
|
||||||
android:centerX="0.2"
|
android:centerX="0.2"
|
||||||
android:centerY="0.2"
|
android:centerY="0.2"
|
||||||
android:centerColor="#FF5E00"
|
android:centerColor="#FF5E00"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<stroke
|
<stroke
|
||||||
android:width="0dp"
|
android:width="0dp"
|
||||||
android:color="#992f2f" />
|
android:color="#FF5E00" />
|
||||||
<corners
|
<corners
|
||||||
android:radius="30dp" />
|
android:radius="30dp" />
|
||||||
<padding
|
<padding
|
||||||
|
|||||||
@@ -90,7 +90,9 @@
|
|||||||
android:text="@string/prompt_remember_me"
|
android:text="@string/prompt_remember_me"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:onClick="rememberMeOnClick"/>
|
android:onClick="rememberMeOnClick"
|
||||||
|
android:button="@drawable/bewo_checkbox"
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/sign_in_button"
|
android:id="@+id/sign_in_button"
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:singleLine="true"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:maxLines="1"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subtitle"
|
android:id="@+id/subtitle"
|
||||||
@@ -48,9 +48,20 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:singleLine="true"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:textStyle="normal" />
|
android:textStyle="normal"
|
||||||
|
android:maxLines="1"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/messagePreview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="normal"
|
||||||
|
android:maxLines="1"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
|
<!--<item name="actionBarStyle">@style/MyActionBar</item>-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
|
||||||
|
<item name="android:background">#FF5E00</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="button_text" >
|
<style name="button_text" >
|
||||||
|
|||||||
@@ -1421,14 +1421,26 @@ namespace BeWo.View
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NetworkStream serverStream = s.GetStream();
|
var serverStream = s.GetStream();
|
||||||
|
|
||||||
String abc = NetworkInterface.GetAllNetworkInterfaces().Where(inc => inc.OperationalStatus == OperationalStatus.Up).Select(inc => inc.GetPhysicalAddress().ToString()).FirstOrDefault();
|
var macAddress = NetworkInterface.GetAllNetworkInterfaces().Where(inc => inc.OperationalStatus == OperationalStatus.Up).Select(inc => inc.GetPhysicalAddress().ToString()).FirstOrDefault();
|
||||||
|
|
||||||
Packet a = new Packet();
|
var formattedMacAddress = "";
|
||||||
|
if(macAddress != null)
|
||||||
|
{
|
||||||
|
for(var i = 0; i < macAddress.Length; i++)
|
||||||
|
{
|
||||||
|
formattedMacAddress += macAddress[i];
|
||||||
|
if((i + 1) % 2 == 0 && i < macAddress.Length - 1)
|
||||||
|
{
|
||||||
|
formattedMacAddress += ":";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
byte[] outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, 0,
|
var a = new Packet();
|
||||||
BeWoApp.LoggedOnUser.LoginName, abc, DataIdentifier.Login, BeWoApp.Tenant, false);
|
|
||||||
|
var outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, 0, BeWoApp.LoggedOnUser.LoginName, formattedMacAddress, DataIdentifier.Login, BeWoApp.Tenant, false);
|
||||||
|
|
||||||
serverStream.Write(outStream, 0, outStream.Length);
|
serverStream.Write(outStream, 0, outStream.Length);
|
||||||
serverStream.Flush();
|
serverStream.Flush();
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace BeWoChatServer
|
|||||||
{
|
{
|
||||||
SenderPersonOid = dataPacket.SenderPersonOid,
|
SenderPersonOid = dataPacket.SenderPersonOid,
|
||||||
ChatText = Encoding.UTF8.GetBytes(dataPacket.ChatMessage),
|
ChatText = Encoding.UTF8.GetBytes(dataPacket.ChatMessage),
|
||||||
EmpfängerPersonOid = dataPacket.RecipientPersonOid,
|
EmpfaengerPersonOid = dataPacket.RecipientPersonOid,
|
||||||
Uhrzeit = DateTime.Now,
|
Uhrzeit = DateTime.Now,
|
||||||
InsUser = dataPacket.ClientName,
|
InsUser = dataPacket.ClientName,
|
||||||
IsDelivered = dataPacket.IsDelivered
|
IsDelivered = dataPacket.IsDelivered
|
||||||
@@ -338,7 +338,7 @@ namespace BeWoChatServer
|
|||||||
{
|
{
|
||||||
SenderPersonOid = dataPacket.SenderPersonOid,
|
SenderPersonOid = dataPacket.SenderPersonOid,
|
||||||
ChatText = Encoding.UTF8.GetBytes(dataPacket.ChatMessage),
|
ChatText = Encoding.UTF8.GetBytes(dataPacket.ChatMessage),
|
||||||
EmpfängerPersonOid = dataPacket.RecipientPersonOid,
|
EmpfaengerPersonOid = dataPacket.RecipientPersonOid,
|
||||||
Uhrzeit = dataPacket.MessageTimeStamp,
|
Uhrzeit = dataPacket.MessageTimeStamp,
|
||||||
InsUser = dataPacket.ClientName,
|
InsUser = dataPacket.ClientName,
|
||||||
TeamOid = dataPacket.RecipientPersonOid
|
TeamOid = dataPacket.RecipientPersonOid
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ using System.Text;
|
|||||||
using System.Web.Services;
|
using System.Web.Services;
|
||||||
|
|
||||||
using BeWo.Data.Access;
|
using BeWo.Data.Access;
|
||||||
using BeWo.Data.Entities;
|
|
||||||
using BeWo.Service.DCEntityMapper;
|
|
||||||
using BeWo.Service.ServiceContracts;
|
using BeWo.Service.ServiceContracts;
|
||||||
using BeWo.Service.ServiceImplementations;
|
using BeWo.Service.ServiceImplementations;
|
||||||
|
|
||||||
@@ -17,6 +15,7 @@ using BS.Shared;
|
|||||||
using BS.Shared.Core;
|
using BS.Shared.Core;
|
||||||
using BS.Shared.DataContracts.Compact;
|
using BS.Shared.DataContracts.Compact;
|
||||||
using BS.Shared.Extensions;
|
using BS.Shared.Extensions;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BeWoPlanerAndroid
|
namespace BeWoPlanerAndroid
|
||||||
@@ -37,6 +36,11 @@ namespace BeWoPlanerAndroid
|
|||||||
[WebMethod(EnableSession = true)]
|
[WebMethod(EnableSession = true)]
|
||||||
public string Login(string pTenant, string pUsername, string pPassword)
|
public string Login(string pTenant, string pUsername, string pPassword)
|
||||||
{
|
{
|
||||||
|
if(!SoapHibernateSessionManager.TenantExists(pTenant))
|
||||||
|
{
|
||||||
|
return LoginFailReason.WrongTenant.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
MobileSessionFacade.Tenant = pTenant;
|
MobileSessionFacade.Tenant = pTenant;
|
||||||
Tenant = pTenant;
|
Tenant = pTenant;
|
||||||
|
|
||||||
@@ -53,12 +57,12 @@ namespace BeWoPlanerAndroid
|
|||||||
|
|
||||||
if (user == null || !DAOFactory.SearchDAO.CheckIfEmployeeIsAllowedToChat(user.Employee.Person.Oid.Value))
|
if (user == null || !DAOFactory.SearchDAO.CheckIfEmployeeIsAllowedToChat(user.Employee.Person.Oid.Value))
|
||||||
{
|
{
|
||||||
return null;
|
return LoginFailReason.Unauthorized.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!DAOFactory.UserDAO.CheckPassword(user, pPassword))
|
if(!DAOFactory.UserDAO.CheckPassword(user, pPassword))
|
||||||
{
|
{
|
||||||
return null;
|
return LoginFailReason.WrongCredentials.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileSessionFacade.LoggedInUser = user;
|
MobileSessionFacade.LoggedInUser = user;
|
||||||
@@ -66,7 +70,7 @@ namespace BeWoPlanerAndroid
|
|||||||
return user.Employee.Oid.Value + ";" + user.Employee.Person.FirstNameLastName + ";" + user.LoginName + ";" + user.Employee.Person.Oid.Value;
|
return user.Employee.Oid.Value + ";" + user.Employee.Person.FirstNameLastName + ";" + user.LoginName + ";" + user.Employee.Person.Oid.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return LoginFailReason.Unknown.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod(EnableSession = true)]
|
[WebMethod(EnableSession = true)]
|
||||||
@@ -102,16 +106,25 @@ namespace BeWoPlanerAndroid
|
|||||||
|
|
||||||
var jsonMessages = new List<ChatMessageForJson>();
|
var jsonMessages = new List<ChatMessageForJson>();
|
||||||
|
|
||||||
var messages = DAOFactory.SearchDAO.FindAllChatMessagesForAndroid(pSenderPersonOid, pRecipientPersonOid, exceptions, pIsForTeam).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfängerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
var messages = DAOFactory.SearchDAO.FindAllChatMessagesForAndroid(pSenderPersonOid, pRecipientPersonOid, exceptions, pIsForTeam).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfaengerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||||
|
|
||||||
return JsonConvert.SerializeObject(jsonMessages);
|
return JsonConvert.SerializeObject(jsonMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
//[WebMethod(EnableSession = true)]
|
[WebMethod(EnableSession = true)]
|
||||||
//public string GetAllUnreadMessages()
|
public string GetAllUnreadMessages()
|
||||||
//{
|
{
|
||||||
|
return "";
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
[WebMethod(EnableSession = true)]
|
||||||
|
public string GetNewestMessages(long pRecipientPersonOid)
|
||||||
|
{
|
||||||
|
var jsonMessages = new List<ChatMessageForJson>();
|
||||||
|
var liste = DAOFactory.SearchDAO.FindNewestChatMessages(pRecipientPersonOid).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfaengerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||||
|
|
||||||
|
return JsonConvert.SerializeObject(jsonMessages);
|
||||||
|
}
|
||||||
|
|
||||||
[WebMethod(EnableSession = true)]
|
[WebMethod(EnableSession = true)]
|
||||||
public string GetServerAddressByToken(string pToken)
|
public string GetServerAddressByToken(string pToken)
|
||||||
|
|||||||
@@ -124,5 +124,15 @@ namespace BeWoPlanerAndroid.Service
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool TenantExists(string pTenant)
|
||||||
|
{
|
||||||
|
var path2config = HttpContext.Current.Server.MapPath("");
|
||||||
|
|
||||||
|
path2config = Path.Combine(path2config, ConfigurationManager.AppSettings.Get("MultitenancyPath"));
|
||||||
|
path2config = Path.Combine(path2config, pTenant + ".config");
|
||||||
|
|
||||||
|
return File.Exists(path2config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ using NHibernate.SqlCommand;
|
|||||||
using BS.Shared.Core;
|
using BS.Shared.Core;
|
||||||
using BS.Shared;
|
using BS.Shared;
|
||||||
using BS.Shared.DataContracts.Compact;
|
using BS.Shared.DataContracts.Compact;
|
||||||
|
using NHibernate.Transform;
|
||||||
using Login = BeWo.Data.Entities.Login;
|
using Login = BeWo.Data.Entities.Login;
|
||||||
|
|
||||||
namespace BeWo.Data.Access
|
namespace BeWo.Data.Access
|
||||||
@@ -1526,10 +1527,10 @@ namespace BeWo.Data.Access
|
|||||||
Restrictions.Or(
|
Restrictions.Or(
|
||||||
Restrictions.And(
|
Restrictions.And(
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid),
|
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid),
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, empfaengerOid)),
|
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, empfaengerOid)),
|
||||||
Restrictions.And(
|
Restrictions.And(
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, empfaengerOid),
|
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, empfaengerOid),
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, senderOid))));
|
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, senderOid))));
|
||||||
|
|
||||||
return c.List<ChatMessage>();
|
return c.List<ChatMessage>();
|
||||||
}
|
}
|
||||||
@@ -1548,7 +1549,7 @@ namespace BeWo.Data.Access
|
|||||||
var c = CreateCriteriaIsActive<ChatMessage>()
|
var c = CreateCriteriaIsActive<ChatMessage>()
|
||||||
.Add(Restrictions.And(
|
.Add(Restrictions.And(
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid),
|
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid),
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, empfaengerOid)));
|
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, empfaengerOid)));
|
||||||
|
|
||||||
return c.List<ChatMessage>();
|
return c.List<ChatMessage>();
|
||||||
}
|
}
|
||||||
@@ -1604,10 +1605,10 @@ namespace BeWo.Data.Access
|
|||||||
Restrictions.Or(
|
Restrictions.Or(
|
||||||
Restrictions.And(
|
Restrictions.And(
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, pSenderOid),
|
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, pSenderOid),
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, pRecipientOid)),
|
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, pRecipientOid)),
|
||||||
Restrictions.And(
|
Restrictions.And(
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, pRecipientOid),
|
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, pRecipientOid),
|
||||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, pSenderOid))))
|
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, pSenderOid))))
|
||||||
.Add(Restrictions.Not(Restrictions.In(BeWoEntityBase.PropertyName_Oid, pExceptions)))
|
.Add(Restrictions.Not(Restrictions.In(BeWoEntityBase.PropertyName_Oid, pExceptions)))
|
||||||
.Add(Restrictions.IsNull(ChatMessage.PropertyName_TeamOid));
|
.Add(Restrictions.IsNull(ChatMessage.PropertyName_TeamOid));
|
||||||
|
|
||||||
@@ -1657,10 +1658,18 @@ namespace BeWo.Data.Access
|
|||||||
public IEnumerable<ChatMessage> FindUnreadChatMessagesForRecipient(long pRecipientOid)
|
public IEnumerable<ChatMessage> FindUnreadChatMessagesForRecipient(long pRecipientOid)
|
||||||
{
|
{
|
||||||
var c = CreateCriteriaIsActive<ChatMessage>()
|
var c = CreateCriteriaIsActive<ChatMessage>()
|
||||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, pRecipientOid))
|
.Add(Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, pRecipientOid))
|
||||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_IstGelesen, 0));
|
.Add(Restrictions.Eq(ChatMessage.PropertyName_IstGelesen, 0));
|
||||||
|
|
||||||
return c.List<ChatMessage>();
|
return c.List<ChatMessage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ChatMessage> FindNewestChatMessages(long pRecipientPersonOid)
|
||||||
|
{
|
||||||
|
var query = Session.CreateSQLQuery(string.Format("SELECT MAX({0}) FROM chatmessages WHERE {1} = {2} AND {3} IS NULL OR {3} IS NOT NULL AND {1} IN (SELECT t.{0} FROM Team t JOIN employee2team e ON e.{3} WHERE e.{4} = {2}) GROUP BY {1}, {5}", BeWoEntityBase.PropertyName_Oid, ChatMessage.PropertyName_EmpfaengerPersonOid, pRecipientPersonOid, "TeamOid", "EmployeeOid", ChatMessage.PropertyName_SenderPersonOid));
|
||||||
|
var result = query.List<long>();
|
||||||
|
|
||||||
|
return result.Count > 0 ? DAOFactory.GenericDAO.LoadByIDs<ChatMessage>(result) : new List<ChatMessage>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
using BS.Shared;
|
using System;
|
||||||
using System;
|
using BS.Shared;
|
||||||
|
|
||||||
namespace BeWo.Data.Entities
|
namespace BeWo.Data.Entities
|
||||||
{
|
{
|
||||||
public class ChatMessage : BeWoEntityBase
|
public class ChatMessage : BeWoEntityBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string PropertyName_ChatText = "ChatText";
|
public static string PropertyName_ChatText = "ChatText";
|
||||||
|
|
||||||
public static string PropertyName_Uhrzeit = "Uhrzeit";
|
public static string PropertyName_Uhrzeit = "Uhrzeit";
|
||||||
|
|
||||||
public static string PropertyName_EmpfängerPersonOid = "EmpfängerPersonOid";
|
public static string PropertyName_EmpfaengerPersonOid = "EmpfaengerPersonOid";
|
||||||
|
|
||||||
public static string PropertyName_SenderPersonOid = "SenderPersonOid";
|
public static string PropertyName_SenderPersonOid = "SenderPersonOid";
|
||||||
|
|
||||||
@@ -22,18 +21,18 @@ namespace BeWo.Data.Entities
|
|||||||
|
|
||||||
private byte[] _ChatText;
|
private byte[] _ChatText;
|
||||||
|
|
||||||
private DateTime _Uhrzeit;
|
private long? _EmpfaengerPersonOid;
|
||||||
|
|
||||||
private long? _EmpfängerPersonOid;
|
|
||||||
|
|
||||||
private long? _SenderPersonOid;
|
|
||||||
|
|
||||||
private bool _IsDelivered;
|
private bool _IsDelivered;
|
||||||
|
|
||||||
private int _IstGelesen;
|
private int _IstGelesen;
|
||||||
|
|
||||||
|
private long? _SenderPersonOid;
|
||||||
|
|
||||||
private long? _TeamOid;
|
private long? _TeamOid;
|
||||||
|
|
||||||
|
private DateTime _Uhrzeit;
|
||||||
|
|
||||||
public ChatMessage()
|
public ChatMessage()
|
||||||
{
|
{
|
||||||
_Tid = TableID.ChatMessage;
|
_Tid = TableID.ChatMessage;
|
||||||
@@ -41,77 +40,62 @@ namespace BeWo.Data.Entities
|
|||||||
|
|
||||||
public virtual byte[] ChatText
|
public virtual byte[] ChatText
|
||||||
{
|
{
|
||||||
get
|
get { return _ChatText; }
|
||||||
{
|
|
||||||
return _ChatText;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.AreDifferent(this._ChatText, value))
|
if(AreDifferent(_ChatText, value))
|
||||||
{
|
{
|
||||||
this._ChatText = value;
|
_ChatText = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual DateTime Uhrzeit
|
public virtual DateTime Uhrzeit
|
||||||
{
|
{
|
||||||
get
|
get { return _Uhrzeit; }
|
||||||
{
|
|
||||||
return this._Uhrzeit;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.AreDifferent(this._Uhrzeit, value))
|
if(AreDifferent(_Uhrzeit, value))
|
||||||
{
|
{
|
||||||
this._Uhrzeit = value;
|
_Uhrzeit = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual long? EmpfängerPersonOid
|
public virtual long? EmpfaengerPersonOid
|
||||||
{
|
{
|
||||||
get
|
get { return _EmpfaengerPersonOid; }
|
||||||
{
|
|
||||||
return this._EmpfängerPersonOid;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.AreDifferent(this._EmpfängerPersonOid, value))
|
if(AreDifferent(_EmpfaengerPersonOid, value))
|
||||||
{
|
{
|
||||||
this._EmpfängerPersonOid = value;
|
_EmpfaengerPersonOid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual long? SenderPersonOid
|
public virtual long? SenderPersonOid
|
||||||
{
|
{
|
||||||
get
|
get { return _SenderPersonOid; }
|
||||||
{
|
|
||||||
return this._SenderPersonOid;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.AreDifferent(this._SenderPersonOid, value))
|
if(AreDifferent(_SenderPersonOid, value))
|
||||||
{
|
{
|
||||||
this._SenderPersonOid = value;
|
_SenderPersonOid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsDelivered
|
public virtual bool IsDelivered
|
||||||
{
|
{
|
||||||
get
|
get { return _IsDelivered; }
|
||||||
{
|
|
||||||
return _IsDelivered;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (AreDifferent(_IsDelivered, value))
|
if(AreDifferent(_IsDelivered, value))
|
||||||
{
|
{
|
||||||
_IsDelivered = value;
|
_IsDelivered = value;
|
||||||
}
|
}
|
||||||
@@ -121,14 +105,11 @@ namespace BeWo.Data.Entities
|
|||||||
|
|
||||||
public virtual int IstGelesen
|
public virtual int IstGelesen
|
||||||
{
|
{
|
||||||
get
|
get { return _IstGelesen; }
|
||||||
{
|
|
||||||
return _IstGelesen;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (AreDifferent(_IstGelesen, value))
|
if(AreDifferent(_IstGelesen, value))
|
||||||
{
|
{
|
||||||
_IstGelesen = value;
|
_IstGelesen = value;
|
||||||
}
|
}
|
||||||
@@ -138,16 +119,13 @@ namespace BeWo.Data.Entities
|
|||||||
|
|
||||||
public virtual long? TeamOid
|
public virtual long? TeamOid
|
||||||
{
|
{
|
||||||
get
|
get { return _TeamOid; }
|
||||||
{
|
|
||||||
return _TeamOid;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.AreDifferent(this._TeamOid, value))
|
if(AreDifferent(_TeamOid, value))
|
||||||
{
|
{
|
||||||
this._TeamOid = value;
|
_TeamOid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</id>
|
</id>
|
||||||
<version type="Int64" column="Version" name="Version" />
|
<version type="Int64" column="Version" name="Version" />
|
||||||
<property name="SenderPersonOid" column="SenderPersonOid" />
|
<property name="SenderPersonOid" column="SenderPersonOid" />
|
||||||
<property name="EmpfängerPersonOid" column="EmpfaengerPersonOid" />
|
<property name="EmpfaengerPersonOid" column="EmpfaengerPersonOid" />
|
||||||
<property name="InsTs" />
|
<property name="InsTs" />
|
||||||
<property name="InsUser" />
|
<property name="InsUser" />
|
||||||
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
|
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace BeWo.Service.DCEntityMapper
|
|||||||
public override ChatMessageDC MergeWithDC(ChatMessage pEntity, ChatMessageDC pDataContract)
|
public override ChatMessageDC MergeWithDC(ChatMessage pEntity, ChatMessageDC pDataContract)
|
||||||
{
|
{
|
||||||
pDataContract.SenderPersonOid = pEntity.SenderPersonOid;
|
pDataContract.SenderPersonOid = pEntity.SenderPersonOid;
|
||||||
pDataContract.EmpfängerPersonOid = pEntity.EmpfängerPersonOid;
|
pDataContract.EmpfängerPersonOid = pEntity.EmpfaengerPersonOid;
|
||||||
pDataContract.ChatText = System.Text.Encoding.UTF8.GetString(pEntity.ChatText);
|
pDataContract.ChatText = System.Text.Encoding.UTF8.GetString(pEntity.ChatText);
|
||||||
pDataContract.Uhrzeit = pEntity.Uhrzeit;
|
pDataContract.Uhrzeit = pEntity.Uhrzeit;
|
||||||
pDataContract.IsDelivered = pEntity.IsDelivered;
|
pDataContract.IsDelivered = pEntity.IsDelivered;
|
||||||
@@ -22,7 +22,7 @@ namespace BeWo.Service.DCEntityMapper
|
|||||||
public override ChatMessage MergeWithEntity(ChatMessageDC pDataContract, ChatMessage pEntity)
|
public override ChatMessage MergeWithEntity(ChatMessageDC pDataContract, ChatMessage pEntity)
|
||||||
{
|
{
|
||||||
pEntity.SenderPersonOid = pDataContract.SenderPersonOid;
|
pEntity.SenderPersonOid = pDataContract.SenderPersonOid;
|
||||||
pEntity.EmpfängerPersonOid = pDataContract.EmpfängerPersonOid;
|
pEntity.EmpfaengerPersonOid = pDataContract.EmpfängerPersonOid;
|
||||||
pEntity.Uhrzeit = pDataContract.Uhrzeit;
|
pEntity.Uhrzeit = pDataContract.Uhrzeit;
|
||||||
pEntity.IsDelivered = pDataContract.IsDelivered;
|
pEntity.IsDelivered = pDataContract.IsDelivered;
|
||||||
pEntity.ChatText = System.Text.Encoding.Default.GetBytes(pDataContract.ChatText);
|
pEntity.ChatText = System.Text.Encoding.Default.GetBytes(pDataContract.ChatText);
|
||||||
|
|||||||
@@ -3134,7 +3134,7 @@ namespace BeWo.Service.ServiceImplementations
|
|||||||
{
|
{
|
||||||
var chatMessage = new ChatMessage
|
var chatMessage = new ChatMessage
|
||||||
{
|
{
|
||||||
EmpfängerPersonOid = empfängerOid,
|
EmpfaengerPersonOid = empfängerOid,
|
||||||
SenderPersonOid = senderOid,
|
SenderPersonOid = senderOid,
|
||||||
Uhrzeit = DateTime.Now,
|
Uhrzeit = DateTime.Now,
|
||||||
IsDelivered = isDeliverd,
|
IsDelivered = isDeliverd,
|
||||||
|
|||||||
@@ -856,4 +856,12 @@ namespace BS.Shared
|
|||||||
Offline,
|
Offline,
|
||||||
Beschäftigt
|
Beschäftigt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LoginFailReason
|
||||||
|
{
|
||||||
|
WrongCredentials,
|
||||||
|
WrongTenant,
|
||||||
|
Unauthorized,
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
}
|
}
|
||||||