-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from mash-up-kr/release/v1.1.4
[Release] version 1.1.4
- Loading branch information
Showing
19 changed files
with
221 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
app/src/main/java/com/mashup/data/repository/FirebaseRepository.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.mashup.ui.splash | ||
|
||
import android.content.Context | ||
import androidx.core.content.pm.PackageInfoCompat | ||
import com.mashup.base.BaseViewModel | ||
import com.mashup.core.firebase.FirebaseRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.CancellationException | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import javax.inject.Inject | ||
|
||
|
||
@HiltViewModel | ||
class SplashViewModel @Inject constructor( | ||
private val firebaseRepository: FirebaseRepository | ||
) : BaseViewModel() { | ||
|
||
private val _onLowerAppVersion = MutableSharedFlow<Unit>() | ||
val onLowerAppVersion: SharedFlow<Unit> = _onLowerAppVersion | ||
|
||
private val _onFinishInit = MutableSharedFlow<Unit>() | ||
val onFinishInit: SharedFlow<Unit> = _onFinishInit | ||
|
||
fun checkAppVersion(context: Context) = mashUpScope { | ||
try { | ||
val localVersionCode = PackageInfoCompat.getLongVersionCode( | ||
context.packageManager.getPackageInfo(context.packageName, 0) | ||
) | ||
val resentAppVersion = firebaseRepository.getRecentAppVersion() | ||
if (localVersionCode < resentAppVersion) { | ||
_onLowerAppVersion.emit(Unit) | ||
} else { | ||
delay(2000L) | ||
_onFinishInit.emit(Unit) | ||
} | ||
} catch (cancelException: CancellationException) { | ||
throw cancelException | ||
} catch (ignore: Exception) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.