Skip to content

Commit

Permalink
remove bulk notify
Browse files Browse the repository at this point in the history
  • Loading branch information
genywind committed Aug 16, 2010
1 parent bfa692a commit 666095a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
43 changes: 32 additions & 11 deletions app/Settings/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,39 @@ def do_sync
redirect :action => :index, :query => {:msg => @msg}
end

def bulk_callback
puts "bulk_callback: #{@params}"
def sync_notify

if status == "error"

err_code = @params['error_code'].to_i
rho_error = Rho::RhoError.new(err_code)

if @params['bulk_status'] == 'start' && @params['partition'].length == 0
AppApplication.start_bulk_sync = Time.now
puts "Start time = " + AppApplication.start_bulk_sync.to_i.inspect
WebView.navigate (url_for :action => :wait)
end
@msg = @params['error_message'] if err_code == Rho::RhoError::ERR_CUSTOMSYNCSERVER
@msg = rho_error.message() unless @msg && @msg.length > 0

if rho_error.unknown_client?(@params['error_message'])
Rhom::Rhom.database_client_reset
SyncEngine.dosync
elsif err_code == Rho::RhoError::ERR_UNATHORIZED
WebView.navigate ( url_for :action => :login, :query => {:msg => "Server credentials are expired"} )
end

elsif status == "complete"
WebView.navigate Rho::RhoConfig.start_path
elsif @params['sync_type'] == 'bulk'
puts "bulk_callback: #{@params}"

if @params['bulk_status'] == 'start' && @params['partition'].length == 0
AppApplication.start_bulk_sync = Time.now
puts "Start time = " + AppApplication.start_bulk_sync.to_i.inspect
WebView.navigate (url_for :action => :wait)
end

AppApplication.end_bulk_sync = Time.now
AppApplication.bulk_sync_total_time =
AppApplication.end_bulk_sync.to_i - AppApplication.start_bulk_sync.to_i
WebView.navigate Rho::RhoConfig.start_path unless @params['status'] == 'in_progress'
else

AppApplication.end_bulk_sync = Time.now
AppApplication.bulk_sync_total_time =
AppApplication.end_bulk_sync.to_i - AppApplication.start_bulk_sync.to_i
WebView.navigate Rho::RhoConfig.start_path unless @params['status'] == 'in_progress'
end
end
2 changes: 1 addition & 1 deletion app/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize
@@tabbar = nil
# Important to call super _after_ you define @tabs!

SyncEngine::set_bulk_notification("/app/Settings/bulk_callback", "")
SyncEngine.set_notification(-1, "/app/Settings/sync_notify", '')
super
end
end

0 comments on commit 666095a

Please sign in to comment.