mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android: Fixed opening attachments
This commit is contained in:
parent
a6884a2ee4
commit
6950c40b12
@ -13,6 +13,15 @@
|
|||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
||||||
|
|
||||||
|
<!-- Need this block to support viewing files in with Android API 30 -->
|
||||||
|
<!-- https://github.com/vinzscam/react-native-file-viewer/issues/94#issuecomment-767743365 -->
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<data android:mimeType="*/*" />
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
android:requestLegacyExternalStorage: Android 10 introduced new "scoped storage" mechanism.
|
android:requestLegacyExternalStorage: Android 10 introduced new "scoped storage" mechanism.
|
||||||
Apps targeting Android 10 (sdk 29) can no longer freely access arbitrary paths on the shared storage.
|
Apps targeting Android 10 (sdk 29) can no longer freely access arbitrary paths on the shared storage.
|
||||||
|
@ -44,10 +44,13 @@ import SelectDateTimeDialog from '../SelectDateTimeDialog';
|
|||||||
import ShareExtension from '../../utils/ShareExtension.js';
|
import ShareExtension from '../../utils/ShareExtension.js';
|
||||||
import CameraView from '../CameraView';
|
import CameraView from '../CameraView';
|
||||||
import { NoteEntity } from '@joplin/lib/services/database/types';
|
import { NoteEntity } from '@joplin/lib/services/database/types';
|
||||||
|
import Logger from '@joplin/lib/Logger';
|
||||||
const urlUtils = require('@joplin/lib/urlUtils');
|
const urlUtils = require('@joplin/lib/urlUtils');
|
||||||
|
|
||||||
const emptyArray: any[] = [];
|
const emptyArray: any[] = [];
|
||||||
|
|
||||||
|
const logger = Logger.create('screens/Note');
|
||||||
|
|
||||||
class NoteScreenComponent extends BaseScreenComponent {
|
class NoteScreenComponent extends BaseScreenComponent {
|
||||||
static navigationOptions(): any {
|
static navigationOptions(): any {
|
||||||
return { header: null };
|
return { header: null };
|
||||||
@ -186,6 +189,8 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
} else if (item.type_ === BaseModel.TYPE_RESOURCE) {
|
} else if (item.type_ === BaseModel.TYPE_RESOURCE) {
|
||||||
if (!(await Resource.isReady(item))) throw new Error(_('This attachment is not downloaded or not decrypted yet.'));
|
if (!(await Resource.isReady(item))) throw new Error(_('This attachment is not downloaded or not decrypted yet.'));
|
||||||
const resourcePath = Resource.fullPath(item);
|
const resourcePath = Resource.fullPath(item);
|
||||||
|
|
||||||
|
logger.info(`Opening resource: ${resourcePath}`);
|
||||||
await FileViewer.open(resourcePath);
|
await FileViewer.open(resourcePath);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(_('The Joplin mobile app does not currently support this type of link: %s', BaseModel.modelTypeToName(item.type_)));
|
throw new Error(_('The Joplin mobile app does not currently support this type of link: %s', BaseModel.modelTypeToName(item.type_)));
|
||||||
|
Loading…
Reference in New Issue
Block a user