react-native-device-info
This commit is contained in:
parent
b94d0e38c9
commit
0b9b8b989d
|
|
@ -6,7 +6,7 @@ export class Navigator extends Feature {
|
|||
constructor() {
|
||||
super();
|
||||
this.namespace = '';
|
||||
this.base = 'http://oaklocalhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
this.base = 'http://oak-localhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
}
|
||||
setNamespace(namespace) {
|
||||
this.namespace = namespace;
|
||||
|
|
@ -23,7 +23,7 @@ export class Navigator extends Feature {
|
|||
const urlParse = new URL(url.toString(), this.base);
|
||||
let url2 = urlParse.toString();
|
||||
if (process.env.OAK_PLATFORM !== 'web') {
|
||||
url2 = decodeURIComponent(url2)
|
||||
url2 = decodeURIComponent(url2);
|
||||
}
|
||||
return url2.replace(this.base, '');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import { Platform } from 'react-native';
|
||||
import { getLocales } from 'react-native-localize';
|
||||
import { getDeviceId } from 'react-native-device-info';
|
||||
export async function getEnv() {
|
||||
const language = getLocales()[0].languageTag;
|
||||
const deviceId = getDeviceId();
|
||||
const fullEnv = {
|
||||
...Platform,
|
||||
visitorId: deviceId,
|
||||
language,
|
||||
type: 'native',
|
||||
};
|
||||
const briefEnv = {
|
||||
brand: fullEnv.constants.Brand,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class Navigator extends Feature_1.Feature {
|
|||
constructor() {
|
||||
super();
|
||||
this.namespace = '';
|
||||
this.base = 'http://localhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
this.base = 'http://oak-localhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
}
|
||||
setNamespace(namespace) {
|
||||
this.namespace = namespace;
|
||||
|
|
@ -25,7 +25,9 @@ class Navigator extends Feature_1.Feature {
|
|||
urlFormat(url) {
|
||||
const urlParse = new url_1.url(url.toString(), this.base);
|
||||
let url2 = urlParse.toString();
|
||||
url2 = decodeURIComponent(url2);
|
||||
if (process.env.OAK_PLATFORM !== 'web') {
|
||||
url2 = decodeURIComponent(url2);
|
||||
}
|
||||
return url2.replace(this.base, '');
|
||||
}
|
||||
constructState(pathname, state, search) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.getEnv = void 0;
|
||||
const react_native_1 = require("react-native");
|
||||
const react_native_localize_1 = require("react-native-localize");
|
||||
const react_native_device_info_1 = require("react-native-device-info");
|
||||
async function getEnv() {
|
||||
const language = (0, react_native_localize_1.getLocales)()[0].languageTag;
|
||||
const deviceId = (0, react_native_device_info_1.getDeviceId)();
|
||||
const fullEnv = {
|
||||
...react_native_1.Platform,
|
||||
visitorId: deviceId,
|
||||
language,
|
||||
type: 'native',
|
||||
};
|
||||
const briefEnv = {
|
||||
brand: fullEnv.constants.Brand,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
"oak-domain": "file:../oak-domain",
|
||||
"oak-memory-tree-store": "file:../oak-memory-tree-store",
|
||||
"ol": "^7.3.0",
|
||||
"react-native-device-info": "^10.12.0",
|
||||
"react-native-localize": "^3.0.4",
|
||||
"react-responsive": "^9.0.2",
|
||||
"rmc-pull-to-refresh": "^1.0.13",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export class Navigator extends Feature {
|
|||
constructor() {
|
||||
super();
|
||||
this.namespace = '';
|
||||
this.base = 'http://oaklocalhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
this.base = 'http://oak-localhost'; // 使用URL解析链接时 相对路径需要使用构建一个完整链接
|
||||
}
|
||||
|
||||
setNamespace(namespace: string) {
|
||||
|
|
@ -35,8 +35,6 @@ export class Navigator extends Feature {
|
|||
if (process.env.OAK_PLATFORM !== 'web') {
|
||||
url2 = decodeURIComponent(url2)
|
||||
}
|
||||
// url2 = decodeURIComponent(url2)
|
||||
|
||||
return url2.replace(this.base, '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
import { NativeEnv, BriefEnv } from 'oak-domain/lib/types/Environment';
|
||||
import { Platform } from 'react-native';
|
||||
import { getLocales } from 'react-native-localize';
|
||||
import { getDeviceId } from 'react-native-device-info';
|
||||
|
||||
export async function getEnv() {
|
||||
const language = getLocales()[0].languageTag;
|
||||
const deviceId = getDeviceId();
|
||||
const fullEnv = {
|
||||
...Platform,
|
||||
visitorId: deviceId,
|
||||
language,
|
||||
type: 'native',
|
||||
} as NativeEnv;
|
||||
|
||||
const briefEnv: BriefEnv = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue