-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat:Add webview provider name and versioncode in the debug info #20020
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
Conversation
50b9231 to
a7c29af
Compare
a7c29af to
84fa732
Compare
AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
Outdated
Show resolved
Hide resolved
bd24f34 to
15f0c75
Compare
AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
Outdated
Show resolved
Hide resolved
15f0c75 to
b65bc1c
Compare
| binding.setDueDatePager, | ||
| ) { tab: TabLayout.Tab, position: Int -> | ||
| SetDueDateViewModel.Tab.entries | ||
| Tab.entries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad
AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
Outdated
Show resolved
Hide resolved
b65bc1c to
91e1580
Compare
91e1580 to
edb5ee1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of unrelated changes
How about this: move the responsibility of formatting to the debug info
and just returning null should be OK
Subject: [PATCH]
---
Index: AnkiDroid/src/main/java/com/ichi2/utils/WebViewUtils.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/utils/WebViewUtils.kt b/AnkiDroid/src/main/java/com/ichi2/utils/WebViewUtils.kt
--- a/AnkiDroid/src/main/java/com/ichi2/utils/WebViewUtils.kt (revision edb5ee19955e1e3706a1e315bbcbb91824f84938)
+++ b/AnkiDroid/src/main/java/com/ichi2/utils/WebViewUtils.kt (date 1767738660183)
@@ -149,20 +149,21 @@
data class WebViewInfo(
val userAgent: String?,
- val provider: String,
+ val packageName: String?,
+ val versionCode: Long?,
)
suspend fun getWebViewInfo(context: Context): WebViewInfo =
withContext(Dispatchers.Main) {
- val userAgentValue = getWebviewUserAgent(context)
- val pkg = runCatching { WebViewCompat.getCurrentWebViewPackage(context) }.getOrNull()
- val providerName = pkg?.packageName ?: "Unknown"
+ val packageInfo = runCatching { WebViewCompat.getCurrentWebViewPackage(context) }.getOrNull()
- val version =
- runCatching {
- pkg?.let { PackageInfoCompat.getLongVersionCode(it) }
- }.getOrNull() ?: "Unknown"
- WebViewInfo(userAgentValue, "$providerName ($version)")
+ WebViewInfo(
+ userAgent = getWebviewUserAgent(context),
+ packageName = packageInfo?.packageName,
+ versionCode = runCatching {
+ packageInfo?.let { PackageInfoCompat.getLongVersionCode(it) }
+ }.getOrNull()
+ )
}
private fun showOutdatedWebViewDialog(
Index: AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt b/AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt (revision edb5ee19955e1e3706a1e315bbcbb91824f84938)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/DebugInfoService.kt (date 1767738606060)
@@ -43,7 +43,7 @@
Android Version = ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT})
ProductFlavor = ${BuildConfig.FLAVOR}
Device Info = ${Build.MANUFACTURER} | ${Build.BRAND} | ${Build.DEVICE} | ${Build.PRODUCT} | ${Build.MODEL} | ${Build.HARDWARE}
- Webview User Agent = ${webviewInfo.userAgent} (${webviewInfo.provider})
+ WebView Info = [${webviewInfo.packageName} | ${webviewInfo.versionCode}]: ${webviewInfo.userAgent}
ACRA UUID = ${Installation.id(info)}
FSRS = ${BackendBuildConfig.FSRS_VERSION} (Enabled: $isFSRSEnabled)
Crash Reports Enabled = ${isSendingCrashReports(info)}
.idea/codeStyles/Project.xml
Outdated
| <option name="BLANK_LINES_AROUND_INITIALIZER" value="2" /> | ||
| <option name="IMPORT_LAYOUT_TABLE"> | ||
| <value> | ||
| <package name="" withSubpackages="true" static="false" module="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
edb5ee1 to
5a706c4
Compare
|
please check the diff before pinging me, this isn't reviewable yet |
5a706c4 to
91f767a
Compare
|
I have fixed the diff now |
| private fun isSendingCrashReports(context: Context): Boolean = CrashReportService.isAcraEnabled(context, false) | ||
| } | ||
|
|
||
| private fun isSendingCrashReports(context: Context): Boolean = CrashReportService.isAcraEnabled(context, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't have been moved, please revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
david-allison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One required change, but it should be mechanical. Tentatively approving. Thanks!!
91f767a to
11af848
Compare
|
Pinging for second review |
|
@Fandroid745 please do not ping If it is labeled for "Needs Second Review" it shows up in reviewers queues Reviewer time (which could be used for reviews) is taken up processing notifications that come from pings, so they are negative progress by absorbing otherwise useful time |
Purpose / Description
This pr adds the webview provider and versioncode in the debug info which is necessary to solve #19914
Fixes
Approach
Updated the DebugInfoService::getDebugInfo to retreive the webview information
How Has This Been Tested?
Ran the app on my phone(redmi note 10 pro) and verified that the debug info includes the webview provider and version code.
Learning (optional, can help others)
None
Links to blog posts, patterns, libraries or addons used to solve this problem
Checklist
Please, go through these checks before submitting the PR.