Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS support and target apps #601

Merged
merged 55 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8cedcab
Added iOS implementation in demos-interactions
Jun 30, 2023
877227d
Added BackStackParallax to iOS sample
Jun 30, 2023
5f9e68b
WIP: Adding BackStackParallax iOS sample
Jul 1, 2023
7db9dbf
Added ZIndex to BackStackParallax
Jul 3, 2023
f3f47c8
Updated module summary
Jul 26, 2023
c8c488d
Merge branch '2.x' into ios-samples
Jul 28, 2023
d54118b
WIP: Running Sample App
Jul 31, 2023
5533c95
Reverted color
Jul 31, 2023
78cf9b2
Implemented UUID, SystemClock and Logging for iOS
Jul 31, 2023
2770260
Added theme directory and using AppyxTheme
Jul 31, 2023
87aebc5
Merge branch '2.x' into ios-samples
Aug 16, 2023
e3d0780
Added iOS implementations for expect functions
Aug 16, 2023
f624da8
Supporting ios for appyx-navigation
Aug 23, 2023
de3a0a2
Added ios implementation for appyx-navigation
Aug 30, 2023
845bdb8
Running appyx-navigation on ios
Sep 6, 2023
a1110c8
Only having ios target and removed common + android submodules
Sep 6, 2023
9e66196
Not having PlatformLifecycleRegistery as open
Sep 6, 2023
1a7ad4b
Removed Android and common submodules for appyx-interactions iOS target
Sep 6, 2023
4e54211
Adding expect to Android PlatformLifecycleRegistry
Sep 6, 2023
fa56c4a
Added back icon
Sep 7, 2023
818ad5d
Renamed package
Sep 11, 2023
183329d
Merge branch '2.x' into ios-samples
Sep 12, 2023
4e0a72f
Added convention plugin to ios modules
Sep 12, 2023
74324c3
Added back support for iOS navigation
Sep 13, 2023
05e6f83
Merge branch '2.x' into ios-samples
Sep 18, 2023
9393e85
Black background for insets
aashay-gaikwad Sep 18, 2023
f6491fd
Updated documentation depicting usage of IOSNodeHost
aashay-gaikwad Sep 18, 2023
8813455
Updated AppIcon and setting top padding to scaffold
aashay-gaikwad Sep 21, 2023
feb64bd
Cleaning ios appyx-interactions sample
aashay-gaikwad Sep 21, 2023
98137ed
Renamed IosNodeHost
aashay-gaikwad Sep 21, 2023
4f2936b
Revert change
aashay-gaikwad Sep 21, 2023
f36aa77
Updated changelog
aashay-gaikwad Sep 21, 2023
c3af4bb
Updated doc
aashay-gaikwad Sep 21, 2023
0efed6d
Clarified back behaviour on documentation
aashay-gaikwad Sep 21, 2023
54b28fe
Added content description to back button
aashay-gaikwad Sep 21, 2023
7fe77da
Cleaning
aashay-gaikwad Sep 21, 2023
70fe7ff
Merge branch '2.x' into ios-samples
aashay-gaikwad Sep 21, 2023
c0a1731
Renaming
aashay-gaikwad Sep 21, 2023
e9d8ff3
Merge remote-tracking branch 'origin/ios-samples' into ios-samples
Sep 21, 2023
535b001
Added detekt for ios code and fixed issues
aashay-gaikwad Sep 21, 2023
55d56ca
Updated gitignore
aashay-gaikwad Sep 21, 2023
a7cb394
Update demos/appyx-navigation/ios/build.gradle.kts
aashay-gaikwad Sep 25, 2023
57be977
Update demos/appyx-navigation/ios/ios.podspec
aashay-gaikwad Sep 25, 2023
313a209
Update demos/appyx-navigation/ios/build.gradle.kts
aashay-gaikwad Sep 25, 2023
bee88a6
Removed unnecessary deps
aashay-gaikwad Sep 25, 2023
2c4e4eb
Merge remote-tracking branch 'origin/ios-samples' into ios-samples
Sep 25, 2023
5f6cb23
Update demos/appyx-interactions/ios/src/iosMain/kotlin/BackStackParal…
aashay-gaikwad Sep 25, 2023
3b37883
Removed casting backStack as BaseAppyxComponent
aashay-gaikwad Sep 25, 2023
9de1055
Updated Changelog
aashay-gaikwad Sep 25, 2023
378e881
Update demos/appyx-navigation/ios/ios.podspec
aashay-gaikwad Sep 25, 2023
0f8922c
Update demos/appyx-navigation/ios/ios.podspec
aashay-gaikwad Sep 25, 2023
881734c
Setting alphabetical order
aashay-gaikwad Sep 25, 2023
d664f1d
Added license to podspec
aashay-gaikwad Sep 25, 2023
60bda2d
Updated AppIcon for iOS
aashay-gaikwad Sep 25, 2023
7ee043b
Passing viewController to iOS integration point and popping/dismissing
aashay-gaikwad Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ build/
local.properties
site/
__pycache__
iosApp/Podfile.lock
**/iosApp/Pods/*
**/iosApp/iosApp.xcworkspace/*
**/iosApp/iosApp.xcodeproj/*
!**/iosApp/iosApp.xcodeproj/project.pbxproj
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
### Added

