[Gekidou] fixes (#5590)

* fix android authorized network requests

* Use default theme if no specific theme for team

* Avoid app from crashing if no team or channel is selected

* Apply suggestions from code review

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
This commit is contained in:
Elias Nahum 2021-08-03 20:01:45 -04:00 committed by GitHub
parent 85bef9eefc
commit 733b10377b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4492 additions and 5343 deletions

View file

@ -40,7 +40,7 @@ const ThemeProvider = ({currentTeamId, children, themes}: Props) => {
const getTheme = (): Theme => {
if (currentTeamId.length) {
const teamId = currentTeamId[0]?.value;
const teamTheme = themes.find((t) => t.name === teamId);
const teamTheme = themes.find((t) => t.name === teamId) || themes[0];
if (teamTheme?.value) {
try {
const theme = JSON.parse(teamTheme.value) as Theme;

View file

@ -86,16 +86,65 @@ const Channel = ({currentChannelId, currentTeamId, time}: ChannelProps) => {
return <FailedChannels teamId={currentTeamId.value}/>;
}
return (
<ChannelNavBar
channelId={currentChannelId.value}
onPress={() => null}
/>
);
}, [currentTeamId.value, currentChannelId.value]);
const textStyle = getMarkdownTextStyles(theme);
const blockStyle = getMarkdownBlockStyles(theme);
return (
<>
<ChannelNavBar
channelId={currentChannelId?.value}
onPress={() => null}
/>
<ScrollView style={{paddingHorizontal: 10, width: '100%'}}>
<ProgressiveImage
id='file-123'
thumbnailUri='data:image/png;base64,/9j/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIABAAEAMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APcrv4uftAfbNW1XT57Gz0C+1DUEgTVbWMS2EaFY4mO5lEajggNnJJZuDivYPh38Ytd/4Te8tteS4uvDs32aystTSS2lSa4bP7wLE25EYf3hzkEACuX+Ln7M3jjXvGmoax4f8X3EenapcK0ulmGF4owTM8rESq3BUQx4HUuSeBUfwI+BvxC0b4gWmp+Kp4ptJswZLv7dMJZ726MWFkUKm3EZJG7IJz/EAKebYepiqdLFUJqM4JpRi7J3a1mtOa1u+iv1aPppYjCqVWChBxkm9ndbe6m9mraadX0vb//Z'
imageUri='http://192.168.1.6:8065/api/v4/files/9rcknudg9ig9xkz515faj374pw/preview'
resizeMode='contain'
onError={() => true}
style={{width: 322.72727272727275, height: 132.96363636363637}}
inViewPort={inViewport}
/>
<JumboEmoji
isEdited={true}
baseTextStyle={{
color: theme.centerChannelColor,
fontSize: 15,
lineHeight: 20,
}}
value={md.jumbo}
/>
<Markdown
value={md.value}
theme={theme}
textStyles={textStyle}
blockStyles={blockStyle}
isEdited={true}
baseTextStyle={{
color: theme.centerChannelColor,
fontSize: 15,
lineHeight: 20,
}}
mentionKeys={[{
key: 'Elias',
caseSensitive: false,
}]}
imagesMetadata={md.imagesMetadata}
channelMentions={md.channelMentions}
/>
<View style={styles.sectionContainer}>
<Text
onPress={doLogout}
style={styles.sectionTitle}
>
{`Loaded in: ${time || 0}ms. Logout from ${serverUrl}`}
</Text>
</View>
</ScrollView>
</>
);
}, [currentTeamId.value, currentChannelId.value, theme]);
const textStyle = getMarkdownTextStyles(theme);
const blockStyle = getMarkdownBlockStyles(theme);
const [inViewport, setInViewport] = useState(false);
setTimeout(async () => {
@ -111,53 +160,6 @@ const Channel = ({currentChannelId, currentTeamId, time}: ChannelProps) => {
<ServerVersion/>
<StatusBar theme={theme}/>
{renderComponent}
<ScrollView style={{paddingHorizontal: 10, width: '100%'}}>
<ProgressiveImage
id='file-123'
thumbnailUri='data:image/png;base64,/9j/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIABAAEAMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APcrv4uftAfbNW1XT57Gz0C+1DUEgTVbWMS2EaFY4mO5lEajggNnJJZuDivYPh38Ytd/4Te8tteS4uvDs32aystTSS2lSa4bP7wLE25EYf3hzkEACuX+Ln7M3jjXvGmoax4f8X3EenapcK0ulmGF4owTM8rESq3BUQx4HUuSeBUfwI+BvxC0b4gWmp+Kp4ptJswZLv7dMJZ726MWFkUKm3EZJG7IJz/EAKebYepiqdLFUJqM4JpRi7J3a1mtOa1u+iv1aPppYjCqVWChBxkm9ndbe6m9mraadX0vb//Z'
imageUri='http://192.168.1.6:8065/api/v4/files/9rcknudg9ig9xkz515faj374pw/preview'
resizeMode='contain'
onError={() => true}
style={{width: 322.72727272727275, height: 132.96363636363637}}
inViewPort={inViewport}
/>
<JumboEmoji
isEdited={true}
baseTextStyle={{
color: theme.centerChannelColor,
fontSize: 15,
lineHeight: 20,
}}
value={md.jumbo}
/>
<Markdown
value={md.value}
theme={theme}
textStyles={textStyle}
blockStyles={blockStyle}
isEdited={true}
baseTextStyle={{
color: theme.centerChannelColor,
fontSize: 15,
lineHeight: 20,
}}
mentionKeys={[{
key: 'Elias',
caseSensitive: false,
}]}
imagesMetadata={md.imagesMetadata}
channelMentions={md.channelMentions}
/>
<View style={styles.sectionContainer}>
<Text
onPress={doLogout}
style={styles.sectionTitle}
>
{`Loaded in: ${time || 0}ms. Logout from ${serverUrl}`}
</Text>
</View>
</ScrollView>
</SafeAreaView>
);
};

View file

@ -432,7 +432,7 @@ PODS:
- Swime (3.0.6)
- UMAppLoader (2.2.0)
- UMCore (7.1.1)
- UMReactNativeAdapter (6.3.4):
- UMReactNativeAdapter (6.3.5):
- ExpoModulesCore
- React-Core
- UMCore
@ -783,7 +783,7 @@ SPEC CHECKSUMS:
Swime: d7b2c277503b6cea317774aedc2dce05613f8b0b
UMAppLoader: 21af63390e55c82e037fb9752d93114a80ecf16e
UMCore: 2f671796d7439604a1cf8ac7bbe5809cd5c50437
UMReactNativeAdapter: 684b07b79d5fe52b496d2b50bfe31f68d7daf71a
UMReactNativeAdapter: f808906d586a16cebdc3844d86e1bdb8f114a873
UMTaskManagerInterface: 2be431101b73604e64fbfffcf759336f9d8fccbb
WatermelonDB: 577c61fceff16e9f9103b59d14aee4850c0307b6
XCDYouTubeKit: 79baadb0560673a67c771eba45f83e353fd12c1f

9715
package-lock.json generated

File diff suppressed because it is too large Load diff