Navigation Menu

Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Jul 25, 2018
1 parent d4a2cf3 commit 62f03a9
Show file tree
Hide file tree
Showing 68 changed files with 753 additions and 852 deletions.
5 changes: 4 additions & 1 deletion Habitica/build.gradle
Expand Up @@ -124,6 +124,8 @@ dependencies {
exclude group: 'com.android.support', module: 'multidex'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'com.android.support:multidex:1.0.3'
}


Expand All @@ -135,6 +137,7 @@ android {
applicationId "com.habitrpg.android.habitica"
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "STORE", "\"google\""
multiDexEnabled true
}

lintOptions {
Expand All @@ -161,7 +164,7 @@ android {
release {
signingConfig signingConfigs.release
debuggable false
multiDexEnabled false
multiDexEnabled true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider"
Expand Down
2 changes: 2 additions & 0 deletions Habitica/proguard-rules.pro
Expand Up @@ -178,3 +178,5 @@
-dontwarn com.viewpagerindicator.**
#-ignorewarnings

-keep class com.google.firebase.provider.FirebaseInitProvider
-keep class com.example.instabug.**
2 changes: 1 addition & 1 deletion Habitica/res/values/attrs.xml
Expand Up @@ -21,7 +21,7 @@
<attr name="showSeedsPromo" format="boolean" />
</declare-styleable>

<declare-styleable name="MaxHeightScrollView">
<declare-styleable name="MaxHeightLinearLayout">
<attr name="maxHeightMultiplier" format="float" />
</declare-styleable>
<declare-styleable name="SubscriptionOptionView">
Expand Down
Expand Up @@ -10,6 +10,7 @@ import android.content.res.Resources
import android.database.DatabaseErrorHandler
import android.database.sqlite.SQLiteDatabase
import android.preference.PreferenceManager
import android.support.multidex.MultiDexApplication
import android.support.v7.app.AppCompatDelegate
import android.util.Log

Expand Down Expand Up @@ -50,7 +51,7 @@ import io.realm.Realm
import io.realm.RealmConfiguration

//contains all HabiticaApplicationLogic except dagger componentInitialisation
abstract class HabiticaBaseApplication : Application() {
abstract class HabiticaBaseApplication : MultiDexApplication() {
var refWatcher: RefWatcher? = null
@Inject
internal lateinit var lazyApiHelper: ApiClient
Expand Down
@@ -1,6 +1,5 @@
package com.habitrpg.android.habitica.api;

import com.habitrpg.android.habitica.models.responses.HabitResponse;
import com.habitrpg.android.habitica.models.responses.MaintenanceResponse;

import io.reactivex.Flowable;
Expand All @@ -9,9 +8,9 @@
public interface MaintenanceApiService {

@GET("maintenance-android.json")
Flowable<HabitResponse<MaintenanceResponse>> getMaintenanceStatus();
Flowable<MaintenanceResponse> getMaintenanceStatus();

@GET("deprecation-android.json")
Flowable<HabitResponse<MaintenanceResponse>> getDepricationStatus();
Flowable<MaintenanceResponse> getDepricationStatus();

}

This file was deleted.

@@ -0,0 +1,14 @@
package com.habitrpg.android.habitica.data

import com.habitrpg.android.habitica.models.ContentResult
import com.habitrpg.android.habitica.models.WorldState

import io.reactivex.Flowable

interface ContentRepository : BaseRepository {

fun retrieveContent(): Flowable<ContentResult>
fun retrieveContent(forced: Boolean): Flowable<ContentResult>

fun retrieveWorldState(): Flowable<WorldState>
}

This file was deleted.

@@ -0,0 +1,10 @@
package com.habitrpg.android.habitica.data

import com.habitrpg.android.habitica.models.inventory.Customization

import io.reactivex.Flowable
import io.realm.RealmResults

interface CustomizationRepository : ContentRepository {
fun getCustomizations(type: String, category: String?, onlyAvailable: Boolean): Flowable<RealmResults<Customization>>
}

This file was deleted.

@@ -0,0 +1,11 @@
package com.habitrpg.android.habitica.data

import com.habitrpg.android.habitica.models.FAQArticle

import io.reactivex.Flowable
import io.realm.RealmResults

interface FAQRepository : BaseRepository {
fun getArticles(): Flowable<RealmResults<FAQArticle>>

}

This file was deleted.

@@ -0,0 +1,87 @@
package com.habitrpg.android.habitica.data

import com.habitrpg.android.habitica.models.inventory.Egg
import com.habitrpg.android.habitica.models.inventory.Equipment
import com.habitrpg.android.habitica.models.inventory.Food
import com.habitrpg.android.habitica.models.inventory.HatchingPotion
import com.habitrpg.android.habitica.models.inventory.Item
import com.habitrpg.android.habitica.models.inventory.Mount
import com.habitrpg.android.habitica.models.inventory.Pet
import com.habitrpg.android.habitica.models.inventory.Quest
import com.habitrpg.android.habitica.models.inventory.QuestContent
import com.habitrpg.android.habitica.models.responses.BuyResponse
import com.habitrpg.android.habitica.models.responses.FeedResponse
import com.habitrpg.android.habitica.models.shops.Shop
import com.habitrpg.android.habitica.models.shops.ShopItem
import com.habitrpg.android.habitica.models.user.Items
import com.habitrpg.android.habitica.models.user.User

import io.reactivex.Flowable
import io.realm.RealmResults


interface InventoryRepository : ContentRepository {

fun getArmoireRemainingCount(): Long

fun getInAppRewards(): Flowable<RealmResults<ShopItem>>
fun getOwnedEquipment(): Flowable<RealmResults<Equipment>>

fun getMounts(): Flowable<RealmResults<Mount>>

fun getOwnedMounts(): Flowable<RealmResults<Mount>>

fun getPets(): Flowable<RealmResults<Pet>>

fun getOwnedPets(): Flowable<RealmResults<Pet>>
fun getQuestContent(key: String): Flowable<QuestContent>

fun getItems(searchedKeys: List<String>): Flowable<RealmResults<Equipment>>
fun retrieveInAppRewards(): Flowable<List<ShopItem>>

fun getOwnedEquipment(type: String): Flowable<RealmResults<Equipment>>

fun getOwnedItems(itemClass: Class<out Item>, user: User?): Flowable<out RealmResults<out Item>>
fun getOwnedItems(user: User): Flowable<out Map<String, Item>>

fun getEquipment(key: String): Flowable<Equipment>

fun openMysteryItem(user: User?): Flowable<Equipment>

fun saveEquipment(equipment: Equipment)
fun getMounts(type: String, group: String): Flowable<RealmResults<Mount>>
fun getOwnedMounts(animalType: String, animalGroup: String): Flowable<RealmResults<Mount>>
fun getPets(type: String, group: String): Flowable<RealmResults<Pet>>
fun getOwnedPets(type: String, group: String): Flowable<RealmResults<Pet>>

fun updateOwnedEquipment(user: User)

fun changeOwnedCount(type: String, key: String, amountToAdd: Int)

fun sellItem(user: User?, type: String, key: String): Flowable<User>
fun sellItem(user: User?, item: Item): Flowable<User>

fun equipGear(user: User?, equipment: String, asCostume: Boolean): Flowable<Items>
fun equip(user: User?, type: String, key: String): Flowable<Items>

fun feedPet(pet: Pet, food: Food): Flowable<FeedResponse>

fun hatchPet(egg: Egg, hatchingPotion: HatchingPotion): Flowable<Items>

fun inviteToQuest(quest: QuestContent): Flowable<Quest>

fun buyItem(user: User?, id: String, value: Double): Flowable<BuyResponse>

fun retrieveShopInventory(identifier: String): Flowable<Shop>
fun retrieveMarketGear(): Flowable<Shop>

fun purchaseMysterySet(categoryIdentifier: String): Flowable<Void>

fun purchaseHourglassItem(purchaseType: String, key: String): Flowable<Void>

fun purchaseQuest(key: String): Flowable<Void>

fun purchaseItem(purchaseType: String, key: String): Flowable<Void>

fun togglePinnedItem(item: ShopItem): Flowable<List<ShopItem>>
}

This file was deleted.

@@ -0,0 +1,11 @@
package com.habitrpg.android.habitica.data


import com.habitrpg.android.habitica.models.SetupCustomization
import com.habitrpg.android.habitica.models.user.User

interface SetupCustomizationRepository {

fun getCustomizations(type: String, user: User): List<SetupCustomization>
fun getCustomizations(type: String, subtype: String?, user: User): List<SetupCustomization>
}
Expand Up @@ -71,7 +71,9 @@ class ApiClientImpl//private OnHabitsAPIResult mResultListener;
private val apiService: ApiService

private val apiCallTransformer = FlowableTransformer<HabitResponse<Any>, Any> { observable ->
observable.map { habitResponse ->
observable
.filter { it.data != null }
.map { habitResponse ->
if (habitResponse.notifications != null) {
popupNotificationsManager.showNotificationDialog(habitResponse.notifications)
}
Expand Down
Expand Up @@ -10,7 +10,7 @@ import io.realm.RealmResults

class CustomizationRepositoryImpl(localRepository: CustomizationLocalRepository, apiClient: ApiClient) : ContentRepositoryImpl<CustomizationLocalRepository>(localRepository, apiClient), CustomizationRepository {

override fun getCustomizations(type: String, category: String, onlyAvailable: Boolean): Flowable<RealmResults<Customization>> {
override fun getCustomizations(type: String, category: String?, onlyAvailable: Boolean): Flowable<RealmResults<Customization>> {
return localRepository.getCustomizations(type, category, onlyAvailable)
}
}

0 comments on commit 62f03a9

Please sign in to comment.