From 9fb104ec7c22e27293eddff2cd6818384608a418 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Fri, 8 Nov 2024 05:01:29 -0800 Subject: [PATCH 1/8] Mobile: Fixes #11276: Fix new note button is pushed offscreen on certain Android devices (#11323) --- .../buttons/FloatingActionButton.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/app-mobile/components/buttons/FloatingActionButton.tsx b/packages/app-mobile/components/buttons/FloatingActionButton.tsx index e05e6281718..8e241f97e49 100644 --- a/packages/app-mobile/components/buttons/FloatingActionButton.tsx +++ b/packages/app-mobile/components/buttons/FloatingActionButton.tsx @@ -3,7 +3,7 @@ import { useState, useCallback, useMemo } from 'react'; import { FAB, Portal } from 'react-native-paper'; import { _ } from '@joplin/lib/locale'; import { Dispatch } from 'redux'; -import { Platform, useWindowDimensions, View } from 'react-native'; +import { Platform, View, ViewStyle } from 'react-native'; import shim from '@joplin/lib/shim'; import AccessibleWebMenu from '../accessibility/AccessibleModalMenu'; const Icon = require('react-native-vector-icons/Ionicons').default; @@ -71,10 +71,22 @@ const FloatingActionButton = (props: ActionButtonProps) => { // is disabled. // // See https://github.com/callstack/react-native-paper/issues/4064 - const windowSize = useWindowDimensions(); + // May be possible to remove if https://github.com/callstack/react-native-paper/pull/4514 + // is merged. const adjustMargins = !open && shim.mobilePlatform() === 'android'; - const marginTop = adjustMargins ? Math.max(0, windowSize.height - 140) : undefined; - const marginStart = adjustMargins ? Math.max(0, windowSize.width - 200) : undefined; + const marginStyles = useMemo((): ViewStyle => { + if (!adjustMargins) { + return {}; + } + + // Internally, React Native Paper uses absolute positioning to make its + // (usually invisible) view fill the screen. Setting top and left to + // undefined causes the view to take up only part of the screen. + return { + top: undefined, + left: undefined, + }; + }, [adjustMargins]); const label = props.mainButton?.label ?? _('Add new'); @@ -92,7 +104,7 @@ const FloatingActionButton = (props: ActionButtonProps) => { const menuContent = Date: Fri, 8 Nov 2024 07:34:39 -0800 Subject: [PATCH 2/8] Mobile: Fixes #11325: Fix error on creating new notes if the user is a share recipient (#11326) --- packages/lib/models/Note.test.ts | 2 +- packages/lib/models/Note.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/lib/models/Note.test.ts b/packages/lib/models/Note.test.ts index 6ba5d96df0c..2b15dc82447 100644 --- a/packages/lib/models/Note.test.ts +++ b/packages/lib/models/Note.test.ts @@ -387,7 +387,7 @@ describe('models/Note', () => { expect(conflictedNote.conflict_original_id).toBe(origNote.id); expect(conflictedNote.parent_id).toBe(folder.id); expect(conflictedNote.is_shared).toBeUndefined(); - expect(conflictedNote.share_id).toBeUndefined(); + expect(conflictedNote.share_id).toBe(''); }); it('should copy conflicted note to target folder and cancel conflict', (async () => { diff --git a/packages/lib/models/Note.ts b/packages/lib/models/Note.ts index bc93f781b21..b456b4677f7 100644 --- a/packages/lib/models/Note.ts +++ b/packages/lib/models/Note.ts @@ -828,9 +828,15 @@ export default class Note extends BaseItem { void ItemChange.add(BaseModel.TYPE_NOTE, savedNote.id, isNew ? ItemChange.TYPE_CREATE : ItemChange.TYPE_UPDATE, changeSource, beforeNoteJson); if (dispatchUpdateAction) { + // The UI requires share_id -- if a new note, it will always be the empty string in the database + // until processed by the share service. At present, loading savedNote from the database in this case + // breaks tests. + if (!('share_id' in savedNote) && isNew) { + savedNote.share_id = ''; + } // Ensures that any note added to the state has all the required // properties for the UI to work. - if (!('deleted_time' in savedNote)) { + if (!('deleted_time' in savedNote) || !('share_id' in savedNote)) { const fields = removeElement(unique(this.previewFields().concat(Object.keys(savedNote))), 'type_'); savedNote = await this.load(savedNote.id, { fields, From 0876086caa75de80ce41c3b53fba26d941b792be Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Sat, 9 Nov 2024 04:53:25 -0800 Subject: [PATCH 3/8] Desktop: Fixes #11335: Markdown editor: Auto-close backticks (#11351) --- packages/editor/CodeMirror/configFromSettings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/CodeMirror/configFromSettings.ts b/packages/editor/CodeMirror/configFromSettings.ts index 2e931df7c24..0174068cab2 100644 --- a/packages/editor/CodeMirror/configFromSettings.ts +++ b/packages/editor/CodeMirror/configFromSettings.ts @@ -29,7 +29,7 @@ const configFromSettings = (settings: EditorSettings) => { ], codeLanguages: lookUpLanguage, }), - markdownLanguage.data.of({ closeBrackets: openingBrackets }), + markdownLanguage.data.of({ closeBrackets: { brackets: openingBrackets } }), ]; } else if (language === EditorLanguageType.Html) { return html(); From a08ebb9ce50eb5c965b12a5e706db01b8eff9ff6 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Sat, 9 Nov 2024 04:54:09 -0800 Subject: [PATCH 4/8] Android: Fixes #11324: Fix sharing to Joplin causes back navigation to get stuck (#11355) --- .../app-mobile/components/screens/Note.tsx | 8 +++---- packages/app-mobile/package.json | 1 + packages/app-mobile/root.tsx | 16 +++++++++++++- packages/app-mobile/utils/shareHandler.ts | 21 +++++++------------ yarn.lock | 1 + 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/packages/app-mobile/components/screens/Note.tsx b/packages/app-mobile/components/screens/Note.tsx index a5f4253d8d4..a10bc2e0a31 100644 --- a/packages/app-mobile/components/screens/Note.tsx +++ b/packages/app-mobile/components/screens/Note.tsx @@ -245,14 +245,14 @@ class NoteScreenComponent extends BaseScreenComponent implements B } if (this.state.fromShare) { - // effectively the same as NAV_BACK but NAV_BACK causes undesired behaviour in this case: + // Note: In the past, NAV_BACK caused undesired behaviour in this case: // - share to Joplin from some other app // - open Joplin and open any note // - go back -- with NAV_BACK this causes the app to exit rather than just showing notes + // This no longer seems to happen, but this case should be checked when adjusting navigation + // history behavior. this.props.dispatch({ - type: 'NAV_GO', - routeName: 'Notes', - folderId: this.state.note.parent_id, + type: 'NAV_BACK', }); ShareExtension.close(); diff --git a/packages/app-mobile/package.json b/packages/app-mobile/package.json index 8e91d6b0f42..a6d75759e96 100644 --- a/packages/app-mobile/package.json +++ b/packages/app-mobile/package.json @@ -107,6 +107,7 @@ "babel-loader": "9.1.3", "babel-plugin-module-resolver": "4.1.0", "babel-plugin-react-native-web": "0.19.12", + "fast-deep-equal": "3.1.3", "fs-extra": "11.2.0", "gulp": "4.0.2", "jest": "29.7.0", diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index 84b04110dc4..129af711501 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -36,6 +36,7 @@ const DropdownAlert = require('react-native-dropdownalert').default; const AlarmServiceDriver = require('./services/AlarmServiceDriver').default; const SafeAreaView = require('./components/SafeAreaView'); const { connect, Provider } = require('react-redux'); +import fastDeepEqual = require('fast-deep-equal'); import { Provider as PaperProvider, MD3DarkTheme, MD3LightTheme } from 'react-native-paper'; import BackButtonService from './services/BackButtonService'; import NavService from '@joplin/lib/services/NavService'; @@ -89,6 +90,8 @@ import JoplinCloudLoginScreen from './components/screens/JoplinCloudLoginScreen' import SyncTargetNone from '@joplin/lib/SyncTargetNone'; + + SyncTargetRegistry.addClass(SyncTargetNone); SyncTargetRegistry.addClass(SyncTargetOneDrive); SyncTargetRegistry.addClass(SyncTargetNextcloud); @@ -301,7 +304,18 @@ const appReducer = (state = appDefaultState, action: any) => { const currentRoute = state.route; if (!historyGoingBack && historyCanGoBackTo(currentRoute)) { - navHistory.push(currentRoute); + const previousRoute = navHistory.length && navHistory[navHistory.length - 1]; + const isDifferentRoute = !previousRoute || !fastDeepEqual(navHistory[navHistory.length - 1], currentRoute); + + // Avoid multiple consecutive duplicate screens in the navigation history -- these can make + // pressing "back" seem to have no effect. + if (isDifferentRoute) { + navHistory.push(currentRoute); + } + } + + if (action.clearHistory) { + navHistory.splice(0, navHistory.length); } newState = { ...state }; diff --git a/packages/app-mobile/utils/shareHandler.ts b/packages/app-mobile/utils/shareHandler.ts index 5947fc6e4fb..f001d57262f 100644 --- a/packages/app-mobile/utils/shareHandler.ts +++ b/packages/app-mobile/utils/shareHandler.ts @@ -3,6 +3,7 @@ import shim from '@joplin/lib/shim'; import Note from '@joplin/lib/models/Note'; import checkPermissions from './checkPermissions.js'; +import NavService from '@joplin/lib/services/NavService'; const { ToastAndroid } = require('react-native'); const { PermissionsAndroid } = require('react-native'); const { Platform } = require('react-native'); @@ -27,27 +28,21 @@ export default async (sharedData: SharedData, folderId: string, dispatch: Functi } } + const newNote = await Note.save({ + parent_id: folderId, + }, { provisional: true }); + // This is a bit hacky, but the surest way to go to // the needed note. We go back one screen in case there's // already a note open - if we don't do this, the dispatch // below will do nothing (because routeName wouldn't change) // Then we wait a bit for the state to be set correctly, and // finally we go to the new note. - dispatch({ type: 'NAV_BACK' }); - + await NavService.go('Notes', { folderId, clearHistory: true }); dispatch({ type: 'SIDE_MENU_CLOSE' }); - const newNote = await Note.save({ - parent_id: folderId, - }, { provisional: true }); - - shim.setTimeout(() => { - dispatch({ - type: 'NAV_GO', - routeName: 'Note', - noteId: newNote.id, - sharedData: sharedData, - }); + shim.setTimeout(async () => { + await NavService.go('Note', { noteId: newNote.id, sharedData }); ShareExtension.close(); }, 5); diff --git a/yarn.lock b/yarn.lock index 14c8a5e6ece..0b25738f604 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7507,6 +7507,7 @@ __metadata: crypto-browserify: 3.12.0 deprecated-react-native-prop-types: 5.0.0 events: 3.3.0 + fast-deep-equal: 3.1.3 fs-extra: 11.2.0 gulp: 4.0.2 jest: 29.7.0 From 360ece6f8873ef81afbfb98b25faad696ffccdb6 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Sat, 9 Nov 2024 04:54:29 -0800 Subject: [PATCH 5/8] Desktop: Fix title rendering in GotoAnything search results (#11356) --- packages/app-desktop/plugins/GotoAnything.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app-desktop/plugins/GotoAnything.tsx b/packages/app-desktop/plugins/GotoAnything.tsx index fdad2636b01..ae9d0d0e068 100644 --- a/packages/app-desktop/plugins/GotoAnything.tsx +++ b/packages/app-desktop/plugins/GotoAnything.tsx @@ -23,6 +23,7 @@ import Resource from '@joplin/lib/models/Resource'; import { NoteEntity, ResourceEntity } from '@joplin/lib/services/database/types'; import Dialog from '../gui/Dialog'; import AsyncActionQueue from '@joplin/lib/AsyncActionQueue'; +import { htmlentities } from '@joplin/utils/html'; const logger = Logger.create('GotoAnything'); @@ -555,7 +556,7 @@ class DialogComponent extends React.PureComponent { }; const titleHtml = item.fragments - ? `${item.title}` + ? `${htmlentities(item.title)}` : wrapKeywordMatches(item.title); const fragmentsHtml = !item.fragments ? null : wrapKeywordMatches(item.fragments); From d58126484a585ce69e015571b33cdfb23abf7d42 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 9 Nov 2024 12:56:27 +0000 Subject: [PATCH 6/8] Desktop release v3.1.24 --- packages/app-desktop/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app-desktop/package.json b/packages/app-desktop/package.json index 0a8c51c1147..17f88f15d2f 100644 --- a/packages/app-desktop/package.json +++ b/packages/app-desktop/package.json @@ -1,6 +1,6 @@ { "name": "@joplin/app-desktop", - "version": "3.1.23", + "version": "3.1.24", "description": "Joplin for Desktop", "main": "main.js", "private": true, From 3ff720463b4dfd77d04705db9dc93ad2dc11815b Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 9 Nov 2024 13:04:50 +0000 Subject: [PATCH 7/8] Android 3.1.8 --- packages/app-mobile/android/app/build.gradle | 4 ++-- readme/about/changelog/android.md | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/app-mobile/android/app/build.gradle b/packages/app-mobile/android/app/build.gradle index 187dc343570..96718847358 100644 --- a/packages/app-mobile/android/app/build.gradle +++ b/packages/app-mobile/android/app/build.gradle @@ -79,8 +79,8 @@ android { applicationId "net.cozic.joplin" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 2097755 - versionName "3.1.7" + versionCode 2097756 + versionName "3.1.8" ndk { abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } diff --git a/readme/about/changelog/android.md b/readme/about/changelog/android.md index e98ead245c9..fc1ec65c87a 100644 --- a/readme/about/changelog/android.md +++ b/readme/about/changelog/android.md @@ -1,5 +1,11 @@ # Joplin Android Changelog +## [android-v3.1.8](https://github.com/laurent22/joplin/releases/tag/android-v3.1.8) (Pre-release) - 2024-11-09T13:02:33Z + +- Fixed: Fix error on creating new notes if the user is a share recipient (#11326) (#11325 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) +- Fixed: Fix new note button is pushed off-screen on certain Android devices (#11323) (#11276 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) +- Fixed: Fix sharing to Joplin causes back navigation to get stuck (#11355) (#11324 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) + ## [android-v3.1.7](https://github.com/laurent22/joplin/releases/tag/android-v3.1.7) (Pre-release) - 2024-11-04T20:27:52Z - Fixed: Fix search result note hidden after powering on device (#11297) (#11197 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) From 50b16c605439ec3e2c99aecb9090011649d3e95d Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 9 Nov 2024 13:05:25 +0000 Subject: [PATCH 8/8] iOS 13.1.7 --- .../ios/Joplin.xcodeproj/project.pbxproj | 16 ++++++++-------- readme/about/changelog/ios.md | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj b/packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj index 9c66cbe427d..2cd9fe332e0 100644 --- a/packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj +++ b/packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj @@ -505,13 +505,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements; - CURRENT_PROJECT_VERSION = 127; + CURRENT_PROJECT_VERSION = 128; DEVELOPMENT_TEAM = A9BXAFS6CT; ENABLE_BITCODE = NO; INFOPLIST_FILE = Joplin/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 13.1.6; + MARKETING_VERSION = 13.1.7; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -536,12 +536,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements; - CURRENT_PROJECT_VERSION = 127; + CURRENT_PROJECT_VERSION = 128; DEVELOPMENT_TEAM = A9BXAFS6CT; INFOPLIST_FILE = Joplin/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 13.1.6; + MARKETING_VERSION = 13.1.7; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -726,14 +726,14 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 127; + CURRENT_PROJECT_VERSION = 128; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = A9BXAFS6CT; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 13.1.6; + MARKETING_VERSION = 13.1.7; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ( @@ -764,14 +764,14 @@ CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 127; + CURRENT_PROJECT_VERSION = 128; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = A9BXAFS6CT; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 13.1.6; + MARKETING_VERSION = 13.1.7; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ( "$(inherited)", diff --git a/readme/about/changelog/ios.md b/readme/about/changelog/ios.md index 02fe677bdbf..9a0429d526f 100644 --- a/readme/about/changelog/ios.md +++ b/readme/about/changelog/ios.md @@ -1,5 +1,11 @@ # Joplin iOS Changelog +## [ios-v13.1.7](https://github.com/laurent22/joplin/releases/tag/ios-v13.1.7) - 2024-11-09T13:05:12Z + +- Fixed: Fix error on creating new notes if the user is a share recipient (#11326) (#11325 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) +- Fixed: Fix new note button is pushed off-screen on certain Android devices (#11323) (#11276 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) +- Fixed: Fix search result note hidden after powering on device (#11297) (#11197 by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator)) + ## [ios-v13.1.6](https://github.com/laurent22/joplin/releases/tag/ios-v13.1.6) - 2024-10-17T22:16:20Z - Improved: Added feature flag to disable sync lock support (#10925) (#10407)