Skip to content

Commit

Permalink
Merge pull request #99 from e-picsa/chore/compliance-updates
Browse files Browse the repository at this point in the history
Chore/compliance updates
  • Loading branch information
chrismclarke authored Feb 2, 2023
2 parents 93b632c + 2685a04 commit 672ad2d
Show file tree
Hide file tree
Showing 14 changed files with 670 additions and 619 deletions.
4 changes: 2 additions & 2 deletions apps/picsa-apps/extension-app-native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "io.picsa.extension"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3015001
versionName "3.15.1"
versionCode 3015002
versionName "3.15.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies {
implementation project(':capacitor-community-firebase-analytics')
implementation project(':capacitor-community-firebase-crashlytics')
implementation project(':capacitor-firebase-performance')
implementation "com.android.support:support-v4:27.+"
implementation "androidx.webkit:webkit:1.4.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/picsa-apps/extension-app-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.14'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
1 change: 1 addition & 0 deletions apps/picsa-apps/extension-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class AppComponent {
'budget-tool': 'budget-tool',
'climate-tool': 'climate-tool',
whatsapp: 'whatsapp',
play_store: 'play_store',
};
for (const [key, value] of Object.entries(icons)) {
this.matIconRegistry.addSvgIcon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ng-template>
</div>

<div style="flex: 2">
<div class="resource-item-info">
<!-- Header -->
<mat-card-header>
<mat-card-title style="margin-top: 12px">{{
Expand All @@ -31,7 +31,7 @@
</mat-card-subtitle>
</mat-card-header>
<!-- Contents -->
<mat-card-content>
<mat-card-content class="resource-item-content">
<p *ngIf="resource.description">
{{ resource.description | translate }}
</p>
Expand All @@ -42,11 +42,23 @@
</div>
<!-- Passed Content -->
<ng-content></ng-content>
<!-- Google play button -->
<button
mat-button
class="action-button google-play"
*ngIf="actionButton && actionButton.svgIcon"
>
<mat-icon [svgIcon]="actionButton.icon"></mat-icon>
</button>
</mat-card-content>
</div>
<!-- Action Button -->
<button mat-button class="action-button" *ngIf="actionButtonIcon">
<mat-icon color="primary">{{ actionButtonIcon }}</mat-icon>
<!-- Inline Action Button -->
<button
mat-button
class="action-button"
*ngIf="actionButton && !actionButton.svgIcon"
>
<mat-icon color="primary">{{ actionButton.icon }}</mat-icon>
</button>
<!-- Download Progress -->
<div class="download-progress" *ngIf="downloadProgress !== undefined">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,31 @@
padding: 4px;
color: white;
}
.resource-item-info {
flex: 2;
display: flex;
flex-direction: column;
height: 100%;
}
.resource-item-content {
flex: 1;
display: flex;
flex-direction: column;
}
.action-button {
margin: auto 8px;
}
.action-button.google-play {
padding: 0;
margin: 16px 0 0 0;
width: 100%;
max-width: 160px;
}
.action-button.google-play > mat-icon {
margin: 0;
width: 100%;
height: auto;
}
.download-progress {
margin: auto 8px;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import { ResourcesStore } from '../../stores';
type IResourceClickHandlers = {
[type in IResourceType]: (resource: any) => void;
};
interface IActionButton {
icon: 'open_in_new' | 'file_download' | 'tab' | 'picsa_play_store';
/** Specify TRUE if using custom registered icon */
svgIcon?: boolean;
}

@Component({
selector: 'picsa-resource-item',
Expand All @@ -25,11 +30,7 @@ export class ResourceItemComponent implements OnInit {
@Input() viewStyle: 'expanded' | 'default' = 'default';
@Input() resource: IResource;

public actionButtonIcon?:
| 'open_in_new'
| 'file_download'
| 'smartphone'
| 'tab';
public actionButton?: IActionButton;
public downloadProgress?: number;

public subtitle = '';
Expand All @@ -56,6 +57,7 @@ export class ResourceItemComponent implements OnInit {
if (inputHandler) {
inputHandler(this.resource);
}
console.log('resource', this.resource);
}
}

Expand All @@ -67,7 +69,9 @@ class LinkItemHandler {
this.handleOverrides();
}
private async handleOverrides() {
this.parent.actionButtonIcon = (this.resource.icon as any) || 'tab';
this.parent.actionButton = {
icon: (this.resource.icon as any) || 'tab',
};
}

private handleClick(e: Event) {
Expand All @@ -86,9 +90,9 @@ class FileItemHandler {
}
private async handleOverrides() {
const isDownloaded = this.parent.store.isFileDownloaded(this.resource);
this.parent.actionButtonIcon = isDownloaded
? 'open_in_new'
: 'file_download'; // TODO show file download size alongside download icon
this.parent.actionButton = {
icon: isDownloaded ? 'open_in_new' : 'file_download',
}; // TODO show file download size alongside download icon
}

private async handleClick(e: Event) {
Expand All @@ -109,12 +113,12 @@ class FileItemHandler {
this.download$.unsubscribe();
this.download$ = undefined;
this.parent.downloadProgress = undefined;
this.parent.actionButtonIcon = 'file_download';
this.parent.actionButton = { icon: 'file_download' };
}
}

private handleResourceDownload() {
this.parent.actionButtonIcon = undefined;
this.parent.actionButton = undefined;
this.parent.downloadProgress = 0;
this.parent.store.downloadResource(this.resource).subscribe({
next: ({ progress, subscription }) => {
Expand All @@ -124,13 +128,13 @@ class FileItemHandler {
error: (err) => {
console.error(err);
this.parent.downloadProgress = undefined;
this.parent.actionButtonIcon = 'file_download';
this.parent.actionButton = { icon: 'file_download' };
// TODO - show error message
throw err;
},
complete: () => {
this.parent.downloadProgress = undefined;
this.parent.actionButtonIcon = 'open_in_new';
this.parent.actionButton = { icon: 'open_in_new' };
this.parent.store.openFileResource(this.resource);
},
});
Expand Down Expand Up @@ -179,12 +183,12 @@ class AppItemHandler {
this.handleOverrides();
}
private async handleOverrides() {
this.parent.actionButtonIcon = 'smartphone';
this.parent.actionButton = { icon: 'picsa_play_store', svgIcon: true };
console.log('app item', this.parent);
}

private handleClick(e: Event) {
e.stopPropagation();
console.log('handle click', this.resource);
const { appId } = this.resource;
this.parent.store.openBrowserLink(
`https://play.google.com/store/apps/details?id=${appId}`
Expand Down
25 changes: 23 additions & 2 deletions apps/picsa-tools/resources-tool/src/app/material.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { DomSanitizer } from '@angular/platform-browser';

// use custom module to make it easier to control what is available through app
@NgModule({
Expand All @@ -30,4 +31,24 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
},
],
})
export class ResourcesMaterialModule {}
export class ResourcesMaterialModule {
constructor(
private matIconRegistry: MatIconRegistry,
private domSanitizer: DomSanitizer
) {
this.registerIcons();
}

registerIcons() {
const RESOURCE_ICONS = {
play_store: 'play_store',
};
for (const [key, value] of Object.entries(RESOURCE_ICONS)) {
const iconName = `picsa_${key}`;
const iconUrl = this.domSanitizer.bypassSecurityTrustResourceUrl(
`assets/resources/mat-icons/${value}.svg`
);
this.matIconRegistry.addSvgIcon(iconName, iconUrl);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@
"md5Checksum": "b58f4cdf1c67f97c999b32abec8e3ee3",
"modifiedTime": "2022-09-30T09:15:14.200Z"
},
"mat-icons/play_store.svg": {
"relativePath": "mat-icons/play_store.svg",
"size_kb": 6,
"md5Checksum": "6e6469f18f958a0a55016d868ef3d533",
"modifiedTime": "2023-01-31T20:33:57.210Z"
},
"picsa-field-manual-en.pdf": {
"relativePath": "picsa-field-manual-en.pdf",
"size_kb": 1439.1,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion libs/environments/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import packageJson from '../../../package.json';

export const APP_VERSION = {
number: packageJson.version,
date: '2023-01-27',
date: '2023-01-31',
};
4 changes: 2 additions & 2 deletions libs/theme/src/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ body {
position: relative;
z-index: 1;
}
.page-content.no-padding {
padding: 0;
.no-padding {
padding: 0 !important;
}
58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "picsa-apps",
"version": "3.15.1",
"version": "3.15.2",
"license": "See LICENSE",
"scripts": {
"ng": "nx",
Expand Down Expand Up @@ -32,21 +32,21 @@
"@angular/router": "15.1.2",
"@angular/service-worker": "15.1.2",
"@asymmetrik/ngx-leaflet": "^14.0.1",
"@awesome-cordova-plugins/core": "^5.45.0",
"@awesome-cordova-plugins/file": "^5.45.0",
"@awesome-cordova-plugins/file-opener": "^5.45.0",
"@awesome-cordova-plugins/network": "^5.45.0",
"@awesome-cordova-plugins/social-sharing": "^5.45.0",
"@capacitor-community/firebase-analytics": "^2.0.0-1",
"@awesome-cordova-plugins/core": "^6.3.0",
"@awesome-cordova-plugins/file": "^6.3.0",
"@awesome-cordova-plugins/file-opener": "^6.3.0",
"@awesome-cordova-plugins/network": "^6.3.0",
"@awesome-cordova-plugins/social-sharing": "^6.3.0",
"@capacitor-community/firebase-analytics": "^4.0.0",
"@capacitor-community/firebase-crashlytics": "^2.0.0-1",
"@capacitor-firebase/performance": "^1.1.0",
"@capacitor/app": "^4.0.1",
"@capacitor/browser": "^4.0.1",
"@capacitor/core": "^4.1.0",
"@capacitor/device": "^4.0.1",
"@capacitor/filesystem": "^4.1.0",
"@capacitor-firebase/performance": "^1.3.0",
"@capacitor/app": "^4.1.1",
"@capacitor/browser": "^4.1.1",
"@capacitor/core": "^4.6.2",
"@capacitor/device": "^4.1.0",
"@capacitor/filesystem": "^4.1.4",
"@ionic-native/core": "^5.36.0",
"@ionic/angular": "6.1.8",
"@ionic/angular": "6.5.2",
"@ngx-translate/core": "~14.0.0",
"@ngx-translate/http-loader": "~7.0.0",
"@nrwl/angular": "15.6.2",
Expand All @@ -55,32 +55,32 @@
"capacitor-blob-writer": "^1.1.3",
"cordova-plugin-codeplay-share-own-apk": "0.0.7",
"cordova-plugin-file": "^7.0.0",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-file-opener2": "^4.0.0",
"cordova-plugin-x-socialsharing": "^6.0.4",
"date-fns": "^2.29.3",
"deepmerge": "^4.2.2",
"dexie": "^3.2.2",
"deepmerge": "^4.3.0",
"dexie": "^3.2.3",
"downloadjs": "^1.4.7",
"enketo-core": "^6.1.3",
"firebase": "^9.8.2",
"glob": "^8.0.3",
"firebase": "^9.16.0",
"glob": "^8.1.0",
"html2canvas": "^1.4.1",
"leaflet": "^1.8.0",
"leaflet": "^1.9.3",
"leaflet-draw": "github:enketo/Leaflet.draw#ff730785db7fcccbf2485ffcf4dffe1238a7c617",
"lottie-web": "^5.9.6",
"mobx": "^6.6.1",
"mobx-angular": "^4.6.0",
"lottie-web": "^5.10.2",
"mobx": "^6.7.0",
"mobx-angular": "^4.7.1",
"ng2-canvas-whiteboard": "^4.0.2",
"ngx-file-drop": "13.0.0",
"ngx-lottie": "^9.1.0",
"ngx-youtube-player": "^12.0.1",
"ngx-file-drop": "14.0.2",
"ngx-lottie": "^10.0.0",
"ngx-youtube-player": "^12.0.2",
"papaparse": "^5.3.2",
"parse": "3.4.2",
"rxjs": "~7.5.0",
"rxjs": "~7.8.0",
"save-svg-as-png": "^1.4.17",
"sharp": "^0.30.7",
"sharp": "^0.31.3",
"stacktrace-js": "^2.0.2",
"tslib": "^2.3.0",
"tslib": "^2.5.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 672ad2d

Please sign in to comment.