- [#579](https://github.com/bumble-tech/appyx/pull/579) – Expose `AndroidLifecycle` in `PlatformLifecycleRegistry` for Android
- [#601](https://github.com/bumble-tech/appyx/pull/601) – iOS support and target apps

### Fixed

Expand Down
15 changes: 15 additions & 0 deletions appyx-components/experimental/cards/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ kotlin {
moduleName = "appyx-components-experimental-cards-commons"
browser()
}
iosX64()
iosArm64()
iosSimulatorArm64()
sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -41,6 +44,15 @@ kotlin {
}
val androidMain by getting
val desktopMain by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand All @@ -49,4 +61,7 @@ dependencies {
add("kspAndroid", project(":ksp:mutable-ui-processor"))
add("kspDesktop", project(":ksp:mutable-ui-processor"))
add("kspJs", project(":ksp:mutable-ui-processor"))
add("kspIosArm64", project(":ksp:mutable-ui-processor"))
add("kspIosX64", project(":ksp:mutable-ui-processor"))
add("kspIosSimulatorArm64", project(":ksp:mutable-ui-processor"))
}
15 changes: 15 additions & 0 deletions appyx-components/experimental/modal/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ kotlin {
moduleName = "appyx-components-modal-commons"
browser()
}
iosX64()
iosArm64()
iosSimulatorArm64()
sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -46,6 +49,15 @@ kotlin {
}
}
val desktopMain by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand All @@ -54,4 +66,7 @@ dependencies {
add("kspAndroid", project(":ksp:mutable-ui-processor"))
add("kspDesktop", project(":ksp:mutable-ui-processor"))
add("kspJs", project(":ksp:mutable-ui-processor"))
add("kspIosArm64", project(":ksp:mutable-ui-processor"))
add("kspIosX64", project(":ksp:mutable-ui-processor"))
add("kspIosSimulatorArm64", project(":ksp:mutable-ui-processor"))
}
15 changes: 15 additions & 0 deletions appyx-components/experimental/promoter/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ kotlin {
moduleName = "appyx-components-experimental-promoter-commons"
browser()
}
iosX64()
iosArm64()
iosSimulatorArm64()
sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -42,6 +45,15 @@ kotlin {
}
val androidMain by getting
val desktopMain by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand All @@ -50,4 +62,7 @@ dependencies {
add("kspAndroid", project(":ksp:mutable-ui-processor"))
add("kspDesktop", project(":ksp:mutable-ui-processor"))
add("kspJs", project(":ksp:mutable-ui-processor"))
add("kspIosArm64", project(":ksp:mutable-ui-processor"))
add("kspIosX64", project(":ksp:mutable-ui-processor"))
add("kspIosSimulatorArm64", project(":ksp:mutable-ui-processor"))
}
18 changes: 18 additions & 0 deletions appyx-components/stable/backstack/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ kotlin {
moduleName = "appyx-components-stable-backstack-commons"
browser()
}

iosX64()
iosArm64()
iosSimulatorArm64()

sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -42,6 +47,16 @@ kotlin {
val androidMain by getting
val desktopMain by getting
val jsMain by getting

val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand All @@ -50,4 +65,7 @@ dependencies {
add("kspAndroid", project(":ksp:mutable-ui-processor"))
add("kspDesktop", project(":ksp:mutable-ui-processor"))
add("kspJs", project(":ksp:mutable-ui-processor"))
add("kspIosArm64", project(":ksp:mutable-ui-processor"))
add("kspIosX64", project(":ksp:mutable-ui-processor"))
add("kspIosSimulatorArm64", project(":ksp:mutable-ui-processor"))
}
18 changes: 18 additions & 0 deletions appyx-components/stable/spotlight/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ kotlin {
moduleName = "appyx-components-stable-spotlight-commons"
browser()
}

iosX64()
iosArm64()
iosSimulatorArm64()

sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -45,6 +50,16 @@ kotlin {
}
}
val desktopMain by getting

val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand All @@ -53,4 +68,7 @@ dependencies {
add("kspAndroid", project(":ksp:mutable-ui-processor"))
add("kspDesktop", project(":ksp:mutable-ui-processor"))
add("kspJs", project(":ksp:mutable-ui-processor"))
add("kspIosArm64", project(":ksp:mutable-ui-processor"))
add("kspIosX64", project(":ksp:mutable-ui-processor"))
add("kspIosSimulatorArm64", project(":ksp:mutable-ui-processor"))
}
15 changes: 15 additions & 0 deletions appyx-interactions/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ kotlin {
moduleName = "appyx-interactions-common"
browser()
}

iosX64()
iosArm64()
iosSimulatorArm64()

sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -62,5 +67,15 @@ kotlin {
implementation(npm("uuid", libs.versions.uuid.get()))
}
}

