package com.danding.yang800.Presenter;

import android.content.Context;
import android.content.SharedPreferences;

import com.danding.yang800.CourseActivity;
import com.danding.yang800.General.HttpCallBack;
import com.danding.yang800.MentorActivity;
import com.danding.yang800.Util.StringUtil;
import com.danding.yang800.Util.VolleyUtil;

import org.json.JSONObject;

import java.util.HashMap;

public class CourseActivityPresenter {
    private CourseActivity context;
    SharedPreferences sp;

    public CourseActivityPresenter(CourseActivity context) {
        sp = context.getSharedPreferences("variable", Context.MODE_PRIVATE);
        this.context = context;
    }

    public void getInfo() {
        HashMap<String, String> map = new HashMap<>();
        new VolleyUtil(context).request(context, "store.guildUrl", true, map, new HttpCallBack() {
            @Override
            public void onSuccess(JSONObject json) {
                try {
                    String result = StringUtil.toString(json.getString("result"));
                    context.update(result);
                } catch (Exception e) {
                }

            }

            @Override
            public void onerrSuccess() {
            }

            @Override
            public void onCatch() {

            }

            @Override
            public void onFail() {
            }
        });
    }


}
