-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into yamada-ika/run-test-on-mac
- Loading branch information
Showing
41 changed files
with
594 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app-ios/Sources/ContributorFeature/ContributorsCountItem.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import SwiftUI | ||
import Theme | ||
|
||
struct ContributorsCountItem: View { | ||
let totalContributor: Int | ||
let duration: Double = 1.0 | ||
@State private var tracker = 0 | ||
|
||
var body: some View { | ||
VStack(alignment: .leading) { | ||
|
||
Text(String(localized: "Total", bundle: .module)) | ||
.textStyle(.titleMedium) | ||
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
|
||
HStack { | ||
Text("\(tracker)") | ||
.textStyle(.headlineLarge) | ||
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) | ||
.onAppear() { | ||
animate() | ||
} | ||
|
||
Text(String(localized: "Person", bundle: .module)) | ||
.textStyle(.headlineSmall) | ||
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) | ||
} | ||
|
||
Spacer() | ||
.frame(height: 16) | ||
Divider() | ||
} | ||
} | ||
|
||
func animate() { | ||
let interval = duration / Double(totalContributor) | ||
Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { time in | ||
tracker += 1 | ||
if tracker == totalContributor { | ||
time.invalidate() | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
ContributorsCountItem(totalContributor: 112) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...in/kotlin/io/github/droidkaigi/confsched/droidkaigiui/KaigiAppCompositionLocalProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.droidkaigi.confsched.droidkaigiui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.ProvidedValue | ||
|
||
@Composable | ||
inline fun KaigiAppCompositionLocalProvider( | ||
vararg locals: ProvidedValue<*>, | ||
crossinline content: @Composable () -> Unit, | ||
) { | ||
CompositionLocalProvider(*locals) { | ||
if (isTest()) { | ||
ProvideAndroidContextToComposeResource() | ||
} | ||
content() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...lin/io/github/droidkaigi/confsched/droidkaigiui/ProvideAndroidContextToComposeResource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.github.droidkaigi.confsched.droidkaigiui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.platform.LocalInspectionMode | ||
import org.jetbrains.compose.resources.ExperimentalResourceApi | ||
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect | ||
|
||
@OptIn(ExperimentalResourceApi::class) | ||
@Composable | ||
fun ProvideAndroidContextToComposeResource() { | ||
CompositionLocalProvider(LocalInspectionMode provides true) { | ||
PreviewContextConfigurationEffect() | ||
} | ||
} |
Oops, something went wrong.