-
Notifications
You must be signed in to change notification settings - Fork 12
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 #39 from icerockdev/develop
Release 0.7.0
- Loading branch information
Showing
25 changed files
with
733 additions
and
323 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import java.util.Base64 | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
|
@@ -26,6 +28,81 @@ allprojects { | |
} | ||
} | ||
} | ||
|
||
plugins.withId(Deps.Plugins.mavenPublish.id) { | ||
group = "dev.icerock.moko" | ||
version = Deps.mokoMediaVersion | ||
|
||
val javadocJar by tasks.registering(Jar::class) { | ||
archiveClassifier.set("javadoc") | ||
} | ||
|
||
configure<PublishingExtension> { | ||
repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
name = "OSSRH" | ||
|
||
credentials { | ||
username = System.getenv("OSSRH_USER") | ||
password = System.getenv("OSSRH_KEY") | ||
} | ||
} | ||
|
||
publications.withType<MavenPublication> { | ||
// Stub javadoc.jar artifact | ||
artifact(javadocJar.get()) | ||
|
||
// Provide artifacts information requited by Maven Central | ||
pom { | ||
name.set("MOKO media") | ||
description.set("Media selection & presenting for mobile (android & ios) Kotlin Multiplatform development") | ||
url.set("https://github.com/icerockdev/moko-media") | ||
licenses { | ||
license { | ||
url.set("https://github.com/icerockdev/moko-media/blob/master/LICENSE.md") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("Alex009") | ||
name.set("Aleksey Mikhailov") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("Tetraquark") | ||
name.set("Vladislav Areshkin") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("RezMike") | ||
name.set("Mikhail Reznichenko") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:ssh://github.com/icerockdev/moko-media.git") | ||
developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-media.git") | ||
url.set("https://github.com/icerockdev/moko-media") | ||
} | ||
} | ||
} | ||
|
||
apply(plugin = Deps.Plugins.signing.id) | ||
|
||
configure<SigningExtension> { | ||
val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") | ||
val signingPassword: String? = System.getenv("SIGNING_PASSWORD") | ||
val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> | ||
String(Base64.getDecoder().decode(base64Key)) | ||
} | ||
if (signingKeyId != null) { | ||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) | ||
sign(publications) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.register("clean", Delete::class).configure { | ||
|
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,18 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
plugins { | ||
plugin(Deps.Plugins.androidLibrary) | ||
plugin(Deps.Plugins.kotlinMultiplatform) | ||
plugin(Deps.Plugins.mobileMultiplatform) | ||
plugin(Deps.Plugins.mavenPublish) | ||
} | ||
|
||
dependencies { | ||
commonMainApi(project(":media")) | ||
|
||
androidMainImplementation(Deps.Libs.Android.appCompat) | ||
|
||
commonTestImplementation(Deps.Libs.Tests.mokoTest) | ||
} |
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,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="dev.icerock.moko.media.test"/> |
43 changes: 43 additions & 0 deletions
43
media-test/src/androidMain/kotlin/dev/icerock/moko/media/test/MediaPickerControllerMock.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,43 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import dev.icerock.moko.media.Bitmap | ||
import dev.icerock.moko.media.FileMedia | ||
import dev.icerock.moko.media.Media | ||
import dev.icerock.moko.media.picker.MediaPickerController | ||
import dev.icerock.moko.media.picker.MediaSource | ||
import dev.icerock.moko.permissions.PermissionsController | ||
|
||
actual open class MediaPickerControllerMock actual constructor( | ||
actual override val permissionsController: PermissionsController | ||
) : MediaPickerController { | ||
actual override suspend fun pickImage(source: MediaSource): Bitmap { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickImage( | ||
source: MediaSource, | ||
maxWidth: Int, | ||
maxHeight: Int | ||
): Bitmap { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickMedia(): Media { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickFiles(): FileMedia { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun bind( | ||
lifecycle: androidx.lifecycle.Lifecycle, | ||
fragmentManager: androidx.fragment.app.FragmentManager | ||
) { | ||
TODO("Not yet implemented") | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
media-test/src/androidMain/kotlin/dev/icerock/moko/media/test/createBitmapMock.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,23 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import dev.icerock.moko.media.Bitmap | ||
|
||
actual fun createBitmapMock(): Bitmap { | ||
return Bitmap(object : Bitmap.Delegate { | ||
override fun getAndroidBitmap(): android.graphics.Bitmap { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getByteArray(): ByteArray { | ||
return ByteArray(0) | ||
} | ||
|
||
override fun getResized(maxSize: Int): Bitmap { | ||
return createBitmapMock() | ||
} | ||
}) | ||
} |
65 changes: 65 additions & 0 deletions
65
media-test/src/commonMain/kotlin/dev/icerock/moko/media/test/MediaPickerControllerMock.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,65 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import dev.icerock.moko.media.Bitmap | ||
import dev.icerock.moko.media.FileMedia | ||
import dev.icerock.moko.media.Media | ||
import dev.icerock.moko.media.picker.MediaPickerController | ||
import dev.icerock.moko.media.picker.MediaSource | ||
import dev.icerock.moko.permissions.PermissionsController | ||
|
||
expect open class MediaPickerControllerMock constructor( | ||
permissionsController: PermissionsController | ||
) : MediaPickerController { | ||
override val permissionsController: PermissionsController | ||
|
||
override suspend fun pickImage(source: MediaSource): Bitmap | ||
override suspend fun pickImage( | ||
source: MediaSource, | ||
maxWidth: Int, | ||
maxHeight: Int | ||
): Bitmap | ||
|
||
override suspend fun pickMedia(): Media | ||
override suspend fun pickFiles(): FileMedia | ||
} | ||
|
||
fun createMediaPickerControllerMock( | ||
permissionsController: PermissionsController, | ||
galleryImageResult: Bitmap, | ||
cameraImageResult: Bitmap | ||
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) { | ||
override suspend fun pickImage(source: MediaSource): Bitmap { | ||
return source.result() | ||
} | ||
|
||
override suspend fun pickImage(source: MediaSource, maxWidth: Int, maxHeight: Int): Bitmap { | ||
return source.result() | ||
} | ||
|
||
private fun MediaSource.result() = when (this) { | ||
MediaSource.GALLERY -> galleryImageResult | ||
MediaSource.CAMERA -> cameraImageResult | ||
} | ||
} | ||
|
||
fun createMediaPickerControllerMock( | ||
permissionsController: PermissionsController, | ||
mediaResult: Media | ||
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) { | ||
override suspend fun pickMedia(): Media { | ||
return mediaResult | ||
} | ||
} | ||
|
||
fun createMediaPickerControllerMock( | ||
permissionsController: PermissionsController, | ||
fileMediaResult: FileMedia | ||
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) { | ||
override suspend fun pickFiles(): FileMedia { | ||
return fileMediaResult | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
media-test/src/commonMain/kotlin/dev/icerock/moko/media/test/createBitmapMock.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,9 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import dev.icerock.moko.media.Bitmap | ||
|
||
expect fun createBitmapMock(): Bitmap |
16 changes: 16 additions & 0 deletions
16
media-test/src/commonTest/kotlin/dev/icerock/moko/media/test/BitmapMockTests.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,16 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import kotlin.test.Test | ||
|
||
class BitmapMockTests { | ||
@Test | ||
fun `bitmap byte array`() { | ||
val bitmap = createBitmapMock() | ||
val byteArray = bitmap.toByteArray() | ||
// we should not throw any exceptions | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
media-test/src/iosMain/kotlin/dev/icerock/moko/media/test/MediaPickerControllerMock.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,36 @@ | ||
/* | ||
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.test | ||
|
||
import dev.icerock.moko.media.Bitmap | ||
import dev.icerock.moko.media.FileMedia | ||
import dev.icerock.moko.media.Media | ||
import dev.icerock.moko.media.picker.MediaPickerController | ||
import dev.icerock.moko.media.picker.MediaSource | ||
import dev.icerock.moko.permissions.PermissionsController | ||
|
||
actual open class MediaPickerControllerMock actual constructor( | ||
actual override val permissionsController: PermissionsController | ||
) : MediaPickerController { | ||
actual override suspend fun pickImage(source: MediaSource): Bitmap { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickImage( | ||
source: MediaSource, | ||
maxWidth: Int, | ||
maxHeight: Int | ||
): Bitmap { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickMedia(): Media { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
actual override suspend fun pickFiles(): FileMedia { | ||
TODO("Not yet implemented") | ||
} | ||
} |
Oops, something went wrong.