diff --git a/packages/backend/src/backendManager.ts b/packages/backend/src/backendManager.ts index 5862e47218..42fa25d78b 100644 --- a/packages/backend/src/backendManager.ts +++ b/packages/backend/src/backendManager.ts @@ -11,6 +11,7 @@ import initRnBridge from './rn-bridge' import { INestApplicationContext } from '@nestjs/common' import logger from './nest/common/logger' import { OpenServices, validateOptions } from './options' +import { SOCKS_PROXY_AGENT } from './nest/const' const log = logger('backendManager') @@ -112,11 +113,16 @@ export const runBackendMobile = async () => { const connectionsManager = app.get(ConnectionsManagerService) connectionsManager.closeSocket() }) + rn_bridge.channel.on('open', async (msg: OpenServices) => { const connectionsManager = app.get(ConnectionsManagerService) const torControl = app.get(TorControl) + const proxyAgent = app.get<{ proxy: { port: string } }>(SOCKS_PROXY_AGENT) + torControl.torControlParams.port = msg.torControlPort torControl.torControlParams.auth.value = msg.authCookie + proxyAgent.proxy.port = msg.httpTunnelPort + await connectionsManager.openSocket() }) } diff --git a/packages/backend/src/nest/storage/storage.service.ts b/packages/backend/src/nest/storage/storage.service.ts index d3b21f8164..53988be1ff 100644 --- a/packages/backend/src/nest/storage/storage.service.ts +++ b/packages/backend/src/nest/storage/storage.service.ts @@ -567,7 +567,7 @@ export class StorageService extends EventEmitter { ) const channel = this.channels.get(channelId) - this.logger(`Found existing channel: ${channel}`) + this.logger('Found existing channel:', channel) if (channel === undefined) { await this.channels.put(channelId, { ...channelData }) diff --git a/packages/desktop/package-lock.json b/packages/desktop/package-lock.json index b9e6b1cdd9..12b3985070 100644 --- a/packages/desktop/package-lock.json +++ b/packages/desktop/package-lock.json @@ -1,12 +1,12 @@ { "name": "@quiet/desktop", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@quiet/desktop", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "license": "GPL-3.0-or-later", "dependencies": { "@electron/remote": "^2.0.8", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 5bd2b83dc2..65741f26b2 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -80,7 +80,7 @@ }, "homepage": "https://github.com/TryQuiet", "@comment version": "To build new version for specific platform, just replace platform in version tag to one of following linux, mac, windows", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "description": "Decentralized team chat", "main": "dist/main/main.js", "scripts": { diff --git a/packages/desktop/src/rtl-tests/community.join.test.tsx b/packages/desktop/src/rtl-tests/community.join.test.tsx index 1a945aa070..f49fb3e1bd 100644 --- a/packages/desktop/src/rtl-tests/community.join.test.tsx +++ b/packages/desktop/src/rtl-tests/community.join.test.tsx @@ -29,6 +29,7 @@ import { AnyAction } from 'redux' import { InvitationData, ChannelsReplicatedPayload, + ChannelSubscribedPayload, Community, ErrorPayload, type NetworkInfo, @@ -116,6 +117,9 @@ describe('User', () => { }, }, }) + socket.socketClient.emit(SocketActionTypes.CHANNEL_SUBSCRIBED, { + channelId: 'general', + }) } } @@ -185,6 +189,7 @@ describe('User', () => { "Network/addInitializedCommunity", "Communities/clearInvitationCodes", "PublicChannels/channelsReplicated", + "PublicChannels/setChannelSubscribed", "PublicChannels/addChannel", "Messages/addPublicChannelsMessagesBase", "PublicChannels/sendIntroductionMessage", diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index 8a2cea9443..78177dd28f 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -188,8 +188,8 @@ android { applicationId "com.quietmobile" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 407 - versionName "2.1.2-alpha.11" + versionCode 408 + versionName "2.1.2-alpha.12" resValue "string", "build_config_package", "com.quietmobile" testBuildType System.getProperty('testBuildType', 'debug') testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' diff --git a/packages/mobile/ios/Quiet/Info.plist b/packages/mobile/ios/Quiet/Info.plist index 85de7d53ea..ceb549b6da 100644 --- a/packages/mobile/ios/Quiet/Info.plist +++ b/packages/mobile/ios/Quiet/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 364 + 365 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/packages/mobile/ios/QuietTests/Info.plist b/packages/mobile/ios/QuietTests/Info.plist index bc9f380f8f..26206fad8f 100644 --- a/packages/mobile/ios/QuietTests/Info.plist +++ b/packages/mobile/ios/QuietTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 364 + 365 diff --git a/packages/mobile/package-lock.json b/packages/mobile/package-lock.json index 0e2bd61b6c..3970b38d00 100644 --- a/packages/mobile/package-lock.json +++ b/packages/mobile/package-lock.json @@ -1,12 +1,12 @@ { "name": "@quiet/mobile", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@quiet/mobile", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "dependencies": { "@peculiar/webcrypto": "^1.4.3", "@react-native-clipboard/clipboard": "^1.13.2", diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 1381a726a7..eee2ba663b 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -1,6 +1,6 @@ { "name": "@quiet/mobile", - "version": "2.1.2-alpha.11", + "version": "2.1.2-alpha.12", "scripts": { "build": "tsc -p tsconfig.build.json --noEmit", "storybook-android": "ENVFILE=.env.storybook react-native run-android --mode=storybookDebug --appIdSuffix=storybook.debug", diff --git a/packages/state-manager/src/sagas/publicChannels/sendIntroductionMessage/sendIntroductionMessage.saga.ts b/packages/state-manager/src/sagas/publicChannels/sendIntroductionMessage/sendIntroductionMessage.saga.ts index 8a485494b4..87e2cd04f4 100644 --- a/packages/state-manager/src/sagas/publicChannels/sendIntroductionMessage/sendIntroductionMessage.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/sendIntroductionMessage/sendIntroductionMessage.saga.ts @@ -1,4 +1,4 @@ -import { put, select, call } from 'typed-redux-saga' +import { put, select, call, delay } from 'typed-redux-saga' import { messagesActions } from '../../messages/messages.slice' import { publicChannelsSelectors } from '../publicChannels.selectors' import { WriteMessagePayload, MessageType, PublicChannel, PublicChannelStorage } from '@quiet/types' @@ -24,6 +24,24 @@ export function* sendIntroductionMessageSaga(): Generator { channelId: generalChannel.id, } + // FIXME: This is a quick fix for an issue that can be fixed by + // unifying CHANNELS_STORED and CHANNELS_SUBSCRIBED events and + // refactoring a bit. The problem is that the frontend sends a + // message upon receiving the CHANNELS_STORED event, but the channel + // hasn't been fully initialized/subscribed yet (it doesn't exist in + // publicChannelsRepos on the backend so the backend fails to send + // it). Ideally, I think we should only tell the frontend about + // channels once they've been fully initialized. Once we fix that, + // we can remove the following code. + while (true) { + const subscribedChannels = yield* select(publicChannelsSelectors.subscribedChannels) + if (subscribedChannels.includes(generalChannel.id)) { + break + } + console.error('Failed to send introduction message, general channel not subscribed. Retrying...') + yield* delay(500) + } + yield* put(messagesActions.sendMessage(payload)) yield* put(identityActions.updateIdentity({ ...identity, introMessageSent: true })) }