Skip to content

Commit 462d393

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 861cb57 + 4f9a021 commit 462d393

28 files changed

Lines changed: 782 additions & 203 deletions

File tree

App_Resources/cardwallet/Android/app.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
def splitEnabled = (gradle.startParameter.taskNames.contains("assembleDebug") && project.hasProperty('abiFilters')) || project.hasProperty('splitEnabled');
1111
defaultConfig {
1212
multiDexEnabled false
13-
versionCode 82
14-
versionName "1.14.0"
13+
versionCode 85
14+
versionName "1.14.3"
1515

1616
// if (project.hasProperty('resConfigs')) {
1717
// def resConfigs = project.findProperty('resConfigs')

App_Resources/cardwallet/iOS/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleShortVersionString</key>
6-
<string>1.13.0</string>
6+
<string>1.13.1</string>
77
<key>CFBundleVersion</key>
8-
<string>67</string>
8+
<string>68</string>
99
<key>CFBundleDevelopmentRegion</key>
1010
<string>en</string>
1111
<key>CFBundleDisplayName</key>

App_Resources/documentscanner/Android/app.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
def splitEnabled = (gradle.startParameter.taskNames.contains("assembleDebug") && project.hasProperty('abiFilters')) || project.hasProperty('splitEnabled');
1111
defaultConfig {
1212
multiDexEnabled false
13-
versionCode 160
14-
versionName "1.25.0"
13+
versionCode 162
14+
versionName "1.25.2"
1515

1616
// if (project.hasProperty('resConfigs')) {
1717
// def resConfigs = project.findProperty('resConfigs')

App_Resources/documentscanner/iOS/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleShortVersionString</key>
6-
<string>1.19.0</string>
6+
<string>1.19.1</string>
77
<key>CFBundleVersion</key>
8-
<string>88</string>
8+
<string>89</string>
99
<key>CFBundleDevelopmentRegion</key>
1010
<string>en</string>
1111
<key>CFBundleDisplayName</key>

app/components/edit/DocumentEdit.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@
771771
</stacklayout>
772772

773773
<stacklayout borderTopColor={colorOutline} borderTopWidth={1} orientation="horizontal" row={4}>
774-
<mdbutton class="icon-btn" text="mdi-crop" variant="text" on:tap={() => cropEdit()} />
774+
<mdbutton class="icon-btn" text="mdi-crop" variant="text" visibility={currentItem?.sourceImagePath ? 'visible' : 'collapse'} on:tap={() => cropEdit()} />
775775
<mdbutton class="icon-btn" text="mdi-rotate-left" variant="text" on:tap={() => rotateImageLeft()} />
776776
<mdbutton class="icon-btn" text="mdi-rotate-right" variant="text" on:tap={() => rotateImageRight()} />
777777
<mdbutton class="icon-btn" text="mdi-auto-fix" variant="text" on:tap={showEnhancements} />

app/components/edit/EnhancementsPopover.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { ColorMatricesTypes, getColorMatrix } from '~/utils/matrix';
88
import { lc } from '@nativescript-community/l';
99
import { colors, fontScale } from '~/variables';
10+
import { hasOriginalImage } from '~/utils/originals';
1011
const filters = ColorMatricesTypes.map((k) => ({
1112
...k,
1213
text: lc(k.id),
@@ -29,11 +30,14 @@
2930
const value = transforms.indexOf(transformId) !== -1;
3031
return { type: 'checkbox', id: transformId, value, data: value };
3132
}
33+
// transforms are recomputed from the original image: without it only the color filters are available
3234
const options = (
33-
TRANSFORMS.map((i) => ({
34-
...getData(i.id),
35-
...i
36-
})) as any[]
35+
hasOriginalImage(item)
36+
? (TRANSFORMS.map((i) => ({
37+
...getData(i.id),
38+
...i
39+
})) as any[])
40+
: []
3741
).concat({
3842
type: 'filters'
3943
});

app/components/list/DocumentsList.svelte

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import { openFile, openUrl, throttle } from '@nativescript/core/utils';
88
import { showError } from '@shared/utils/showError';
99
import dayjs from 'dayjs';
10-
import { filesize } from 'filesize';
1110
import { Template } from '@nativescript-community/svelte-native/components';
1211
import { NativeViewElementNode } from '@nativescript-community/svelte-native/dom';
1312
import { isEInk } from '~/helpers/theme';
1413
import { DocFolder } from '~/models/OCRDocument';
15-
import { importImageFromCamera } from '~/utils/ui';
14+
import { formatStorageSizes, importImageFromCamera } from '~/utils/ui';
15+
import { computeStorageSizes } from '~/utils/originals';
1616
import { colors, fontScale, hasCamera, windowInset } from '~/variables';
1717
import PageIndicator from '../common/PageIndicator.svelte';
1818
import RotableImageView from '../common/RotableImageView.svelte';
@@ -65,15 +65,7 @@
6565
textPaint.color = colorOnSurfaceVariant;
6666
const { doc } = item;
6767
textPaint.textSize = condensed ? 11 : 14 * $fontScale;
68-
canvas.drawText(
69-
filesize(
70-
doc.pages.reduce((acc, v) => acc + v.size, 0),
71-
{ output: 'string' }
72-
),
73-
dx,
74-
h - (condensed ? 0 : 16) - 10,
75-
textPaint
76-
);
68+
canvas.drawText(formatStorageSizes(computeStorageSizes(doc.pages)), dx, h - (condensed ? 0 : 16) - 10, textPaint);
7769
textPaint.color = colorOnBackground;
7870
const topText = createNativeAttributedString({
7971
spans: [

app/components/list/MainList.svelte

Lines changed: 13 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<script context="module" lang="ts">
2-
import { GestureRootView } from '@nativescript-community/gesturehandler';
32
import { Template } from '@nativescript-community/svelte-native/components';
43
import { NativeViewElementNode } from '@nativescript-community/svelte-native/dom';
54
import { Canvas, CanvasView, LayoutAlignment, Paint, StaticLayout } from '@nativescript-community/ui-canvas';
6-
import { CheckBox } from '@nativescript-community/ui-checkbox';
75
import { CollectionView } from '@nativescript-community/ui-collectionview';
86
import { Img } from '@nativescript-community/ui-image';
9-
import { Label, createNativeAttributedString } from '@nativescript-community/ui-label';
7+
import { createNativeAttributedString } from '@nativescript-community/ui-label';
108
import { confirm, prompt } from '@nativescript-community/ui-material-dialogs';
119
import { VerticalPosition } from '@nativescript-community/ui-popover';
1210
import { AnimationDefinition, Application, ApplicationSettings, Color, EventData, Frame, NavigatedData, ObservableArray, Page, Screen, StackLayout } from '@nativescript/core';
@@ -46,7 +44,6 @@
4644
DEFAULT_NB_COLUMNS_LANDSCAPE,
4745
DEFAULT_SORT_ORDER,
4846
DEFAULT_TRASH_ENABLED,
49-
DEFAULT_TRASH_REMEMBERED_DELETE_MODE,
5047
DEFAULT_VIEW_STYLE,
5148
EVENT_DOCUMENT_ADDED,
5249
EVENT_DOCUMENT_DELETED,
@@ -65,11 +62,11 @@
6562
SETTINGS_NB_COLUMNS_LANDSCAPE,
6663
SETTINGS_SORT_ORDER,
6764
SETTINGS_TRASH_ENABLED,
68-
SETTINGS_TRASH_REMEMBERED_DELETE_MODE,
6965
SETTINGS_VIEW_STYLE
7066
} from '~/utils/constants';
7167
import {
72-
createView,
68+
deleteDocumentsWithConfirm,
69+
deleteOriginalImages,
7370
detectOCR,
7471
goToDocumentView,
7572
goToFolderView,
@@ -914,82 +911,8 @@
914911
async function deleteSelectedDocuments() {
915912
if (nbSelected > 0) {
916913
try {
917-
if (trashEnabled && !isTrash) {
918-
DEV_LOG && console.log('rememberedMode1');
919-
const rememberedMode = ApplicationSettings.getString(SETTINGS_TRASH_REMEMBERED_DELETE_MODE, DEFAULT_TRASH_REMEMBERED_DELETE_MODE);
920-
let result = false;
921-
DEV_LOG && console.log('rememberedMode', rememberedMode);
922-
if (!rememberedMode) {
923-
const view = createView(GestureRootView, {
924-
columns: 'auto,*',
925-
rows: 'auto'
926-
});
927-
const checkBox = createView(CheckBox, {});
928-
const label = createView(Label, {
929-
verticalAlignment: 'center',
930-
col: 1,
931-
text: lc('remember_delete_choice')
932-
});
933-
label.on('tap', () => {
934-
DEV_LOG && console.log('label tap');
935-
checkBox.checked = !checkBox.checked;
936-
});
937-
view.addChild(checkBox);
938-
view.addChild(label);
939-
result = await confirm({
940-
neutralButtonText: lc('cancel'),
941-
message: lcp('confirm_move_to_trash', nbSelected),
942-
cancelButtonText: lc('delete_permanently'),
943-
okButtonText: lc('move_to_trash'),
944-
title: lc('delete'),
945-
view
946-
} as any);
947-
if (result !== null && checkBox.checked) {
948-
ApplicationSettings.setString(SETTINGS_TRASH_REMEMBERED_DELETE_MODE, result === true ? 'trash' : 'permament');
949-
}
950-
} else {
951-
switch (rememberedMode) {
952-
case 'permament':
953-
result = false;
954-
break;
955-
case 'trash':
956-
result = true;
957-
break;
958-
default:
959-
break;
960-
}
961-
}
962-
if (result === true) {
963-
await documentsService.trashDocuments(await getSelectedDocuments());
964-
return true;
965-
} else if (result === false) {
966-
// neutral button tapped: delete permanently
967-
const confirmed = await confirm({
968-
cancelButtonText: lc('cancel'),
969-
message: lcp('confirm_delete_permanently', nbSelected),
970-
okButtonText: lc('delete_permanently'),
971-
title: lc('delete_permanently')
972-
});
973-
if (confirmed) {
974-
await documentsService.deleteDocuments(await getSelectedDocuments());
975-
return true;
976-
}
977-
return false;
978-
}
979-
return false;
980-
} else {
981-
const result = await confirm({
982-
cancelButtonText: lc('cancel'),
983-
message: lcp('confirm_delete_documents', nbSelected),
984-
okButtonText: lc('delete'),
985-
title: lc('delete')
986-
});
987-
if (result) {
988-
await documentsService.deleteDocuments(await getSelectedDocuments());
989-
return true;
990-
}
991-
return false;
992-
}
914+
// the trash list only offers "delete permanently"
915+
return await deleteDocumentsWithConfirm(await getSelectedDocuments());
993916
} catch (error) {
994917
showError(error);
995918
}
@@ -1224,7 +1147,8 @@
12241147
...(nbSelected === 1 ? [{ icon: 'mdi-rename', id: 'rename', name: lc('rename') }] : []),
12251148
{ icon: 'mdi-star', id: 'favorite', name: lc('toggle_favorite') },
12261149
{ icon: 'mdi-folder-swap', id: 'move_folder', name: lc('move_folder') },
1227-
{ icon: 'mdi-fullscreen', id: 'fullscreen', name: lc('show_fullscreen_images') }
1150+
{ icon: 'mdi-fullscreen', id: 'fullscreen', name: lc('show_fullscreen_images') },
1151+
{ icon: 'mdi-image-remove', id: 'delete_originals', name: lc('delete_original_images') }
12281152
];
12291153
}
12301154
@@ -1279,6 +1203,12 @@
12791203
unselectAll();
12801204
}
12811205
break;
1206+
case 'delete_originals':
1207+
result = await deleteOriginalImages({ documents: await getSelectedDocuments() });
1208+
if (result) {
1209+
unselectAll();
1210+
}
1211+
break;
12821212
case 'delete':
12831213
result = await deleteSelectedDocuments();
12841214
if (result) {

app/components/list/TrashList.svelte

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import { ellipsize } from '~/utils/utils.common';
1111
import { colors, fontScale } from '~/variables';
1212
import dayjs from 'dayjs';
13-
import { filesize } from 'filesize';
13+
import { computeStorageSizes } from '~/utils/originals';
14+
import { formatStorageSizes } from '~/utils/ui';
1415
import PageIndicator from '../common/PageIndicator.svelte';
1516
import RotableImageView from '../common/RotableImageView.svelte';
1617
import SelectedIndicator from '../common/SelectedIndicator.svelte';
@@ -53,15 +54,7 @@
5354
textPaint.color = colorOnSurfaceVariant;
5455
const { doc } = item;
5556
textPaint.textSize = condensed ? 11 : 14 * $fontScale;
56-
canvas.drawText(
57-
filesize(
58-
doc.pages.reduce((acc, v) => acc + v.size, 0),
59-
{ output: 'string' }
60-
),
61-
dx,
62-
h - (condensed ? 0 : 16) - 10,
63-
textPaint
64-
);
57+
canvas.drawText(formatStorageSizes(computeStorageSizes(doc.pages)), dx, h - (condensed ? 0 : 16) - 10, textPaint);
6558
textPaint.color = colorOnBackground;
6659
const topText = createNativeAttributedString({
6760
spans: [

0 commit comments

Comments
 (0)