Skip to content

Commit a813413

Browse files
committed
Resolved TODOs
1 parent daff22a commit a813413

File tree

5 files changed

+31
-27
lines changed
  • ethree-common/src/main/java/com/virgilsecurity/android/common/interaction
  • ethree-enclave/src/main/java/com/virgilsecurity/android/ethreeenclave/interaction
  • samples/android-kotlin-nexmo/app/src/main/java/com/android/virgilsecurity/ethreenexmodemo/ui/chatControl/thread
  • tests/src/androidTest/java/com/virgilsecurity/android/ethree

5 files changed

+31
-27
lines changed

ethree-common/src/main/java/com/virgilsecurity/android/common/interaction/KeyManagerCloud.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class KeyManagerCloud(
7272
fun exists(password: String) = initCloudKeyStorage(password).exists(identity)
7373

7474
fun store(password: String, data: ByteArray, meta: Map<String, String>?) =
75-
initCloudKeyStorage(password).store(identity, data, meta) // TODO ckech whether meta is null by default
75+
initCloudKeyStorage(password).store(identity, data, meta)
7676

7777
fun retrieve(password: String) = initCloudKeyStorage(password).retrieve(identity)
7878

ethree-enclave/src/main/java/com/virgilsecurity/android/ethreeenclave/interaction/EThree.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ private constructor(
8888
keyStorageAndroid.store(keyEntryAndroid)
8989
} catch (throwable: Throwable) {
9090
keyStorageAndroid.names().forEach { keyStorageAndroid.delete(it) }
91+
9192
throw KeyStorageException("Error while migrating keys from legacy key "
9293
+ "storage to the new one. All keys are restored in legacy key storage.")
9394
}

samples/android-kotlin-nexmo/app/src/main/java/com/android/virgilsecurity/ethreenexmodemo/ui/chatControl/thread/ThreadPresenter.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ class ThreadPresenter(context: Context) {
2424
fun startMessagesListener(thread: NexmoConversation, onNewMessage: (NexmoMessage) -> Unit) {
2525
messageEventListener = object : NexmoMessageEventListener {
2626
override fun onTypingEvent(p0: NexmoTypingEvent) {
27-
// TODO Implement body or it will be empty ):
27+
2828
}
2929

3030
override fun onAttachmentEvent(p0: NexmoAttachmentEvent) {
31-
// TODO Implement body or it will be empty ):
31+
3232
}
3333

3434
override fun onTextEvent(textEvent: NexmoTextEvent) {
3535
if (textEvent.member.user.name != preferences.username()) {
3636
val sender = thread.allMembers.first { it.user.name != preferences.username() }
37-
.user.name // TODO get right name
37+
.user.name
3838
onNewMessage(NexmoMessage(textEvent.text, sender))
3939
}
4040
}
4141

4242
override fun onSeenReceipt(p0: NexmoSeenEvent) {
43-
// TODO Implement body or it will be empty ):
43+
4444
}
4545

4646
override fun onEventDeleted(p0: NexmoDeletedEvent) {
47-
// TODO Implement body or it will be empty ):
47+
4848
}
4949

5050
override fun onDeliveredReceipt(p0: NexmoDeliveredEvent) {
51-
// TODO Implement body or it will be empty ):
51+
5252
}
5353

5454
}

tests/src/androidTest/java/com/virgilsecurity/android/ethree/interaction/sync/EThreeSyncNegative.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class EThreeSyncNegative {
240240
} catch (throwable: Throwable) {
241241
assertTrue(throwable is WrongPasswordException)
242242
}
243-
} // TODO check whether it's ok that updateRecipients executes successfully if KeyKnox is empty
243+
}
244244

245245
//STE-2
246246
@Test fun lookup_zero_users() {

tests/src/androidTest/java/com/virgilsecurity/android/ethree/java/interaction/EThreeTestPositive.java

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
import static org.junit.Assert.assertEquals;
6767
import static org.junit.Assert.assertNotNull;
68+
import static org.junit.Assert.assertTrue;
6869
import static org.junit.Assert.fail;
6970

7071
@RunWith(AndroidJUnit4.class)
@@ -148,23 +149,25 @@ public void onError(@NotNull Throwable throwable) {
148149
assertEquals(1, cards.size());
149150
}
150151

151-
// TODO uncomment after sdk updated to handle null jwt properly
152-
// @Test public void initialize_with_null_token() throws InterruptedException {
153-
// final CountDownLatch lock = new CountDownLatch(1);
154-
// EThree.initialize(TestConfig.Companion.getContext(), new OnGetTokenCallback() {
155-
// @NotNull @Override public String onGetToken() {
156-
// return null;
157-
// }
158-
// }).addCallback(new OnResultListener<EThree>() {
159-
// @Override public void onSuccess(EThree result) {
160-
// eThree = result;
161-
// lock.countDown();
162-
// }
163-
//
164-
// @Override public void onError(@NotNull Throwable throwable) {
165-
// fail(throwable.getMessage());
166-
// }
167-
// });
168-
// lock.await(TestUtils.THROTTLE_TIMEOUT, TimeUnit.SECONDS);
169-
// }
152+
@Test public void initialize_with_null_token() throws InterruptedException {
153+
final CountDownLatch lock = new CountDownLatch(1);
154+
EThree.initialize(TestConfig.Companion.getContext(), new OnGetTokenCallback() {
155+
@NotNull @Override public String onGetToken() {
156+
//noinspection ConstantConditions
157+
return null;
158+
}
159+
}).addCallback(new OnResultListener<EThree>() {
160+
@Override public void onSuccess(EThree result) {
161+
fail("Null token should throw exception");
162+
163+
}
164+
165+
@Override public void onError(@NotNull Throwable throwable) {
166+
assertTrue(throwable instanceof IllegalArgumentException);
167+
168+
lock.countDown();
169+
}
170+
});
171+
lock.await(TestUtils.THROTTLE_TIMEOUT, TimeUnit.SECONDS);
172+
}
170173
}

0 commit comments

Comments
 (0)