Skip to content

Commit

Permalink
Merge branch 'release-3.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 9, 2024
2 parents 5056ac4 + 50b16c6 commit 551bcc6
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 41 deletions.
3 changes: 2 additions & 1 deletion packages/app-desktop/plugins/GotoAnything.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -555,7 +556,7 @@ class DialogComponent extends React.PureComponent<Props, State> {
};

const titleHtml = item.fragments
? `<span style="font-weight: bold; color: ${theme.color};">${item.title}</span>`
? `<span style="font-weight: bold; color: ${theme.color};">${htmlentities(item.title)}</span>`
: wrapKeywordMatches(item.title);

const fragmentsHtml = !item.fragments ? null : wrapKeywordMatches(item.fragments);
Expand Down
2 changes: 1 addition & 1 deletion packages/app-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2097755
versionCode 2097756
versionName "3.2.0"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
Expand Down
22 changes: 17 additions & 5 deletions packages/app-mobile/components/buttons/FloatingActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');

Expand All @@ -92,7 +104,7 @@ const FloatingActionButton = (props: ActionButtonProps) => {
const menuContent = <FAB.Group
open={open}
accessibilityLabel={label}
style={{ marginStart, marginTop }}
style={marginStyles}
icon={ open ? openIcon : closedIcon }
fabStyle={{
backgroundColor: props.mainButton?.color ?? 'rgba(231,76,60,1)',
Expand Down
8 changes: 4 additions & 4 deletions packages/app-mobile/components/screens/Note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ class NoteScreenComponent extends BaseScreenComponent<Props, State> 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();
Expand Down
8 changes: 4 additions & 4 deletions packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
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;
Expand Down Expand Up @@ -583,7 +583,7 @@
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;
Expand Down Expand Up @@ -774,7 +774,7 @@
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;
Expand Down Expand Up @@ -813,7 +813,7 @@
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;
Expand Down
1 change: 1 addition & 0 deletions packages/app-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,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",
Expand Down
16 changes: 15 additions & 1 deletion packages/app-mobile/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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';
Expand Down Expand Up @@ -88,6 +89,8 @@ import JoplinCloudLoginScreen from './components/screens/JoplinCloudLoginScreen'

import SyncTargetNone from '@joplin/lib/SyncTargetNone';



SyncTargetRegistry.addClass(SyncTargetNone);
SyncTargetRegistry.addClass(SyncTargetOneDrive);
SyncTargetRegistry.addClass(SyncTargetNextcloud);
Expand Down Expand Up @@ -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 };
Expand Down
21 changes: 8 additions & 13 deletions packages/app-mobile/utils/shareHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions packages/editor/CodeMirror/configFromSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ const configFromSettings = (settings: EditorSettings) => {
htmlTagLanguage: html({ matchClosingTags: false, autoCloseTags: false }),
}),
}),
markdownLanguage.data.of({
closeBrackets: openingBrackets,
}),
markdownLanguage.data.of({ closeBrackets: { brackets: openingBrackets } }),
];
} else if (language === EditorLanguageType.Html) {
return html({ autoCloseTags: settings.autocompleteMarkup });
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/models/Note.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
8 changes: 7 additions & 1 deletion packages/lib/models/Note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,15 @@ export default class Note extends BaseItem {
});

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,
Expand Down
6 changes: 6 additions & 0 deletions readme/about/changelog/android.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
6 changes: 6 additions & 0 deletions readme/about/changelog/ios.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
15 changes: 8 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8307,6 +8307,7 @@ __metadata:
events: 3.3.0
expo: 51.0.26
expo-camera: 15.0.16
fast-deep-equal: 3.1.3
fs-extra: 11.2.0
gulp: 4.0.2
jest: 29.7.0
Expand Down Expand Up @@ -42980,20 +42981,20 @@ __metadata:
languageName: node
linkType: hard

"source-map-js@npm:^1.0.1, source-map-js@npm:^1.2.1":
version: 1.2.1
resolution: "source-map-js@npm:1.2.1"
checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b
languageName: node
linkType: hard

"source-map-js@npm:^1.2.0":
version: 1.2.0
resolution: "source-map-js@npm:1.2.0"
checksum: 791a43306d9223792e84293b00458bf102a8946e7188f3db0e4e22d8d530b5f80a4ce468eb5ec0bf585443ad55ebbd630bf379c98db0b1f317fd902500217f97
languageName: node
linkType: hard

"source-map-js@npm:^1.2.1":
version: 1.2.1
resolution: "source-map-js@npm:1.2.1"
checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b
languageName: node
linkType: hard

"source-map-loader@npm:5.0.0":
version: 5.0.0
resolution: "source-map-loader@npm:5.0.0"
Expand Down

0 comments on commit 551bcc6

Please sign in to comment.