Skip to content

Commit acfcdd5

Browse files
authored
Merge pull request #7553 from LibreSign/backport/7551/stable33
[stable33] fix: remove mobile orientation signing hint
2 parents e86f95c + 449d820 commit acfcdd5

2 files changed

Lines changed: 0 additions & 72 deletions

File tree

src/tests/views/SignPDF/Sign.spec.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,54 +1687,6 @@ describe('Sign.vue - signWithTokenCode', () => {
16871687
expect(wrapper.vm.hasSignatures).toBe(false)
16881688
expect(wrapper.vm.needCreateSignature).toBe(false)
16891689
})
1690-
1691-
it('shows a mobile orientation hint when signature setup is required on portrait phones', async () => {
1692-
const { default: realSign } = await import('../../../views/SignPDF/_partials/Sign.vue')
1693-
const { useSignStore } = await import('../../../store/sign.js')
1694-
const signStore = useSignStore()
1695-
1696-
signStore.document = createSignDocument({
1697-
nodeType: 'file',
1698-
signers: [
1699-
{ signRequestId: 501, me: true },
1700-
],
1701-
visibleElements: [
1702-
{ elementId: 201, fileId: 1, signRequestId: 501, type: 'signature', coordinates: { page: 1, left: 10, top: 20, width: 30, height: 40 } },
1703-
],
1704-
})
1705-
1706-
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 390, writable: true })
1707-
Object.defineProperty(window, 'innerHeight', { configurable: true, value: 844, writable: true })
1708-
1709-
const wrapper = mount(realSign, {
1710-
global: {
1711-
stubs: {
1712-
NcButton: true,
1713-
NcDialog: true,
1714-
NcLoadingIcon: true,
1715-
TokenManager: true,
1716-
EmailManager: true,
1717-
UploadCertificate: true,
1718-
Documents: true,
1719-
Signatures: true,
1720-
Draw: true,
1721-
ManagePassword: true,
1722-
CreatePassword: true,
1723-
NcNoteCard: false,
1724-
NcPasswordField: true,
1725-
NcRichText: true,
1726-
},
1727-
mocks: {
1728-
$watch: vi.fn(),
1729-
},
1730-
},
1731-
})
1732-
1733-
await flushPromises()
1734-
1735-
expect(wrapper.vm.needCreateSignature).toBe(true)
1736-
expect(wrapper.text()).toContain('For a better signing experience on mobile, rotate your phone to landscape mode.')
1737-
})
17381690
})
17391691

17401692
describe('Sign.vue - create signature modal', () => {

src/views/SignPDF/_partials/Sign.vue

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<Signatures v-if="hasSignatures" />
99
</div>
1010
<div v-if="!loading" class="button-wrapper">
11-
<NcNoteCard v-if="showMobileOrientationHint" type="warning">
12-
{{ t('libresign', 'For a better signing experience on mobile, rotate your phone to landscape mode.') }}
13-
</NcNoteCard>
1411
<NcNoteCard v-for="(error, index) in signStore.errors"
1512
:key="index"
1613
:heading="error.title || ''"
@@ -436,7 +433,6 @@ const sidebarStore = useSidebarStore() as SidebarStoreContract
436433
const identificationDocumentStore = useIdentificationDocumentStore() as IdentificationDocumentStoreContract
437434
438435
const loading = ref(true)
439-
const isMobilePortrait = ref(false)
440436
const user = ref<UserInfo>({
441437
account: { uid: '', emailAddress: '', displayName: '' },
442438
settings: { canRequestSign: false, hasSignatureFile: false, phoneNumber: '' },
@@ -476,7 +472,6 @@ const needCreateSignature = computed(() => {
476472
}
477473
return hasVisibleElementsForCurrentUser(visibleElementsDocument.value)
478474
})
479-
const showMobileOrientationHint = computed(() => needCreateSignature.value && isMobilePortrait.value)
480475
const needIdentificationDocuments = computed(() => identificationDocumentStore.showDocumentsComponent())
481476
const canCreateSignature = computed(() => {
482477
const capabilities = getCapabilities() as LibresignCapabilities
@@ -548,19 +543,6 @@ function clearBlockingSignError() {
548543
signStore.clearSigningErrors()
549544
}
550545
551-
function updateOrientationHint() {
552-
if (typeof window === 'undefined') {
553-
isMobilePortrait.value = false
554-
return
555-
}
556-
557-
const isMobileViewport = window.innerWidth <= 512
558-
const isPortrait = window.matchMedia?.('(orientation: portrait)').matches
559-
?? window.innerHeight > window.innerWidth
560-
561-
isMobilePortrait.value = isMobileViewport && isPortrait
562-
}
563-
564546
function saveSignature() {
565547
if (signatureElementsStore.success.length) {
566548
showSuccess(signatureElementsStore.success)
@@ -746,10 +728,6 @@ function executeSigningAction(action: string) {
746728
}
747729
748730
onMounted(async () => {
749-
updateOrientationHint()
750-
window.addEventListener('resize', updateOrientationHint, { passive: true })
751-
window.addEventListener('orientationchange', updateOrientationHint)
752-
753731
loading.value = true
754732
signatureElementsStore.signRequestUuid = signRequestUuid.value
755733
signatureElementsStore.loadSignatures()
@@ -797,8 +775,6 @@ watch(signRequestUuid, (newUuid, oldUuid) => {
797775
})
798776
799777
onBeforeUnmount(() => {
800-
window.removeEventListener('resize', updateOrientationHint)
801-
window.removeEventListener('orientationchange', updateOrientationHint)
802778
resetSignMethodsState()
803779
if (unwatchPendingAction) {
804780
unwatchPendingAction()

0 commit comments

Comments
 (0)