@alfalab/bridge-to-native 0.0.6 → 0.0.7-beta-34caabb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants.js +0 -2
- package/index.d.ts +2 -3
- package/index.js +2 -6
- package/package.json +1 -2
- package/types.d.ts +0 -3
package/constants.js
CHANGED
|
@@ -14,14 +14,12 @@ exports.versionToIosAppId = {
|
|
|
14
14
|
exports.nativeFeaturesFromVersion = {
|
|
15
15
|
android: {
|
|
16
16
|
linksInBrowser: {
|
|
17
|
-
nativeFeatureFtKey: 'linksInBrowserAndroid',
|
|
18
17
|
fromVersion: '11.71.0',
|
|
19
18
|
},
|
|
20
19
|
geolocation: { fromVersion: '11.71.0' },
|
|
21
20
|
},
|
|
22
21
|
ios: {
|
|
23
22
|
linksInBrowser: {
|
|
24
|
-
nativeFeatureFtKey: 'linksInBrowserIos',
|
|
25
23
|
fromVersion: '13.3.0',
|
|
26
24
|
},
|
|
27
25
|
geolocation: { fromVersion: '0.0.0' },
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { NativeFallbacks } from './native-fallbacks';
|
|
2
2
|
import { HandleRedirect, NativeNavigationAndTitle } from './native-navigation-and-title';
|
|
3
|
-
import type { Environment, NativeFeatureKey,
|
|
3
|
+
import type { Environment, NativeFeatureKey, NativeParams } from './types';
|
|
4
4
|
declare type Theme = 'light' | 'dark';
|
|
5
5
|
/**
|
|
6
6
|
* Этот класс - абстракция для связи веб приложения с нативом и предназначен ТОЛЬКО
|
|
7
7
|
* для использования в вебвью окружении.
|
|
8
8
|
*/
|
|
9
9
|
export declare class BridgeToNative {
|
|
10
|
-
nativeFeaturesFts: NativeFeaturesFts;
|
|
11
10
|
readonly AndroidBridge: {
|
|
12
11
|
setPageSettings: (params: string) => void;
|
|
13
12
|
} | undefined;
|
|
@@ -20,7 +19,7 @@ export declare class BridgeToNative {
|
|
|
20
19
|
private _iosAppId?;
|
|
21
20
|
private _theme;
|
|
22
21
|
private _handleRedirect;
|
|
23
|
-
constructor(
|
|
22
|
+
constructor(handleRedirect: HandleRedirect, nativeParams?: NativeParams);
|
|
24
23
|
get theme(): Theme;
|
|
25
24
|
get appVersion(): string;
|
|
26
25
|
get iosAppId(): string | undefined;
|
package/index.js
CHANGED
|
@@ -11,8 +11,7 @@ const utils_1 = require("./utils");
|
|
|
11
11
|
* для использования в вебвью окружении.
|
|
12
12
|
*/
|
|
13
13
|
class BridgeToNative {
|
|
14
|
-
constructor(
|
|
15
|
-
this.nativeFeaturesFts = nativeFeaturesFts;
|
|
14
|
+
constructor(handleRedirect, nativeParams) {
|
|
16
15
|
// Webview, запущенное в Android окружении имеет объект `Android` в window.
|
|
17
16
|
this.AndroidBridge = window.Android;
|
|
18
17
|
this.environment = this.AndroidBridge ? 'android' : 'ios';
|
|
@@ -55,10 +54,7 @@ class BridgeToNative {
|
|
|
55
54
|
* @param feature Название функциональности, которую нужно проверить.
|
|
56
55
|
*/
|
|
57
56
|
canUseNativeFeature(feature) {
|
|
58
|
-
const {
|
|
59
|
-
if (nativeFeatureFtKey && !this.nativeFeaturesFts[nativeFeatureFtKey]) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
57
|
+
const { fromVersion } = constants_1.nativeFeaturesFromVersion[this.environment][feature];
|
|
62
58
|
return this.isCurrentVersionHigherOrEqual(fromVersion);
|
|
63
59
|
}
|
|
64
60
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "UNLICENSED",
|
|
3
3
|
"name": "@alfalab/bridge-to-native",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7-beta-34caabb",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/core-ds/bridge-to-native.git"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"compile:copy-resources": "yarn copyfiles -e \"**/*.{[jt]s*(x),snap}\" -e \"**/*.json\" -e \"src/mock/**/*\" -u 1 \"src/**/*\" .publish",
|
|
19
19
|
"compile:clean": "shx rm -rf .publish",
|
|
20
20
|
"compile:ts": "tsc --project tsconfig.build.json",
|
|
21
|
-
"create-release-commit": "git add package.json CHANGELOG.md && git commit -m \"$MESSAGE\" && git push origin \"$BRANCH\"",
|
|
22
21
|
"lint:scripts": "eslint \"**/*.{js,jsx,ts,tsx}\" --ext .js,.jsx,.ts,.tsx",
|
|
23
22
|
"lint": "yarn lint:scripts && prettier --check \"./src/*.{ts,tsx,js,jsx,json}\"",
|
|
24
23
|
"lint:fix": "yarn lint:scripts --fix",
|
package/types.d.ts
CHANGED
|
@@ -6,11 +6,8 @@ export declare type NativeParams = {
|
|
|
6
6
|
nextPageId: number | null;
|
|
7
7
|
originalWebviewParams: string;
|
|
8
8
|
};
|
|
9
|
-
declare type NativeFeatureFtKey = 'linksInBrowserAndroid' | 'linksInBrowserIos';
|
|
10
|
-
export declare type NativeFeaturesFts = Record<NativeFeatureFtKey, boolean>;
|
|
11
9
|
export declare type NativeFeatureKey = 'geolocation' | 'linksInBrowser';
|
|
12
10
|
declare type NativeFeaturesParams = Readonly<Record<NativeFeatureKey, {
|
|
13
|
-
nativeFeatureFtKey?: NativeFeatureFtKey;
|
|
14
11
|
fromVersion: string;
|
|
15
12
|
}>>;
|
|
16
13
|
export declare type NativeFeaturesFromVersion = Readonly<{
|