package net.yasme.android.asyncTasks.server;

import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;

import net.yasme.android.R;
import net.yasme.android.connection.ChatTask;
import net.yasme.android.controller.Toaster;
import net.yasme.android.entities.Chat;
import net.yasme.android.exception.RestServiceException;

/**
 * Created by robert on 29.07.14.
 */
public class ChangeChatProperties extends AsyncTask<String, Void, Boolean> {
    private Chat chat;

    public ChangeChatProperties(Chat chat) {
        this.chat = chat;
    }


    /**
     * @return Returns true if it was successful, otherwise false
     */
    @Override
    protected Boolean doInBackground(String... params) {
        try {
            ChatTask.getInstance().updateChat(chat);
        } catch (RestServiceException e) {
            Log.w(this.getClass().getSimpleName(), e.getMessage());
            return false;
        }
        return true;
    }


    /**
     *
     */
    protected void onPostExecute(final Boolean success) {
        if(success) {
            Toaster.getInstance().toast(R.string.change_successful, Toast.LENGTH_LONG);
        } else {
            Toaster.getInstance().toast(R.string.change_not_successful, Toast.LENGTH_LONG);
        }
    }
}

@@ -338,16 +338,66 @@
 ception;
+%0Aimport net.yasme.android.storage.DatabaseManager;
 %0A%0A/**%0A *
@@ -975,24 +975,84 @@
 ;%0A        %7D%0A
+        DatabaseManager.INSTANCE.getChatDAO().update(chat);%0A
         retu

store changes now directly in the client-DB, trying to find bug