From 5055c37843265e466b9fb3deeef87415930cbd8d Mon Sep 17 00:00:00 2001 From: Sin-Kang Date: Thu, 19 Nov 2026 03:54:57 +0900 Subject: [PATCH] feat(android): DdsSocialSignIn chooses how many methods show inline (0.12.0) primaryLimit (positive) sets how many sign-in methods sit on the screen; the rest stay in the sheet. The existing overloads keep three. --- android/CHANGELOG.ko.md | 7 +++++ android/CHANGELOG.md | 7 +++++ android/README.ko.md | 2 +- android/README.md | 2 +- .../devslab/dds/compose/ScreenReaderTest.kt | 16 ++++++----- .../kr/devslab/dds/compose/component/Auth.kt | 27 +++++++++++-------- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/android/CHANGELOG.ko.md b/android/CHANGELOG.ko.md index a91f37c..eddaf76 100644 --- a/android/CHANGELOG.ko.md +++ b/android/CHANGELOG.ko.md @@ -5,6 +5,13 @@ `kr.devslab:dds-android-tokens`, `kr.devslab:dds-compose`, 그리고 0.7.0부터 `kr.devslab:dds-compose-testing`은 한 버전을 쓰고, 웹 패키지와는 버전이 따로다(D-048). 릴리스는 `android-v<버전>` 태그로 낸다. +## 0.12.0 — 2026-11-19 + +**새 기능** + +- **`DdsSocialSignIn(primaryLimit = …)`** — 화면에 바로 보일 로그인 수단 개수를 정한다. 나머지는 시트에 남는다. 기존 + 호출의 기본값은 그대로 3이고, 1보다 작은 값은 거부한다. + ## 0.11.1 — 2026-11-18 **고침** diff --git a/android/CHANGELOG.md b/android/CHANGELOG.md index a662898..f0160e4 100644 --- a/android/CHANGELOG.md +++ b/android/CHANGELOG.md @@ -5,6 +5,13 @@ `kr.devslab:dds-android-tokens`, `kr.devslab:dds-compose` and (from 0.7.0) `kr.devslab:dds-compose-testing` share one version, separate from the web packages (D-048). Releases are cut by an `android-v` tag. +## 0.12.0 — 2026-11-19 + +**New** + +- **`DdsSocialSignIn(primaryLimit = …)`** chooses how many methods show inline; the rest stay in the sheet. Three remains + the default for the existing overloads, and a limit below one is rejected. + ## 0.11.1 — 2026-11-18 **Fixed** diff --git a/android/README.ko.md b/android/README.ko.md index 5b7e2d0..664dc6c 100644 --- a/android/README.ko.md +++ b/android/README.ko.md @@ -74,7 +74,7 @@ mavenLocal { content { includeGroup("kr.devslab") } } ## 소셜 로그인 선택 UI -`DdsSocialSignIn`은 앱이 연결한 제공자를 전달받아 순서대로 표시한다. 처음 세 수단은 화면에 표시하고 나머지는 ‘다른 로그인 방법’ 시트에서 고를 수 있다. 앱은 각 버튼의 현지화된 문구를 지정한다. DDS가 제공자 로고를 표시하며 `DdsSignInMethod.icon`으로 앱의 에셋을 지정할 수 있다. 인증을 시작할 때 `onSelect`에서 선택한 제공자 ID를 받는다. +`DdsSocialSignIn`은 앱이 연결한 제공자를 전달받아 순서대로 표시한다. 처음 세 수단은 화면에 표시하고 나머지는 ‘다른 로그인 방법’ 시트에서 고를 수 있다. 화면에 보일 개수를 바꾸려면 `primaryLimit`(1 이상)을 넘긴다. 앱은 각 버튼의 현지화된 문구를 지정한다. DDS가 제공자 로고를 표시하며 `DdsSignInMethod.icon`으로 앱의 에셋을 지정할 수 있다. 인증을 시작할 때 `onSelect`에서 선택한 제공자 ID를 받는다. ```kotlin DdsSocialSignIn( diff --git a/android/README.md b/android/README.md index 734a251..55e4f14 100644 --- a/android/README.md +++ b/android/README.md @@ -74,7 +74,7 @@ mavenLocal { content { includeGroup("kr.devslab") } } ## Social sign-in options -Pass the app's supported methods to `DdsSocialSignIn` in display order. It shows the first three and offers the remaining methods in a sheet. Each method takes a localized label. DDS draws the bundled brand mark by default, and `DdsSignInMethod.icon` accepts app-provided artwork. `onSelect` provides the public provider ID through the selected `DdsSocialProvider`. +Pass the app's supported methods to `DdsSocialSignIn` in display order. It shows the first three and offers the remaining methods in a sheet. Pass `primaryLimit` to show a different number inline (it must be positive). Each method takes a localized label. DDS draws the bundled brand mark by default, and `DdsSignInMethod.icon` accepts app-provided artwork. `onSelect` provides the public provider ID through the selected `DdsSocialProvider`. ```kotlin DdsSocialSignIn( diff --git a/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt b/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt index c492b21..ff0bfe6 100644 --- a/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt +++ b/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt @@ -142,9 +142,11 @@ class ScreenReaderTest { DdsSignInMethod(DdsSocialProvider.Google, "Google"), DdsSignInMethod(DdsSocialProvider.Kakao, "Kakao"), DdsSignInMethod(DdsSocialProvider.Line, "LINE"), + DdsSignInMethod(DdsSocialProvider.Microsoft, "Microsoft"), DdsSignInMethod(DdsSocialProvider.Slack, "Slack", enabled = false), ), onSelect = { attempts.add(it); pending = it }, + primaryLimit = 4, pending = pending, customization = DdsSocialSignInCustomization( expanded = expanded, @@ -164,21 +166,21 @@ class ScreenReaderTest { ), ) } - rule.onNodeWithText("Main: Kakao").assertExists() - rule.onNodeWithText("Additional: LINE").assertDoesNotExist() + rule.onNodeWithText("Main: LINE").assertExists() + rule.onNodeWithText("Additional: Microsoft").assertDoesNotExist() rule.onNodeWithText("More methods").performClick() rule.onNodeWithText("Additional: Slack").assertIsNotEnabled() - rule.onNodeWithText("Additional: LINE").performClick() + rule.onNodeWithText("Additional: Microsoft").performClick() rule.onNodeWithText("Main: Naver").assertIsNotEnabled() rule.onNodeWithText("More methods").assertIsNotEnabled() - rule.onNodeWithText("Additional: Signing in with LINE").performClick() + rule.onNodeWithText("Additional: Signing in with Microsoft").performClick() rule.onNodeWithText("Close methods").performClick() - rule.onNodeWithText("Additional: Signing in with LINE").assertExists() + rule.onNodeWithText("Additional: Signing in with Microsoft").assertExists() rule.runOnIdle { - assertEquals(listOf(DdsSocialProvider.Line), attempts) + assertEquals(listOf(DdsSocialProvider.Microsoft), attempts) pending = null } - rule.onNodeWithText("Additional: LINE").assertDoesNotExist() + rule.onNodeWithText("Additional: Microsoft").assertDoesNotExist() } // --- text field --------------------------------------------------------- diff --git a/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt index 6d19e3c..1bd1f09 100644 --- a/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt +++ b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt @@ -94,6 +94,8 @@ public class DdsSocialSignInCustomization( public val sheet: (@Composable (buttonWidth: Dp, onDismiss: () -> Unit, content: @Composable () -> Unit) -> Unit)? = null, ) +private const val DefaultPrimarySignInLimit = 3 + /** * Shows the app's [methods] in order. The first three appear inline and the rest open in a sheet. * An empty list shows nothing. The first entry for each provider wins if the list contains duplicates. @@ -116,7 +118,7 @@ public fun DdsSocialSignIn( closeLabel: String = stringResource(R.string.dds_auth_close_methods), gutter: Dp = ddsFrame().width.gutter, ) { - SocialSignIn(methods, onSelect, modifier, pending, moreLabel, closeLabel, gutter, customization = null) + DdsSocialSignIn(methods, onSelect, DefaultPrimarySignInLimit, modifier, pending, moreLabel, closeLabel, gutter) } /** Uses [customization] to integrate application-specific sign-in controls and recovery content. */ @@ -131,25 +133,28 @@ public fun DdsSocialSignIn( closeLabel: String = stringResource(R.string.dds_auth_close_methods), gutter: Dp = ddsFrame().width.gutter, ) { - SocialSignIn(methods, onSelect, modifier, pending, moreLabel, closeLabel, gutter, customization) + DdsSocialSignIn(methods, onSelect, DefaultPrimarySignInLimit, modifier, pending, moreLabel, closeLabel, gutter, customization) } +/** Shows up to [primaryLimit] methods inline and the remaining methods in a sheet. The limit must be positive. */ @Composable -private fun SocialSignIn( +public fun DdsSocialSignIn( methods: List, onSelect: (DdsSocialProvider) -> Unit, - modifier: Modifier, - pending: DdsSocialProvider?, - moreLabel: String, - closeLabel: String, - gutter: Dp, - customization: DdsSocialSignInCustomization?, + primaryLimit: Int, + modifier: Modifier = Modifier, + pending: DdsSocialProvider? = null, + moreLabel: String = stringResource(R.string.dds_auth_more_methods), + closeLabel: String = stringResource(R.string.dds_auth_close_methods), + gutter: Dp = ddsFrame().width.gutter, + customization: DdsSocialSignInCustomization? = null, ) { + require(primaryLimit > 0) { "primaryLimit must be positive" } if (methods.isEmpty()) return val ordered = methods.distinctBy { it.provider } - val primary = ordered.take(3) - val additional = ordered.drop(3) + val primary = ordered.take(primaryLimit) + val additional = ordered.drop(primaryLimit) BoxWithConstraints( modifier.fillMaxWidth().padding(horizontal = gutter), contentAlignment = Alignment.TopCenter,