-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1cacf0
commit 9a4b059
Showing
16 changed files
with
375 additions
and
60 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
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
1 change: 0 additions & 1 deletion
1
core/commons/src/main/kotlin/com/divinelink/core/commons/ApiConstants.kt
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.divinelink.core.commons | ||
|
||
object ApiConstants { | ||
const val TMDB_URL = BuildConfig.TMDB_BASE_URL | ||
const val TMDB_IMAGE_URL = BuildConfig.TMDB_IMAGE_URL | ||
} |
11 changes: 11 additions & 0 deletions
11
core/commons/src/main/kotlin/com/divinelink/core/commons/BuildConfigProvider.kt
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,11 @@ | ||
package com.divinelink.core.commons | ||
|
||
interface BuildConfigProvider { | ||
val isDebug: Boolean | ||
val buildType: String | ||
} | ||
|
||
object DefaultBuildConfigProvider : BuildConfigProvider { | ||
override val isDebug: Boolean = BuildConfig.DEBUG | ||
override val buildType: String = BuildConfig.BUILD_TYPE | ||
} |
18 changes: 18 additions & 0 deletions
18
core/commons/src/main/kotlin/com/divinelink/core/commons/util/AppSettingsUtil.kt
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,18 @@ | ||
package com.divinelink.core.commons.util | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
import android.provider.Settings | ||
import androidx.core.content.ContextCompat.startActivity | ||
|
||
object AppSettingsUtil { | ||
private const val PACKAGE_SCHEME = "package" | ||
|
||
fun openAppDetails(context: Context) { | ||
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { | ||
data = Uri.fromParts(PACKAGE_SCHEME, context.packageName, null) | ||
} | ||
startActivity(context, intent, null) | ||
Check warning on line 16 in core/commons/src/main/kotlin/com/divinelink/core/commons/util/AppSettingsUtil.kt Codecov / codecov/patchcore/commons/src/main/kotlin/com/divinelink/core/commons/util/AppSettingsUtil.kt#L13-L16
|
||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
core/commons/src/test/kotlin/com/divinelink/core/commons/extensions/StringExtensionsTest.kt
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,26 @@ | ||
package com.divinelink.core.commons.extensions | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import org.junit.Test | ||
|
||
class StringExtensionsTest { | ||
|
||
@Test | ||
fun `test extractDetailsFromDeeplink with valid url`() { | ||
val url = "https://www.themoviedb.org/tv/693134-dune-part-two" | ||
|
||
val result = url.extractDetailsFromDeepLink() | ||
|
||
val expected = Pair(693134, "tv") | ||
assertThat(expected).isEqualTo(result) | ||
} | ||
|
||
@Test | ||
fun `test extractDetailsFromDeeplink with invalid url`() { | ||
val url = "https://www.themoviedb.org/tv/" | ||
|
||
val result = url.extractDetailsFromDeepLink() | ||
|
||
assertThat(result).isNull() | ||
} | ||
} |
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.