Merge branch 'develop' of https://github.com/HabitRPG/habitrpg-android into develop

This commit is contained in:
Negue 2015-12-01 01:06:36 +01:00
commit 3828382a1f
5 changed files with 48 additions and 2 deletions

View file

@ -1,4 +1,21 @@
[
{
"name": "Version 0.0.11",
"items":[
{
"type": "F",
"title": "Ability to Change/See/Add checklists"
},
{
"type": "F",
"title": "Settings Screen with logout options and account details."
},
{
"type": "B",
"title": "fix clear database"
}
]
},
{
"name": "Version 0.0.10",
"items":[
@ -204,4 +221,4 @@
}
]
}
]
]

View file

@ -69,6 +69,9 @@ public class HabiticaApplication extends Application {
@Override
public boolean deleteDatabase(String name) {
if(!name.endsWith(".db")){
name += ".db";
}
return super.deleteDatabase(getDatabasePath(name).getAbsolutePath());
}

View file

@ -39,6 +39,13 @@ import com.raizlabs.android.dbflow.sql.language.Select;
import org.solovyev.android.checkout.ActivityCheckout;
import org.solovyev.android.checkout.Checkout;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import butterknife.ButterKnife;
import butterknife.InjectView;
import de.greenrobot.event.EventBus;
@ -198,6 +205,14 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
private void setUserData() {
if (user != null) {
Calendar mCalendar = new GregorianCalendar();
TimeZone mTimeZone = mCalendar.getTimeZone();
long offset = -TimeUnit.MINUTES.convert(mTimeZone.getRawOffset(), TimeUnit.MILLISECONDS);
if (offset != user.getPreferences().getTimezoneOffset()) {
Map<String, String> updateData = new HashMap<String, String>();
updateData.put("preferences.timezoneOffset", String.valueOf(offset));
mAPIHelper.apiService.updateUser(updateData, new HabitRPGUserCallback(this));
}
runOnUiThread(new Runnable() {
@Override
public void run() {

View file

@ -1,8 +1,15 @@
package com.habitrpg.android.habitica.callbacks;
import android.util.Log;
import com.crashlytics.android.Crashlytics;
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
@ -22,7 +29,6 @@ public class HabitRPGUserCallback implements Callback<HabitRPGUser> {
public void success(HabitRPGUser habitRPGUser, Response response) {
habitRPGUser.async().save();
mCallback.onUserReceived(habitRPGUser);
}

View file

@ -15,7 +15,9 @@ import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Map;
import retrofit.Callback;
import retrofit.http.Body;
@ -41,6 +43,9 @@ public interface ApiService {
@GET("/user/")
void getUser(Callback<HabitRPGUser> habitRPGUserCallback);
@PUT("/user/")
void updateUser(@Body Map<String, String> updateDictionary, Callback<HabitRPGUser> habitRPGUserCallback);
@GET("/user/inventory/buy")
void getInventoryBuyableGear(Callback<List<ItemData>> buyableGearCallback);