Skip to content

Commit 0d5c764

Browse files
committed
chore: fixes
1 parent 815e62e commit 0d5c764

File tree

4 files changed

+27
-51
lines changed

4 files changed

+27
-51
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ packages/**/*.ngsummary.json
3535
!packages/**/angular/package.json
3636
!packages/**/platforms
3737
packages/**/*.d.ts
38+
*.aar

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"nativescript-vue": "^2.9.0",
4343
"ng-packagr": "~12.2.0",
4444
"prettier": "^2.3.2",
45+
"promise-polyfill": "^8.2.0",
4546
"react-nativescript": "^2.2.0",
4647
"rimraf": "^3.0.2",
4748
"rollup": "^2.48.0",
@@ -53,7 +54,7 @@
5354
"ts-patch": "^1.4.2",
5455
"tslib": "^2.3.0",
5556
"typedoc": "^0.21.5",
56-
"typescript": "~4.1.6",
57+
"typescript": "~4.3.5",
5758
"url": "^0.11.0",
5859
"vue": "^2.6.14",
5960
"yargs": "^17.1.0"

src/webview/index.common.ts

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export class UnsupportedSDKError extends Error {
362362
}
363363

364364
@CSSType('WebView')
365-
export class WebViewExtBase extends ContainerView {
365+
export abstract class WebViewExtBase extends ContainerView {
366366
public webConsole: boolean;
367367

368368
public static readonly supportXLocalScheme: boolean;
@@ -765,58 +765,42 @@ export class WebViewExtBase extends ContainerView {
765765
/**
766766
* Platform specific loadURL-implementation.
767767
*/
768-
public _loadUrl(src: string): void {
769-
throw new Error('Method not implemented.');
770-
}
768+
abstract _loadUrl(src: string): void;
771769

772770
/**
773771
* Platform specific loadData-implementation.
774772
*/
775-
public _loadData(src: string): void {
776-
throw new Error('Method not implemented.');
777-
}
773+
abstract _loadData(src: string): void;
778774

779775
/**
780776
* Stops loading the current content (if any).
781777
*/
782-
public stopLoading() {
783-
throw new Error('Method not implemented.');
784-
}
778+
abstract stopLoading();
785779

786780
/**
787781
* Gets a value indicating whether the WebView can navigate back.
788782
*/
789-
public get canGoBack(): boolean {
790-
throw new Error('This member is abstract.');
791-
}
783+
abstract get canGoBack(): boolean;
792784

793785
/**
794786
* Gets a value indicating whether the WebView can navigate forward.
795787
*/
796-
public get canGoForward(): boolean {
797-
throw new Error('This member is abstract.');
798-
}
788+
abstract get canGoForward(): boolean;
799789

800790
/**
801791
* Navigates back.
802792
*/
803-
public goBack() {
804-
throw new Error('Method not implemented.');
805-
}
793+
abstract goBack();
806794

807795
/**
808796
* Navigates forward.
809797
*/
810-
public goForward() {
811-
throw new Error('Method not implemented.');
812-
}
798+
abstract goForward();
813799

814800
/**
815801
* Reloads the current url.
816802
*/
817-
public reload() {
818-
throw new Error('Method not implemented.');
819-
}
803+
abstract reload();
820804

821805
[srcProperty.getDefault](): string {
822806
return '';
@@ -921,24 +905,17 @@ export class WebViewExtBase extends ContainerView {
921905
* Register a local resource.
922906
* This resource can be loaded via "x-local://{name}" inside the webview
923907
*/
924-
public registerLocalResource(name: string, filepath: string): void {
925-
throw new Error('Method not implemented.');
926-
}
908+
abstract registerLocalResource(name: string, filepath: string): void;
927909

928910
/**
929911
* Unregister a local resource.
930912
*/
931-
public unregisterLocalResource(name: string): void {
932-
throw new Error('Method not implemented.');
933-
}
913+
abstract unregisterLocalResource(name: string): void;
934914

935915
/**
936916
* Resolve a "x-local://{name}" to file-path.
937917
*/
938-
public getRegisteredLocalResource(name: string): string | void {
939-
throw new Error('Method not implemented.');
940-
}
941-
918+
abstract getRegisteredLocalResource(name: string): string | void;
942919
/**
943920
* Load URL - Wait for promise
944921
*
@@ -1207,9 +1184,7 @@ export class WebViewExtBase extends ContainerView {
12071184
* Larger scripts should be injected with loadJavaScriptFile.
12081185
* NOTE: stringifyResult only applies on iOS.
12091186
*/
1210-
public executeJavaScript<T>(scriptCode: string, stringifyResult?: boolean): Promise<T> {
1211-
throw new Error('Method not implemented.');
1212-
}
1187+
abstract executeJavaScript<T>(scriptCode: string, stringifyResult?: boolean): Promise<T>;
12131188

12141189
/**
12151190
* Execute a promise inside the webview and wait for it to resolve.
@@ -1459,21 +1434,13 @@ export class WebViewExtBase extends ContainerView {
14591434
* Get document.title
14601435
* NOTE: On Android, if empty returns filename
14611436
*/
1462-
public getTitle(): Promise<string | void> {
1463-
throw new Error('Method not implemented.');
1464-
}
1437+
abstract getTitle(): Promise<string | void>;
14651438

1466-
public zoomIn(): boolean {
1467-
throw new Error('Method not implemented.');
1468-
}
1439+
abstract zoomIn(): boolean;
14691440

1470-
public zoomOut(): boolean {
1471-
throw new Error('Method not implemented.');
1472-
}
1441+
abstract zoomOut(): boolean;
14731442

1474-
public zoomBy(zoomFactor: number) {
1475-
throw new Error('Method not implemented.');
1476-
}
1443+
abstract zoomBy(zoomFactor: number);
14771444

14781445
/**
14791446
* Helper function, strips 'x-local://' from a resource name

src/webview/index.ios.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export * from './index.common';
1616
const messageHandlerName = 'nsBridge';
1717

1818
export class AWebView extends WebViewExtBase {
19+
zoomIn(): boolean {
20+
return false;
21+
}
22+
zoomOut(): boolean {
23+
return false;
24+
}
25+
zoomBy(zoomFactor: number) {}
1926
public ios: WKWebView;
2027
nativeViewProtected: WKWebView;
2128

0 commit comments

Comments
 (0)