Skip to content

Commit

Permalink
Merge branch 'develop' into fix/1966
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Dec 4, 2023
2 parents 6df0c5a + 7e6a034 commit 2d293da
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 50 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[unreleased]
[2.0.3-alpha.12]

* Better descriptions of the joining process

Expand Down
23 changes: 22 additions & 1 deletion packages/desktop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
[unreleased]
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3-alpha.12](https://github.com/TryQuiet/quiet/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-12-04)

**Note:** Version bump only for package @quiet/desktop





[2.0.3-alpha.12]

* Better descriptions of the joining process

* Update custom deps repositiries (upload-s3-action, ipfs-pubsub-peer-monitor)

* Add certificates validation.

* Move certificates to separate store.

* Move csrs to separate store.

Expand Down
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.0.3-alpha.10",
"version": "2.0.3-alpha.12",
"description": "Decentralized team chat",
"main": "dist/main/main.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,14 @@ export const BasicMessageComponent: React.FC<BasicMessageProps & FileActionsProp
const userLabel = messageDisplayData?.isDuplicated
? UserLabelType.DUPLICATE
: !messageDisplayData?.isRegistered
? UserLabelType.UNREGISTERED
: null

console.log('Unregistered Debug - Basic Message', { userLabel })
? UserLabelType.UNREGISTERED
: null

const infoMessage = messageDisplayData.type === 3 // 3 stands for MessageType.Info

console.log('Unregistered Debug - Basic Message', { infoMessage })

// Grey out sender name if the first message hasn't been sent yet
const pending: boolean = pendingMessages[messageDisplayData.id] !== undefined

console.log('Unregistered Debug - Basic Message - condition to display label', userLabel && !infoMessage)

return (
<StyledListItem
className={classNames({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ const UserLabel: React.FC<UserLabelProps> = ({
const isUnregistered = type === UserLabelType.UNREGISTERED
const handleOpen = isUnregistered ? unregisteredUsernameModalHandleOpen : duplicatedUsernameModalHandleOpen

console.log('Unregistered Debug - UserLabel Component', { isUnregistered })

return (
<StyledGrid>
<Grid
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/src/renderer/sagas/store.utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createSelector } from '@reduxjs/toolkit'
import { StoreKeys } from '../store/store.keys'
import { AnyObject } from '../../utils/types/AnyObject.interface'

import { CreatedSelectors, StoreModuleStateClass, StoreState } from './store.types'

export const selectorsFactory = <StoreKey extends StoreKeys>(
Expand Down
27 changes: 26 additions & 1 deletion packages/mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
[unreleased]
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3-alpha.13](https://github.com/TryQuiet/quiet/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-12-04)


### Bug Fixes

* correct getting ndk path ([#2130](https://github.com/TryQuiet/quiet/issues/2130)) ([f0a6336](https://github.com/TryQuiet/quiet/commit/f0a6336434d4f8ba829123ca6f24d3df3df557a8))
* poin to a different directory after breaking changes ([#2132](https://github.com/TryQuiet/quiet/issues/2132)) ([07ef5bb](https://github.com/TryQuiet/quiet/commit/07ef5bb5a403ee52cf69982d19a9d0b14f11c969))





[2.0.3-alpha.12]

* Better descriptions of the joining process

* Update custom deps repositiries (upload-s3-action, ipfs-pubsub-peer-monitor)

* Add certificates validation.

* Move certificates to separate store.

* Move csrs to separate store.

Expand Down
28 changes: 21 additions & 7 deletions packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,28 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["arm64-v8a"]
}

Properties properties = new Properties()
def localPropertiesFile = project.rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.newDataInputStream())
def getNDK() {
// Load local.properties
Properties properties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.newDataInputStream())
}

// Return ndk.dir if it exists
def localNDK = properties['ndk.path']
if (localNDK) {
return localNDK
}

// If ndk.dir doesn't exist, check for NDK_PATH in gradle.properties
return rootProject.ext.has('NDK_PATH') ? rootProject.ext.get('NDK_PATH') : null
}

def ndkDirectory = getNDK()

android {
ndkPath properties.getProperty('ndk.dir', project.property('NDK_PATH'))
ndkPath ndkDirectory

ndkVersion rootProject.ext.ndkVersion

Expand All @@ -172,8 +186,8 @@ android {
applicationId "com.quietmobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 381
versionName "2.0.3-alpha.11"
versionCode 383
versionName "2.0.3-alpha.13"
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>338</string>
<string>340</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>338</string>
<string>340</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.0.3-alpha.11",
"version": "2.0.3-alpha.13",
"scripts": {
"build": "tsc -p tsconfig.build.json --noEmit",
"storybook-android": "ENVFILE=.env.storybook react-native run-android --variant=storybookDebug --appIdSuffix=storybook.debug",
Expand Down
12 changes: 12 additions & 0 deletions packages/mobile/src/setupTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ jest.mock('redux-persist', () => {

jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')

jest.mock('redux-persist-filesystem-storage', () => ({
config: jest.fn()
}))

jest.mock('react-native-blob-util', () => ({
fs: {
dirs: {
DocumentDir: 'dir'
}
}
}))

jest.mock('react-native-mathjax-html-to-svg', () => { })

jest.mock('react-native-qrcode-svg', () => jest.fn())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { expectSaga } from 'redux-saga-test-plan'
import { FactoryGirl } from 'factory-girl'
import { generateMessageFactoryContentWithId, getFactory, identity, publicChannels } from '@quiet/state-manager'
import { setupCrypto } from '@quiet/identity'

import { navigationActions } from '../navigation.slice'
import { ScreenNames } from '../../../const/ScreenNames.enum'

Expand Down
9 changes: 9 additions & 0 deletions packages/mobile/src/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import FilesystemStorage from 'redux-persist-filesystem-storage'
import RNFetchBlob from 'react-native-blob-util'
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'
import { persistReducer, persistStore } from 'redux-persist'
import createSagaMiddleware from 'redux-saga'
Expand All @@ -16,9 +17,17 @@ import {
ConnectionTransform,
UsersTransform,
} from '@quiet/state-manager'

import { StoreKeys } from './store.keys'
import { InitTransform } from './init/init.transform'

FilesystemStorage.config({
storagePath: `${RNFetchBlob.fs.dirs.DocumentDir}/persistStore2`,
encoding: "utf8",
toFileName: (name: string) => name.split(":").join("-"),
fromFileName: (name: string) => name.split("-").join(":"),
});

const persistedReducer = persistReducer(
{
key: 'persistedReducer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const ownerNickname = createSelector(
const parsedCert = parseCertificate(certificate)
nickname = getCertFieldValue(parsedCert, CertFieldsTypes.nickName)
} else {
nickname = getCertFieldValue(oldestParsedCerificate, CertFieldsTypes.nickName)
nickname = getCertFieldValue(oldestParsedCerificate.certificate, CertFieldsTypes.nickName)
}

if (!nickname) {
Expand Down
38 changes: 19 additions & 19 deletions packages/state-manager/src/sagas/users/users.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const allUsers = createSelector(csrsMapping, certificatesMapping, (csrs,
isDuplicated: false,
pubKey,
}
console.log('Unregistered Debug - allUsers selector - certs - user', users[pubKey])
})

Object.keys(csrs).map(pubKey => {
Expand All @@ -105,16 +104,12 @@ export const allUsers = createSelector(csrsMapping, certificatesMapping, (csrs,

const isRegistered = Boolean(certs[pubKey])

console.log('Unregistered Debug - allUsers selector - csrs - certs[pubKey]', certs[pubKey])

users[pubKey] = {
...csrs[pubKey],
isRegistered,
isDuplicated,
pubKey,
}

console.log('Unregistered Debug - allUsers selector - csrs - user', users[pubKey])
})

return users
Expand All @@ -124,26 +119,31 @@ export const getUserByPubKey = (pubKey: string) => createSelector(allUsers, user

export const getOldestParsedCerificate = createSelector(certificates, certs => {
const getTimestamp = (cert: Certificate) => new Date(cert.notBefore.value).getTime()
let certificates: Certificate[] = []
Object.keys(certs).map(pubKey => {
certificates = [...certificates, certs[pubKey]]
})
certificates.sort((a, b) => {
const aTimestamp = getTimestamp(a)
const bTimestamp = getTimestamp(b)
return aTimestamp - bTimestamp
})

let certificates: { pubkey: string; certificate: Certificate }[] = []

certificates = Array.from(Object.entries(certs))
.sort((a, b) => {
const aTimestamp = getTimestamp(a[1])
const bTimestamp = getTimestamp(b[1])
return aTimestamp - bTimestamp
})
.map(cert => {
return {
pubkey: cert[0],
certificate: cert[1],
}
})
return certificates[0]
})

export const ownerData = createSelector(getOldestParsedCerificate, ownerCert => {
if (!ownerCert) return null
const username = getCertFieldValue(ownerCert, CertFieldsTypes.nickName)
const onionAddress = getCertFieldValue(ownerCert, CertFieldsTypes.commonName)
const peerId = getCertFieldValue(ownerCert, CertFieldsTypes.peerId)
const dmPublicKey = getCertFieldValue(ownerCert, CertFieldsTypes.dmPublicKey)
const pubKey = keyFromCertificate(ownerCert)
const username = getCertFieldValue(ownerCert.certificate, CertFieldsTypes.nickName)
const onionAddress = getCertFieldValue(ownerCert.certificate, CertFieldsTypes.commonName)
const peerId = getCertFieldValue(ownerCert.certificate, CertFieldsTypes.peerId)
const dmPublicKey = getCertFieldValue(ownerCert.certificate, CertFieldsTypes.dmPublicKey)
const pubKey = ownerCert.pubkey

return {
username,
Expand Down

0 comments on commit 2d293da

Please sign in to comment.