Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Rename to StrUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
SanmerDev committed Jun 29, 2024
1 parent 5ebe3d0 commit a9f7699
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/src/main/kotlin/dev/sanmer/mrepo/model/json/UpdateJson.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.sanmer.mrepo.model.json

import dev.sanmer.mrepo.compat.NetworkCompat
import dev.sanmer.mrepo.model.online.VersionItem
import dev.sanmer.mrepo.utils.Utils
import dev.sanmer.mrepo.utils.StrUtil
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.decodeFromStream

Expand All @@ -24,7 +24,7 @@ data class UpdateJson(

return VersionItem(
timestamp = timestamp,
version = Utils.getVersionDisplay(version, versionCode),
version = StrUtil.getVersionDisplay(version, versionCode),
versionCode = versionCode,
zipUrl = zipUrl,
changelog = changelog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.sanmer.mrepo.model.local

import dev.sanmer.mrepo.utils.Utils
import dev.sanmer.mrepo.content.Module
import dev.sanmer.mrepo.utils.StrUtil

typealias LocalModule = Module

val Module.versionDisplay get() = Utils.getVersionDisplay(version, versionCode)
val Module.versionDisplay get() = StrUtil.getVersionDisplay(version, versionCode)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.sanmer.mrepo.model.online

import dev.sanmer.mrepo.utils.Utils
import dev.sanmer.mrepo.utils.StrUtil
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -17,7 +17,7 @@ data class OnlineModule(
val versions: List<VersionItem>,
) {
val versionDisplay by lazy {
Utils.getVersionDisplay(version, versionCode)
StrUtil.getVersionDisplay(version, versionCode)
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.sanmer.mrepo.utils

object Utils {
object StrUtil {
fun getVersionDisplay(version: String, versionCode: Int): String {
val included = "\\(.*?${versionCode}.*?\\)".toRegex()
.containsMatchIn(version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import dev.sanmer.mrepo.repository.UserPreferencesRepository
import dev.sanmer.mrepo.service.DownloadService
import dev.sanmer.mrepo.ui.activity.InstallActivity
import dev.sanmer.mrepo.ui.navigation.graphs.RepositoryScreen
import dev.sanmer.mrepo.utils.Utils
import dev.sanmer.mrepo.utils.StrUtil
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import timber.log.Timber
Expand Down Expand Up @@ -107,7 +107,7 @@ class ModuleViewModel @Inject constructor(
val userPreferences = userPreferencesRepository.data.first()
val downloadPath = userPreferences.downloadPath

val filename = Utils.getFilename(
val filename = StrUtil.getFilename(
name = online.name,
version = item.version,
versionCode = item.versionCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import dev.sanmer.mrepo.repository.UserPreferencesRepository
import dev.sanmer.mrepo.service.DownloadService
import dev.sanmer.mrepo.stub.IModuleOpsCallback
import dev.sanmer.mrepo.ui.activity.InstallActivity
import dev.sanmer.mrepo.utils.Utils
import dev.sanmer.mrepo.utils.StrUtil
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
Expand Down Expand Up @@ -246,7 +246,7 @@ class ModulesViewModel @Inject constructor(
val userPreferences = userPreferencesRepository.data.first()
val downloadPath = userPreferences.downloadPath

val filename = Utils.getFilename(
val filename = StrUtil.getFilename(
name = module.name,
version = item.version,
versionCode = item.versionCode,
Expand Down

0 comments on commit a9f7699

Please sign in to comment.