/multiplatform-payments-fe

This is Kotlin Multiplatform project to share Repository layer with iOS, Android and Web (React) apps

Primary LanguageKotlin

Multiplatform Ktor Repository Module

kotlin-version

Kotlin Multiplatform project with SwiftUI, Jetpack Compose, Compose for Wear OS, Compose for Desktop, Compose for Web, and Kotlin/JS + React clients along with Ktor backend. Currently running on

  • Android (Jetpack Compose)
  • iOS (Compose for iOS - experimental support!)
  • Web (Kotlin/JS + React Wrapper)

Overview

This Project provides Repository Layers that uses Ktor under the hood to provide networking and can be used in Web, iOS and Android platforms

Table of Contents

Features

The repo provides ApiGeeInteractor that does Authentication. Under the hood it calls PaymentsRepository

This repo currently is only a showcase for making only one API.

TODO: Make Generic Interactor that can work for all rest apis.

ALl three platform require some data by the library

host is needed only if you have same host for all apis

clientId and clientSecret are needed if you have Oauth call to get Token. If this data is given Repo layer will take care to token generation and expiry.

JS Platform

Use AppDependenciesContext and provide necessary data to Library

val appConfig = AppConfig(
            host = "",
            clientId = "",
            clientSecret = "")
        AppDependenciesContext.Provider(AppDependencies(appConfig)) {
            child(App)
        }

Android

Call initKoin in Android Apps Application class or in any component during app launch time.

initKoin ({
            androidLogger()
            modules(androidAppModule)
            // TODO provide valid host, clientID and clientSecret
        }, AppConfig("", "", ""))

iOS

@main
struct iOSApp: App {
    init() {
        HelperKt.doInitKoin()
    }
	var body: some Scene {
		WindowGroup {
			ContentView()
		}
	}
}

Getting Started

TODO

Prerequisites

Installation

# Clone the repository
git clone https://github.com/khalid64927/multiplatform-payments-fe.git

# Change into the project directory
cd multiplatform-payments-fe

# Build and run the project
./gradlew build

## Usage
Android

```bash
./gradlew :androidApp:installDebug

iOS

./gradlew :iosApp:installDebug

Web run below command to see demo JS app

./gradlew :web:browserDevelopmentRun

App will open your default web browser and load the page. Now open Web Developer tools and observe console logs you should see as below for successful authenticate call (remember to provide AppConfig values)

plot

run below command to see demo JS app to see instant changes you make

./gradlew :web:browserDevelopmentRun --continuous

To generate npm binary from shared module

./gradlew shared:packJsPackage

Libraries

Contributing

TODO

License

TODO

Changelog

TODO

Acknowledgments