Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb committed Aug 23, 2023
1 parent 5b005ad commit 2e709a8
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 514 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ Calf is a library that allows you to easily create adaptive UIs for your Compose
[![BuildPassing](https://shields.io/badge/build-passing-brightgreen)](https://github.com/MohamedRejeb/ksoup/actions)
[![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.calf/calf-ui)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.calf%22%20AND%20a:%calf-ui%22)

## Artifacts

| Artifact | Description | Platforms | Version |
|-----------------------|--------------------------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **calf-ui** | Adaptive UI components | Android, iOS, Desktop | [![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.calf/calf-ui)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.calf%22%20AND%20a:%calf-ui%22) |
| **calf-file-picker** | Native File Picker wrapper | Android, iOS, Desktop | [![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.calf/calf-file-picker)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.calf%22%20AND%20a:%calf-file-picker%22) |
| **calf-navigation** | Native navigation wrapper | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |
| **calf-map** | Native Maps wrapper | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |
| **calf-media** | Video/Audio player | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |
| **calf-permissions** | API allows you to handle permissions | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |
| **calf-notification** | Notification manager | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |
| **calf-sf-symbols** | Apple SF Symbols icons | Coming soon... 🚧 🚧 | Coming soon... 🚧 🚧 |

## Installation

[![Maven Central](https://img.shields.io/maven-central/v/com.mohamedrejeb.calf/calf-ui)](https://search.maven.org/search?q=g:%22com.mohamedrejeb.calf%22%20AND%20a:%calf-ui%22)
Expand All @@ -25,7 +38,7 @@ implementation("com.mohamedrejeb.calf:calf-file-picker:0.1.0")

If you are using `calf-ui` artifact, make sure to export it to binaries:

### Regular Framewoek
#### Regular Framewoek
```kotlin
...
kotlin {
Expand All @@ -44,7 +57,7 @@ kotlin {
...
```

### CocoaPods
#### CocoaPods
```kotlin
...
kotlin {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
// id("root.publication")
// id("module.publication")
id("root.publication")
id("module.publication")
//trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidApplication).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import com.mohamedrejeb.calf.io.KmpFile

@Composable
expect fun rememberFilePickerLauncher(
type: FilePickerType = FilePickerType.Any,
type: FilePickerFileType = FilePickerFileType.All,
selectionMode: FilePickerSelectionMode = FilePickerSelectionMode.Single,
onResult: (List<KmpFile>) -> Unit,
): FilePickerLauncher

sealed class FilePickerType(vararg val value: String) {
data object Image: FilePickerType("image/*")
data object Video: FilePickerType("video/*")
data object ImageVideo: FilePickerType("image/*", "video/*")
data object Any: FilePickerType("*/*")
sealed class FilePickerFileType(vararg val value: String) {
data object Image: FilePickerFileType("image/*")
data object Video: FilePickerFileType("video/*")
data object ImageVideo: FilePickerFileType("image/*", "video/*")
data object All: FilePickerFileType("*/*")
}

sealed class FilePickerSelectionMode {
Expand All @@ -23,8 +23,8 @@ sealed class FilePickerSelectionMode {
}

expect class FilePickerLauncher(
type: FilePickerType = FilePickerType.Any,
selectionMode: FilePickerSelectionMode = FilePickerSelectionMode.Single,
type: FilePickerFileType,
selectionMode: FilePickerSelectionMode,
onLaunch: () -> Unit,
) {
fun launch()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
package com.mohamedrejeb.calf.picker

import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import com.mohamedrejeb.calf.io.KmpFile
import kotlinx.cinterop.BetaInteropApi
import kotlinx.cinterop.ObjCClass
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import platform.Foundation.NSItemProviderReadingProtocol
import platform.Photos.PHPhotoLibrary
import platform.PhotosUI.*
import platform.UIKit.UIApplication
import platform.UIKit.UIImage
import platform.UIKit.registerForRemoteNotifications
import platform.UniformTypeIdentifiers.UTType
import platform.UniformTypeIdentifiers.UTTypeImage
import platform.UniformTypeIdentifiers.UTTypeMovie
import platform.UserNotifications.*
import platform.darwin.DISPATCH_QUEUE_CONCURRENT
import platform.darwin.NSObject

@BetaInteropApi
@Composable
actual fun rememberFilePickerLauncher(
type: FilePickerType,
type: FilePickerFileType,
selectionMode: FilePickerSelectionMode,
onResult: (List<KmpFile>) -> Unit,
): FilePickerLauncher {
Expand Down Expand Up @@ -88,7 +79,7 @@ private fun createPHPickerViewController(
}

actual class FilePickerLauncher actual constructor(
type: FilePickerType,
type: FilePickerFileType,
selectionMode: FilePickerSelectionMode,
private val onLaunch: () -> Unit,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import com.mohamedrejeb.calf.io.KmpFile
@Composable
actual fun rememberFilePickerLauncher(
type: FilePickerType,
type: FilePickerFileType,
selectionMode: FilePickerSelectionMode,
onResult: (List<KmpFile>) -> Unit,
): FilePickerLauncher {
Expand All @@ -24,7 +24,7 @@ actual fun rememberFilePickerLauncher(
}

actual class FilePickerLauncher actual constructor(
type: FilePickerType,
type: FilePickerFileType,
selectionMode: FilePickerSelectionMode,
private val onLaunch: () -> Unit,
) {
Expand Down
2 changes: 1 addition & 1 deletion calf-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
// id("module.publication")
id("module.publication")
}

kotlin {
Expand Down
Loading

0 comments on commit 2e709a8

Please sign in to comment.