Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
imknown committed May 10, 2020
2 parents 239b465 + 0cc614b commit 7d4cd56
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 37 deletions.
4 changes: 2 additions & 2 deletions app/proguard-firebase-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
-keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.

# If you want a faster, obfuscated build with ProGuard, exclude Crashlytics by adding the following lines to your ProGuard config file:
# -keep com.google.firebase.crashlytics** {*; }
# -dontwarn com.google.firebase.crashlytics**
# -keep class com.google.firebase.crashlytics.** { *; }
# -dontwarn com.google.firebase.crashlytics.**
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.content.IntentFilter
import androidx.lifecycle.LiveData
import net.imknown.android.forefrontinfo.base.Event

class LanguageBroadcastLiveData : LiveData<Event<Int>>() {
class LanguageBroadcastLiveData : LiveData<Event<Unit>>() {
override fun onActive() {
super.onActive()

Expand All @@ -23,7 +23,7 @@ class LanguageBroadcastLiveData : LiveData<Event<Int>>() {

private val receiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
value = Event(0)
value = Event(Unit)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ open class MyApplication : Application() {
companion object {
lateinit var instance: MyApplication

val homeLanguageEvent: LiveData<Event<Int>> by lazy { instance._homeLanguageEvent }
val settingsLanguageEvent: LiveData<Event<Int>> by lazy { instance._settingsLanguageEvent }
val homeLanguageEvent: LiveData<Event<Unit>> by lazy { instance._homeLanguageEvent }
val settingsLanguageEvent: LiveData<Event<Unit>> by lazy { instance._settingsLanguageEvent }

val sharedPreferences: SharedPreferences by lazy {
PreferenceManager.getDefaultSharedPreferences(instance)
Expand All @@ -48,8 +48,8 @@ open class MyApplication : Application() {
instance.getString(resId, *formatArgs)
}

private val _homeLanguageEvent by lazy { MutableLiveData<Event<Int>>() }
private val _settingsLanguageEvent by lazy { MutableLiveData<Event<Int>>() }
private val _homeLanguageEvent by lazy { MutableLiveData<Event<Unit>>() }
private val _settingsLanguageEvent by lazy { MutableLiveData<Event<Unit>>() }

override fun onCreate() {
super.onCreate()
Expand Down Expand Up @@ -105,8 +105,8 @@ open class MyApplication : Application() {

private suspend fun initLanguage() = withContext(Dispatchers.Main) {
LanguageBroadcastLiveData().observeForever {
_homeLanguageEvent.value = Event(0)
_settingsLanguageEvent.value = Event(0)
_homeLanguageEvent.value = Event(Unit)
_settingsLanguageEvent.value = Event(Unit)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class BaseListFragment : BaseFragment() {
return inflater.inflate(R.layout.fragment_list, container, false)
}

protected fun observeLanguageEvent(event: LiveData<Event<Int>>) {
protected fun observeLanguageEvent(event: LiveData<Event<Unit>>) {
event.observe(viewLifecycleOwner, EventObserver {
swipeRefreshLayout.isRefreshing = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ abstract class BaseListViewModel : BaseViewModel(), IAndroidVersion {
private val _models by lazy { MutableLiveData<ArrayList<MyModel>>() }
val models: LiveData<ArrayList<MyModel>> by lazy { _models }

private val _showModelsEvent by lazy { MutableLiveData<Event<Int>>() }
val showModelsEvent: LiveData<Event<Int>> by lazy { _showModelsEvent }
private val _showModelsEvent by lazy { MutableLiveData<Event<Unit>>() }
val showModelsEvent: LiveData<Event<Unit>> by lazy { _showModelsEvent }

private val _showErrorEvent by lazy { MutableLiveData<Event<String>>() }
val showErrorEvent: LiveData<Event<String>> by lazy { _showErrorEvent }
Expand Down Expand Up @@ -71,7 +71,7 @@ abstract class BaseListViewModel : BaseViewModel(), IAndroidVersion {
myModels.addAll(newModels)

withContext(Dispatchers.Main) {
_showModelsEvent.value = Event(0)
_showModelsEvent.value = Event(Unit)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ class HomeViewModel : BaseListViewModel() {
}
val outdatedOrderProp: LiveData<Event<Boolean>> by lazy { _outdatedOrderProp }

private val _showOutdatedOrderEvent by lazy { MutableLiveData<Event<Int>>() }
val showOutdatedOrderEvent: LiveData<Event<Int>> by lazy { _showOutdatedOrderEvent }
private val _showOutdatedOrderEvent by lazy { MutableLiveData<Event<Unit>>() }
val showOutdatedOrderEvent: LiveData<Event<Unit>> by lazy { _showOutdatedOrderEvent }

private fun copyJsonIfNeeded() {
if (JsonIo.whetherNeedCopyAssets(MyApplication.instance.assets)) {
Expand Down Expand Up @@ -1047,7 +1047,7 @@ class HomeViewModel : BaseListViewModel() {
myModels.last().detail = getOutdatedTargetSdkVersionApkModel(JsonIo.lld).detail

withContext(Dispatchers.Main) {
_showOutdatedOrderEvent.value = Event(0)
_showOutdatedOrderEvent.value = Event(Unit)
}
}
// endregion [detect]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class SettingsViewModel : BaseViewModel(), IAndroidVersion {
private val _version by lazy { MutableLiveData<Version>() }
val version: LiveData<Version> by lazy { _version }

private val _versionClick by lazy { MutableLiveData<Event<Int>>() }
val versionClick: LiveData<Event<Int>> by lazy { _versionClick }
private val _versionClick by lazy { MutableLiveData<Event<Unit>>() }
val versionClick: LiveData<Event<Unit>> by lazy { _versionClick }

private val _themesPrefChangeEvent by lazy {
MyApplication.sharedPreferences.stringEventLiveData(
Expand Down Expand Up @@ -132,7 +132,7 @@ class SettingsViewModel : BaseViewModel(), IAndroidVersion {

if (--timesLeft == 0) {
withContext(Dispatchers.Main) {
_versionClick.value = Event(0)
_versionClick.value = Event(Unit)
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ buildscript {
google()
jcenter()
// maven { url 'https://maven.aliyun.com/repository/jcenter' }

maven { url 'https://storage.googleapis.com/r8-releases/raw' }
}

dependencies {
// https://issuetracker.google.com/issues/144514795
// https://issuetracker.google.com/issues/147972078
classpath "com.android.tools:r8:$androidBuild.r8"

classpath "com.android.tools.build:gradle:$androidBuild.androidStudioGradlePlugin"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinSdk.core"

Expand Down
17 changes: 7 additions & 10 deletions gradle/buildScriptConfig.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
ext {
// region [AndroidBuild]
androidBuild = [
// https://r8.googlesource.com/r8/+refs
r8 : '2.0.71',

androidStudioGradlePlugin: '3.6.3',

// https://developer.android.com/studio/releases/build-tools.html#notes
Expand All @@ -12,8 +9,8 @@ ext {
compileSdkVersion : 29,
targetSdkVersion : 29,

versionCode : 24,
versionName : '1.8.4'//_unpublished'
versionCode : 25,
versionName : '1.8.5'//_unpublished'
]
// endregion [AndroidBuild]

Expand Down Expand Up @@ -122,13 +119,13 @@ ext {
firebase = [
googleServices : '4.3.3',

firebaseAnalytics : '17.4.0',
firebaseAnalytics : '17.4.1',

// https://firebase.google.com/docs/crashlytics/get-started-new-sdk?platform=android#add-crashlytics
firebaseCrashlyticsGradlePlugin: '2.0.0',
// https://firebase.google.com/docs/crashlytics/get-started-new-sdk?platform=android#add-dependencies
// https://firebase.google.com/docs/crashlytics/get-started?platform=android#add-crashlytics
firebaseCrashlyticsGradlePlugin: '2.1.0',
// https://firebase.google.com/docs/crashlytics/get-started?platform=android#add-dependencies
firebaseCrashlytics : '17.0.0',
// https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk#update-gradle-config
// https://firebase.google.com/docs/crashlytics/ndk-reports
firebaseCrashlyticsNdk : '17.0.0'
]
// endregion [Firebase]
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ dependencies {
// endregion [3rd Parties]

implementation "com.google.firebase:firebase-analytics:$firebase.firebaseAnalytics"
implementation "com.google.firebase:firebase-crashlytics:$firebase.firebaseCrashlytics"
// implementation "com.google.firebase:firebase-crashlytics:$firebase.firebaseCrashlytics"
implementation "com.google.firebase:firebase-crashlytics-ndk:$firebase.firebaseCrashlyticsNdk"
}

0 comments on commit 7d4cd56

Please sign in to comment.