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: Add by default the flagship UA on SupervisedWebview #1164

Merged
merged 1 commit into from
Feb 8, 2024
Merged
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
3 changes: 0 additions & 3 deletions src/components/webviews/ReloadInterceptorWebView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { useState } from 'react'
import { useClient, useInstanceInfo } from 'cozy-client'

import { SupervisedWebView } from '/components/webviews/SupervisedWebView'
import { APPLICATION_NAME_FOR_USER_AGENT } from '/constants/userAgent'
import { ProgressContainer } from '/components/ProgressContainer'
import {
interceptNavigation,
Expand All @@ -27,7 +26,6 @@ const ReloadInterceptorWebView = React.forwardRef((props, ref) => {
<ProgressContainer progress={progress}>
<SupervisedWebView
{...props}
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
ref={ref}
onShouldStartLoadWithRequest={initialRequest => {
return interceptNavigation({
Expand Down Expand Up @@ -61,7 +59,6 @@ const ReloadInterceptorWebView = React.forwardRef((props, ref) => {
<ProgressContainer progress={progress}>
<SupervisedWebView
{...props}
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
ref={ref}
key={timestamp}
onShouldStartLoadWithRequest={initialRequest => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/webviews/SupervisedWebView.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useCallback, useEffect, useState } from 'react'
import { WebView } from 'react-native-webview'
import Minilog from 'cozy-minilog'

import Minilog from 'cozy-minilog'
import { useClient } from 'cozy-client'

import { RemountProgress } from '/app/view/Loading/RemountProgress'
import { resyncCookies } from '/libs/httpserver/httpCookieManager'
import { APPLICATION_NAME_FOR_USER_AGENT } from '/constants/userAgent'

const log = Minilog('SupervisedWebView')

Expand Down Expand Up @@ -108,6 +109,7 @@ export const SupervisedWebView = React.forwardRef((props, ref) => {
return (
<>
<WebView
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
{...otherProps}
ref={ref}
key={key}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useRef, useState } from 'react'
import { KeyboardAvoidingView, Platform, StyleSheet, View } from 'react-native'

import Minilog from 'cozy-minilog'

import {
Expand All @@ -19,7 +20,6 @@ import {
import { getOnboardingDataFromRequest } from '/screens/login/components/functions/getOnboardingDataFromRequest'
import { openWindowWithInAppBrowser } from '/screens/login/components/functions/interceptExternalLinks'
import { jsPaddingInjection } from '/screens/login/components/functions/webViewPaddingInjection'
import { APPLICATION_NAME_FOR_USER_AGENT } from '/constants/userAgent'

const log = Minilog('ClouderyCreateInstanceView')

Expand Down Expand Up @@ -106,7 +106,6 @@ export const ClouderyCreateInstanceView = ({
behavior="height"
>
<SupervisedWebView
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
source={{ uri: clouderyUrl }}
ref={webviewRef}
onShouldStartLoadWithRequest={handleNavigation}
Expand Down
4 changes: 0 additions & 4 deletions src/screens/login/components/ClouderyViewSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {
} from '/screens/login/components/functions/interceptExternalLinks'
import { LOGIN_FLAGSHIP_URL } from '/screens/login/components/functions/oidc'
import { jsPaddingInjection } from '/screens/login/components/functions/webViewPaddingInjection'
import { APPLICATION_NAME_FOR_USER_AGENT } from '/constants/userAgent'
import { navigationRef } from '/libs/RootNavigation'

const log = Minilog('ClouderyViewSwitchProps')
Expand Down Expand Up @@ -132,7 +131,6 @@ export const ClouderyViewSwitch = forwardRef(
testID="ViewSignin"
>
<ClouderyWebView
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
ref={webviewSigninRef}
uri={urls.signinUrl}
key="WebViewSignin"
Expand All @@ -157,7 +155,6 @@ export const ClouderyViewSwitch = forwardRef(
testID="ViewLogin"
>
<ClouderyWebView
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
ref={webviewLoginRef}
uri={urls.loginUrl}
key="WebViewLogin"
Expand Down Expand Up @@ -229,7 +226,6 @@ const ClouderyWebView = forwardRef(

return (
<SupervisedWebView
applicationNameForUserAgent={APPLICATION_NAME_FOR_USER_AGENT}
source={{ uri: uri }}
ref={webviewRef}
onNavigationStateChange={(event: WebViewNavigation): void => {
Expand Down
Loading