-
Notifications
You must be signed in to change notification settings - Fork 0
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
Style conflict resolution page #199
Conversation
00f2f7b
to
c596fba
Compare
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.
Looking good.
Cue/app/actions/library.js
Outdated
// check if any other changes need to be synced | ||
for (let key in change) { | ||
if((key === 'cards' && change.cards.length) || (change[key] != serverDeck[key] && !key.match("^(?:cards|uuid|action)$"))) { | ||
if((key === 'cards' && change.cards.length) || (change[key] != updatedDeck[key] && !key.match("^(?:cards|uuid|action)$"))) { | ||
serverDeck = await LibraryApi.editDeck({ |
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.
Should this be updatedDeck =
?
Cue/app/common/SyncConflict.js
Outdated
|
||
//TODO: issue #146: style this page | ||
type Conflict = { |
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.
Import this from actions/library
instead?
<Text style={this.props.disabled ? styles.textDisabled : styles.text}> | ||
{this.props.text} | ||
</Text> | ||
<View> |
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.
This view needs flex: 1
and the icon needs flex: 0
for the text to wrap and not push the icon off the screen.
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.
Also, minor nitpick: I think the Android paddingVertical
in container
can be reduced to 8, the rows are spaced really far apart right now.
<Text style={this.props.disabled ? styles.textDisabled : styles.text}> | ||
{this.props.text} | ||
</Text> | ||
<Text style={styles.textSecondary}> |
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.
You have to only render this conditionally based on whether this.props.subText
is specified, otherwise layouts with just primary text are shifted.
Cue/app/common/SyncConflict.js
Outdated
_internetAlert = () => { | ||
Alert.alert ( | ||
Platform.OS === "android" ? 'Failed to resolve conflicts' : 'Failed to Resolve Conflicts', | ||
'Check your Internet connection and try again.') |
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.
Can just pull the recoveryMessage
based on changes in #207.
Cue/app/common/SyncConflict.js
Outdated
? 'Keep changes from "' + conflict.serverDeck.last_update_device + '"' | ||
: 'Keep server copy' | ||
} else { | ||
serverText = 'Keep deleted server change' |
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.
Maybe "Delete this deck" and make the subtext "Deleted on another device" or something?
Cue/app/common/SyncConflict.js
Outdated
if (interval > 1) { | ||
return interval + " minutes"; | ||
} | ||
return Math.floor(seconds) + " seconds"; |
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'd actually call this "just now" so the time is a little fuzzier.
Cue/app/common/SyncConflict.js
Outdated
<ListView | ||
onLayout={this.on_layout} | ||
key={this.state.conflicts} |
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.
Does this need a key
?
Cue/app/reducers/library.js
Outdated
else | ||
decks[deckIndex] = serverDeck | ||
} else if (updatedDeck.deleted) { | ||
decks.splice(deckIndex,1) |
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.
Isn't this already handled by the inaccessibleDecks
stuff in LOADED_LIBRARY
?
Cue/app/common/SyncConflict.js
Outdated
return Math.floor(seconds) + " seconds"; | ||
} | ||
|
||
_renderRow = (conflict) => { |
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.
Flow type?
c596fba
to
98bc96c
Compare
Cue/app/common/SyncConflict.js
Outdated
icon: CueIcons.cancel, | ||
onPress: () => { this.props.navigator.pop() } | ||
} | ||
} | ||
|
||
_getRightItems = () => { | ||
if (this.state.conflicts && !this.state.conflicts.find(c => c.useServerDeck==undefined)) { | ||
if (this.state.conflicts && !this.state.conflicts.find(c => c.useServerDeck==null)) { |
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.
Are we using null
or undefined
? This check worked anyway since:
null == undefined // true
null != undefined // false
null === undefined // false
null !== undefined // true
I'd use ===
or typeof obj === 'undefined'
for all checks which involve undefined
values.
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.
Also: check if !this.state.loading
here.
Cue/app/common/SyncConflict.js
Outdated
if (interval >= 1) { | ||
return interval + ' minute' + (interval > 1 ? 's' : '') + ' ago' | ||
} | ||
return ' just now' |
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.
There's an extra leading space here?
@@ -127,7 +127,8 @@ class LibraryHome extends React.Component { | |||
[ | |||
{text: 'Remove', style: 'destructive'}, | |||
{text: 'Copy', onPress: () => this.props.onCopyDeck(deck)}, | |||
] | |||
], | |||
{ cancelable: false } |
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.
Nice catch. 👍
Cue/app/common/SyncConflict.js
Outdated
|
||
let content | ||
if (this.state.loading) { | ||
content = <ActivityIndicator/> |
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.
This needs style={{flex: 1}}
to be centred.
Cue/app/common/SyncConflict.js
Outdated
label: 'Use local copy', | ||
value: false | ||
} | ||
{ label: 'Use server copy', value: true }, |
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.
These aren't being used anymore, right?
<View style={{flex: 1}}> | ||
<Text style={styles.headerText}>{headerText}</Text> | ||
<ListView | ||
dataSource={this.state.dataSource} |
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.
Can you add removeClippedSubviews={false}
to the ListView
(and also to the ListView
s in LibraryListView
and CardListView
)? There's a long-standing RN bug where if a ListView
is updated off-screen, when it reappears on the screen, the contents don't appear until the list is scrolled facebook/react-native#8607 In this case, the list can be rendered before the view is animated onto the screen, so the ListView
is empty until it is scrolled.
@mattyu007 Updated. Set |
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.
Looks good. We should try another stress test to make sure scroll performance on iOS doesn't regress tremendously because of removeClippedSubviews
.
Closes #200. |
Closes #148
Styles the conflict resolution page.
Handled sync cases:
inaccessibleDecks