package com.expidev.gcmapp.db;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import com.expidev.gcmapp.sql.TableNames;
import com.expidev.gcmapp.utils.DatabaseOpenHelper;

/**
 * Created by William.Randall on 1/21/2015.
 */
public class SessionDao
{
    private final String TAG = getClass().getSimpleName();

    private Context context;
    private SQLiteOpenHelper databaseHelper;

    private static final Object instanceLock = new Object();
    private static SessionDao instance;

    private SessionDao(final Context context)
    {
        this.context = context;
        this.databaseHelper = new DatabaseOpenHelper(context);
    }

    public static SessionDao getInstance(Context context)
    {
        if(instance == null)
        {
            synchronized(instanceLock)
            {
                instance = new SessionDao(context.getApplicationContext());
            }
        }

        return instance;
    }

    public Cursor retrieveSessionToken()
    {
        final SQLiteDatabase database = databaseHelper.getReadableDatabase();

        try
        {
            return database.query(TableNames.SESSION.getTableName(), null, null, null, null, null, null);
        }
        catch(Exception e)
        {
            Log.e(TAG, "Failed to retrieve session token: " + e.getMessage());
        }

        return null;
    }

    public void saveSessionToken(String sessionToken)
    {

    }
}

@@ -448,37 +448,8 @@
 );%0A%0A
-    private Context context;%0A
     
@@ -648,40 +648,8 @@
   %7B%0A
-        this.context = context;%0A
     

Remove unused context variable