vn-verdnaturachat/app/containers/RoomTypeIcon.js

57 lines
1.6 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { Image, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
2019-04-08 12:35:28 +00:00
import { CustomIcon } from '../lib/Icons';
2019-12-04 16:39:53 +00:00
import { themes } from '../constants/colors';
const styles = StyleSheet.create({
style: {
marginRight: 7,
2019-07-18 17:44:02 +00:00
marginTop: 3
},
2019-04-08 12:35:28 +00:00
discussion: {
marginRight: 6
}
});
2019-12-04 16:39:53 +00:00
const RoomTypeIcon = React.memo(({
type, size, isGroupChat, style, theme
2019-12-04 16:39:53 +00:00
}) => {
if (!type) {
return null;
}
2019-12-04 16:39:53 +00:00
const color = themes[theme].auxiliaryText;
2019-04-08 12:35:28 +00:00
if (type === 'discussion') {
// FIXME: These are temporary only. We should have all room icons on <Customicon />, but our design team is still working on this.
2019-12-04 16:39:53 +00:00
return <CustomIcon name='chat' size={13} style={[styles.style, styles.iconColor, styles.discussion, { color }]} />;
2019-04-08 12:35:28 +00:00
}
if (type === 'c') {
2019-12-04 16:39:53 +00:00
return <Image source={{ uri: 'hashtag' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
2019-07-18 17:44:02 +00:00
} if (type === 'd') {
if (isGroupChat) {
return <CustomIcon name='team' size={13} style={[styles.style, styles.discussion, { color }]} />;
}
2019-12-04 16:39:53 +00:00
return <CustomIcon name='at' size={13} style={[styles.style, styles.discussion, { color }]} />;
2020-02-07 13:24:16 +00:00
} if (type === 'l') {
[NEW] Passcode and biometric unlock (#2059) * Update expo libs * Configure expo-local-authentication * ScreenLockedView * Authenticate server change * Auth on app resume * localAuthentication util * Add servers.lastLocalAuthenticatedSession column * Save last session date on background * Use our own version of app state redux * Fix libs * Remove inactive * ScreenLockConfigView * Apply on saved data * Auto lock option label * Starting passcode * Basic passcode flow working * Change passcode * Check if biometry is enrolled * Use fork * Migration * Patch expo-local-authentication * Use async storage * Styling * Timer * Refactor * Lock orientation portrait when not on tablet * share extension * Deep linking * Share extension * Refactoring passcode * use state * Stash * Refactor * Change passcode * Animate dots on error * Matching passcodes * Shake * Remove lib * Delete button * Fade animation on modal * Refactoring * ItemInfo * I18n * I18n * Remove unnecessary prop * Save biometry column * Raise time to lock to 30 seconds * Vibrate on wrong confirmation passcode * Reset attempts and save last authentication on local passcode confirmation * Remove inline style * Save last auth * Fix header blink * Change function name * Fix android modal * Fix vibration permission * PasscodeEnter calls biometry * Passcode on the state * Biometry button on PasscodeEnter * Show whole passcode * Secure passcode * Save passcode with promise to prevent empty passcodes and immediately lock * Patch expo-local-authentication * I18n * Fix biometry being called every time * Blur screen on app inactive * Revert "Blur screen on app inactive" This reverts commit a4ce812934adcf6cf87eb1a92aec9283e2f26753. * Remove immediately because of how Activities work on Android * Pods * New layout * stash * Layout refactored * Fix icons * Force set passcode from server * Lint * Improve permission message * Forced passcode subtitle * Disable based on admin's choice * Require local authentication on login success * Refactor * Update tests * Update react-native-device-info to fix notch * Lint * Fix modal * Fix icons * Fix min auto lock time * Review * keep enabled on mobile * fix forced by admin when enable unlock with passcode * use DEFAULT_AUTO_LOCK when manual enable screenLock * fix check has passcode * request biometry on first password * reset auto time lock when disabled on server Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com>
2020-05-08 17:04:37 +00:00
return <CustomIcon name='omnichannel' size={13} style={[styles.style, styles.discussion, { color }]} />;
}
2019-12-04 16:39:53 +00:00
return <Image source={{ uri: 'lock' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
});
RoomTypeIcon.propTypes = {
2019-12-04 16:39:53 +00:00
theme: PropTypes.string,
type: PropTypes.string,
isGroupChat: PropTypes.bool,
size: PropTypes.number,
style: PropTypes.object
};
RoomTypeIcon.defaultProps = {
size: 10
};
export default RoomTypeIcon;