From f68d1f0983b99acad987ac4997c0f002209bb0d2 Mon Sep 17 00:00:00 2001 From: Matthieu Finiasz Date: Tue, 3 Dec 2024 13:50:28 +0100 Subject: [PATCH] v3.4.1 (build 258) --- CHANGELOG.md | 5 ++ .../src/main/java/io/olvid/engine/Logger.java | 3 + .../java/io/olvid/engine/engine/Engine.java | 8 ++- .../olvid/engine/engine/types/EngineAPI.java | 2 + .../engine/networkfetch/FetchManager.java | 43 +++++++++---- .../CreateServerSessionCoordinator.java | 5 +- ...eleteMessageAndAttachmentsCoordinator.java | 8 ++- .../DownloadAttachmentCoordinator.java | 7 +- ...loadMessageExtendedPayloadCoordinator.java | 5 +- ...MessagesAndListAttachmentsCoordinator.java | 5 +- .../coordinators/FreeTrialCoordinator.java | 3 + .../GetTurnCredentialsCoordinator.java | 3 + ...shInboxAttachmentSignedUrlCoordinator.java | 5 +- ...terServerPushNotificationsCoordinator.java | 5 +- .../coordinators/ServerQueryCoordinator.java | 7 +- .../ServerUserDataCoordinator.java | 7 +- .../VerifyReceiptCoordinator.java | 5 +- .../coordinators/WebsocketCoordinator.java | 7 +- .../coordinators/WellKnownCoordinator.java | 5 +- .../olvid/engine/networksend/SendManager.java | 8 +++ .../CancelAttachmentUploadCoordinator.java | 5 +- ...hOutboxAttachmentSignedUrlCoordinator.java | 5 +- .../SendAttachmentCoordinator.java | 5 +- .../coordinators/SendMessageCoordinator.java | 9 ++- .../SendReturnReceiptCoordinator.java | 5 +- .../engine/protocol/ProtocolManager.java | 8 ++- .../coordinators/ProtocolStepCoordinator.java | 5 +- obv_messenger/app/build.gradle | 8 +-- .../java/io/olvid/messenger/AppSingleton.java | 2 + .../messenger/activities/ShareActivity.java | 2 +- .../activities/ShortcutActivity.java | 2 +- .../ForwardMessagesDialogFragment.java | 2 +- .../FilteredContactListFragment.java | 64 ++++++++++--------- .../FilteredDiscussionListFragment.java | 6 +- .../messenger/group/GroupCreationActivity.kt | 9 +-- .../main/contacts/ContactListScreen.kt | 47 +++++++------- .../messenger/openid/KeycloakManager.java | 2 +- .../plus_button/KeycloakSearchFragment.kt | 32 +++++----- .../plus_button/WebClientScannedFragment.kt | 2 +- .../TroubleshootingActivity.kt | 20 +++--- .../messenger/webrtc/WebrtcCallService.kt | 14 ++-- .../res/layout/fragment_onboarding_scan.xml | 4 +- 42 files changed, 258 insertions(+), 146 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23afb222..c062c200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Build 258 (3.4.1) +2024-12-03 + +- Fix a few occasional crashes + # Build 257 (3.4) 2024-11-28 diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/Logger.java b/obv_engine/engine/src/main/java/io/olvid/engine/Logger.java index e57546d3..2535ccfd 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/Logger.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/Logger.java @@ -108,6 +108,9 @@ public static byte[] fromHexString(String hex) { public static String getUuidString(UUID uuid) { + if (uuid == null) { + return ""; + } return (digits(uuid.getMostSignificantBits() >> 32, 8) + "-" + digits(uuid.getMostSignificantBits() >> 16, 4) + "-" + digits(uuid.getMostSignificantBits(), 4) + "-" + diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/engine/Engine.java b/obv_engine/engine/src/main/java/io/olvid/engine/engine/Engine.java index eb924637..efaacc7a 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/engine/Engine.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/engine/Engine.java @@ -74,7 +74,6 @@ import io.olvid.engine.datatypes.containers.IdentityWithSerializedDetails; import io.olvid.engine.datatypes.containers.ServerQuery; import io.olvid.engine.datatypes.containers.TrustOrigin; -import io.olvid.engine.datatypes.containers.UidAndPreKey; import io.olvid.engine.datatypes.key.asymmetric.EncryptionEciesMDCKeyPair; import io.olvid.engine.datatypes.key.asymmetric.ServerAuthenticationECSdsaMDCKeyPair; import io.olvid.engine.datatypes.key.symmetric.AuthEncKey; @@ -298,6 +297,13 @@ public Engine(File baseDirectory, ObvBackupAndSyncDelegate appBackupAndSyncDeleg metaManager.initializationComplete(); } + @Override + public void startProcessing() { + fetchManager.startProcessing(); + sendManager.startProcessing(); + protocolManager.startProcessing(); + } + private static void upgradeTables(Session session, int oldVersion, int newVersion) throws SQLException { UserInterfaceDialog.upgradeTable(session, oldVersion, newVersion); } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/engine/types/EngineAPI.java b/obv_engine/engine/src/main/java/io/olvid/engine/engine/types/EngineAPI.java index 8085f61b..811adaed 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/engine/types/EngineAPI.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/engine/types/EngineAPI.java @@ -59,6 +59,8 @@ enum ApiKeyStatus { FREE_TRIAL_KEY_EXPIRED, } + void startProcessing(); + // Engine notifications void addNotificationListener(String notificationName, EngineNotificationListener engineNotificationListener); void addNotificationListener(String notificationName, EngineNotificationListener engineNotificationListener, ListenerPriority priority); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/FetchManager.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/FetchManager.java index 4e48e4f7..0ea1fe64 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/FetchManager.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/FetchManager.java @@ -92,7 +92,7 @@ public class FetchManager implements FetchManagerSessionFactory, NetworkFetchDel private final DownloadMessagesAndListAttachmentsCoordinator downloadMessagesAndListAttachmentsCoordinator; private final DownloadMessageExtendedPayloadCoordinator downloadMessageExtendedPayloadCoordinator; private final DeleteMessageAndAttachmentsCoordinator deleteMessageAndAttachmentsCoordinator; - private final RegisterServerPushNotificationsCoordinator serverPushNotificationsCoordinator; + private final RegisterServerPushNotificationsCoordinator registerServerPushNotificationsCoordinator; private final WebsocketCoordinator websocketCoordinator; private final ServerQueryCoordinator serverQueryCoordinator; private final ServerUserDataCoordinator serverUserDataCoordinator; @@ -116,8 +116,8 @@ public FetchManager(MetaManager metaManager, SSLSocketFactory sslSocketFactory, this.downloadMessagesAndListAttachmentsCoordinator = new DownloadMessagesAndListAttachmentsCoordinator(this, sslSocketFactory, createServerSessionCoordinator); this.downloadMessageExtendedPayloadCoordinator = new DownloadMessageExtendedPayloadCoordinator(this, sslSocketFactory, createServerSessionCoordinator); this.deleteMessageAndAttachmentsCoordinator = new DeleteMessageAndAttachmentsCoordinator(this, sslSocketFactory, createServerSessionCoordinator); - this.serverPushNotificationsCoordinator = new RegisterServerPushNotificationsCoordinator(this, sslSocketFactory, createServerSessionCoordinator, downloadMessagesAndListAttachmentsCoordinator); - this.downloadMessagesAndListAttachmentsCoordinator.setRegisterServerPushNotificationDelegate(this.serverPushNotificationsCoordinator); + this.registerServerPushNotificationsCoordinator = new RegisterServerPushNotificationsCoordinator(this, sslSocketFactory, createServerSessionCoordinator, downloadMessagesAndListAttachmentsCoordinator); + this.downloadMessagesAndListAttachmentsCoordinator.setRegisterServerPushNotificationDelegate(this.registerServerPushNotificationsCoordinator); this.serverUserDataCoordinator = new ServerUserDataCoordinator(this, sslSocketFactory, createServerSessionCoordinator, jsonObjectMapper, prng); this.serverQueryCoordinator = new ServerQueryCoordinator(this, sslSocketFactory, prng, createServerSessionCoordinator, serverUserDataCoordinator, jsonObjectMapper); this.freeTrialCoordinator = new FreeTrialCoordinator(this, sslSocketFactory); @@ -144,7 +144,7 @@ public FetchManager(MetaManager metaManager, SSLSocketFactory sslSocketFactory, @Override public void initialisationComplete() { wellKnownCoordinator.initialQueueing(); - serverPushNotificationsCoordinator.initialQueueing(); + registerServerPushNotificationsCoordinator.initialQueueing(); downloadAttachmentCoordinator.initialQueueing(); serverQueryCoordinator.initialQueueing(); downloadMessagesAndListAttachmentsCoordinator.initialQueueing(); @@ -154,6 +154,23 @@ public void initialisationComplete() { createServerSessionCoordinator.initialQueueing(); } + public void startProcessing() { + createServerSessionCoordinator.startProcessing(); + deleteMessageAndAttachmentsCoordinator.startProcessing(); + downloadAttachmentCoordinator.startProcessing(); + downloadMessageExtendedPayloadCoordinator.startProcessing(); + downloadMessagesAndListAttachmentsCoordinator.startProcessing(); + freeTrialCoordinator.startProcessing(); + getTurnCredentialsCoordinator.startProcessing(); + refreshInboxAttachmentSignedUrlCoordinator.startProcessing(); + registerServerPushNotificationsCoordinator.startProcessing(); + serverQueryCoordinator.startProcessing(); + serverUserDataCoordinator.startProcessing(); + verifyReceiptCoordinator.startProcessing(); + websocketCoordinator.startProcessing(); + wellKnownCoordinator.startProcessing(); + } + @SuppressWarnings("unused") public void setDelegate(CreateSessionDelegate createSessionDelegate) { this.createSessionDelegate = createSessionDelegate; @@ -201,7 +218,7 @@ public void setDelegate(ProcessDownloadedMessageDelegate processDownloadedMessag @SuppressWarnings("unused") public void setDelegate(NotificationListeningDelegate notificationListeningDelegate) { - this.serverPushNotificationsCoordinator.setNotificationListeningDelegate(notificationListeningDelegate); + this.registerServerPushNotificationsCoordinator.setNotificationListeningDelegate(notificationListeningDelegate); this.websocketCoordinator.setNotificationListeningDelegate(notificationListeningDelegate); this.downloadMessagesAndListAttachmentsCoordinator.setNotificationListeningDelegate(notificationListeningDelegate); this.downloadMessageExtendedPayloadCoordinator.setNotificationListeningDelegate(notificationListeningDelegate); @@ -216,7 +233,7 @@ public void setDelegate(NotificationListeningDelegate notificationListeningDeleg @SuppressWarnings("unused") public void setDelegate(NotificationPostingDelegate notificationPostingDelegate) { this.notificationPostingDelegate = notificationPostingDelegate; - this.serverPushNotificationsCoordinator.setNotificationPostingDelegate(notificationPostingDelegate); + this.registerServerPushNotificationsCoordinator.setNotificationPostingDelegate(notificationPostingDelegate); this.downloadAttachmentCoordinator.setNotificationPostingDelegate(notificationPostingDelegate); this.createServerSessionCoordinator.setNotificationPostingDelegate(notificationPostingDelegate); this.refreshInboxAttachmentSignedUrlCoordinator.setNotificationPostingDelegate(notificationPostingDelegate); @@ -240,7 +257,7 @@ public void setDelegate(IdentityDelegate identityDelegate) { @SuppressWarnings("unused") public void setDelegate(ProtocolStarterDelegate protocolStarterDelegate) { this.websocketCoordinator.setProtocolStarterDelegate(protocolStarterDelegate); - this.serverPushNotificationsCoordinator.setProtocolStarterDelegate(protocolStarterDelegate); + this.registerServerPushNotificationsCoordinator.setProtocolStarterDelegate(protocolStarterDelegate); } // endregion @@ -281,7 +298,7 @@ public FetchManagerSession getSession() throws SQLException { deleteMessageAndAttachmentsCoordinator, downloadAttachmentCoordinator, // deleteMessageAndAttachmentsCoordinator, - serverPushNotificationsCoordinator, + registerServerPushNotificationsCoordinator, serverQueryCoordinator, identityDelegate, engineBaseDirectory, @@ -296,7 +313,7 @@ private FetchManagerSession wrapSession(Session session) { deleteMessageAndAttachmentsCoordinator, downloadAttachmentCoordinator, // deleteMessageAndAttachmentsCoordinator, - serverPushNotificationsCoordinator, + registerServerPushNotificationsCoordinator, serverQueryCoordinator, identityDelegate, engineBaseDirectory, @@ -640,7 +657,7 @@ public void retryScheduledNetworkTasks() { downloadMessagesAndListAttachmentsCoordinator.retryScheduledNetworkTasks(); downloadMessageExtendedPayloadCoordinator.retryScheduledNetworkTasks(); refreshInboxAttachmentSignedUrlCoordinator.retryScheduledNetworkTasks(); - serverPushNotificationsCoordinator.retryScheduledNetworkTasks(); + registerServerPushNotificationsCoordinator.retryScheduledNetworkTasks(); serverQueryCoordinator.retryScheduledNetworkTasks(); websocketCoordinator.retryScheduledNetworkTasks(); } @@ -730,17 +747,17 @@ public void registerPushNotificationIfConfigurationChanged(Session session, Iden @Override public void processAndroidPushNotification(String maskingUidString) { - serverPushNotificationsCoordinator.processAndroidPushNotification(maskingUidString); + registerServerPushNotificationsCoordinator.processAndroidPushNotification(maskingUidString); } @Override public void forceRegisterPushNotification(Identity ownedIdentity, boolean triggerAnOwnedDeviceDiscoveryWhenFinished) { - serverPushNotificationsCoordinator.registerServerPushNotification(ownedIdentity, triggerAnOwnedDeviceDiscoveryWhenFinished); + registerServerPushNotificationsCoordinator.registerServerPushNotification(ownedIdentity, triggerAnOwnedDeviceDiscoveryWhenFinished); } @Override public Identity getOwnedIdentityFromMaskingUid(String maskingUidString) { - return serverPushNotificationsCoordinator.getOwnedIdentityFromMaskingUid(maskingUidString); + return registerServerPushNotificationsCoordinator.getOwnedIdentityFromMaskingUid(maskingUidString); } // endregion diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/CreateServerSessionCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/CreateServerSessionCoordinator.java index 43aae644..a09eeaa6 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/CreateServerSessionCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/CreateServerSessionCoordinator.java @@ -59,9 +59,12 @@ public CreateServerSessionCoordinator(FetchManagerSessionFactory fetchManagerSes scheduler = new ExponentialBackoffRepeatingScheduler<>(); createServerSessionOperationQueue = new NoDuplicateOperationQueue(); - createServerSessionOperationQueue.execute(1, "Engine-CreateServerSessionCoordinator"); queryApiKeyStatusOperationQueue = new OperationQueue(true); + } + + public void startProcessing() { + createServerSessionOperationQueue.execute(1, "Engine-CreateServerSessionCoordinator"); queryApiKeyStatusOperationQueue.execute(1, "Engine-CreateServerSessionCoordinator-QueryApiKeyStatus"); } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DeleteMessageAndAttachmentsCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DeleteMessageAndAttachmentsCoordinator.java index b713446f..964a3839 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DeleteMessageAndAttachmentsCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DeleteMessageAndAttachmentsCoordinator.java @@ -72,7 +72,7 @@ public DeleteMessageAndAttachmentsCoordinator(FetchManagerSessionFactory fetchMa this.createServerSessionDelegate = createServerSessionDelegate; deleteMessageAndAttachmentsFromServerOperationQueue = new NoDuplicateOperationQueue(); - deleteMessageAndAttachmentsFromServerOperationQueue.execute(1, "Engine-DeleteMessageAndAttachmentsCoordinator"); + messageUidsToDeleteByOwnedIdentity = new HashMap<>(); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -83,6 +83,12 @@ public DeleteMessageAndAttachmentsCoordinator(FetchManagerSessionFactory fetchMa serverSessionCreatedNotificationListener = new ServerSessionCreatedNotificationListener(); } + + public void startProcessing() { + deleteMessageAndAttachmentsFromServerOperationQueue.execute(1, "Engine-DeleteMessageAndAttachmentsCoordinator"); + } + + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { // register to NotificationCenter for NOTIFICATION_SERVER_SESSION_CREATED notificationListeningDelegate.addListener(DownloadNotifications.NOTIFICATION_SERVER_SESSION_CREATED, serverSessionCreatedNotificationListener); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadAttachmentCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadAttachmentCoordinator.java index 40e3a095..cb38b378 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadAttachmentCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadAttachmentCoordinator.java @@ -77,10 +77,8 @@ public DownloadAttachmentCoordinator(FetchManagerSessionFactory fetchManagerSess this.refreshInboxAttachmentSignedUrlDelegate = refreshInboxAttachmentSignedUrlDelegate; downloadAttachmentOperationWeightQueue = new PriorityOperationQueue(); - downloadAttachmentOperationWeightQueue.execute(4, "Engine-DownloadAttachmentCoordinator-weight"); downloadAttachmentOperationTimestampQueue = new PriorityOperationQueue(); - downloadAttachmentOperationTimestampQueue.execute(4, "Engine-DownloadAttachmentCoordinator-timestamp"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -92,6 +90,11 @@ public DownloadAttachmentCoordinator(FetchManagerSessionFactory fetchManagerSess awaitingIdentityReactivationOperationsLock = new ReentrantLock(); } + public void startProcessing() { + downloadAttachmentOperationWeightQueue.execute(4, "Engine-DownloadAttachmentCoordinator-weight"); + downloadAttachmentOperationTimestampQueue.execute(4, "Engine-DownloadAttachmentCoordinator-timestamp"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; // register to NotificationCenter for NOTIFICATION_INBOX_ATTACHMENT_SIGNED_URL_REFRESHED diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessageExtendedPayloadCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessageExtendedPayloadCoordinator.java index 630af8e4..fdf5bdef 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessageExtendedPayloadCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessageExtendedPayloadCoordinator.java @@ -71,7 +71,6 @@ public DownloadMessageExtendedPayloadCoordinator(FetchManagerSessionFactory fetc this.createServerSessionDelegate = createServerSessionDelegate; downloadMessagesExtendedPayloadOperationQueue = new NoDuplicateOperationQueue(); - downloadMessagesExtendedPayloadOperationQueue.execute(1, "Engine-DownloadMessagesExtendedPayloadCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); awaitingNotificationListener = new AwaitingNotificationListener(); @@ -83,6 +82,10 @@ public DownloadMessageExtendedPayloadCoordinator(FetchManagerSessionFactory fetc awaitingIdentityReactivationOperationsLock = new ReentrantLock(); } + public void startProcessing() { + downloadMessagesExtendedPayloadOperationQueue.execute(1, "Engine-DownloadMessagesExtendedPayloadCoordinator"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; // register to NotificationCenter for NOTIFICATION_SERVER_SESSION_CREATED diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessagesAndListAttachmentsCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessagesAndListAttachmentsCoordinator.java index 1ed116c1..666bbe59 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessagesAndListAttachmentsCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/DownloadMessagesAndListAttachmentsCoordinator.java @@ -79,7 +79,6 @@ public DownloadMessagesAndListAttachmentsCoordinator(FetchManagerSessionFactory this.createServerSessionDelegate = createServerSessionDelegate; downloadMessagesAndListAttachmentsOperationQueue = new NoDuplicateOperationQueue(); - downloadMessagesAndListAttachmentsOperationQueue.execute(1, "Engine-DownloadMessagesAndListAttachmentsCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); awaitingServerSessionOperations = new HashMap<>(); @@ -88,6 +87,10 @@ public DownloadMessagesAndListAttachmentsCoordinator(FetchManagerSessionFactory awaitingNotificationListener = new AwaitingNotificationListener(); } + public void startProcessing() { + downloadMessagesAndListAttachmentsOperationQueue.execute(1, "Engine-DownloadMessagesAndListAttachmentsCoordinator"); + } + public void setRegisterServerPushNotificationDelegate(RegisterServerPushNotificationDelegate registerServerPushNotificationDelegate) { this.registerServerPushNotificationDelegate = registerServerPushNotificationDelegate; } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/FreeTrialCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/FreeTrialCoordinator.java index 63cdf38e..a9cfc6de 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/FreeTrialCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/FreeTrialCoordinator.java @@ -37,6 +37,9 @@ public FreeTrialCoordinator(FetchManagerSessionFactory fetchManagerSessionFactor this.sslSocketFactory = sslSocketFactory; freeTrialOperationQueue = new OperationQueue(true); + } + + public void startProcessing() { freeTrialOperationQueue.execute(1, "Engine-FreeTrialCoordinator"); } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/GetTurnCredentialsCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/GetTurnCredentialsCoordinator.java index 3c2f810d..789f9aca 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/GetTurnCredentialsCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/GetTurnCredentialsCoordinator.java @@ -50,6 +50,9 @@ public GetTurnCredentialsCoordinator(FetchManagerSessionFactory fetchManagerSess this.wellKnownCacheDelegate = wellKnownCacheDelegate; getTurnCredentialsOperationQueue = new OperationQueue(true); + } + + public void startProcessing() { getTurnCredentialsOperationQueue.execute(1, "Engine-GetTurnCredentialsCoordinator"); } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RefreshInboxAttachmentSignedUrlCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RefreshInboxAttachmentSignedUrlCoordinator.java index 00aedc63..a3cf3b3c 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RefreshInboxAttachmentSignedUrlCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RefreshInboxAttachmentSignedUrlCoordinator.java @@ -68,7 +68,6 @@ public RefreshInboxAttachmentSignedUrlCoordinator(FetchManagerSessionFactory fet this.lastUrlRefreshTimestamps = new HashMap<>(); refreshInboxAttachmentSignedUrlOperationQueue = new NoDuplicateOperationQueue(); - refreshInboxAttachmentSignedUrlOperationQueue.execute(1, "Engine-RefreshInboxAttachmentSignedUrlCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -77,6 +76,10 @@ public RefreshInboxAttachmentSignedUrlCoordinator(FetchManagerSessionFactory fet awaitingIdentityReactivationNotificationListener = new AwaitingIdentityReactivationNotificationListener(); } + public void startProcessing() { + refreshInboxAttachmentSignedUrlOperationQueue.execute(1, "Engine-RefreshInboxAttachmentSignedUrlCoordinator"); + } + public void setNotificationPostingDelegate(NotificationPostingDelegate notificationPostingDelegate) { this.notificationPostingDelegate = notificationPostingDelegate; } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RegisterServerPushNotificationsCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RegisterServerPushNotificationsCoordinator.java index 28e97321..a8d9d744 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RegisterServerPushNotificationsCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/RegisterServerPushNotificationsCoordinator.java @@ -76,7 +76,6 @@ public RegisterServerPushNotificationsCoordinator(FetchManagerSessionFactory fet this.downloadMessagesAndListAttachmentsDelegate = downloadMessagesAndListAttachmentsDelegate; registerPushNotificationOperationQueue = new NoDuplicateOperationQueue(); - registerPushNotificationOperationQueue.execute(1, "Engine-RegisterServerPushNotificationsCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -86,6 +85,10 @@ public RegisterServerPushNotificationsCoordinator(FetchManagerSessionFactory fet serverSessionCreatedNotificationListener = new ServerSessionCreatedNotificationListener(); } + public void startProcessing() { + registerPushNotificationOperationQueue.execute(1, "Engine-RegisterServerPushNotificationsCoordinator"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; // register to NotificationCenter for NOTIFICATION_SERVER_SESSION_CREATED diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerQueryCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerQueryCoordinator.java index d9663937..917d640e 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerQueryCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerQueryCoordinator.java @@ -96,6 +96,10 @@ public ServerQueryCoordinator(FetchManagerSessionFactory fetchManagerSessionFact notificationListener = new NotificationListener(); } + public void startProcessing() { + serverQueriesOperationQueue.execute(1, "Engine-ServerQueryCoordinator"); + } + public void initialQueueing() { try (FetchManagerSession fetchManagerSession = fetchManagerSessionFactory.getSession()) { PendingServerQuery[] pendingServerQueries = PendingServerQuery.getAll(fetchManagerSession); @@ -111,9 +115,6 @@ public void initialQueueing() { } catch (Exception e) { Logger.x(e); } - - // only start processing queries after the initial queueing is performed (otherwise a query could be queued while its already being executed) - serverQueriesOperationQueue.execute(1, "Engine-ServerQueryCoordinator"); } public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerUserDataCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerUserDataCoordinator.java index 511e7ded..4f37f3f5 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerUserDataCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/ServerUserDataCoordinator.java @@ -86,9 +86,7 @@ public ServerUserDataCoordinator(FetchManagerSessionFactory fetchManagerSessionF this.prng = prng; deleteUserDataOperationQueue = new NoDuplicateOperationQueue(); - deleteUserDataOperationQueue.execute(1, "Engine-ServerUserDataCoordinator-delete"); refreshUserDataOperationQueue = new NoDuplicateOperationQueue(); - refreshUserDataOperationQueue.execute(1, "Engine-ServerUserDataCoordinator-refresh"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -100,6 +98,11 @@ public ServerUserDataCoordinator(FetchManagerSessionFactory fetchManagerSessionF notificationListener = new NotificationListener(); } + public void startProcessing() { + deleteUserDataOperationQueue.execute(1, "Engine-ServerUserDataCoordinator-delete"); + refreshUserDataOperationQueue.execute(1, "Engine-ServerUserDataCoordinator-refresh"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; // register to NotificationCenter for NOTIFICATION_SERVER_SESSION_CREATED diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/VerifyReceiptCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/VerifyReceiptCoordinator.java index f0e3cd7d..9dcbfe25 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/VerifyReceiptCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/VerifyReceiptCoordinator.java @@ -57,7 +57,6 @@ public VerifyReceiptCoordinator(FetchManagerSessionFactory fetchManagerSessionFa this.createServerSessionDelegate = createServerSessionDelegate; verifyReceiptOperationQueue = new OperationQueue(true); - verifyReceiptOperationQueue.execute(1, "Engine-VerifyReceiptCoordinator"); awaitingServerSessionOperations = new HashMap<>(); awaitingServerSessionOperationsLock = new ReentrantLock(); @@ -75,7 +74,9 @@ private void queueNewVerifyReceiptOperation(Identity ownedIdentity, String store verifyReceiptOperationQueue.queue(op); } - + public void startProcessing() { + verifyReceiptOperationQueue.execute(1, "Engine-VerifyReceiptCoordinator"); + } @Override public void onCancelCallback(Operation operation) { diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WebsocketCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WebsocketCoordinator.java index ec93d2e9..2465bdf5 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WebsocketCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WebsocketCoordinator.java @@ -133,10 +133,8 @@ public WebsocketCoordinator(FetchManagerSessionFactory fetchManagerSessionFactor this.jsonObjectMapper = jsonObjectMapper; websocketCreationOperationQueue = new NoDuplicateOperationQueue(); - websocketCreationOperationQueue.execute(1, "Engine-WebsocketCoordinator-create"); identityRegistrationOperationQueue = new NoDuplicateOperationQueue(); - identityRegistrationOperationQueue.execute(1, "Engine-WebsocketCoordinator-register"); scheduler = new ExponentialBackoffRepeatingScheduler<>() { @Override @@ -164,6 +162,11 @@ protected long computeReschedulingDelay(int failedAttemptCount) { okHttpClient = initializeOkHttpClientForWebSocket(sslSocketFactory); } + public void startProcessing() { + websocketCreationOperationQueue.execute(1, "Engine-WebsocketCoordinator-create"); + identityRegistrationOperationQueue.execute(1, "Engine-WebsocketCoordinator-register"); + } + public static OkHttpClient initializeOkHttpClientForWebSocket(SSLSocketFactory sslSocketFactory) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); if (sslSocketFactory != null) { diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WellKnownCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WellKnownCoordinator.java index 90be9213..f4183f1f 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WellKnownCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networkfetch/coordinators/WellKnownCoordinator.java @@ -69,11 +69,14 @@ public WellKnownCoordinator(FetchManagerSessionFactory fetchManagerSessionFactor this.wellKnownCache = new HashMap<>(); this.wellKnownDownloadOperationQueue = new NoDuplicateOperationQueue(); - this.wellKnownDownloadOperationQueue.execute(1, "Engine-WellKnownDownloadCoordinator"); this.wellKnownDownloadTimer = new Timer("Engine-WellKnownDownloadTimer"); } + public void startProcessing() { + this.wellKnownDownloadOperationQueue.execute(1, "Engine-WellKnownDownloadCoordinator"); + } + public void setNotificationPostingDelegate(NotificationPostingDelegate notificationPostingDelegate) { this.notificationPostingDelegate = notificationPostingDelegate; } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/SendManager.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/SendManager.java index 2625c4dd..36ac7bcd 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/SendManager.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/SendManager.java @@ -85,6 +85,14 @@ public void initialisationComplete() { sendReturnReceiptCoordinator.initialQueueing(); } + public void startProcessing() { + cancelAttachmentUploadCoordinator.startProcessing(); + refreshOutboxAttachmentSignedUrlCoordinator.startProcessing(); + sendAttachmentCoordinator.startProcessing(); + sendMessageCoordinator.startProcessing(); + sendReturnReceiptCoordinator.startProcessing(); + } + public void setDelegate(CreateSessionDelegate createSessionDelegate) { this.createSessionDelegate = createSessionDelegate; diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/CancelAttachmentUploadCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/CancelAttachmentUploadCoordinator.java index a6fa6fe6..73336b6e 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/CancelAttachmentUploadCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/CancelAttachmentUploadCoordinator.java @@ -63,7 +63,6 @@ public CancelAttachmentUploadCoordinator(SendManagerSessionFactory sendManagerSe this.sslSocketFactory = sslSocketFactory; cancelAttachmentUploadOperationQueue = new NoDuplicateOperationQueue(); - cancelAttachmentUploadOperationQueue.execute(1, "Engine-CancelAttachmentUploadCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -73,6 +72,10 @@ public CancelAttachmentUploadCoordinator(SendManagerSessionFactory sendManagerSe notificationListener = new NotificationListener(); } + public void startProcessing() { + cancelAttachmentUploadOperationQueue.execute(1, "Engine-CancelAttachmentUploadCoordinator"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; this.notificationListeningDelegate.addListener(IdentityNotifications.NOTIFICATION_OWNED_IDENTITY_CHANGED_ACTIVE_STATUS, notificationListener); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/RefreshOutboxAttachmentSignedUrlCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/RefreshOutboxAttachmentSignedUrlCoordinator.java index 1c3027d8..4459168d 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/RefreshOutboxAttachmentSignedUrlCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/RefreshOutboxAttachmentSignedUrlCoordinator.java @@ -69,7 +69,6 @@ public RefreshOutboxAttachmentSignedUrlCoordinator(SendManagerSessionFactory sen this.lastUrlRefreshTimestamps = new HashMap<>(); refreshOutboxAttachmentSignedUrlOperationQueue = new NoDuplicateOperationQueue(); - refreshOutboxAttachmentSignedUrlOperationQueue.execute(1, "Engine-RefreshOutboxAttachmentSignedUrlCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -79,6 +78,10 @@ public RefreshOutboxAttachmentSignedUrlCoordinator(SendManagerSessionFactory sen notificationListener = new NotificationListener(); } + public void startProcessing() { + refreshOutboxAttachmentSignedUrlOperationQueue.execute(1, "Engine-RefreshOutboxAttachmentSignedUrlCoordinator"); + } + public void setNotificationPostingDelegate(NotificationPostingDelegate notificationPostingDelegate) { this.notificationPostingDelegate = notificationPostingDelegate; } diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendAttachmentCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendAttachmentCoordinator.java index bd1ac4d3..2cd1022b 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendAttachmentCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendAttachmentCoordinator.java @@ -75,7 +75,6 @@ public SendAttachmentCoordinator(SendManagerSessionFactory sendManagerSessionFac this.refreshOutboxAttachmentSignedUrlDelegate = refreshOutboxAttachmentSignedUrlCoordinator; sendAttachmentOperationQueue = new PriorityOperationQueue(); - sendAttachmentOperationQueue.execute(4, "Engine-SendAttachmentCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -89,6 +88,10 @@ public SendAttachmentCoordinator(SendManagerSessionFactory sendManagerSessionFac awaitingIdentityReactivationOperationsLock = new ReentrantLock(); } + public void startProcessing() { + sendAttachmentOperationQueue.execute(4, "Engine-SendAttachmentCoordinator"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; this.notificationListeningDelegate.addListener(UploadNotifications.NOTIFICATION_OUTBOX_ATTACHMENT_SIGNED_URL_REFRESHED, notificationListener); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendMessageCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendMessageCoordinator.java index a1b002af..121971b4 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendMessageCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendMessageCoordinator.java @@ -78,18 +78,15 @@ public SendMessageCoordinator(SendManagerSessionFactory sendManagerSessionFactor this.sslSocketFactory = sslSocketFactory; sendMessageWithAttachmentOperationQueue = new OperationQueue(true); - sendMessageWithAttachmentOperationQueue.execute(1, "Engine-SendMessageCoordinator-WithAttachment"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); userContentMessageUidsByServer = new HashMap<>(); batchSendUserContentMessageOperationQueue = new NoDuplicateOperationQueue(); - batchSendUserContentMessageOperationQueue.execute(1, "Engine-SendMessageCoordinator-WithUserContent"); protocolMessageUidsByServer = new HashMap<>(); batchSendProtocolMessageOperationQueue = new NoDuplicateOperationQueue(); - batchSendProtocolMessageOperationQueue.execute(1, "Engine-SendMessageCoordinator-Protocol"); batchScheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -100,6 +97,12 @@ public SendMessageCoordinator(SendManagerSessionFactory sendManagerSessionFactor notificationListener = new NotificationListener(); } + public void startProcessing() { + sendMessageWithAttachmentOperationQueue.execute(1, "Engine-SendMessageCoordinator-WithAttachment"); + batchSendUserContentMessageOperationQueue.execute(1, "Engine-SendMessageCoordinator-WithUserContent"); + batchSendProtocolMessageOperationQueue.execute(1, "Engine-SendMessageCoordinator-Protocol"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; this.notificationListeningDelegate.addListener(IdentityNotifications.NOTIFICATION_OWNED_IDENTITY_CHANGED_ACTIVE_STATUS, notificationListener); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendReturnReceiptCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendReturnReceiptCoordinator.java index 91116b88..a8065353 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendReturnReceiptCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/networksend/coordinators/SendReturnReceiptCoordinator.java @@ -70,7 +70,6 @@ public SendReturnReceiptCoordinator(SendManagerSessionFactory sendManagerSession returnReceiptOwnedIdentityAndIdByServer = new HashMap<>(); sendReturnReceiptOperationQueue = new NoDuplicateOperationQueue(); - sendReturnReceiptOperationQueue.execute(1, "Engine-SendReturnReceiptCoordinator"); scheduler = new ExponentialBackoffRepeatingScheduler<>(); @@ -80,6 +79,10 @@ public SendReturnReceiptCoordinator(SendManagerSessionFactory sendManagerSession notificationListener = new NotificationListener(); } + public void startProcessing() { + sendReturnReceiptOperationQueue.execute(1, "Engine-SendReturnReceiptCoordinator"); + } + public void setNotificationListeningDelegate(NotificationListeningDelegate notificationListeningDelegate) { this.notificationListeningDelegate = notificationListeningDelegate; this.notificationListeningDelegate.addListener(IdentityNotifications.NOTIFICATION_OWNED_IDENTITY_CHANGED_ACTIVE_STATUS, notificationListener); diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/protocol/ProtocolManager.java b/obv_engine/engine/src/main/java/io/olvid/engine/protocol/ProtocolManager.java index a8509553..d11b37be 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/protocol/ProtocolManager.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/protocol/ProtocolManager.java @@ -207,9 +207,15 @@ public void initialisationComplete() { Logger.x(e); } -// schedulerForPeriodicSync.scheduleAtFixedRate(this::triggerOwnedDevicesSync, Constants.PERIODIC_OWNED_DEVICE_SYNC_INTERVAL, Constants.PERIODIC_OWNED_DEVICE_SYNC_INTERVAL, TimeUnit.MILLISECONDS); +// schedulerForPeriodicSync.schedule(this::triggerOwnedDevicesSync, Constants.PERIODIC_OWNED_DEVICE_SYNC_INTERVAL, Constants.PERIODIC_OWNED_DEVICE_SYNC_INTERVAL, TimeUnit.MILLISECONDS); } + public void startProcessing() { + protocolStepCoordinator.startProcessing(); + } + + + // private void triggerOwnedDevicesSync() { // try (ProtocolManagerSession protocolManagerSession = getSession()) { // for (ProtocolInstance protocolInstance : ProtocolInstance.getAllForProtocolId(protocolManagerSession, ConcreteProtocol.SYNCHRONIZATION_PROTOCOL_ID)) { diff --git a/obv_engine/engine/src/main/java/io/olvid/engine/protocol/coordinators/ProtocolStepCoordinator.java b/obv_engine/engine/src/main/java/io/olvid/engine/protocol/coordinators/ProtocolStepCoordinator.java index 51b56bb3..ae0b1c55 100644 --- a/obv_engine/engine/src/main/java/io/olvid/engine/protocol/coordinators/ProtocolStepCoordinator.java +++ b/obv_engine/engine/src/main/java/io/olvid/engine/protocol/coordinators/ProtocolStepCoordinator.java @@ -56,10 +56,13 @@ public ProtocolStepCoordinator(ProtocolManagerSessionFactory protocolManagerSess this.jsonObjectMapper = jsonObjectMapper; protocolOperationQueue = new NoDuplicateOperationQueue(); - protocolOperationQueue.execute(1, "Engine-ProtocolStepCoordinator"); stepFailedAttemptCount = new HashMap<>(); } + public void startProcessing() { + protocolOperationQueue.execute(1, "Engine-ProtocolStepCoordinator"); + } + private void queueNewProtocolOperation(UID receivedMessageUid) { ProtocolOperation op = new ProtocolOperation(protocolManagerSessionFactory, receivedMessageUid, prng, jsonObjectMapper, this, this); protocolOperationQueue.queue(op); diff --git a/obv_messenger/app/build.gradle b/obv_messenger/app/build.gradle index d95f9ac9..330db77e 100644 --- a/obv_messenger/app/build.gradle +++ b/obv_messenger/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "io.olvid.messenger" minSdkVersion 21 targetSdk 35 - versionCode 257 - versionName "3.4" + versionCode 258 + versionName "3.4.1" vectorDrawables.useSupportLibrary true multiDexEnabled true resourceConfigurations += ['en', 'fr'] @@ -190,8 +190,8 @@ dependencies { implementation 'androidx.exifinterface:exifinterface:1.3.7' implementation 'androidx.fragment:fragment-ktx:1.8.5' implementation 'androidx.fragment:fragment-compose:1.8.5' - implementation 'androidx.media3:media3-exoplayer:1.4.1' - implementation 'androidx.media3:media3-ui:1.4.1' + implementation 'androidx.media3:media3-exoplayer:1.5.0' + implementation 'androidx.media3:media3-ui:1.5.0' implementation 'androidx.media:media:1.7.0' final def navigation_version = '2.8.4' implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/AppSingleton.java b/obv_messenger/app/src/main/java/io/olvid/messenger/AppSingleton.java index 117d86dc..9e614643 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/AppSingleton.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/AppSingleton.java @@ -275,6 +275,8 @@ public void x(String tag, Throwable throwable) { e.printStackTrace(); throw new RuntimeException(e); } + this.engine.startProcessing(); + this.engineNotificationProcessor = new EngineNotificationProcessor(this.engine); this.engineNotificationProcessorForContacts = new EngineNotificationProcessorForContacts(this.engine); this.engineNotificationProcessorForGroups = new EngineNotificationProcessorForGroups(this.engine); diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShareActivity.java b/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShareActivity.java index 7de595fd..1e45f633 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShareActivity.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShareActivity.java @@ -185,7 +185,7 @@ protected void notLockedOnCreate() { } AppSingleton.getInstance().selectIdentity(bytesOwnedIdentity, null); }); - Transformations.switchMap(AppSingleton.getCurrentIdentityLiveData(), (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? null : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); + Transformations.switchMap(AppSingleton.getCurrentIdentityLiveData(), (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? new byte[0] : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); FilteredDiscussionListFragment filteredDiscussionListFragment = new FilteredDiscussionListFragment(); diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShortcutActivity.java b/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShortcutActivity.java index 3cf54f29..ba3d41cc 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShortcutActivity.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/activities/ShortcutActivity.java @@ -152,7 +152,7 @@ protected void notLockedOnCreate() { } AppSingleton.getInstance().selectIdentity(bytesOwnedIdentity, null); }); - Transformations.switchMap(AppSingleton.getCurrentIdentityLiveData(), (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? null : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); + Transformations.switchMap(AppSingleton.getCurrentIdentityLiveData(), (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? new byte[0] : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); FilteredDiscussionListFragment filteredDiscussionListFragment = new FilteredDiscussionListFragment(); diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/discussion/ForwardMessagesDialogFragment.java b/obv_messenger/app/src/main/java/io/olvid/messenger/discussion/ForwardMessagesDialogFragment.java index c730028a..8dd90072 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/discussion/ForwardMessagesDialogFragment.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/discussion/ForwardMessagesDialogFragment.java @@ -165,7 +165,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c } viewModel.setForwardMessageBytesOwnedIdentity(bytesOwnedIdentity); }); - Transformations.switchMap(viewModel.forwardMessageOwnedIdentityLiveData, (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? null : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); + Transformations.switchMap(viewModel.forwardMessageOwnedIdentityLiveData, (OwnedIdentity ownedIdentity) -> AppDatabase.getInstance().ownedIdentityDao().getAllNotHiddenExceptOne(ownedIdentity == null ? new byte[0] : ownedIdentity.bytesOwnedIdentity)).observe(this, adapter); FilteredDiscussionListFragment filteredDiscussionListFragment = new FilteredDiscussionListFragment(); diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredContactListFragment.java b/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredContactListFragment.java index 7e8cdf6e..200c628d 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredContactListFragment.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredContactListFragment.java @@ -79,7 +79,7 @@ public class FilteredContactListFragment extends Fragment implements TextWatcher protected TextView emptyViewTextView; private Observer> selectedContactsObserver; - private Observer> filteredContactsObserver; +// private Observer> filteredContactsObserver; private List initiallySelectedContacts; @@ -87,7 +87,7 @@ public class FilteredContactListFragment extends Fragment implements TextWatcher private boolean selectable = false; private boolean disableEmptyView = false; private boolean disableAnimations = false; - private String emptyViewText = null; +// private String emptyViewText = null; protected FilteredContactListAdapter filteredContactListAdapter; @@ -99,9 +99,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (unfilteredContacts != null) { observeUnfiltered(); } - if (this.filteredContactsObserver != null) { - filteredContactListViewModel.getFilteredContacts().observe(this, this.filteredContactsObserver); - } +// if (this.filteredContactsObserver != null) { +// filteredContactListViewModel.getFilteredContacts().observe(this, this.filteredContactsObserver); +// } if (this.selectedContactsObserver != null) { filteredContactListViewModel.getSelectedContacts().observe(this, this.selectedContactsObserver); } @@ -129,9 +129,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c recyclerView.setEmptyView(recyclerEmptyView); } emptyViewTextView = rootView.findViewById(R.id.widget_list_empty_view_text_view); - if (emptyViewText != null) { - emptyViewTextView.setText(emptyViewText); - } +// if (emptyViewText != null) { +// emptyViewTextView.setText(emptyViewText); +// } View loadingSpinner = rootView.findViewById(R.id.loading_spinner); recyclerView.setLoadingSpinner(loadingSpinner); @@ -169,6 +169,10 @@ public void setContactFilterEditText(EditText contactFilterEditText) { } this.contactFilterEditText = contactFilterEditText; this.contactFilterEditText.addTextChangedListener(this); + if (filteredContactListViewModel != null) { + Editable editable = this.contactFilterEditText.getText(); + filteredContactListViewModel.setFilter(editable == null ? "" : editable.toString()); + } } public void setFilter(String filter) { @@ -177,17 +181,17 @@ public void setFilter(String filter) { } } - public void setFilteredContactObserver(@Nullable Observer> observer) { - if (filteredContactListViewModel != null) { - if (this.filteredContactsObserver != null) { - filteredContactListViewModel.getFilteredContacts().removeObserver(this.filteredContactsObserver); - } - if (observer != null) { - filteredContactListViewModel.getFilteredContacts().observe(this, observer); - } - } - this.filteredContactsObserver = observer; - } +// public void setFilteredContactObserver(@Nullable Observer> observer) { +// if (filteredContactListViewModel != null) { +// if (this.filteredContactsObserver != null) { +// filteredContactListViewModel.getFilteredContacts().removeObserver(this.filteredContactsObserver); +// } +// if (observer != null) { +// filteredContactListViewModel.getFilteredContacts().observe(this, observer); +// } +// } +// this.filteredContactsObserver = observer; +// } public void setOnClickDelegate(FilteredContactListOnClickDelegate onClickDelegate) { this.onClickDelegate = onClickDelegate; @@ -217,13 +221,13 @@ public void setSelectedContactsObserver(Observer> observer) { this.selectedContactsObserver = observer; } - public void setEmptyViewText(@Nullable String text) { - if (emptyViewTextView != null) { - emptyViewTextView.setText(text); - } else { - emptyViewText = text; - } - } +// public void setEmptyViewText(@Nullable String text) { +// if (emptyViewTextView != null) { +// emptyViewTextView.setText(text); +// } else { +// emptyViewText = text; +// } +// } public void removeBottomPadding() { removeBottomPadding = true; @@ -530,7 +534,7 @@ public int getItemCount() { return 0; } - class ContactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { + public class ContactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { final InitialView initialView; final TextView contactNameTextView; final TextView contactNameSecondLineTextView; @@ -570,10 +574,8 @@ public void onClick(View view) { if (contactFilterEditText != null) { contactFilterEditText.selectAll(); } - } else { - if (FilteredContactListFragment.this.onClickDelegate != null) { - FilteredContactListFragment.this.onClickDelegate.contactClicked(view, filteredContacts.get(position).contact); - } + } else if (FilteredContactListFragment.this.onClickDelegate != null) { + FilteredContactListFragment.this.onClickDelegate.contactClicked(view, filteredContacts.get(position).contact); } } diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredDiscussionListFragment.java b/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredDiscussionListFragment.java index b43ed8e7..fc20486e 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredDiscussionListFragment.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/fragments/FilteredDiscussionListFragment.java @@ -79,7 +79,7 @@ public class FilteredDiscussionListFragment extends Fragment implements TextWatc private boolean showPinned = false; private boolean selectable = false; - protected FilteredDiscussionListAdapter filteredDiscussionListAdapter; + FilteredDiscussionListAdapter filteredDiscussionListAdapter; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -246,6 +246,7 @@ class FilteredDiscussionListAdapter extends RecyclerView.Adapter searchableDiscussions) { this.filteredDiscussions = searchableDiscussions; @@ -408,6 +409,9 @@ public void onClick(View view) { int position = this.getLayoutPosition(); if (selectable) { filteredDiscussionListViewModel.selectedDiscussionId(filteredDiscussions.get(position).discussionId); + if (discussionFilterEditText != null) { + discussionFilterEditText.selectAll(); + } } else if (FilteredDiscussionListFragment.this.onClickDelegate != null) { FilteredDiscussionListFragment.this.onClickDelegate.discussionClicked(view, filteredDiscussions.get(position)); } diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/group/GroupCreationActivity.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/group/GroupCreationActivity.kt index 92df82f6..d10e90ce 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/group/GroupCreationActivity.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/group/GroupCreationActivity.kt @@ -20,6 +20,8 @@ package io.olvid.messenger.group import android.content.res.Configuration import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.text.InputType import android.util.Pair import android.view.LayoutInflater @@ -28,13 +30,11 @@ import android.view.MenuItem import android.view.View import android.view.View.OnClickListener import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager import android.widget.Button import android.widget.EditText import android.widget.TextView import androidx.activity.viewModels -import androidx.appcompat.widget.AppCompatEditText -import androidx.appcompat.widget.SearchView -import androidx.appcompat.widget.SearchView.OnQueryTextListener import androidx.appcompat.widget.Toolbar import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.view.ViewCompat @@ -323,6 +323,7 @@ class GroupCreationActivity : LockableActivity(), OnClickListener { val expandListener = object : MenuItem.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem): Boolean { searchView.requestFocus() + Handler(Looper.getMainLooper()).postDelayed({ (getSystemService(INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT) }, 200) return true } @@ -342,7 +343,7 @@ class GroupCreationActivity : LockableActivity(), OnClickListener { } searchView.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS or InputType.TYPE_TEXT_VARIATION_FILTER - contactsSelectionFragment!!.setContactFilterEditText(searchView) + contactsSelectionFragment?.setContactFilterEditText(searchView) } } return true diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/main/contacts/ContactListScreen.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/main/contacts/ContactListScreen.kt index 19cf8d60..f170d3dd 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/main/contacts/ContactListScreen.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/main/contacts/ContactListScreen.kt @@ -60,6 +60,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment @@ -95,7 +96,7 @@ import io.olvid.messenger.settings.SettingsActivity import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch -data class ContactFilterTab(val label: String, val filter: (ContactOrKeycloakDetails) -> Boolean) +data class ContactFilterTab(val labelResId: Int, val filter: (ContactOrKeycloakDetails) -> Boolean) @OptIn(ExperimentalMaterialApi::class) @Composable @@ -114,23 +115,24 @@ fun ContactListScreen( val contacts by contactListViewModel.filteredContacts.observeAsState() val refreshState = onRefresh?.let { rememberPullRefreshState(refreshing, onRefresh) } - val tabs = arrayListOf( - ContactFilterTab( - label = stringResource(id = R.string.contact_list_tab_contact), - filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contact?.oneToOne == true } - ), - ContactFilterTab( - label = stringResource(id = R.string.contact_list_tab_others), - filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contact?.oneToOne == false } - ) - ) - if (contactListViewModel.keycloakManaged.value) { - tabs.add(ContactFilterTab( - label = stringResource(id = R.string.contact_list_tab_directory), - filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contactType != CONTACT } - )) - } + val tabs = arrayListOf( + ContactFilterTab( + labelResId = R.string.contact_list_tab_contact, + filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contact?.oneToOne == true } + ), + ContactFilterTab( + labelResId = R.string.contact_list_tab_others, + filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contact?.oneToOne == false } + ) + ).apply { + if (contactListViewModel.keycloakManaged.value) { + add(ContactFilterTab( + labelResId = R.string.contact_list_tab_directory, + filter = { contactOrKeycloakDetails -> contactOrKeycloakDetails.contactType != CONTACT } + )) + } + } AppCompatTheme { Box( @@ -138,8 +140,7 @@ fun ContactListScreen( .then(refreshState?.let { Modifier.pullRefresh(it) } ?: Modifier) ) { Column(modifier = Modifier.fillMaxSize()) { - val pagerState = - rememberPagerState { if (contactListViewModel.keycloakManaged.value) 3 else 2 } + val pagerState = rememberPagerState { tabs.size } LaunchedEffect(pagerState) { snapshotFlow { pagerState.currentPage }.collect { page -> if (page == 2) { @@ -369,7 +370,7 @@ private fun Header( contacts: List?, ) { TabRow( - selectedTabIndex = pagerState.currentPage, + selectedTabIndex = pagerState.currentPage.coerceAtMost(tabs.size - 1) , backgroundColor = colorResource(id = R.color.almostWhite), contentColor = colorResource(id = R.color.almostBlack), ) { @@ -384,7 +385,7 @@ private fun Header( }, text = { if (contactListViewModel.getFilter().isNullOrEmpty()) { - Text(text = tab.label, softWrap = false, overflow = TextOverflow.Ellipsis) + Text(text = stringResource(tab.labelResId), softWrap = false, overflow = TextOverflow.Ellipsis) } else if (index == 2 && contactListViewModel.keycloakSearchInProgress) { BadgedBox(badge = { CircularProgressIndicator( @@ -396,7 +397,7 @@ private fun Header( ) }) { Text( - text = tab.label, + text = stringResource(tab.labelResId), softWrap = false, overflow = TextOverflow.Ellipsis ) @@ -421,7 +422,7 @@ private fun Header( } }) { Text( - text = tab.label, + text = stringResource(tab.labelResId), softWrap = false, overflow = TextOverflow.Ellipsis ) diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/openid/KeycloakManager.java b/obv_messenger/app/src/main/java/io/olvid/messenger/openid/KeycloakManager.java index 4e2e229f..97211e8f 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/openid/KeycloakManager.java +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/openid/KeycloakManager.java @@ -677,7 +677,7 @@ public void run() { }); } - private static void registerMeApiKeyOnServer(KeycloakManagerState kms, BytesKey identityBytesKey, UUID apiKey) { + private static void registerMeApiKeyOnServer(KeycloakManagerState kms, BytesKey identityBytesKey, @NonNull UUID apiKey) { // retry at most 10 times for (int i=0; i<10; i++) { RegisterApiKeyResult registerApiKeyResult = AppSingleton.getEngine().registerOwnedIdentityApiKeyOnServer(identityBytesKey.bytes, apiKey); diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/KeycloakSearchFragment.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/KeycloakSearchFragment.kt index 62957543..8588bc03 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/KeycloakSearchFragment.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/KeycloakSearchFragment.kt @@ -190,7 +190,7 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { } private fun startSearch() { - val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager imm?.hideSoftInputFromWindow(keycloakSearchEditText?.windowToken, 0) val ownedIdentity = viewModel.currentIdentity @@ -342,9 +342,9 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { userDetails.identity ) != null ) { - holder.initialView.setFromCache(userDetails.identity) + holder.initialView?.setFromCache(userDetails.identity) } else { - holder.initialView.setInitial( + holder.initialView?.setInitial( if (userDetails.identity == null) ByteArray(0) else userDetails.identity, StringUtils.getInitial(name) ) @@ -352,12 +352,12 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { val posComp = identityDetails.formatPositionAndCompany(contactDisplayNameFormat) if (posComp != null) { - holder.keycloakUserNameTextView.maxLines = 1 - holder.keycloakUserPositionTextView.visibility = View.VISIBLE + holder.keycloakUserNameTextView?.maxLines = 1 + holder.keycloakUserPositionTextView?.visibility = View.VISIBLE matchAndHighlight(posComp, holder.keycloakUserPositionTextView) } else { - holder.keycloakUserNameTextView.maxLines = 2 - holder.keycloakUserPositionTextView.visibility = View.GONE + holder.keycloakUserNameTextView?.maxLines = 2 + holder.keycloakUserPositionTextView?.visibility = View.GONE } if (userDetails.identity != null) { @@ -368,11 +368,11 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { .contactDao()[bytesOwnedIdentity, userDetails.identity] Handler(Looper.getMainLooper()).post { if (contact != null) { - holder.initialView.setContact(contact) - holder.keycloakUserKnownImageView.visibility = + holder.initialView?.setContact(contact) + holder.keycloakUserKnownImageView?.visibility = if (contact.oneToOne) View.VISIBLE else View.GONE } else { - holder.keycloakUserKnownImageView.visibility = + holder.keycloakUserKnownImageView?.visibility = View.GONE } } @@ -389,7 +389,7 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { } } - private fun matchAndHighlight(text: String, textView: TextView) { + private fun matchAndHighlight(text: String, textView: TextView?) { val regexes: MutableList = ArrayList(patterns.size) for (pattern in patterns) { regexes.add(Regex(pattern.toString())) @@ -409,7 +409,7 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { ) i++ } - textView.text = highlightedString + textView?.text = highlightedString } @@ -459,11 +459,11 @@ class KeycloakSearchFragment : Fragment(), OnClickListener { internal class SearchResultViewHolder(itemView: View, onClick: (userDetails: JsonKeycloakUserDetails) -> Unit) : ViewHolder(itemView) { - val keycloakUserNameTextView: TextView = itemView.findViewById(R.id.keycloak_user_name) - val keycloakUserPositionTextView: TextView = + val keycloakUserNameTextView: TextView? = itemView.findViewById(R.id.keycloak_user_name) + val keycloakUserPositionTextView: TextView? = itemView.findViewById(R.id.keycloak_user_position) - val initialView: InitialView = itemView.findViewById(R.id.initial_view) - val keycloakUserKnownImageView: ImageView = + val initialView: InitialView? = itemView.findViewById(R.id.initial_view) + val keycloakUserKnownImageView: ImageView? = itemView.findViewById(R.id.keycloak_user_known_image_view) val missingCountTextView: TextView? = itemView.findViewById(R.id.keycloak_missing_count) diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/WebClientScannedFragment.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/WebClientScannedFragment.kt index ce3e273e..5781a10f 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/WebClientScannedFragment.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/plus_button/WebClientScannedFragment.kt @@ -254,7 +254,7 @@ class WebClientScannedFragment : Fragment(), OnClickListener { sasCodeError!!.visibility = View.INVISIBLE sasCodeEditText!!.requestFocus() val imm = - activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + activity.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager imm?.showSoftInput(sasCodeEditText, InputMethodManager.SHOW_IMPLICIT) } } diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/troubleshooting/TroubleshootingActivity.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/troubleshooting/TroubleshootingActivity.kt index 18035d45..c0976c35 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/troubleshooting/TroubleshootingActivity.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/troubleshooting/TroubleshootingActivity.kt @@ -34,16 +34,14 @@ import android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS import android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS import android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS import android.text.format.Formatter -import androidx.activity.ComponentActivity import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContracts.RequestPermission +import androidx.appcompat.app.AppCompatActivity import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.systemBarsPadding @@ -94,7 +92,7 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalPermissionsApi::class) -class TroubleshootingActivity : ComponentActivity() { +class TroubleshootingActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { @@ -118,7 +116,7 @@ class TroubleshootingActivity : ComponentActivity() { CheckState(SOCKET_CHECK_STATE, troubleshootingDataStore) { getPermanentSocketState() } } val backupState = remember { - CheckState(BACKUP_CHECK_STATE, troubleshootingDataStore, statusIsOk = {a -> a == 0}) { getBackupState()} + CheckState(BACKUP_CHECK_STATE, troubleshootingDataStore, statusIsOk = { a -> a == 0 }) { getBackupState() } } val fullScreenIntentState = remember { CheckState(FULL_SCREEN_CHECK_STATE, troubleshootingDataStore) { getFullScreenIntentState() } @@ -127,7 +125,7 @@ class TroubleshootingActivity : ComponentActivity() { CheckState(LOCATION_CHECK_STATE, troubleshootingDataStore) { getLocationState() } } - val postNotificationsState = rememberPermissionState( permission.POST_NOTIFICATIONS ) + val postNotificationsState = rememberPermissionState(permission.POST_NOTIFICATIONS) val cameraState = rememberPermissionState(permission.CAMERA) val microphoneState = rememberPermissionState(permission.RECORD_AUDIO) val locationPermissionState = rememberMultiplePermissionsState(listOf(permission.ACCESS_FINE_LOCATION, permission.ACCESS_COARSE_LOCATION)) @@ -145,12 +143,12 @@ class TroubleshootingActivity : ComponentActivity() { ) ) - val troubleshootingItems : MutableState> = remember { + val troubleshootingItems: MutableState> = remember { mutableStateOf(mutableListOf()) } LaunchedEffect(Unit) { - val list : ArrayList> = ArrayList() // triple is (valid, critical, TroubleshootItemType) + val list: ArrayList> = ArrayList() // triple is (valid, critical, TroubleshootItemType) if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { list.add(Triple(postNotificationsState.status.isGranted, true, TroubleshootingItemType.NOTIFICATIONS)) } else { @@ -221,7 +219,7 @@ class TroubleshootingActivity : ComponentActivity() { horizontalAlignment = Alignment.CenterHorizontally ) { - FaqLinkHeader ( + FaqLinkHeader( openFaq = { startActivity( Intent( @@ -236,7 +234,7 @@ class TroubleshootingActivity : ComponentActivity() { ) troubleshootingItems.value.forEach { troubleshootingItem -> - when(troubleshootingItem) { + when (troubleshootingItem) { TroubleshootingItemType.NOTIFICATIONS -> { val notificationsPermissionLauncher = rememberLauncherForActivityResult( @@ -624,7 +622,7 @@ class TroubleshootingActivity : ComponentActivity() { } AppVersionHeader(betaEnabled = SettingsActivity.betaFeaturesEnabled) - + RestartAppButton() } } diff --git a/obv_messenger/app/src/main/java/io/olvid/messenger/webrtc/WebrtcCallService.kt b/obv_messenger/app/src/main/java/io/olvid/messenger/webrtc/WebrtcCallService.kt index 062e33ed..93c30444 100644 --- a/obv_messenger/app/src/main/java/io/olvid/messenger/webrtc/WebrtcCallService.kt +++ b/obv_messenger/app/src/main/java/io/olvid/messenger/webrtc/WebrtcCallService.kt @@ -2784,7 +2784,7 @@ class WebrtcCallService : Service() { } val endCallIntent = Intent(this, WebrtcCallService::class.java) endCallIntent.setAction(ACTION_HANG_UP) - endCallIntent.putExtra(CALL_IDENTIFIER_INTENT_EXTRA, Logger.getUuidString(callIdentifier)) + endCallIntent.putExtra(CALL_IDENTIFIER_INTENT_EXTRA, callIdentifier?.let{Logger.getUuidString(it)} ?: "") endCallIntent.putExtra(BYTES_OWNED_IDENTITY_INTENT_EXTRA, bytesOwnedIdentity) val endCallPendingIntent = PendingIntent.getService( this, @@ -3510,14 +3510,12 @@ class WebrtcCallService : Service() { jsonIceCandidate.sdpMLineIndex, jsonIceCandidate.sdpMid ) - Logger.d( - """☎ sending peer an ice candidate for call ${ - Logger.getUuidString( - callIdentifier - ) - } + callIdentifier?.let { + Logger.d( + """☎ sending peer an ice candidate for call ${Logger.getUuidString(it)} ${jsonIceCandidate.sdpMLineIndex} -> ${jsonIceCandidate.sdp}""" - ) + ) + } if (callParticipant.contact != null && callParticipant.contact.hasChannelOrPreKey()) { postMessage(listOf(callParticipant), jsonNewIceCandidateMessage) } else { diff --git a/obv_messenger/app/src/main/res/layout/fragment_onboarding_scan.xml b/obv_messenger/app/src/main/res/layout/fragment_onboarding_scan.xml index 3f7360c8..7230b097 100644 --- a/obv_messenger/app/src/main/res/layout/fragment_onboarding_scan.xml +++ b/obv_messenger/app/src/main/res/layout/fragment_onboarding_scan.xml @@ -53,9 +53,9 @@ android:padding="8dp" app:srcCompat="@drawable/ic_three_dots_always_white" android:theme="@style/AlwaysWhiteSubtleRipple" + android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="@+id/top_bar" - app:layout_constraintEnd_toEndOf="@+id/top_bar" - app:layout_constraintTop_toTopOf="@+id/top_bar" /> + app:layout_constraintEnd_toEndOf="@+id/top_bar" />