-
Notifications
You must be signed in to change notification settings - Fork 88
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
Feature/notify users about incoming backwards incompatibility #1980 #2042
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a4fcef7
feat: notifier component #1980
siepra aeda65f
feat: notifier screen
siepra 54e2d9b
feat: navigation pop
siepra 3ac25cc
feat: bind pop to the notifier button #1980
siepra 6fd9e52
feat: attach notifier screen #1980
siepra 3f5a26c
fix: current screen selector
siepra 18f9ac1
fix: remove emojis from notifier message
siepra 2ce2c00
feat: use mailto for support address #1980
siepra 2b58f60
chore: cleanup
siepra 11fc395
fix: building mobile package #1980
siepra 04b4d54
fix: lint
siepra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { storiesOf } from '@storybook/react-native' | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react-native' | ||
import { storybookLog } from '../../utils/functions/storybookLog/storybookLog.function' | ||
|
||
import { Button } from './Button.component' | ||
|
||
storiesOf('Button', module) | ||
.add('Default', () => <Button title={'button'} onPress={storybookLog('Button clicked')} />) | ||
.add('New', () => <Button title={'button'} onPress={storybookLog('Button clicked')} newDesign />) | ||
.add('Negative', () => <Button title={"Never mind, I'll stay"} onPress={storybookLog('Button clicked')} negative />) | ||
.add('Disabled', () => <Button title={"Never mind, I'll stay"} onPress={storybookLog('Button clicked')} disabled />) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ export interface ButtonProps { | |
loading?: boolean | ||
negative?: boolean | ||
disabled?: boolean | ||
newDesign?: boolean | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/mobile/src/components/Notifier/Notifier.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { FC } from 'react' | ||
import { View, Text, Image } from 'react-native' | ||
|
||
import { Typography } from '../Typography/Typography.component' | ||
import { Button } from '../Button/Button.component' | ||
|
||
import { NotifierProps } from './Notifier.types' | ||
|
||
import { defaultTheme } from '../../styles/themes/default.theme' | ||
|
||
export const Notifier: FC<NotifierProps> = ({ onButtonPress, onEmailPress, icon, title, message, style }) => { | ||
return ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
backgroundColor: defaultTheme.palette.background.white, | ||
}} | ||
> | ||
<Image | ||
source={icon} | ||
style={{ | ||
margin: 20, | ||
resizeMode: 'cover', | ||
width: 375, | ||
height: 135, | ||
}} | ||
/> | ||
<View style={{ flexDirection: 'column', alignItems: 'center', gap: 20, maxWidth: 330 }}> | ||
<Typography fontSize={28} fontWeight={'medium'} horizontalTextAlign={'center'}> | ||
{title} | ||
</Typography> | ||
<Typography fontSize={14} fontWeight={'normal'} horizontalTextAlign={'center'}> | ||
{message} | ||
</Typography> | ||
<Button onPress={onButtonPress} title={'I understand'} width={135} newDesign /> | ||
<Typography onPress={onEmailPress} fontSize={16} color={'gray50'}> | ||
Need help? <Text style={{ textDecorationLine: 'underline' }}>[email protected]</Text> | ||
</Typography> | ||
</View> | ||
</View> | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/mobile/src/components/Notifier/Notifier.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react-native' | ||
|
||
import { appImages } from '../../assets' | ||
import { storybookLog } from '../../utils/functions/storybookLog/storybookLog.function' | ||
|
||
import { Notifier } from './Notifier.component' | ||
|
||
storiesOf('Notifier', module).add('Default', () => ( | ||
<Notifier | ||
onButtonPress={storybookLog('button pressed')} | ||
onEmailPress={storybookLog('email pressed')} | ||
icon={appImages.update_graphics} | ||
title={'Coming update will remove communities & messages'} | ||
message={ | ||
'Quiet’s next release makes joining communities faster and more reliable by letting people join when the owner is offline! However, these changes required us to reset all communities, and both communities and messages will be lost on mobile. We apologize for the inconvenience, and please reach out immediately if you need help backing up messages.' | ||
} | ||
/> | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
import '@testing-library/jest-native/extend-expect' | ||
import { fireEvent, screen } from '@testing-library/react-native' | ||
|
||
import { renderComponent } from '../../utils/functions/renderComponent/renderComponent' | ||
|
||
import { appImages } from '../../assets' | ||
|
||
import { Notifier } from './Notifier.component' | ||
|
||
describe('Notifier component', () => { | ||
it('should match inline snapshot', () => { | ||
const { toJSON } = renderComponent( | ||
<Notifier | ||
onButtonPress={jest.fn()} | ||
onEmailPress={jest.fn()} | ||
icon={appImages.update_graphics} | ||
title={'Coming update will remove communities & messages'} | ||
message={ | ||
'Quiet’s next release makes joining communities faster and more reliable by letting people join when the owner is offline! However, these changes required us to reset all communities, and both communities and messages will be lost on mobile. We apologize for the inconvenience, and please reach out immediately if you need help backing up messages.' | ||
} | ||
/> | ||
) | ||
|
||
expect(toJSON()).toMatchSnapshot() | ||
}) | ||
|
||
it('should respond on button tap', () => { | ||
const buttonCallback = jest.fn() | ||
|
||
renderComponent( | ||
<Notifier | ||
onButtonPress={buttonCallback} | ||
onEmailPress={jest.fn()} | ||
icon={appImages.update_graphics} | ||
title={'Coming update will remove communities & messages'} | ||
message={ | ||
'Quiet’s next release makes joining communities faster and more reliable by letting people join when the owner is offline! 🎉 However, these changes required us to reset all communities, and both communities and messages will be lost on mobile. 😥 We apologize for the inconvenience, and please reach out immediately if you need help backing up messages.' | ||
} | ||
/> | ||
) | ||
|
||
fireEvent.press(screen.getByText('I understand')) | ||
|
||
expect(buttonCallback).toBeCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { TextStyle } from 'react-native' | ||
|
||
export interface NotifierProps { | ||
onButtonPress: () => void | ||
onEmailPress: () => void | ||
icon: any | ||
title: string | ||
message: string | ||
style?: TextStyle | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be animated, right? We should add some simple css effects to this like those arrows should spin around logo and those little stars should randomly disappear and appear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think let's focus that level of attention on the things people are likely to see a lot.
this particular message will only be seen: