// Path: app/src/main/java/com/cxsj/runhdu/bean/gson/UpdateInfo.java
// public class UpdateInfo {
//     private boolean isUpdate;
//     private String latestVersion;
//     private String currentVersion;
//     private String statement;
// 
//     public boolean isUpdate() {
//         return isUpdate;
//     }
// 
//     public void setUpdate(boolean update) {
//         isUpdate = update;
//     }
// 
//     public String getLatestVersion() {
//         return latestVersion;
//     }
// 
//     public void setLatestVersion(String latestVersion) {
//         this.latestVersion = latestVersion;
//     }
// 
//     public String getCurrentVersion() {
//         return currentVersion;
//     }
// 
//     public void setCurrentVersion(String currentVersion) {
//         this.currentVersion = currentVersion;
//     }
// 
//     public String getStatement() {
//         return statement;
//     }
// 
//     public void setStatement(String statement) {
//         this.statement = statement;
//     }
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/constant/URLs.java
// public class URLs {
//     public static final String DOWNLOAD = "http://d1.51gugu.com/170258/RunHDU";
//     public static final String LOGIN = "http://112.74.115.231:8080/CXSJ/Login";
//     public static final String REGISTER="http://112.74.115.231:8080/CXSJ/Register";
//     public static final String GET_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/ReadAll";
//     public static final String UPLOAD_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/Write";
//     public static final String CLEAR_DATA = "http://112.74.115.231:8080/chuangxinshijian/ClearTheTable";
//     public static final String UPDATE_URL = "http://112.74.115.231:8080/chuangxinshijian/VersionCompare";
//     public static final String GET_RUN_TIMES = "http://112.74.115.231:8080/chuangxinshijian/ReadUserNameAndTimesOnly";
//     public static final String UPLOAD_ALL_INFO = "http://112.74.115.231:8080/chuangxinshijian/WriteByJson";
//     public static final String UPLOAD_PROFILE = "http://112.74.115.231:8080/CXSJ/UploadHead";
//     public static final String PROFILE_URL = "http://112.74.115.231:8080/CXSJ/Image/";
//     public static final String FEEDBACK_URL = "http://112.74.115.231:8080/chuangxinshijian/WriteFeedback";
//     public static final String SUNNY_RUN_QUERY_API = "http://hdu.sunnysport.org.cn/api/student/achievements/";
//     public static final String SUNNY_RUN_INFO_API = "http://hdu.sunnysport.org.cn/api/student/info/";
//     public static final String DELETE_ITEM = "http://112.74.115.231:8080/chuangxinshijian/ClearByUserNameAndRunId";
//     public static final String APPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/Apply";
//     public static final String REPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/BeFriend";
//     public static final String GET_FRIEND = "http://112.74.115.231:8080/CXSJ/MyFriends";
//     public static final String DELETE_FRIEND = "http://112.74.115.231:8080/CXSJ/DeleteFriend";
//     public static final String OFF_LINE = "http://112.74.115.231:8080/CXSJ/Xiaxian";
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/utils/HttpUtil.java
// public class HttpUtil {
//     private static RequestManager manager;
// 
//     public static RequestManager load(String url) {
//         manager = new RequestManager();
//         manager.url(url);
//         return manager;
//     }
// 
//     public static class RequestManager {
//         private Request.Builder requestBuilder = new Request.Builder();
//         private FormBody.Builder formBuilder = new FormBody.Builder();
//         private Call call;
// 
//         private void url(String url) {
//             formBuilder = new FormBody.Builder();
//             requestBuilder = new Request.Builder();
// 
//             requestBuilder = requestBuilder.url(url);
//         }
// 
//         private void cancel() {
//             if (call != null) {
//                 call.cancel();
//             }
//         }
// 
//         public RequestManager addHeader(String key, String value) {
//             requestBuilder.addHeader(key, value);
//             return this;
//         }
// 
//         public RequestManager addParam(String key, String value) {
//             formBuilder = formBuilder.add(key, value);
//             return this;
//         }
// 
//         public void post(Callback callback) {
//             OkHttpClient client = new OkHttpClient.Builder()
//                     .connectTimeout(3, TimeUnit.SECONDS)
//                     .followRedirects(false)
//                     .followSslRedirects(false)
//                     .build();
// 
//             Request request = requestBuilder.post(formBuilder.build()).build();
//             client.newCall(request).enqueue(callback);
//         }
// 
//         public void get(Callback callback) {
//             OkHttpClient client = new OkHttpClient.Builder().build();
//             Request request = requestBuilder.build();
//             call = client.newCall(request);
//             call.enqueue(callback);
//         }
//     }
// }


import android.content.Context;
import com.cxsj.runhdu.R;
import com.cxsj.runhdu.bean.gson.UpdateInfo;
import com.cxsj.runhdu.constant.URLs;
import com.cxsj.runhdu.utils.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
package com.cxsj.runhdu.Model;





/**
 * Created by SailFlorve on 2017/8/25 0025.
 * APP相关的数据请求封装
 */

public class AppModel extends BaseModel {

    public interface UpdateCheckCallback {
        void onSuccess(UpdateInfo updateInfo);

