Skip to content

Commit

Permalink
Fixed the issue that when creating a child account in Family Link, cl…
Browse files Browse the repository at this point in the history
…icking Continue does not respond
  • Loading branch information
DaVinci9196 committed Oct 16, 2024
1 parent 511afe8 commit 6d6580f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ private val KNOWN_GOOGLE_PACKAGES = mapOf(
PackageAndCertHash("com.google.android.apps.tasks", SHA256, "99f6cc5308e6f3318a3bf168bf106d5b5defe2b4b9c561e5ddd7924a7a2ba1e2"),
setOf(ACCOUNT, AUTH, OWNER)
),

// Google familylink
Pair(
PackageAndCertHash("com.google.android.apps.kids.familylink", SHA256, "6b58bb84c1c6d081d950448ff5c051a34769d7fd8d415452c86efeb808716c0e"),
setOf(ACCOUNT, AUTH, OWNER)
),
)

fun isGooglePackage(pkg: PackageAndCertHash): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private val SCREEN_ID_TO_URL = hashMapOf(
530 to "https://fit.google.com/privacy/settings",
547 to "https://myactivity.google.com/product/search",
562 to "https://myaccount.google.com/yourdata/youtube",
580 to "https://families.google.com/kidonboarding",
10003 to "https://myaccount.google.com/personal-info",
10004 to "https://myaccount.google.com/data-and-privacy",
10005 to "https://myaccount.google.com/people-and-sharing",
Expand Down Expand Up @@ -112,7 +113,8 @@ private val ALLOWED_WEB_PREFIXES = setOf(
"https://policies.google.com/",
"https://fit.google.com/privacy/settings",
"https://maps.google.com/maps/timeline",
"https://myadcenter.google.com/controls"
"https://myadcenter.google.com/controls",
"https://families.google.com/kidonboarding"
)

private val ACTION_TO_SCREEN_ID = hashMapOf(
Expand All @@ -134,6 +136,7 @@ class MainActivity : AppCompatActivity() {

val screenId = intent?.getIntExtra(EXTRA_SCREEN_ID, -1).takeIf { it != -1 } ?: ACTION_TO_SCREEN_ID[intent.action] ?: 1
val product = intent?.getStringExtra(EXTRA_SCREEN_MY_ACTIVITY_PRODUCT)
val kidOnboardingParams = intent?.getStringExtra(EXTRA_SCREEN_KID_ONBOARDING_PARAMS)

val screenOptions = intent.extras?.keySet().orEmpty()
.filter { it.startsWith(EXTRA_SCREEN_OPTIONS_PREFIX) }
Expand All @@ -154,7 +157,13 @@ class MainActivity : AppCompatActivity() {
}

if (screenId in SCREEN_ID_TO_URL) {
val screenUrl = SCREEN_ID_TO_URL[screenId]?.run { if (screenId == 547 && !product.isNullOrEmpty()) { replace("search", product) } else { this } }
val screenUrl = SCREEN_ID_TO_URL[screenId]?.run {
if (screenId == 547 && !product.isNullOrEmpty()) {
replace("search", product)
} else if (screenId == 580 && !kidOnboardingParams.isNullOrEmpty()){
"$this?params=$kidOnboardingParams"
} else { this }
}
val layout = RelativeLayout(this)
layout.addView(ProgressBar(this).apply {
layoutParams = RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ const val EXTRA_FALLBACK_URL = "extra.fallbackUrl"
const val EXTRA_FALLBACK_AUTH = "extra.fallbackAuth"
const val EXTRA_THEME_CHOICE = "extra.themeChoice"
const val EXTRA_SCREEN_MY_ACTIVITY_PRODUCT = "extra.screen.myactivityProduct"
const val EXTRA_SCREEN_KID_ONBOARDING_PARAMS = "extra.screen.kidOnboardingParams"

const val OPTION_SCREEN_FLAVOR = "screenFlavor"

0 comments on commit 6d6580f

Please sign in to comment.