Skip to content
This repository was archived by the owner on Aug 19, 2021. It is now read-only.

Commit 635d60a

Browse files
author
Michael Farb
committed
fixed file edit and a reply scenario
- Corrected file editing and reloading. - Fixed #106, allowing reply attempt for previously unregistered devices.
1 parent bb59ca9 commit 635d60a

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

safeslinger-messenger/src/edu/cmu/cylab/starslinger/model/MessageDbAdapter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ public long createDraftMessage(RecipientRow recip, MessageData msg, long submitT
205205
if (msg.getFileName() != null)
206206
values.put(KEY_FILENAME, msg.getFileName()); // name of file
207207

208+
values.put(KEY_FILELEN, msg.getFileSize()); // len encoded file
209+
208210
if (msg.getFileType() != null)
209211
values.put(KEY_FILETYPE, msg.getFileType()); // file mime
210212
// type
@@ -240,6 +242,8 @@ public boolean updateDraftMessage(long rowId, RecipientRow recip, MessageData ms
240242
if (msg.getFileName() != null)
241243
values.put(KEY_FILENAME, msg.getFileName()); // name of file
242244

245+
values.put(KEY_FILELEN, msg.getFileSize()); // len encoded file
246+
243247
if (msg.getFileType() != null)
244248
values.put(KEY_FILETYPE, msg.getFileType()); // file mime
245249
// type

safeslinger-messenger/src/edu/cmu/cylab/starslinger/view/HomeActivity.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ public void processIntent(Intent intent) {
433433
public void setProperDefaultTab() throws SQLException {
434434
// if nothing else, make sure proper default tab is selected
435435
RecipientDbAdapter dbRecipient = RecipientDbAdapter.openInstance(getApplicationContext());
436-
MessageDbAdapter dbMessage = MessageDbAdapter.openInstance(getApplicationContext());
437436

438437
if (dbRecipient.getTrustedRecipientCount() == 0) {
439438
// Sling Keys should be the default when there are 0 keys
@@ -1842,7 +1841,17 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
18421841
try {
18431842
if (c.moveToFirst()) {
18441843
RecipientRow recip = new RecipientRow(c);
1844+
if (recip != null && recip.getNotRegDate() > 0) {
1845+
// reset registration to 0 to enable
1846+
// test reply
1847+
if (!dbRecipient.updateRecipientRegistrationState(
1848+
recip.getRowId(), true)) {
1849+
showNote(R.string.error_UnableToUpdateMessageInDB);
1850+
}
1851+
recip.setNotRegDate(0L);
1852+
}
18451853
d.setRecip(recip);
1854+
18461855
CheckRegistrationStateTask task = new CheckRegistrationStateTask();
18471856
task.execute(recip);
18481857
if (requestCode == VIEW_RECIPSEL_FORFILE_ID

safeslinger-messenger/src/edu/cmu/cylab/starslinger/view/MessagesFragment.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,13 @@ public void run() {
694694

695695
} else if (mDraft != null
696696
&& mDraft.getRowId() == messageRow.getRowId()) {
697+
// file data must reloaded from db,
698+
// text message is edited on this ui
699+
mDraft.setFileData(messageRow.getFileData());
700+
mDraft.setFileDir(messageRow.getFileDir());
701+
mDraft.setFileName(messageRow.getFileName());
702+
mDraft.setFileSize(messageRow.getFileSize());
703+
mDraft.setFileType(messageRow.getFileType());
697704
// draft has already been updated
698705
continue;
699706

0 commit comments

Comments
 (0)