Skip to content

Commit

Permalink
feat: add Zip page
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed May 8, 2024
1 parent 75a3be7 commit 02f0768
Show file tree
Hide file tree
Showing 17 changed files with 261 additions and 1 deletion.
2 changes: 2 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ dependencies {
implementation project(':capacitor-filesystem')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-share')
implementation project(':capawesome-team-capacitor-android-battery-optimization')
implementation project(':capawesome-team-capacitor-android-foreground-service')
implementation project(':capawesome-team-capacitor-datetime-picker')
implementation project(':capawesome-team-capacitor-file-compressor')
implementation project(':capawesome-team-capacitor-file-opener')
implementation project(':capawesome-team-capacitor-printer')
implementation project(':capawesome-team-capacitor-zip')
implementation project(':capawesome-capacitor-app-update')
implementation project(':capawesome-capacitor-background-task')
implementation project(':capawesome-capacitor-badge')
Expand Down
8 changes: 8 additions & 0 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
},
{
"pkg": "@capacitor/share",
"classpath": "com.capacitorjs.plugins.share.SharePlugin"
},
{
"pkg": "@capawesome-team/capacitor-android-battery-optimization",
"classpath": "io.capawesome.capacitorjs.plugins.batteryoptimization.BatteryOptimizationPlugin"
Expand All @@ -55,6 +59,10 @@
"pkg": "@capawesome-team/capacitor-printer",
"classpath": "io.capawesome.capacitorjs.plugins.printer.PrinterPlugin"
},
{
"pkg": "@capawesome-team/capacitor-zip",
"classpath": "io.capawesome.capacitorjs.plugins.zip.ZipPlugin"
},
{
"pkg": "@capawesome/capacitor-app-update",
"classpath": "io.capawesome.capacitorjs.plugins.appupdate.AppUpdatePlugin"
Expand Down
6 changes: 6 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')

include ':capacitor-share'
project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android')

include ':capawesome-team-capacitor-android-battery-optimization'
project(':capawesome-team-capacitor-android-battery-optimization').projectDir = new File('../node_modules/@capawesome-team/capacitor-android-battery-optimization/android')

Expand All @@ -44,6 +47,9 @@ project(':capawesome-team-capacitor-file-opener').projectDir = new File('../node
include ':capawesome-team-capacitor-printer'
project(':capawesome-team-capacitor-printer').projectDir = new File('../node_modules/@capawesome-team/capacitor-printer/android')

include ':capawesome-team-capacitor-zip'
project(':capawesome-team-capacitor-zip').projectDir = new File('../node_modules/@capawesome-team/capacitor-zip/android')

include ':capawesome-capacitor-app-update'
project(':capawesome-capacitor-app-update').projectDir = new File('../node_modules/@capawesome/capacitor-app-update/android')

Expand Down
3 changes: 3 additions & 0 deletions ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"FilesystemPlugin",
"HapticsPlugin",
"KeyboardPlugin",
"SharePlugin",
"DatetimePickerPlugin",
"DatetimePickerPlugin",
"FileCompressorPlugin",
Expand All @@ -45,6 +46,8 @@
"FileOpenerPlugin",
"PrinterPlugin",
"PrinterPlugin",
"ZipPlugin",
"ZipPlugin",
"AppUpdatePlugin",
"AppUpdatePlugin",
"BackgroundTaskPlugin",
Expand Down
2 changes: 2 additions & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ def capacitor_pods
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
pod 'CapawesomeTeamCapacitorDatetimePicker', :path => '../../node_modules/@capawesome-team/capacitor-datetime-picker'
pod 'CapawesomeTeamCapacitorFileCompressor', :path => '../../node_modules/@capawesome-team/capacitor-file-compressor'
pod 'CapawesomeTeamCapacitorFileOpener', :path => '../../node_modules/@capawesome-team/capacitor-file-opener'
pod 'CapawesomeTeamCapacitorPrinter', :path => '../../node_modules/@capawesome-team/capacitor-printer'
pod 'CapawesomeTeamCapacitorZip', :path => '../../node_modules/@capawesome-team/capacitor-zip'
pod 'CapawesomeCapacitorAppUpdate', :path => '../../node_modules/@capawesome/capacitor-app-update'
pod 'CapawesomeCapacitorBackgroundTask', :path => '../../node_modules/@capawesome/capacitor-background-task'
pod 'CapawesomeCapacitorBadge', :path => '../../node_modules/@capawesome/capacitor-badge'
Expand Down
15 changes: 14 additions & 1 deletion ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ PODS:
- Capacitor
- CapacitorKeyboard (6.0.0):
- Capacitor
- CapacitorShare (6.0.0):
- Capacitor
- CapawesomeCapacitorAppUpdate (6.0.0):
- Capacitor
- CapawesomeCapacitorBackgroundTask (6.0.0):
Expand Down Expand Up @@ -48,6 +50,9 @@ PODS:
- Capacitor
- CapawesomeTeamCapacitorPrinter (6.0.0):
- Capacitor
- CapawesomeTeamCapacitorZip (6.0.0):
- Capacitor
- SSZipArchive (~> 2.2)
- Cloudinary (5.0.0):
- Cloudinary/ios (= 5.0.0)
- Cloudinary/ios (5.0.0)
Expand All @@ -64,6 +69,7 @@ DEPENDENCIES:
- "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)"
- "CapacitorHaptics (from `../../node_modules/@capacitor/haptics`)"
- "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)"
- "CapacitorShare (from `../../node_modules/@capacitor/share`)"
- "CapawesomeCapacitorAppUpdate (from `../../node_modules/@capawesome/capacitor-app-update`)"
- "CapawesomeCapacitorBackgroundTask (from `../../node_modules/@capawesome/capacitor-background-task`)"
- "CapawesomeCapacitorBadge (from `../../node_modules/@capawesome/capacitor-badge`)"
Expand All @@ -77,6 +83,7 @@ DEPENDENCIES:
- "CapawesomeTeamCapacitorFileCompressor (from `../../node_modules/@capawesome-team/capacitor-file-compressor`)"
- "CapawesomeTeamCapacitorFileOpener (from `../../node_modules/@capawesome-team/capacitor-file-opener`)"
- "CapawesomeTeamCapacitorPrinter (from `../../node_modules/@capawesome-team/capacitor-printer`)"
- "CapawesomeTeamCapacitorZip (from `../../node_modules/@capawesome-team/capacitor-zip`)"

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -105,6 +112,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/haptics"
CapacitorKeyboard:
:path: "../../node_modules/@capacitor/keyboard"
CapacitorShare:
:path: "../../node_modules/@capacitor/share"
CapawesomeCapacitorAppUpdate:
:path: "../../node_modules/@capawesome/capacitor-app-update"
CapawesomeCapacitorBackgroundTask:
Expand All @@ -131,6 +140,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capawesome-team/capacitor-file-opener"
CapawesomeTeamCapacitorPrinter:
:path: "../../node_modules/@capawesome-team/capacitor-printer"
CapawesomeTeamCapacitorZip:
:path: "../../node_modules/@capawesome-team/capacitor-zip"

SPEC CHECKSUMS:
Alamofire: f36a35757af4587d8e4f4bfa223ad10be2422b8c
Expand All @@ -144,6 +155,7 @@ SPEC CHECKSUMS:
CapacitorFilesystem: 60e59ba274c234a979e7a3be2552feaadcee4263
CapacitorHaptics: 9ebc9363f0e9b8eb4295088a0b474530acf1859b
CapacitorKeyboard: deacbd09d8d1029c3681197fb05d206b721d5f73
CapacitorShare: a771200d3b924a5d7ad9d9fecbac517e4c0aa74f
CapawesomeCapacitorAppUpdate: 3c05b5c8e42f9c6a88d666093406e9336d9bfdb1
CapawesomeCapacitorBackgroundTask: e65f6ca09586bd33af10d4c4ed7f04248b38b785
CapawesomeCapacitorBadge: 3d0f281ad8e4a4f8db8c3d88b7622a7f4c413342
Expand All @@ -157,9 +169,10 @@ SPEC CHECKSUMS:
CapawesomeTeamCapacitorFileCompressor: be4a55e6476c4084ef370e84c224fc63db27f7a5
CapawesomeTeamCapacitorFileOpener: b406c1a389cbb4b1a3e9d686c34c9a357abb5902
CapawesomeTeamCapacitorPrinter: 44da25bc3ff21298649046a175ff3ac588936798
CapawesomeTeamCapacitorZip: 5b579e5e8812dee7b6fed794f3ee6cb1dca9b33f
Cloudinary: 1e8ed5ce1418ba50df625c1fec80ebec746141b6
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef

PODFILE CHECKSUM: 7823fa6d7560dc81dffa3d9afd0c611fff342b75
PODFILE CHECKSUM: 4ca49903ac471928dcd577796e3d0c22498439f5

COCOAPODS: 1.15.2
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
"@capacitor/haptics": "6.0.0",
"@capacitor/ios": "6.0.0",
"@capacitor/keyboard": "6.0.0",
"@capacitor/share": "6.0.0",
"@capawesome-team/capacitor-android-battery-optimization": "6.0.0",
"@capawesome-team/capacitor-android-foreground-service": "6.0.0",
"@capawesome-team/capacitor-datetime-picker": "6.0.0",
"@capawesome-team/capacitor-file-compressor": "6.0.0",
"@capawesome-team/capacitor-file-opener": "6.0.0",
"@capawesome-team/capacitor-printer": "6.0.0",
"@capawesome-team/capacitor-zip": "6.0.0",
"@capawesome/capacitor-app-update": "6.0.0",
"@capawesome/capacitor-background-task": "6.0.0",
"@capawesome/capacitor-badge": "6.0.0",
Expand Down
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ const routes: Routes = [
m => m.TextToSpeechPageModule,
),
},
{
path: 'zip',
loadChildren: () =>
import('./modules/zip/zip.module').then(m => m.ZipPageModule),
},
{
path: '**',
redirectTo: 'home',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/file-opener/file-opener.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class FileOpenerPage {
readData: this.copyToAppDirectory,
});
const file = files[0];
// Workaround for https://github.com/ionic-team/capacitor-plugins/issues/2087
if (this.copyToAppDirectory && file.data) {
await Filesystem.writeFile({
data: file.data,
Expand Down
4 changes: 4 additions & 0 deletions src/app/modules/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export class HomePage {
name: 'Text To Speech',
url: '/text-to-speech',
},
{
name: 'Zip',
url: '/zip',
},
];

constructor() {}
Expand Down
17 changes: 17 additions & 0 deletions src/app/modules/zip/zip-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { ZipPage } from './zip.page';

const routes: Routes = [
{
path: '',
component: ZipPage,
},
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ZipPageRoutingModule {}
12 changes: 12 additions & 0 deletions src/app/modules/zip/zip.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';

import { ZipPageRoutingModule } from './zip-routing.module';

import { SharedModule } from '@app/shared';
import { ZipPage } from './zip.page';

@NgModule({
imports: [SharedModule, ZipPageRoutingModule],
declarations: [ZipPage],
})
export class ZipPageModule {}
48 changes: 48 additions & 0 deletions src/app/modules/zip/zip.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="home"></ion-back-button>
</ion-buttons>
<ion-title>Zip</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-card>
<ion-card-header>
<ion-card-title>About</ion-card-title>
</ion-card-header>
<ion-card-content>
⚡️ Capacitor plugin to zip und unzip files.
</ion-card-content>
<ion-row class="ion-no-padding">
<ion-col>
<ion-button
fill="clear"
(click)="openOnGithub()"
class="ion-float-right"
>GitHub</ion-button
>
</ion-col>
</ion-row>
</ion-card>
<ion-card>
<ion-card-header>
<ion-card-title>Demo</ion-card-title>
</ion-card-header>
<ion-card-content>
<ion-item>
<ion-checkbox readonly [(ngModel)]="copyToAppDirectory"
>Copy to App Directory</ion-checkbox
>
</ion-item>
<ion-button expand="block" (click)="pickFile()"> Pick file </ion-button>
<ion-button expand="block" (click)="unzip()" [disabled]="!path"
>Unzip</ion-button
>
<ion-button expand="block" (click)="zip()" [disabled]="!path"
>Zip</ion-button
>
</ion-card-content>
</ion-card>
</ion-content>
Empty file.
24 changes: 24 additions & 0 deletions src/app/modules/zip/zip.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedTestingModule } from '@tests/modules';
import { ZipPage } from './zip.page';

describe('ZipPage', () => {
let component: ZipPage;
let fixture: ComponentFixture<ZipPage>;

beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [ZipPage],
imports: [SharedTestingModule],
providers: [],
}).compileComponents();

fixture = TestBed.createComponent(ZipPage);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 02f0768

Please sign in to comment.