val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.bumble.appyx.interactions

import platform.CoreFoundation.CFAbsoluteTimeGetCurrent

actual object SystemClock {

actual fun nanoTime(): Long = CFAbsoluteTimeGetCurrent().toLong()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.bumble.appyx.interactions

import platform.Foundation.NSUUID

actual object UUID {

actual fun randomUUID(): String = NSUUID().UUIDString()

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.bumble.appyx.interactions

actual fun getPlatformName(): String {
return "iOS"
}
14 changes: 14 additions & 0 deletions appyx-navigation/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ kotlin {
moduleName = "appyx-navigation-common"
browser()
}

iosX64()
iosArm64()
iosSimulatorArm64()

sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -62,6 +67,15 @@ kotlin {
implementation(npm("uuid", libs.versions.uuid.get()))
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import androidx.compose.runtime.Composable

@Composable
expect fun PlatformBackHandler(
enabled: Boolean = true,
enabled: Boolean,
onBack: () -> Unit
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.bumble.appyx.navigation.integration

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.bumble.appyx.navigation.integrationpoint.IntegrationPoint
import com.bumble.appyx.navigation.node.Node
import com.bumble.appyx.navigation.platform.LocalOnBackPressedDispatcherOwner
import com.bumble.appyx.navigation.platform.OnBackPressedDispatcher
import com.bumble.appyx.navigation.platform.OnBackPressedDispatcherOwner
import com.bumble.appyx.navigation.platform.PlatformLifecycleRegistry
import com.bumble.appyx.utils.customisations.NodeCustomisationDirectory
import com.bumble.appyx.utils.customisations.NodeCustomisationDirectoryImpl
import kotlinx.cinterop.useContents
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import platform.UIKit.UIScreen

@Suppress("ComposableParamOrder") // detekt complains as 'factory' param isn't a pure lambda
@Composable
fun <N : Node> IosNodeHost(
onBackPressedEvents: Flow<Unit>,
modifier: Modifier = Modifier,
integrationPoint: IntegrationPoint,
customisations: NodeCustomisationDirectory = remember { NodeCustomisationDirectoryImpl() },
factory: NodeFactory<N>,
) {
val platformLifecycleRegistry = remember {
PlatformLifecycleRegistry()
}
val mainScreen = UIScreen.mainScreen
val screenBounds = mainScreen.bounds

// Calculate the width and height in dp
val dpWidth = screenBounds.useContents { size.width }.pixelsToDp()
val dpHeight = screenBounds.useContents { size.height }.pixelsToDp()

val onBackPressedDispatcherOwner = remember {
object : OnBackPressedDispatcherOwner {
override val onBackPressedDispatcher: OnBackPressedDispatcher =
OnBackPressedDispatcher { integrationPoint.handleUpNavigation() }
}
}

val scope = rememberCoroutineScope()
LaunchedEffect(onBackPressedEvents) {
scope.launch {
onBackPressedEvents.collect {
onBackPressedDispatcherOwner.onBackPressedDispatcher.onBackPressed()
}
}
}

CompositionLocalProvider(LocalOnBackPressedDispatcherOwner provides onBackPressedDispatcherOwner) {
NodeHost(
lifecycle = platformLifecycleRegistry,
integrationPoint = integrationPoint,
modifier = modifier,
customisations = customisations,
screenSize = ScreenSize(
widthDp = dpWidth.dp,
heightDp = dpHeight.dp,
),
factory = factory,
)
}
}

private fun Double.pixelsToDp(): Double {
val mainScreen = UIScreen.mainScreen
val scale = mainScreen.scale
return this / scale
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.bumble.appyx.navigation.integration

import com.bumble.appyx.navigation.integrationpoint.IntegrationPoint
import platform.UIKit.UIViewController
import platform.UIKit.navigationController

class MainIntegrationPoint: IntegrationPoint() {
private lateinit var viewController: UIViewController

override val isChangingConfigurations: Boolean
get() = false

fun setViewController(viewController: UIViewController) {
this.viewController = viewController
}

override fun onRootFinished() {
viewController.dismissModalViewControllerAnimated(false)
}

override fun handleUpNavigation() {
viewController.navigationController?.popViewControllerAnimated(false)
}
}
Loading