package com.ccwangluo.ccim.util;

import android.content.Context;
import android.content.SharedPreferences;
/**
 * Created by  on 15/7/20.
 */
public class PrefUtil {
    SharedPreferences mSharedPreferences;
    static PrefUtil prefUtil;
    Context context;

    private PrefUtil(Context context) {
        this.context = context;
        mSharedPreferences = context.getSharedPreferences("cc_im_shared_preferences", Context.MODE_PRIVATE);
    }

    public static PrefUtil getInstance(Context context) {
        if (prefUtil == null) {
            prefUtil = new PrefUtil(context);
        }
        return prefUtil;
    }

    public long getClearChannelMsgId(long channelId) {
        return mSharedPreferences.getLong("cc_im_clear_"+channelId, 0);
    }

    public void setClearChannelMsgId(long channelId,long msgId) {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putLong("cc_im_clear_"+channelId, msgId);
        mEditor.commit();
    }
}
