Skip to content

Commit

Permalink
Add Tag manager screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryOkafor committed Jun 13, 2024
1 parent 47085db commit 7946ff2
Show file tree
Hide file tree
Showing 84 changed files with 2,457 additions and 1,112 deletions.
31 changes: 21 additions & 10 deletions .fleet/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@
},
{
"name": "iosApp",
"type": "xcode-app",
"workingDir": "$PROJECT_DIR$",
"buildTarget": {
"project": "iosApp",
"target": "iosApp"
},
"configuration": "Debug",
"destination": "iPhone (2)"
"type": "command",
"workingDir": "$PROJECT_DIR$/iosApp/",
"program": "xcodebuild",
"args": [
"-workspace",
"$PROJECT_DIR$/iosApp/iosApp.xcworkspace",
"-scheme",
"iosApp",
"-configuration",
"Debug",
"OBJROOT=$PROJECT_DIR$/build/ios",
"SYMROOT=$PROJECT_DIR$/build/ios",
"-destination",
"platform=iOS,name=iPhone (2)",
"-allowProvisioningDeviceRegistration",
"-allowProvisioningUpdates",
"install"
]
},
{
"name": "composeApp [Desktop]",
Expand All @@ -27,7 +37,7 @@
"desktopRun"
],
"args": [
"-DmainClass=MainKt",
"-DmainClass=com.jerryokafor.smshare.MainKt",
"--quiet",
"-p",
"$PROJECT_DIR$/composeApp"
Expand All @@ -46,4 +56,5 @@
],
},
]
}
}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ captures
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
/.env
/iosApp/Pods
/secrets.properties
21 changes: 21 additions & 0 deletions LICENSE.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 SMShare Project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ on [GitHub](https://github.com/JetBrains/compose-multiplatform/issues).
[Jetpack Room KMP](https://johnoreilly.dev/posts/jetpack_room_kmp/)
[Advanced work with the Snackbar in the Jetpack Compose](https://proandroiddev.com/advanced-work-with-the-snackbar-in-the-jetpack-compose-9bb7b7a30d60)
[FantasyPremierLeague](https://github.com/joreilly/FantasyPremierLeague/tree/main)
[Tivi](https://github.com/chrisbanes/tivi)
[Tivi](https://github.com/chrisbanes/tivi)
[Compose Custom Window frame](https://github.com/amir1376/compose-custom-window-frame)
[Targeting Android in KMP](https://medium.com/kodein-koders/targeting-android-in-a-kotlin-multiplatform-mobile-library-b6ab75469287)
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ plugins {
// alias(libs.plugins.kotlinx.rpc) apply false
// alias(libs.plugins.kotlinx.rpc.platform) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.buildKonfig) apply false
}
3 changes: 2 additions & 1 deletion composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat


plugins {
alias(libs.plugins.kotlinMultiplatform)
id("com.jerryokafor.smshare.android.application")
Expand Down Expand Up @@ -64,6 +63,7 @@ kotlin {
implementation(projects.core.domain)
implementation(projects.core.datastore)
implementation(projects.core.database)
implementation(projects.core.config)

implementation(compose.runtime)
implementation(compose.foundation)
Expand Down Expand Up @@ -152,6 +152,7 @@ android {
}
dependencies {
implementation(libs.androidx.material3.android)
implementation(project(":core:config"))
}

compose.desktop {
Expand Down
1 change: 1 addition & 0 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:theme="@style/Theme.SMShare.Splash">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:exported="true">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* MIT License
*
* Copyright (c) 2024 SM Share Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.jerryokafor.smshare

import android.content.Context
Expand All @@ -10,7 +34,11 @@ import com.jerryokafor.smshare.channel.ChannelConfig
import java.net.URLEncoder

class AndroidChannelAuthManager(private val context: Context) : ChannelAuthManager {
override var currentChannelConfig: ChannelConfig? = null

override suspend fun authenticateUser(channelConfig: ChannelConfig) {
currentChannelConfig = channelConfig

val redirectUrl = getRedirectUrl()
val challenge = getChallenge()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* MIT License
*
* Copyright (c) 2024 SM Share Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.jerryokafor.smshare

import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.tooling.preview.Preview
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.util.Consumer
import androidx.lifecycle.lifecycleScope
import com.jerryokafor.smshare.channel.ChannelAuthManager
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject

class MainActivity : ComponentActivity() {
private val appViewModel: AppViewModel by inject()

override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
splashScreen.setKeepOnScreenCondition { true }
enableEdgeToEdge()
setContent {
val isDarkTheme = isSystemInDarkTheme()

DisposableEffect(isDarkTheme) {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(
lightScrim = Color.TRANSPARENT,
darkScrim = Color.TRANSPARENT,
) { resources -> isDarkTheme },
navigationBarStyle = SystemBarStyle.auto(
lightScrim = lightScrim,
darkScrim = darkScrim,
) { resources -> isDarkTheme },
)
onDispose {}
}

App(
viewModel = appViewModel,
isDarkTheme = isDarkTheme,
onAppReady = {
splashScreen.setKeepOnScreenCondition { false }
})

DisposableEffect(Unit) {
val listener = Consumer<Intent> {
Log.d("Testing: ", "Intent: $it")
val data: Uri? = it.data
when (val path = data?.path) {
"/auth/callback" -> {
// create session id here
val code = data.getQueryParameter("code")!!
val state = data.getQueryParameter("state")
appViewModel.authenticateChannel(code,state)
}
}
}

addOnNewIntentListener(listener)

onDispose {
removeOnNewIntentListener(listener)
}
}
}
}
}

@Preview
@Composable
fun AppAndroidPreview() {
App()
}

@Suppress("MagicNumber")
private val lightScrim = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)

@Suppress("MagicNumber")
private val darkScrim = Color.argb(0x80, 0x1b, 0x1b, 0x1b)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.jerryokafor.smshare.injection

import android.app.Application
import com.jerryokafor.core.database.androidDBModule
import com.jerryokafor.core.datastore.androidDataStoreModule
import com.jerryokafor.smshare.AndroidChannelAuthManager
import com.jerryokafor.smshare.channel.ChannelAuthManager
import com.jerryokafor.smshare.core.network.util.injection.commonAndroidNetworkModules
import com.jerryokafor.smshare.platform.Platform
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module

fun androidModules(app: Application) = module {
includes(
androidDataStoreModule(app),
androidDBModule(app),
commonAndroidNetworkModules(app)
)

single { Platform() }
single<ChannelAuthManager> { AndroidChannelAuthManager(androidContext()) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* MIT License
*
* Copyright (c) 2024 SM Share Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.jerryokafor.smshare.platform

import android.os.Build

actual class Platform {
actual val type: SupportedPlatformType
get() = SupportedPlatformType.Android
actual val name: String
get() = "Android ${Build.VERSION.SDK_INT}"
}
Loading

0 comments on commit 7946ff2

Please sign in to comment.