Skip to content

Commit

Permalink
Merge pull request #364 from astubenbord/bugfix/pdf-viewer-issue
Browse files Browse the repository at this point in the history
Bugfix/pdf viewer issue
  • Loading branch information
astubenbord authored Jan 12, 2024
2 parents 9bca1cb + 1460ab4 commit 54dd6ec
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 106 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Create GitHub Release
on:
# Enable manual run
workflow_dispatch:
inputs:
is_draft:
description: "Mark as draft"
required: true
default: true
type: boolean

# Declare default permissions as read only.
permissions: read-all

jobs:
create-github-release:
runs-on: ubuntu-latest
steps:
# Setup Ruby, Bundler, and Gemfile dependencies
- name: Create build directory
run: mkdir -p /tmp/build

- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch

- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Copy files to build directory
run: |
mkdir -p /tmp/build
cp -R . /tmp/build
- name: Set FLUTTER_ROOT environment variable and build dir
run: echo "FLUTTER_ROOT=/tmp/build/flutter/bin" >> $GITHUB_ENV

- run: $FLUTTER_ROOT/flutter doctor -v

- name: Setup signing config
uses: ./.github/actions/setup-android-signing-config
with:
keystore-key-alias: ${{ secrets.KEYSTORE_KEY_ALIAS }}
keystore-key-password: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
keystore-store-password: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
release-keystore: ${{ secrets.RELEASE_KEYSTORE }}
release-keystore-passphrase: ${{ secrets.RELEASE_KEYSTORE_PASSPHRASE }}
output-directory: /tmp/build/android

- name: Get packages and run codegen
run: |
bash /tmp/build/scripts/install_dependencies_with_submodule.sh
bash /tmp/build/scripts/update_changelogs.sh
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
bundler-cache: true
working-directory: /tmp/build/android

- name: Build and publish GitHub release
run: |
cd /tmp/build/android
bundle exec fastlane build
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
7 changes: 0 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ if (keystorePropertiesFile.exists()) {
android {
compileSdkVersion 33

packagingOptions {
pickFirst '**/x86/libpdfium.so'
pickFirst '**/x86_64/libpdfium.so'
pickFirst '**/armeabi-v7a/libpdfium.so'
pickFirst '**/arm64-v8a/libpdfium.so'
}

compileOptions {
// Required for flutter_local_notifications
coreLibraryDesugaringEnabled true
Expand Down
5 changes: 5 additions & 0 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ platform :android do |options|
)
end

desc "Build the app"
lane :build do |options|
sh "$FLUTTER_ROOT/flutter build appbundle -v"
end

desc "Promote track"
lane :play_store_promote do |options|
track = options[:track]
Expand Down
Binary file added assets/example/sample.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/core/service/file_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class FileService {
bool create = false,
}) async {
final dir = getDirectory(type);
final filename = (fileName ?? const Uuid().v1()) + '.$extension';
final filename = '${fileName ?? const Uuid().v1()}.$extension';
final file = File(p.join(dir.path, filename));
if (create) {
await file.create(recursive: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
if (!file.existsSync()) {
file.createSync();
await _api.downloadToFile(
state.document!,
state.document!.id,
file.path,
);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
// );

await _api.downloadToFile(
state.document!,
state.document!.id,
targetPath,
original: downloadOriginal,
onProgressChanged: (progress) {
Expand Down Expand Up @@ -255,7 +255,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
FileService.instance.temporaryDirectory,
);
await _api.downloadToFile(
state.document!,
state.document!.id,
filePath,
original: shareOriginal,
);
Expand All @@ -282,7 +282,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
FileService.instance.temporaryDirectory,
);
await _api.downloadToFile(
state.document!,
state.document!.id,
filePath,
original: false,
);
Expand Down
5 changes: 2 additions & 3 deletions lib/features/document_edit/view/document_edit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import 'package:paperless_mobile/routing/routes/labels_route.dart';
import 'package:paperless_mobile/routing/routes/shells/authenticated_route.dart';

typedef ItemBuilder<T> = Widget Function(BuildContext context, T itemData);

class DocumentEditPage extends StatefulWidget {
const DocumentEditPage({
super.key
});
const DocumentEditPage({super.key});

@override
State<DocumentEditPage> createState() => _DocumentEditPageState();
Expand Down
Loading

0 comments on commit 54dd6ec

Please sign in to comment.