        void onFailure(String msg);
    }

// Path: app/src/main/java/com/cxsj/runhdu/bean/gson/UpdateInfo.java
// public class UpdateInfo {
//     private boolean isUpdate;
//     private String latestVersion;
//     private String currentVersion;
//     private String statement;
// 
//     public boolean isUpdate() {
//         return isUpdate;
//     }
// 
//     public void setUpdate(boolean update) {
//         isUpdate = update;
//     }
// 
//     public String getLatestVersion() {
//         return latestVersion;
//     }
// 
//     public void setLatestVersion(String latestVersion) {
//         this.latestVersion = latestVersion;
//     }
// 
//     public String getCurrentVersion() {
//         return currentVersion;
//     }
// 
//     public void setCurrentVersion(String currentVersion) {
//         this.currentVersion = currentVersion;
//     }
// 
//     public String getStatement() {
//         return statement;
//     }
// 
//     public void setStatement(String statement) {
//         this.statement = statement;
//     }
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/constant/URLs.java
// public class URLs {
//     public static final String DOWNLOAD = "http://d1.51gugu.com/170258/RunHDU";
//     public static final String LOGIN = "http://112.74.115.231:8080/CXSJ/Login";
//     public static final String REGISTER="http://112.74.115.231:8080/CXSJ/Register";
//     public static final String GET_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/ReadAll";
//     public static final String UPLOAD_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/Write";
//     public static final String CLEAR_DATA = "http://112.74.115.231:8080/chuangxinshijian/ClearTheTable";
//     public static final String UPDATE_URL = "http://112.74.115.231:8080/chuangxinshijian/VersionCompare";
//     public static final String GET_RUN_TIMES = "http://112.74.115.231:8080/chuangxinshijian/ReadUserNameAndTimesOnly";
//     public static final String UPLOAD_ALL_INFO = "http://112.74.115.231:8080/chuangxinshijian/WriteByJson";
//     public static final String UPLOAD_PROFILE = "http://112.74.115.231:8080/CXSJ/UploadHead";
//     public static final String PROFILE_URL = "http://112.74.115.231:8080/CXSJ/Image/";
//     public static final String FEEDBACK_URL = "http://112.74.115.231:8080/chuangxinshijian/WriteFeedback";
//     public static final String SUNNY_RUN_QUERY_API = "http://hdu.sunnysport.org.cn/api/student/achievements/";
//     public static final String SUNNY_RUN_INFO_API = "http://hdu.sunnysport.org.cn/api/student/info/";
//     public static final String DELETE_ITEM = "http://112.74.115.231:8080/chuangxinshijian/ClearByUserNameAndRunId";
//     public static final String APPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/Apply";
//     public static final String REPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/BeFriend";
//     public static final String GET_FRIEND = "http://112.74.115.231:8080/CXSJ/MyFriends";
//     public static final String DELETE_FRIEND = "http://112.74.115.231:8080/CXSJ/DeleteFriend";
//     public static final String OFF_LINE = "http://112.74.115.231:8080/CXSJ/Xiaxian";
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/utils/HttpUtil.java
// public class HttpUtil {
//     private static RequestManager manager;
// 
//     public static RequestManager load(String url) {
//         manager = new RequestManager();
//         manager.url(url);
//         return manager;
//     }
// 
//     public static class RequestManager {
//         private Request.Builder requestBuilder = new Request.Builder();
//         private FormBody.Builder formBuilder = new FormBody.Builder();
//         private Call call;
// 
//         private void url(String url) {
//             formBuilder = new FormBody.Builder();
//             requestBuilder = new Request.Builder();
// 
//             requestBuilder = requestBuilder.url(url);
//         }
// 
//         private void cancel() {
//             if (call != null) {
//                 call.cancel();
//             }
//         }
// 
//         public RequestManager addHeader(String key, String value) {
//             requestBuilder.addHeader(key, value);
//             return this;
//         }
// 
//         public RequestManager addParam(String key, String value) {
//             formBuilder = formBuilder.add(key, value);
//             return this;
//         }
// 
//         public void post(Callback callback) {
//             OkHttpClient client = new OkHttpClient.Builder()
//                     .connectTimeout(3, TimeUnit.SECONDS)
//                     .followRedirects(false)
//                     .followSslRedirects(false)
//                     .build();
// 
//             Request request = requestBuilder.post(formBuilder.build()).build();
//             client.newCall(request).enqueue(callback);
//         }
// 
//         public void get(Callback callback) {
//             OkHttpClient client = new OkHttpClient.Builder().build();
//             Request request = requestBuilder.build();
//             call = client.newCall(request);
//             call.enqueue(callback);
//         }
//     }
// }


// Path: app/src/main/java/com/cxsj/runhdu/Model/AppModel.java
import android.content.Context;
import com.cxsj.runhdu.R;
import com.cxsj.runhdu.bean.gson.UpdateInfo;
import com.cxsj.runhdu.constant.URLs;
import com.cxsj.runhdu.utils.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

package com.cxsj.runhdu.Model;





/**
 * Created by SailFlorve on 2017/8/25 0025.
 * APP相关的数据请求封装
 */

public class AppModel extends BaseModel {

    public interface UpdateCheckCallback {
        void onSuccess(UpdateInfo updateInfo);

        void onFailure(String msg);
    }

    public static void checkUpdate(Context context, AppModel.UpdateCheckCallback callback) {