1
0

Compare commits

...

5 Commits
0.6.2 ... 0.6.3

Author SHA1 Message Date
65230a31ec Version 0.6.3 2019-01-12 14:41:23 +01:00
c2bcbfaaa9 Add grade id to equals (#213) 2019-01-12 14:16:59 +01:00
c3d354cd5b Add chucker okhttp inspector (#205) 2019-01-10 17:10:10 +01:00
ed49eb4c9c Fix stable id in grade fragment (#211) 2019-01-09 17:30:31 +01:00
7d1866c304 Fix NPE on error dialog (#212) 2019-01-09 17:29:55 +01:00
17 changed files with 69 additions and 23 deletions

View File

@ -23,8 +23,8 @@ android {
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 15
targetSdkVersion 28
versionCode 21
versionName "0.6.2"
versionCode 22
versionName "0.6.3"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
@ -80,7 +80,7 @@ play {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation('io.github.wulkanowy:api:0.6.2') { exclude module: "threetenbp" }
implementation('io.github.wulkanowy:api:0.6.3') { exclude module: "threetenbp" }
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2"
@ -118,6 +118,9 @@ dependencies {
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
releaseImplementation 'fr.o80.chucker:library-no-op:2.0.3'
debugImplementation 'fr.o80.chucker:library:2.0.3'
debugImplementation "com.amitshekhar.android:debug-db:1.0.4"
testImplementation "junit:junit:4.12"

View File

@ -4,6 +4,8 @@
package="io.github.wulkanowy"
android:installLocation="internalOnly">
<uses-sdk tools:overrideLibrary="com.readystatesoftware.chuck"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

View File

@ -6,10 +6,14 @@ import android.content.res.Resources
import androidx.preference.PreferenceManager
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.SocketInternetObservingStrategy
import com.readystatesoftware.chuck.api.ChuckCollector
import com.readystatesoftware.chuck.api.ChuckInterceptor
import com.readystatesoftware.chuck.api.RetentionManager
import dagger.Module
import dagger.Provides
import io.github.wulkanowy.api.Api
import io.github.wulkanowy.data.db.AppDatabase
import io.github.wulkanowy.data.repositories.PreferencesRepository
import okhttp3.logging.HttpLoggingInterceptor
import okhttp3.logging.HttpLoggingInterceptor.Level.BASIC
import okhttp3.logging.HttpLoggingInterceptor.Level.NONE
@ -30,15 +34,26 @@ internal class RepositoryModule {
@Singleton
@Provides
fun provideApi(): Api {
fun provideApi(chuckCollector: ChuckCollector, context: Context): Api {
return Api().apply {
logLevel = NONE
androidVersion = android.os.Build.VERSION.RELEASE
buildTag = android.os.Build.MODEL
setInterceptor(HttpLoggingInterceptor(HttpLoggingInterceptor.Logger { Timber.d(it) }).setLevel(BASIC))
// for debug only
setInterceptor(ChuckInterceptor(context, chuckCollector).maxContentLength(250000L), true, 0)
}
}
@Singleton
@Provides
fun provideChuckCollector(context: Context, prefRepository: PreferencesRepository): ChuckCollector {
return ChuckCollector(context)
.showNotification(prefRepository.isShowChuckerNotification)
.retentionManager(RetentionManager(context, ChuckCollector.Period.ONE_HOUR))
}
@Singleton
@Provides
fun provideDatabase(context: Context) = AppDatabase.newInstance(context)

View File

@ -44,4 +44,8 @@ class PreferencesRepository @Inject constructor(
val isNotificationsEnable: Boolean
get() = sharedPref.getBoolean(context.getString(R.string.pref_key_notifications_enable), true)
val isShowChuckerNotificationKey: String = context.getString(R.string.pref_key_debug_chucker_notification)
val isShowChuckerNotification: Boolean
get() = sharedPref.getBoolean(isShowChuckerNotificationKey, false)
}

View File

@ -13,7 +13,7 @@ abstract class BaseFragment : DaggerFragment(), BaseView {
if (messageContainer == null) (activity as? BaseActivity)?.showError(text, error)
else messageContainer?.also {
Snackbar.make(it, text, Snackbar.LENGTH_LONG).setAction(R.string.all_details) {
ErrorDialog.newInstance(error).show(fragmentManager, error.toString())
ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
}.show()
}
}

View File

@ -1,6 +1,7 @@
package io.github.wulkanowy.ui.base
import android.content.res.Resources
import com.readystatesoftware.chuck.api.ChuckCollector
import io.github.wulkanowy.R
import io.github.wulkanowy.api.interceptor.ServiceUnavailableException
import io.github.wulkanowy.api.login.NotLoggedInException
@ -9,11 +10,12 @@ import java.net.SocketTimeoutException
import java.net.UnknownHostException
import javax.inject.Inject
open class ErrorHandler @Inject constructor(protected val resources: Resources) {
open class ErrorHandler @Inject constructor(protected val resources: Resources, private val chuckCollector: ChuckCollector) {
var showErrorMessage: (String, Throwable) -> Unit = { _, _ -> }
fun dispatch(error: Throwable) {
chuckCollector.onError(error.javaClass.simpleName, error)
Timber.e(error, "An exception occurred while the Wulkanowy was running")
proceed(error)
}

View File

@ -1,11 +1,12 @@
package io.github.wulkanowy.ui.base.session
import android.content.res.Resources
import com.readystatesoftware.chuck.api.ChuckCollector
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.security.ScramblerException
import javax.inject.Inject
class SessionErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) {
class SessionErrorHandler @Inject constructor(resources: Resources, chuckCollector: ChuckCollector) : ErrorHandler(resources, chuckCollector) {
var onDecryptionFail: () -> Unit = {}

View File

@ -52,6 +52,7 @@ class GradeDetailsHeader(
if (subject != other.subject) return false
if (number != other.number) return false
if (average != other.average) return false
if (isExpandable != other.isExpandable) return false
return true
}
@ -60,6 +61,7 @@ class GradeDetailsHeader(
var result = subject.hashCode()
result = 31 * result + number.hashCode()
result = 31 * result + average.hashCode()
result = 31 * result + isExpandable.hashCode()
return result
}

View File

@ -14,8 +14,8 @@ import io.github.wulkanowy.utils.toFormattedString
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.item_grade_details.*
class GradeDetailsItem(val grade: Grade, private val weightString: String, private val valueColor: Int)
: AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
class GradeDetailsItem(val grade: Grade, private val weightString: String, private val valueColor: Int) :
AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
override fun getLayoutRes() = R.layout.item_grade_details
@ -24,8 +24,10 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
}
@SuppressLint("SetTextI18n")
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<*>>, holder: ViewHolder,
position: Int, payloads: MutableList<Any>?) {
override fun bindViewHolder(
adapter: FlexibleAdapter<IFlexible<*>>, holder: ViewHolder,
position: Int, payloads: MutableList<Any>?
) {
holder.run {
gradeItemValue.run {
text = grade.entry
@ -45,6 +47,7 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
other as GradeDetailsItem
if (grade != other.grade) return false
if (grade.id != other.grade.id) return false
if (weightString != other.weightString) return false
if (valueColor != other.valueColor) return false
@ -53,14 +56,14 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
override fun hashCode(): Int {
var result = grade.hashCode()
result = 31 * result + grade.id.toInt()
result = 31 * result + weightString.hashCode()
result = 31 * result + valueColor
return result
}
class ViewHolder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter),
LayoutContainer {
LayoutContainer {
override val containerView: View
get() = contentView

View File

@ -2,12 +2,13 @@ package io.github.wulkanowy.ui.modules.login
import android.content.res.Resources
import android.database.sqlite.SQLiteConstraintException
import com.readystatesoftware.chuck.api.ChuckCollector
import io.github.wulkanowy.R
import io.github.wulkanowy.api.login.BadCredentialsException
import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject
class LoginErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) {
class LoginErrorHandler @Inject constructor(resources: Resources, chuckCollector: ChuckCollector) : ErrorHandler(resources, chuckCollector) {
var onBadCredentials: () -> Unit = {}

View File

@ -6,6 +6,7 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import com.takisoft.preferencex.PreferenceFragmentCompat
import dagger.android.support.AndroidSupportInjection
import io.github.wulkanowy.BuildConfig
import io.github.wulkanowy.R
import io.github.wulkanowy.ui.base.BaseActivity
import io.github.wulkanowy.ui.modules.main.MainView
@ -36,6 +37,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
override fun onCreatePreferencesFix(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.scheme_preferences)
findPreference(getString(R.string.pref_key_debug_chucker_notification)).isVisible = BuildConfig.DEBUG
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {

View File

@ -1,5 +1,7 @@
package io.github.wulkanowy.ui.modules.settings
import com.readystatesoftware.chuck.api.ChuckCollector
import io.github.wulkanowy.data.RepositoryModule_ProvideChuckCollectorFactory
import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.services.job.ServiceHelper
import io.github.wulkanowy.ui.base.BasePresenter
@ -13,7 +15,8 @@ class SettingsPresenter @Inject constructor(
errorHandler: ErrorHandler,
private val preferencesRepository: PreferencesRepository,
private val serviceHelper: ServiceHelper,
private val analytics: FirebaseAnalyticsHelper
private val analytics: FirebaseAnalyticsHelper,
private val chuckCollector: ChuckCollector
) : BasePresenter<SettingsView>(errorHandler) {
override fun onAttachView(view: SettingsView) {
@ -37,6 +40,9 @@ class SettingsPresenter @Inject constructor(
preferencesRepository.currentThemeKey -> {
view?.setTheme(preferencesRepository.currentTheme)
}
preferencesRepository.isShowChuckerNotificationKey -> {
chuckCollector.showNotification(preferencesRepository.isShowChuckerNotification)
}
}
analytics.logEvent("setting_changed", mapOf("name" to key))

View File

@ -1,10 +1,7 @@
Wersja 0.6.2
Wersja 0.6.3
- zmieniono ikonę podsumowania frekwencji
- naprawiono niepokazującą się strzałkę przy przedmiotach w podsumowaniu frekwencji
- naprawiono sortowanie ocen
- naprawiono zepsuty widok podsumowania frekwencji
- naprawiono przeglądanie skrzynki nadawczej na kontach opiekunów
- naprawiono logowanie w systemach Resman Rzeszów i podobnych
- naprawiono problem ze stabilnością przy odczytywaniu ocen
- poprawiono komunikat o błędzie podczas przerwy technicznej dziennika
- (ponownie) naprawiono logowanie w systemach Resman Rzeszów i podobnych
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases/tag/0.6.2
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases/tag/0.6.3

View File

@ -227,6 +227,7 @@
<string name="pref_notify_header">Powiadomienia</string>
<string name="pref_notify_switch">Pokazuj powiadomienia</string>
<string name="pref_debug_notify_switch">Pokazuj powiadomienia debugowania</string>
<string name="pref_services_header">Synchronizacja</string>
<string name="pref_services_switch">Automatyczna aktualizacja</string>

View File

@ -10,4 +10,5 @@
<string name="pref_key_services_interval">services_interval</string>
<string name="pref_key_services_wifi_only">services_disable_wifi_only</string>
<string name="pref_key_notifications_enable">notifications_enable</string>
<string name="pref_key_debug_chucker_notification">chucker_notification</string>
</resources>

View File

@ -210,6 +210,7 @@
<string name="pref_notify_header">Notifications</string>
<string name="pref_notify_switch">Show notifications</string>
<string name="pref_debug_notify_switch">Show debug notifications</string>
<string name="pref_services_header">Synchronization</string>
<string name="pref_services_switch">Automatic update</string>

View File

@ -80,5 +80,10 @@
android:key="@string/pref_key_notifications_enable"
android:title="@string/pref_notify_switch"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_debug_chucker_notification"
android:title="@string/pref_debug_notify_switch"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>