mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
26fe05153c
Summary: The TaskQueue does it's own throttling and has it's own processQueue retry timeout, no need for longPollConnected Remove dead code (OfflineError) Rename long connection state to status so we don't ask for `state.state` Remove long poll actions related to online/offline in favor of exposing connection state through NylasSyncStatusStore Consoliate notifications and account-error-heaer into a single package and organize files into sidebar vs. header. Update the DeveloperBarStore to query the sync status store for long poll statuses Test Plan: All existing tests pass Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2835
44 lines
1.2 KiB
CoffeeScript
44 lines
1.2 KiB
CoffeeScript
{Actions, React} = require 'nylas-exports'
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
class StreamingSyncActivity extends React.Component
|
|
|
|
constructor: (@props) ->
|
|
@_timeoutId = null
|
|
@state =
|
|
receivingDelta: false
|
|
|
|
componentDidMount: =>
|
|
@_unlistener = Actions.longPollReceivedRawDeltasPing.listen(@_onDeltaReceived)
|
|
|
|
componentWillUnmount: =>
|
|
@_unlistener() if @_unlistener
|
|
clearTimeout(@_timeoutId) if @_timeoutId
|
|
|
|
render: =>
|
|
return false unless @state.receivingDelta
|
|
<div className="item" key="delta-sync-item">
|
|
<div style={padding: "9px 9px 0 12px", float: "left"}>
|
|
<RetinaImg name="sending-spinner.gif" width={18} mode={RetinaImg.Mode.ContentPreserve} />
|
|
</div>
|
|
<div className="inner">
|
|
Syncing your mailbox…
|
|
</div>
|
|
</div>
|
|
|
|
_onDeltaReceived: (countDeltas) =>
|
|
tooSmallForNotification = countDeltas <= 10
|
|
return if tooSmallForNotification
|
|
|
|
if @_timeoutId
|
|
clearTimeout(@_timeoutId)
|
|
|
|
@_timeoutId = setTimeout(( =>
|
|
delete(@_timeoutId)
|
|
@setState(receivingDelta: false)
|
|
), 20000)
|
|
|
|
@setState(receivingDelta: true)
|
|
|
|
|
|
module.exports = StreamingSyncActivity
|