Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
7c00a1ad
Commit
7c00a1ad
authored
Jan 31, 2020
by
Kate Glazko
Committed by
Jeff Boek
Feb 07, 2020
Browse files
For #5073: View Site Cert
parent
4fec12b1
Changes
11
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
View file @
7c00a1ad
...
...
@@ -158,7 +158,8 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
title
=
session
.
title
,
isSecured
=
session
.
securityInfo
.
secure
,
sitePermissions
=
sitePermissions
,
gravity
=
getAppropriateLayoutGravity
()
gravity
=
getAppropriateLayoutGravity
(),
certificateName
=
session
.
securityInfo
.
issuer
)
nav
(
R
.
id
.
browserFragment
,
directions
)
}
...
...
app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserFragment.kt
View file @
7c00a1ad
...
...
@@ -164,7 +164,8 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
title
=
session
.
title
,
isSecured
=
session
.
securityInfo
.
secure
,
sitePermissions
=
sitePermissions
,
gravity
=
getAppropriateLayoutGravity
()
gravity
=
getAppropriateLayoutGravity
(),
certificateName
=
session
.
securityInfo
.
issuer
)
nav
(
R
.
id
.
externalAppBrowserFragment
,
directions
)
}
...
...
app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsFragmentStore.kt
View file @
7c00a1ad
...
...
@@ -71,18 +71,20 @@ class QuickSettingsFragmentStore(
* @param isSecured [Boolean] whether the connection is secured (TLS) or not.
* @param permissions [SitePermissions]? list of website permissions and their status.
* @param settings [Settings] application settings.
* @param certificateName [String] the certificate name of the current web page.
*/
@Suppress
(
"LongParameterList"
)
fun
createStore
(
context
:
Context
,
websiteUrl
:
String
,
websiteTitle
:
String
,
certificateName
:
String
,
isSecured
:
Boolean
,
permissions
:
SitePermissions
?,
settings
:
Settings
)
=
QuickSettingsFragmentStore
(
QuickSettingsFragmentState
(
webInfoState
=
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
isSecured
),
webInfoState
=
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
isSecured
,
certificateName
),
websitePermissionsState
=
createWebsitePermissionState
(
context
,
permissions
,
...
...
@@ -104,13 +106,14 @@ class QuickSettingsFragmentStore(
fun
createWebsiteInfoState
(
websiteUrl
:
String
,
websiteTitle
:
String
,
isSecured
:
Boolean
isSecured
:
Boolean
,
certificateName
:
String
):
WebsiteInfoState
{
val
(
stringRes
,
iconRes
,
colorRes
)
=
when
(
isSecured
)
{
true
->
getSecuredWebsiteUiValues
false
->
getInsecureWebsiteUiValues
}
return
WebsiteInfoState
(
websiteUrl
,
websiteTitle
,
stringRes
,
iconRes
,
colorRes
)
return
WebsiteInfoState
(
websiteUrl
,
websiteTitle
,
stringRes
,
iconRes
,
colorRes
,
certificateName
)
}
/**
...
...
@@ -230,7 +233,8 @@ data class WebsiteInfoState(
val
websiteTitle
:
String
,
@StringRes
val
securityInfoRes
:
Int
,
@DrawableRes
val
iconRes
:
Int
,
@ColorRes
val
iconTintRes
:
Int
@ColorRes
val
iconTintRes
:
Int
,
val
certificateName
:
String
)
:
State
/**
...
...
app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsSheetDialogFragment.kt
View file @
7c00a1ad
...
...
@@ -65,7 +65,8 @@ class QuickSettingsSheetDialogFragment : AppCompatDialogFragment() {
websiteTitle
=
args
.
title
,
isSecured
=
args
.
isSecured
,
permissions
=
args
.
sitePermissions
,
settings
=
Settings
.
getInstance
(
context
)
settings
=
Settings
.
getInstance
(
context
),
certificateName
=
args
.
certificateName
)
quickSettingsController
=
DefaultQuickSettingsController
(
...
...
app/src/main/java/org/mozilla/fenix/settings/quicksettings/WebsiteInfoView.kt
View file @
7c00a1ad
...
...
@@ -39,6 +39,7 @@ class WebsiteInfoView(
bindUrl
(
state
.
websiteUrl
)
bindTitle
(
state
.
websiteTitle
)
bindSecurityInfo
(
state
.
securityInfoRes
,
state
.
iconRes
,
state
.
iconTintRes
)
bindCertificateName
(
state
.
certificateName
)
}
private
fun
bindUrl
(
url
:
String
)
{
...
...
@@ -49,6 +50,11 @@ class WebsiteInfoView(
view
.
title
.
text
=
title
}
private
fun
bindCertificateName
(
cert
:
String
)
{
val
certificateLabel
=
view
.
context
.
getString
(
R
.
string
.
verified_by
)
+
" "
+
cert
view
.
certificateInfo
.
text
=
certificateLabel
}
private
fun
bindSecurityInfo
(
@StringRes
securityInfoRes
:
Int
,
@DrawableRes
iconRes
:
Int
,
...
...
app/src/main/res/layout/quicksettings_website_info.xml
View file @
7c00a1ad
...
...
@@ -34,7 +34,22 @@
style=
"@style/QuickSettingsText.Icon"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/quicksettings_item_height"
android:paddingTop=
"8dp"
tools:drawableStart=
"@drawable/mozac_ic_lock"
tools:drawableTint=
"@color/photonGreen50"
tools:text=
"Secure connection"
/>
<TextView
android:id=
"@+id/certificateInfo"
style=
"@style/QuickSettingsSmallText"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:paddingTop=
"0dp"
android:paddingBottom=
"2dp"
tools:text=
"Verified By:"
/>
</LinearLayout>
app/src/main/res/navigation/nav_graph.xml
View file @
7c00a1ad
...
...
@@ -612,6 +612,10 @@
android:name=
"gravity"
android:defaultValue=
"80"
app:argType=
"integer"
/>
<argument
android:name=
"certificateName"
android:defaultValue=
" "
app:argType=
"string"
/>
<action
android:id=
"@+id/action_quickSettingsSheetDialogFragment_to_SitePermissionsManagePhoneFeature"
app:destination=
"@id/SitePermissionsManagePhoneFeature"
...
...
app/src/main/res/values/dimens.xml
View file @
7c00a1ad
...
...
@@ -41,7 +41,7 @@
<dimen
name=
"tp_onboarding_triangle_height"
>
16dp
</dimen>
<!--Quick Settings-->
<dimen
name=
"quicksettings_item_height"
>
46
dp
</dimen>
<dimen
name=
"quicksettings_item_height"
>
28
dp
</dimen>
<dimen
name=
"tracking_protection_item_height"
>
48dp
</dimen>
<dimen
name=
"design_quick_action_sheet_peek_height_min"
>
64dp
</dimen>
...
...
app/src/main/res/values/strings.xml
View file @
7c00a1ad
...
...
@@ -1199,4 +1199,6 @@
<!-- Bookmark deletion confirmation -->
<string
name=
"bookmark_deletion_confirmation"
>
Are you sure you want to delete this bookmark?
</string>
<!-- text shown before the issuer name to indicate who its verified by -->
<string
name=
"verified_by"
>
Verified By:
</string>
</resources>
app/src/main/res/values/styles.xml
View file @
7c00a1ad
...
...
@@ -294,6 +294,15 @@
<item
name=
"android:layout_alignParentStart"
>
true
</item>
</style>
<style
name=
"QuickSettingsSmallText"
>
<item
name=
"android:textColor"
>
@color/photonGrey60
</item>
<item
name=
"android:textSize"
>
12sp
</item>
<item
name=
"android:paddingStart"
>
48dp
</item>
<item
name=
"android:paddingEnd"
>
16dp
</item>
<item
name=
"android:gravity"
>
top
</item>
<item
name=
"android:layout_alignParentStart"
>
true
</item>
</style>
<style
name=
"QuickSettingsText.Icon"
>
<item
name=
"android:drawablePadding"
>
8dp
</item>
</style>
...
...
app/src/test/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsFragmentStoreTest.kt
View file @
7c00a1ad
...
...
@@ -57,7 +57,7 @@ class QuickSettingsFragmentStoreTest {
val
permissions
=
mockk
<
SitePermissions
>(
relaxed
=
true
)
val
store
=
QuickSettingsFragmentStore
.
createStore
(
context
,
"url"
,
"Hello"
,
true
,
permissions
,
settings
context
,
"url"
,
"Hello"
,
"issuer"
,
true
,
permissions
,
settings
)
assertAll
{
...
...
@@ -72,9 +72,10 @@ class QuickSettingsFragmentStoreTest {
fun
`createWebsiteInfoState
constructs
a
WebsiteInfoState
with
the
right
values
for
a
secure
connection`
()
{
val
websiteUrl
=
"https://host.com/page1"
val
websiteTitle
=
"Hello"
val
certificateIssuer
=
"issuer"
val
securedStatus
=
true
val
state
=
QuickSettingsFragmentStore
.
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
securedStatus
)
val
state
=
QuickSettingsFragmentStore
.
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
securedStatus
,
certificateIssuer
)
assertAll
{
assertThat
(
state
).
isNotNull
()
...
...
@@ -90,9 +91,10 @@ class QuickSettingsFragmentStoreTest {
fun
`createWebsiteInfoState
constructs
a
WebsiteInfoState
with
the
right
values
for
an
insecure
connection`
()
{
val
websiteUrl
=
"https://host.com/page1"
val
websiteTitle
=
"Hello"
val
certificateIssuer
=
"issuer"
val
securedStatus
=
false
val
state
=
QuickSettingsFragmentStore
.
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
securedStatus
)
val
state
=
QuickSettingsFragmentStore
.
createWebsiteInfoState
(
websiteUrl
,
websiteTitle
,
securedStatus
,
certificateIssuer
)
assertAll
{
assertThat
(
state
).
isNotNull
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment