 # ----------------------------------------------------------------------------------------------------------------------
 # Service: noteManager
 # ----------------------------------------------------------------------------------------------------------------------
-markever.factory 'noteManager', ['apiClient', (apiClient) -> new class NoteManager
+markever.factory 'noteManager', ['apiClient', 'imageManager', (apiClient, imageManager) -> new class NoteManager
 
   # Status of a note:
   # 1. new: note with a generated guid, not attached to remote

  # ------------------------------------------------------------------------------------------------------------------
  # TODO prevent multipal duplicated requests
  vm.refresh_all_notes = ->
    apiClient.notes.all (data) ->
      # TODO handle failure
      vm.all_notes = data['notes']

  vm.load_note = (guid) ->
    # check if the note to be loaded is already current note


  # ------------------------------------------------------------
  # Load remote note list to update local notes info
  # return: promise
  # ------------------------------------------------------------
  load_remote_notes: =>
    # fetch remote notes
    # TODO handle failure
    return apiClient.notes.all()
      .$promise.then (data) =>
        #@_merge_remote_notes(data['notes'])
        return data

  # ------------------------------------------------------------
  # merge remote note list into local note list
