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

Fix issues with Family Link #2583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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"