[FIX] Missing current server (#427)

* server.current removed

* Increased area of touch on header

* Hide search when sort dropdown is tapped

* default server icon url

* 1.1.1
This commit is contained in:
Diego Mello 2018-09-05 15:15:03 -03:00 committed by GitHub
parent 101d4c727c
commit 92cedf76c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 10 deletions

View File

@ -102,7 +102,7 @@ android {
minSdkVersion 19
targetSdkVersion 27
versionCode VERSIONCODE as Integer
versionName "1.1"
versionName "1.1.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}

View File

@ -10,8 +10,7 @@ const serversSchema = {
properties: {
id: 'string',
name: { type: 'string', optional: true },
iconURL: { type: 'string', optional: true },
current: 'bool'
iconURL: { type: 'string', optional: true }
}
};

View File

@ -46,7 +46,7 @@ const handleServerRequest = function* handleServerRequest({ server }) {
yield call(validate, server);
yield call(NavigationActions.push, { screen: 'LoginSignupView', title: server, backButtonTitle: '' });
database.databases.serversDB.write(() => {
database.databases.serversDB.create('servers', { id: server, current: false }, true);
database.databases.serversDB.create('servers', { id: server }, true);
});
yield put(selectServerRequest(server));
} catch (e) {

View File

@ -33,8 +33,12 @@ const styles = StyleSheet.create({
const Header = ({ onPress, serverName, showServerDropdown }) => (
<View style={styles.container}>
<Text style={styles.title}>{I18n.t('Messages')}</Text>
<TouchableOpacity onPress={onPress} testID='rooms-list-header-server-dropdown-button'>
<TouchableOpacity
onPress={onPress}
testID='rooms-list-header-server-dropdown-button'
style={styles.container}
>
<Text style={styles.title}>{I18n.t('Messages')}</Text>
<View style={styles.button}>
<Text style={styles.server}>{serverName}</Text>
<Image style={[styles.disclosure, showServerDropdown && styles.upsideDown]} source={{ uri: 'disclosure_indicator_server' }} />

View File

@ -126,7 +126,17 @@ export default class ServerDropdown extends Component {
renderServer = ({ item }) => (
<Touch onPress={() => this.select(item.id)} style={styles.serverItem} testID={`rooms-list-header-server-${ item.id }`}>
<View style={styles.serverItemContainer}>
<Image source={{ uri: item.iconURL }} defaultSource={{ uri: 'logo' }} style={styles.serverIcon} />
{item.iconURL ?
<Image
source={{ uri: item.iconURL }}
defaultSource={{ uri: 'logo' }}
style={styles.serverIcon}
/> :
<Image
source={{ uri: 'logo' }}
style={styles.serverIcon}
/>
}
<View style={styles.serverTextContainer}>
<Text style={styles.serverName}>{item.name || item.id}</Text>
<Text style={styles.serverUrl}>{item.id}</Text>

View File

@ -18,6 +18,7 @@ import Touch from '../../utils/touch';
import { toggleSortDropdown } from '../../actions/rooms';
const ROW_HEIGHT = 70;
const SCROLL_OFFSET = 56;
const isAndroid = () => Platform.OS === 'android';
const getItemLayout = (data, index) => ({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index });
@ -62,6 +63,7 @@ export default class RoomsListView extends LoggedView {
static navigatorStyle = {
navBarCustomView: 'RoomsListHeaderView',
navBarComponentAlignment: 'fill',
navBarBackgroundColor: isAndroid() ? '#2F343D' : undefined,
navBarTextColor: isAndroid() ? '#FFF' : undefined,
navBarButtonColor: isAndroid() ? '#FFF' : undefined
@ -272,6 +274,7 @@ export default class RoomsListView extends LoggedView {
navigator.setButtons({ leftButtons, rightButtons });
navigator.setStyle({
navBarCustomView: 'RoomsListHeaderView',
navBarComponentAlignment: 'fill',
navBarBackgroundColor: isAndroid() ? '#2F343D' : undefined,
navBarTextColor: isAndroid() ? '#FFF' : undefined,
navBarButtonColor: isAndroid() ? '#FFF' : undefined
@ -355,7 +358,16 @@ export default class RoomsListView extends LoggedView {
}
}
toggleSort = () => this.props.toggleSortDropdown();
toggleSort = () => {
if (Platform.OS === 'ios') {
this.scroll.scrollTo({ x: 0, y: SCROLL_OFFSET, animated: true });
} else {
this.scroll.scrollTo({ x: 0, y: 0, animated: true });
}
setTimeout(() => {
this.props.toggleSortDropdown();
}, 100);
}
renderHeader = () => {
if (this.state.search.length > 0) {
@ -471,7 +483,8 @@ export default class RoomsListView extends LoggedView {
return (
<ScrollView
contentOffset={Platform.OS === 'ios' ? { x: 0, y: 56 } : {}}
ref={ref => this.scroll = ref}
contentOffset={Platform.OS === 'ios' ? { x: 0, y: SCROLL_OFFSET } : {}}
keyboardShouldPersistTaps='always'
testID='rooms-list-view-list'
>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>