Skip to content

Commit

Permalink
Merge branch 'develop' into feature/2295
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Apr 16, 2024
2 parents eb735f5 + c422cee commit f39f6b2
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 31 deletions.
4 changes: 2 additions & 2 deletions packages/desktop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0-alpha.1",
"version": "2.2.0-alpha.2",
"description": "Decentralized team chat",
"main": "dist/main/main.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ android {
applicationId "com.quietmobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 413
versionName "2.2.0-alpha.1"
versionCode 414
versionName "2.2.0-alpha.2"
resValue "string", "build_config_package", "com.quietmobile"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/ios/Quiet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>370</string>
<string>371</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false />
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/ios/QuietTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>370</string>
<string>371</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions packages/mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quiet/mobile",
"version": "2.2.0-alpha.1",
"version": "2.2.0-alpha.2",
"scripts": {
"build": "tsc -p tsconfig.build.json --noEmit",
"storybook-android": "ENVFILE=.env.storybook react-native run-android --mode=storybookDebug --appIdSuffix=storybook.debug",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { identitySelectors } from '../identity.selectors'
import { identityActions } from '../identity.slice'
import { config } from '../../users/const/certFieldTypes'
import { Socket } from '../../../types'
import { communitiesActions } from '../../communities/communities.slice'
import { communitiesSelectors } from '../../communities/communities.selectors'
import { CreateUserCsrPayload, RegisterCertificatePayload, Community } from '@quiet/types'

Expand All @@ -16,7 +17,13 @@ export function* registerUsernameSaga(

const { nickname, isUsernameTaken = false } = action.payload

const community = yield* select(communitiesSelectors.currentCommunity)
let community = yield* select(communitiesSelectors.currentCommunity)

if (!community) {
yield* take(communitiesActions.addNewCommunity)
}

community = yield* select(communitiesSelectors.currentCommunity)

if (!community) {
console.error('Could not register username, no community data')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Socket, applyEmitParams } from '../../../types'
import { type PayloadAction } from '@reduxjs/toolkit'
import { sign, loadPrivateKey, pubKeyFromCsr } from '@quiet/identity'
import { call, select, apply, put } from 'typed-redux-saga'
import { call, select, apply, put, delay } from 'typed-redux-saga'
import { arrayBufferToString } from 'pvutils'
import { config } from '../../users/const/certFieldTypes'
import { identitySelectors } from '../../identity/identity.selectors'
Expand Down Expand Up @@ -75,6 +75,20 @@ export function* sendMessageSaga(
const isUploadingFileMessage = action.payload.media?.cid?.includes('uploading')
if (isUploadingFileMessage) return // Do not broadcast message until file is uploaded

// Wait until we have subscribed to the channel
//
// TODO: I think we probably want to revise how we are sending
// messages by having the backend handling queueing and retrying
// (in a durable way).
while (true) {
const subscribedChannels = yield* select(publicChannelsSelectors.subscribedChannels)
if (subscribedChannels.includes(channelId)) {
break
}
console.error('Failed to send message, channel not subscribed. Retrying...')
yield* delay(500)
}

yield* apply(
socket,
socket.emit,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { put, select, call, delay } from 'typed-redux-saga'
import { put, select, call } from 'typed-redux-saga'
import { messagesActions } from '../../messages/messages.slice'
import { publicChannelsSelectors } from '../publicChannels.selectors'
import { WriteMessagePayload, MessageType, PublicChannel, PublicChannelStorage } from '@quiet/types'
Expand All @@ -24,24 +24,6 @@ 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 }))
}

0 comments on commit f39f6b2

Please sign in to comment.