// Path: WaniKani/src/tr/xip/wanikani/client/error/RetrofitErrorHandler.java
// public class RetrofitErrorHandler {
//     public static void handleError(Throwable throwable) {
// 
//         if (throwable != null) {
//             try {
//                 // Ghhhhh!
//                 Field f = Throwable.class.getDeclaredField("cause");
//                 f.setAccessible(true);
//                 String message = f.get(throwable).toString();
// 
//                 if (message.contains("GaiException") || message.contains("UnknownHostException")) {
//                     Intent intent = new Intent(BroadcastIntents.RETROFIT_ERROR_CONNECTION());
//                     LocalBroadcastManager.getInstance(App.getContext()).sendBroadcast(intent);
//                 } else {
//                     Intent intent = new Intent(BroadcastIntents.RETROFIT_ERROR_UNKNOWN());
//                     LocalBroadcastManager.getInstance(App.getContext()).sendBroadcast(intent);
//                 }
//             } catch (NoSuchFieldException e) {
//                 e.printStackTrace();
//             } catch (IllegalAccessException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/Request.java
// public class Request<T> {
//     public User user_information;
//     public T requested_information;
//     public Error error;
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/Storable.java
// public interface Storable {
//     void save();
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/User.java
// public class User implements Serializable, Storable {
//     public String username;
//     public String gravatar;
//     public int level;
//     public String title;
//     public String about;
//     public String website;
//     public String twitter;
//     public int topics_count;
//     public int posts_count;
//     public long creation_date;
//     public long vacation_date;
// 
//     public User(String username, String gravatar, int level, String title, String about,
//                 String website, String twitter, int topicsCount, int postsCount, long creationDate,
//                 long vacationDate) {
//         this.username = username;
//         this.gravatar = gravatar;
//         this.level = level;
//         this.title = title;
//         this.about = about;
//         this.website = website;
//         this.twitter = twitter;
//         this.topics_count = topicsCount;
//         this.posts_count = postsCount;
//         this.creation_date = creationDate;
//         this.vacation_date = vacationDate;
//     }
// 
//     public long getCreationDateInMillis() {
//         return creation_date * 1000;
//     }
// 
//     public long getVacationDateInMillis() {
//         return vacation_date * 1000;
//     }
// 
//     public boolean isVacationModeActive() {
//         return getVacationDateInMillis() != 0;
//     }
// 
//     @Override
//     public void save() {
//         DatabaseManager.saveUser(this);
//     }
// }


import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import tr.xip.wanikani.client.error.RetrofitErrorHandler;
import tr.xip.wanikani.models.Request;
import tr.xip.wanikani.models.Storable;
import tr.xip.wanikani.models.User;
package tr.xip.wanikani.client.task.callback;


public abstract class ThroughDbCallback<T extends Request<B>, B extends Storable> implements Callback<T> {
    @Override
    public void onResponse(Call<T> call, Response<T> response) {
        T result = response.body();
        if (result == null) return;

// Path: WaniKani/src/tr/xip/wanikani/client/error/RetrofitErrorHandler.java
// public class RetrofitErrorHandler {
//     public static void handleError(Throwable throwable) {
// 
//         if (throwable != null) {
//             try {
//                 // Ghhhhh!
//                 Field f = Throwable.class.getDeclaredField("cause");
//                 f.setAccessible(true);
//                 String message = f.get(throwable).toString();
// 
//                 if (message.contains("GaiException") || message.contains("UnknownHostException")) {
//                     Intent intent = new Intent(BroadcastIntents.RETROFIT_ERROR_CONNECTION());
//                     LocalBroadcastManager.getInstance(App.getContext()).sendBroadcast(intent);
//                 } else {
//                     Intent intent = new Intent(BroadcastIntents.RETROFIT_ERROR_UNKNOWN());
//                     LocalBroadcastManager.getInstance(App.getContext()).sendBroadcast(intent);
//                 }
//             } catch (NoSuchFieldException e) {
//                 e.printStackTrace();
//             } catch (IllegalAccessException e) {
//                 e.printStackTrace();
//             }
//         }
//     }
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/Request.java
// public class Request<T> {
//     public User user_information;
//     public T requested_information;
//     public Error error;
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/Storable.java
// public interface Storable {
//     void save();
// }
// 
// Path: WaniKani/src/tr/xip/wanikani/models/User.java
// public class User implements Serializable, Storable {
//     public String username;
//     public String gravatar;
//     public int level;
//     public String title;
//     public String about;
//     public String website;
//     public String twitter;
//     public int topics_count;
//     public int posts_count;
//     public long creation_date;
//     public long vacation_date;
// 
//     public User(String username, String gravatar, int level, String title, String about,
//                 String website, String twitter, int topicsCount, int postsCount, long creationDate,
//                 long vacationDate) {
//         this.username = username;
//         this.gravatar = gravatar;
//         this.level = level;
//         this.title = title;
//         this.about = about;
//         this.website = website;
//         this.twitter = twitter;
//         this.topics_count = topicsCount;
//         this.posts_count = postsCount;
//         this.creation_date = creationDate;
//         this.vacation_date = vacationDate;
//     }
// 
//     public long getCreationDateInMillis() {
//         return creation_date * 1000;
//     }
// 
//     public long getVacationDateInMillis() {
//         return vacation_date * 1000;
//     }
// 
//     public boolean isVacationModeActive() {
//         return getVacationDateInMillis() != 0;
//     }
// 
//     @Override
//     public void save() {
//         DatabaseManager.saveUser(this);
//     }
// }


// Path: WaniKani/src/tr/xip/wanikani/client/task/callback/ThroughDbCallback.java
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import tr.xip.wanikani.client.error.RetrofitErrorHandler;
import tr.xip.wanikani.models.Request;
import tr.xip.wanikani.models.Storable;
import tr.xip.wanikani.models.User;

package tr.xip.wanikani.client.task.callback;


public abstract class ThroughDbCallback<T extends Request<B>, B extends Storable> implements Callback<T> {
    @Override
    public void onResponse(Call<T> call, Response<T> response) {
        T result = response.body();
        if (result == null) return;

        final User userInfo = result.user_information;