Skip to content

Commit

Permalink
Add Android app
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-ramotar committed May 3, 2024
1 parent a41766e commit 3b2f61f
Show file tree
Hide file tree
Showing 40 changed files with 152 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package org.mobilenativefoundation.market

import kotlinx.coroutines.CoroutineDispatcher
import org.mobilenativefoundation.market.impl.MarketActionFactory
import org.mobilenativefoundation.market.impl.RealMarketSupplier
import org.mobilenativefoundation.store.store5.Store

interface MarketSupplier<K : Any> {
fun supply(key: K)

companion object {
fun <K : Any, O : Any, A : Market.Action, D : Market.Dispatcher<A>> from(
coroutineDispatcher: CoroutineDispatcher,
store: Store<K, O>,
marketDispatcher: D,
marketActionFactory: MarketActionFactory<O, A>
): MarketSupplier<K> {
return RealMarketSupplier(coroutineDispatcher, store, marketDispatcher, marketActionFactory)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.mobilenativefoundation.market.MarketSupplier
import org.mobilenativefoundation.store.store5.Store
import org.mobilenativefoundation.store.store5.impl.extensions.fresh

class RealMarketSupplier<K : Any, O : Any, A : Market.Action, D : Market.Dispatcher<A>>(
internal class RealMarketSupplier<K : Any, O : Any, A : Market.Action, D : Market.Dispatcher<A>>(
coroutineDispatcher: CoroutineDispatcher,
private val store: Store<K, O>,
private val marketDispatcher: D,
Expand Down
50 changes: 50 additions & 0 deletions experimental/sample/scoop/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
plugins {
id("plugin.scoop.android.application")
alias(libs.plugins.ksp)
alias(libs.plugins.compose)
}

android {
namespace = "monster.scoop.android.app"

defaultConfig {
applicationId = "monster.scoop"
versionCode = 1
versionName = "1.0"
}

packaging {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
excludes.add("/META-INF/versions/9/previous-compilation-data.bin")
}
}
}


dependencies {

implementation(compose.runtime)
implementation(compose.material3)
implementation(libs.androidx.appCompat)
implementation(libs.androidx.compose.activity)
implementation(libs.androidx.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinInject.runtime)
implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.json)
api(libs.circuit.foundation)

ksp(libs.kotlinInject.compiler)
implementation(libs.coil.compose)
implementation(libs.coil.network)
implementation(libs.ktor.client.android)
implementation(libs.ktor.serialization.json)
implementation(libs.ktor.negotiation)

implementation(libs.compose.webview.multiplatform)
}

ksp {
arg("me.tatarka.inject.generateCompanionExtensions", "true")
}
29 changes: 29 additions & 0 deletions experimental/sample/scoop/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest

xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
android:name=".ScoopApp"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:label="Scoop"
android:supportsRtl="true"
android:theme="@style/Theme.Scoop"
android:usesCleartextTraffic="true">

<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package monster.scoop.android.app

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.ExperimentalMaterial3Api
import coil3.annotation.ExperimentalCoilApi
import me.tatarka.inject.annotations.Inject


@OptIn(ExperimentalCoilApi::class, ExperimentalMaterial3Api::class)
@Inject
class MainActivity : ComponentActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContent {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package monster.scoop.android.app

import android.app.Application


class ScoopApp : Application()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Scoop" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowSplashScreenBackground">@color/ic_launcher_background</item>
</style>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#232428</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Scoop" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowSplashScreenBackground">@color/ic_launcher_background</item>
</style>
</resources>
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ include ':experimental:sample:scoop:xplat:foundation:networking:api'
include ':experimental:sample:scoop:xplat:foundation:networking:impl'
include ':experimental:sample:scoop:xplat:common:market'
include ':experimental:sample:scoop:xplat:domain:story:api'
include ':experimental:sample:scoop:xplat:domain:story:impl'
include ':experimental:sample:scoop:xplat:domain:story:impl'
include ':experimental:sample:scoop:android:app'

0 comments on commit 3b2f61f

Please sign in to comment.