Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(2526): Fix images on ios and clean up some logging #2536

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* Use server for downloading initial community metadata if v2 invitation link is detected ([#2295](https://github.com/TryQuiet/quiet/issues/2295))

# Refactorings:

* Consolidate colors and align theme with MUI standards ([#2445](https://github.com/TryQuiet/quiet/issues/2445))

# Fixes:

* Disable spellCheck/autoCorrect on non-spelling sensitive fields like usernames and channels ([#373](https://github.com/TryQuiet/quiet/issues/373))
* Fixes issue with reconnecting to peers on resume on iOS ([#2424](https://github.com/TryQuiet/quiet/issues/2424))

* Fixes references to 'invite code' to be 'invite link' in UI ([#2441](https://github.com/TryQuiet/quiet/issues/2441))
* Fixes issue with image messages not displaying/throwing errors on iOS ([#2526](https://github.com/TryQuiet/quiet/issues/2526))

# Chores

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
if (this.communityId) {
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_LAUNCHED, { id: this.communityId })
this.logger.info('this.libp2pService.connectedPeers', this.libp2pService.connectedPeers)
this.logger.info('this.libp2pservice', this.libp2pService)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was throwing a circular reference error since under the hood the logger is now doing a JSON.stringify on objects.

this.logger.info('this.libp2pService.dialedPeers', this.libp2pService.dialedPeers)
this.serverIoProvider.io.emit(
SocketActionTypes.CONNECTED_PEERS,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/nest/socket/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class SocketService extends EventEmitter implements OnModuleInit {
socket.on(
SocketActionTypes.CREATE_COMMUNITY,
async (payload: InitCommunityPayload, callback: (response: Community | undefined) => void) => {
this.logger.info(`Creating community ${payload.id}`)
this.logger.info(`Creating community`, payload.id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another formatting thing

this.emit(SocketActionTypes.CREATE_COMMUNITY, payload, callback)
}
)
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Fixes issue with reconnecting to peers on resume on iOS ([#2424](https://github.com/TryQuiet/quiet/issues/2424))
* Update github workflows for PR gating ([#2487](https://github.com/TryQuiet/quiet/issues/2487))
* Don't create duplicate CSRs when joining a community under certain circumstances ([#2321](https://github.com/TryQuiet/quiet/issues/2321))
* Fixes issue with image messages not displaying/throwing errors on iOS ([#2526](https://github.com/TryQuiet/quiet/issues/2526))

[2.2.0]

Expand Down
12 changes: 12 additions & 0 deletions packages/mobile/ios/Quiet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<false/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the items added here, even the ones that don't seem relevant (e.g. NSAppleMusicUsageDescription) are required to get access to files we need for uploading files.

<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand All @@ -54,8 +56,16 @@
</dict>
</dict>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>Quiet uses the document directory for storing files and images sent through the app.</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>Quiet uses the document directory for storing files and images sent through the app.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSPhotoLibraryLimitedAccessAPISupport</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>Quiet access photos for sending images through the app.</string>
<key>UIAppFonts</key>
<array>
<string>Rubik-Black.ttf</string>
Expand All @@ -75,6 +85,8 @@
</array>
<key>UIBackgroundModes</key>
<array/>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import FastImage from 'react-native-fast-image'
export const UploadedImage: FC<UploadedImageProps> = ({ media, openImagePreview }) => {
const { path, width, height } = media

const aspectRatio = width && height ? width / height : undefined
const maxWidth = width && width >= 400 ? 400 : width

return (
<View>
<View style={{ padding: 5 }}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just to clean up the appearance of images a little bit.

{!path || !width || !height ? (
<ActivityIndicator size='small' color={defaultTheme.palette.main.brand} />
) : (
<TouchableWithoutFeedback onPress={() => openImagePreview(media)}>
<FastImage source={{ uri: `file://${path}` }} style={{ maxWidth, aspectRatio: width / height }} />
<View>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix for displaying images. Turns out TouchableWithoutFeedback doesn't like when child objects aren't wrapped in a view.

<FastImage source={{ uri: `file://${path}` }} style={{ maxWidth, aspectRatio }} />
</View>
</TouchableWithoutFeedback>
)}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function subscribe(socket: Socket) {
})
// Misc
socket.on(SocketActionTypes.PEER_CONNECTED, (payload: { peers: string[] }) => {
logger.info(`${SocketActionTypes.PEER_CONNECTED}: ${payload}`)
logger.info(`${SocketActionTypes.PEER_CONNECTED}`, payload)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a formatting issue.

emit(networkActions.addConnectedPeers(payload.peers))
})
socket.on(SocketActionTypes.PEER_DISCONNECTED, (payload: NetworkDataPayload) => {
Expand Down
Loading