@rnpack/utils 0.1.4 → 0.1.6
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/LICENSE +1 -1
- package/README.md +16 -26
- package/Utils.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/rnpack/utils/Utils.kt +10 -0
- package/android/src/main/java/com/margelo/nitro/rnpack/utils/UtilsPackage.kt +22 -0
- package/ios/Utils.swift +5 -0
- package/lib/module/Utils.nitro.js +4 -0
- package/lib/module/Utils.nitro.js.map +1 -0
- package/lib/module/constants/index.js +2 -0
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/constants/permissions.js +2 -0
- package/lib/module/constants/permissions.js.map +1 -1
- package/lib/module/constants/settings.js +2 -0
- package/lib/module/constants/settings.js.map +1 -1
- package/lib/module/hooks/index.js +2 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/usePagination.js +2 -0
- package/lib/module/hooks/usePagination.js.map +1 -1
- package/lib/module/hooks/useTimer.js +3 -1
- package/lib/module/hooks/useTimer.js.map +1 -1
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.js +2 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/settings.js +1 -1
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/object.js +2 -0
- package/lib/module/utils/object.js.map +1 -1
- package/lib/module/utils/permissions.js +2 -0
- package/lib/module/utils/permissions.js.map +1 -1
- package/lib/module/utils/responsive.js +5 -3
- package/lib/module/utils/responsive.js.map +1 -1
- package/lib/module/utils/settings.js +2 -0
- package/lib/module/utils/settings.js.map +1 -1
- package/lib/module/utils/string.js +2 -0
- package/lib/module/utils/string.js.map +1 -1
- package/lib/module/utils/utils.js +2 -0
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Utils.nitro.d.ts +8 -0
- package/lib/typescript/src/Utils.nitro.d.ts.map +1 -0
- package/lib/typescript/src/constants/permissions.d.ts +4 -4
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +0 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHybridUtilsSpec.cpp +52 -0
- package/nitrogen/generated/android/c++/JHybridUtilsSpec.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnpack/utils/HybridUtilsSpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnpack/utils/rnpack_utilsOnLoad.kt +35 -0
- package/nitrogen/generated/android/rnpack_utils+autolinking.cmake +81 -0
- package/nitrogen/generated/android/rnpack_utils+autolinking.gradle +27 -0
- package/nitrogen/generated/android/rnpack_utilsOnLoad.cpp +44 -0
- package/nitrogen/generated/android/rnpack_utilsOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/Utils+autolinking.rb +60 -0
- package/nitrogen/generated/ios/Utils-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/Utils-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/Utils-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/UtilsAutolinking.mm +33 -0
- package/nitrogen/generated/ios/UtilsAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridUtilsSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUtilsSpecSwift.hpp +76 -0
- package/nitrogen/generated/ios/swift/HybridUtilsSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridUtilsSpec_cxx.swift +131 -0
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.hpp +62 -0
- package/package.json +92 -99
- package/src/Utils.nitro.ts +6 -0
- package/src/hooks/useTimer.tsx +1 -1
- package/src/index.tsx +9 -0
- package/src/types/index.ts +0 -1
- package/src/utils/responsive.tsx +3 -3
- package/lib/commonjs/constants/index.js +0 -28
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/constants/permissions.js +0 -20
- package/lib/commonjs/constants/permissions.js.map +0 -1
- package/lib/commonjs/constants/settings.js +0 -17
- package/lib/commonjs/constants/settings.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -28
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/usePagination.js +0 -29
- package/lib/commonjs/hooks/usePagination.js.map +0 -1
- package/lib/commonjs/hooks/useTimer.js +0 -44
- package/lib/commonjs/hooks/useTimer.js.map +0 -1
- package/lib/commonjs/index.js +0 -50
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/types/index.js +0 -28
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/settings.js +0 -2
- package/lib/commonjs/types/settings.js.map +0 -1
- package/lib/commonjs/types/storage.js +0 -2
- package/lib/commonjs/types/storage.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -72
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/object.js +0 -32
- package/lib/commonjs/utils/object.js.map +0 -1
- package/lib/commonjs/utils/permissions.js +0 -55
- package/lib/commonjs/utils/permissions.js.map +0 -1
- package/lib/commonjs/utils/responsive.js +0 -36
- package/lib/commonjs/utils/responsive.js.map +0 -1
- package/lib/commonjs/utils/settings.js +0 -100
- package/lib/commonjs/utils/settings.js.map +0 -1
- package/lib/commonjs/utils/storage.js +0 -36
- package/lib/commonjs/utils/storage.js.map +0 -1
- package/lib/commonjs/utils/string.js +0 -60
- package/lib/commonjs/utils/string.js.map +0 -1
- package/lib/commonjs/utils/utils.js +0 -23
- package/lib/commonjs/utils/utils.js.map +0 -1
- package/lib/module/types/storage.js +0 -2
- package/lib/module/types/storage.js.map +0 -1
- package/lib/module/utils/storage.js +0 -30
- package/lib/module/utils/storage.js.map +0 -1
- package/lib/typescript/src/types/storage.d.ts +0 -16
- package/lib/typescript/src/types/storage.d.ts.map +0 -1
- package/lib/typescript/src/utils/storage.d.ts +0 -15
- package/lib/typescript/src/utils/storage.d.ts.map +0 -1
- package/src/types/storage.ts +0 -24
- package/src/utils/storage.ts +0 -45
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.canOpenUrl = canOpenUrl;
|
|
7
|
-
exports.openAndroidBluetoothSettings = openAndroidBluetoothSettings;
|
|
8
|
-
exports.openAndroidLocationSettings = openAndroidLocationSettings;
|
|
9
|
-
exports.openAppCustomSettings = openAppCustomSettings;
|
|
10
|
-
exports.openBluetoothSettings = openBluetoothSettings;
|
|
11
|
-
exports.openIOSBluetoothSettings = openIOSBluetoothSettings;
|
|
12
|
-
exports.openIOSLocationSettings = openIOSLocationSettings;
|
|
13
|
-
exports.openLocationSettings = openLocationSettings;
|
|
14
|
-
exports.openUrl = openUrl;
|
|
15
|
-
var _reactNative = require("react-native");
|
|
16
|
-
var _index = require("../constants/index.js");
|
|
17
|
-
async function canOpenUrl(url) {
|
|
18
|
-
try {
|
|
19
|
-
const isOpenable = await _reactNative.Linking?.canOpenURL(url);
|
|
20
|
-
return isOpenable;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
const err = error;
|
|
23
|
-
console.error('Given url is not valid to open: ', url, err?.message);
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function openUrl(url) {
|
|
28
|
-
const isOpenable = await canOpenUrl(url);
|
|
29
|
-
if (isOpenable) {
|
|
30
|
-
try {
|
|
31
|
-
await _reactNative.Linking?.openURL(url);
|
|
32
|
-
console.log('Opened given url: ', url);
|
|
33
|
-
return true;
|
|
34
|
-
} catch (error) {
|
|
35
|
-
const err = error;
|
|
36
|
-
console.error('Can not open given url: ', url, err?.message);
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
console.warn('Given url is not openable: ', url);
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
async function sentIntentAndroid(args) {
|
|
44
|
-
try {
|
|
45
|
-
await _reactNative.Linking?.sendIntent(args?.action, args?.extras);
|
|
46
|
-
return true;
|
|
47
|
-
} catch (error) {
|
|
48
|
-
const err = error;
|
|
49
|
-
console.error('Sent android intent Error: ', args, err?.message);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function openIOSBluetoothSettings() {
|
|
54
|
-
const status = await openUrl(_index.settings?.ios?.bluetooth);
|
|
55
|
-
return status;
|
|
56
|
-
}
|
|
57
|
-
async function openAndroidBluetoothSettings() {
|
|
58
|
-
return await sentIntentAndroid({
|
|
59
|
-
action: _index.settings?.android?.bluetooth
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
async function openBluetoothSettings() {
|
|
63
|
-
if (_reactNative.Platform?.OS === 'ios') {
|
|
64
|
-
return await openIOSBluetoothSettings();
|
|
65
|
-
}
|
|
66
|
-
if (_reactNative.Platform?.OS === 'android') {
|
|
67
|
-
return await openAndroidBluetoothSettings();
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
async function openAppCustomSettings() {
|
|
72
|
-
try {
|
|
73
|
-
await _reactNative.Linking?.openSettings();
|
|
74
|
-
return true;
|
|
75
|
-
} catch (error) {
|
|
76
|
-
const err = error;
|
|
77
|
-
console.error('Open app custom settings Error: ', err?.message);
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async function openIOSLocationSettings() {
|
|
82
|
-
const status = await openUrl(_index.settings?.ios?.location);
|
|
83
|
-
return status;
|
|
84
|
-
}
|
|
85
|
-
async function openAndroidLocationSettings() {
|
|
86
|
-
const status = await sentIntentAndroid({
|
|
87
|
-
action: _index.settings?.android?.location
|
|
88
|
-
});
|
|
89
|
-
return status;
|
|
90
|
-
}
|
|
91
|
-
async function openLocationSettings() {
|
|
92
|
-
if (_reactNative.Platform?.OS === 'ios') {
|
|
93
|
-
return await openIOSLocationSettings();
|
|
94
|
-
}
|
|
95
|
-
if (_reactNative.Platform?.OS === 'android') {
|
|
96
|
-
return await openAndroidLocationSettings();
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_index","canOpenUrl","url","isOpenable","Linking","canOpenURL","error","err","console","message","openUrl","openURL","log","warn","sentIntentAndroid","args","sendIntent","action","extras","openIOSBluetoothSettings","status","settings","ios","bluetooth","openAndroidBluetoothSettings","android","openBluetoothSettings","Platform","OS","openAppCustomSettings","openSettings","openIOSLocationSettings","location","openAndroidLocationSettings","openLocationSettings"],"sourceRoot":"../../../src","sources":["utils/settings.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.storage = void 0;
|
|
7
|
-
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
-
var _string = require("./string.js");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
async function set(args) {
|
|
11
|
-
await _asyncStorage.default.setItem(args?.key, JSON.stringify(args?.value));
|
|
12
|
-
}
|
|
13
|
-
async function get(args) {
|
|
14
|
-
const data = await _asyncStorage.default.getItem(args?.key);
|
|
15
|
-
if ((0, _string.isNotEmpty)(data)) {
|
|
16
|
-
return JSON.parse(data);
|
|
17
|
-
}
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
async function remove(args) {
|
|
21
|
-
await _asyncStorage.default.removeItem(args?.key);
|
|
22
|
-
}
|
|
23
|
-
async function merge(args) {
|
|
24
|
-
await _asyncStorage.default.mergeItem(args?.key, JSON.stringify(args?.value));
|
|
25
|
-
}
|
|
26
|
-
async function clearAll() {
|
|
27
|
-
await _asyncStorage.default.clear();
|
|
28
|
-
}
|
|
29
|
-
const storage = exports.storage = {
|
|
30
|
-
set,
|
|
31
|
-
get,
|
|
32
|
-
remove,
|
|
33
|
-
merge,
|
|
34
|
-
clearAll
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_asyncStorage","_interopRequireDefault","require","_string","e","__esModule","default","set","args","AsyncStorage","setItem","key","JSON","stringify","value","get","data","getItem","isNotEmpty","parse","remove","removeItem","merge","mergeItem","clearAll","clear","storage","exports"],"sourceRoot":"../../../src","sources":["utils/storage.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAStC,eAAeG,GAAGA,CAACC,IAAwB,EAAE;EAC3C,MAAMC,qBAAY,CAACC,OAAO,CAACF,IAAI,EAAEG,GAAG,EAAEC,IAAI,CAACC,SAAS,CAACL,IAAI,EAAEM,KAAK,CAAC,CAAC;AACpE;AAEA,eAAeC,GAAGA,CAACP,IAAwB,EAAE;EAC3C,MAAMQ,IAAI,GAAG,MAAMP,qBAAY,CAACQ,OAAO,CAACT,IAAI,EAAEG,GAAG,CAAC;EAClD,IAAI,IAAAO,kBAAU,EAACF,IAAI,CAAC,EAAE;IACpB,OAAOJ,IAAI,CAACO,KAAK,CAACH,IAAc,CAAC;EACnC;EAEA,OAAOA,IAAI;AACb;AAEA,eAAeI,MAAMA,CAACZ,IAA2B,EAAE;EACjD,MAAMC,qBAAY,CAACY,UAAU,CAACb,IAAI,EAAEG,GAAG,CAAC;AAC1C;AAEA,eAAeW,KAAKA,CAACd,IAA0B,EAAE;EAC/C,MAAMC,qBAAY,CAACc,SAAS,CAACf,IAAI,EAAEG,GAAG,EAAEC,IAAI,CAACC,SAAS,CAACL,IAAI,EAAEM,KAAK,CAAC,CAAC;AACtE;AAEA,eAAeU,QAAQA,CAAA,EAAG;EACxB,MAAMf,qBAAY,CAACgB,KAAK,CAAC,CAAC;AAC5B;AAEA,MAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG;EACdnB,GAAG;EACHQ,GAAG;EACHK,MAAM;EACNE,KAAK;EACLE;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.base64ToString = base64ToString;
|
|
7
|
-
exports.byteArrayToString = byteArrayToString;
|
|
8
|
-
exports.convertStringToNumber = convertStringToNumber;
|
|
9
|
-
exports.isEmpty = isEmpty;
|
|
10
|
-
exports.isNotEmpty = isNotEmpty;
|
|
11
|
-
exports.removeNullCharactersFromText = removeNullCharactersFromText;
|
|
12
|
-
exports.splitString = splitString;
|
|
13
|
-
exports.stringToBase64 = stringToBase64;
|
|
14
|
-
exports.stringToByteArray = stringToByteArray;
|
|
15
|
-
var _buffer = require("buffer");
|
|
16
|
-
function isEmpty(text) {
|
|
17
|
-
if (!text) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
const value = text;
|
|
21
|
-
return /^\s*$/.test(value);
|
|
22
|
-
}
|
|
23
|
-
function isNotEmpty(text) {
|
|
24
|
-
return !isEmpty(text);
|
|
25
|
-
}
|
|
26
|
-
function byteArrayToString(byteArray) {
|
|
27
|
-
let result = '';
|
|
28
|
-
for (let i = 0; i < byteArray.length; i++) {
|
|
29
|
-
if (!byteArray[i]) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
result += String.fromCharCode(byteArray[i]);
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
function stringToByteArray(data) {
|
|
37
|
-
const arrayBuffer = new ArrayBuffer(data.length * 1);
|
|
38
|
-
const newUint = new Uint8Array(arrayBuffer);
|
|
39
|
-
newUint.forEach((_, i) => {
|
|
40
|
-
newUint[i] = data.charCodeAt(i);
|
|
41
|
-
});
|
|
42
|
-
return newUint;
|
|
43
|
-
}
|
|
44
|
-
function base64ToString(input) {
|
|
45
|
-
return _buffer.Buffer?.from(input, 'base64').toString('utf8');
|
|
46
|
-
}
|
|
47
|
-
function stringToBase64(input) {
|
|
48
|
-
return _buffer.Buffer?.from(input, 'utf8').toString('base64');
|
|
49
|
-
}
|
|
50
|
-
function removeNullCharactersFromText(text) {
|
|
51
|
-
const alphaNumericRegex = new RegExp(/[^a-z0-9]/gi);
|
|
52
|
-
return text?.replaceAll('\0', '')?.replaceAll('%s', '')?.replace(alphaNumericRegex, '');
|
|
53
|
-
}
|
|
54
|
-
function convertStringToNumber(value) {
|
|
55
|
-
return !isEmpty(value) ? parseFloat(value) : undefined;
|
|
56
|
-
}
|
|
57
|
-
function splitString(text, splitBy) {
|
|
58
|
-
return text.split(splitBy);
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=string.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_buffer","require","isEmpty","text","value","test","isNotEmpty","byteArrayToString","byteArray","result","i","length","String","fromCharCode","stringToByteArray","data","arrayBuffer","ArrayBuffer","newUint","Uint8Array","forEach","_","charCodeAt","base64ToString","input","Buffer","from","toString","stringToBase64","removeNullCharactersFromText","alphaNumericRegex","RegExp","replaceAll","replace","convertStringToNumber","parseFloat","undefined","splitString","splitBy","split"],"sourceRoot":"../../../src","sources":["utils/string.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,SAASC,OAAOA,CAACC,IAAa,EAAW;EACvC,IAAI,CAACA,IAAI,EAAE;IACT,OAAO,IAAI;EACb;EAEA,MAAMC,KAAa,GAAGD,IAAc;EAEpC,OAAO,OAAO,CAACE,IAAI,CAACD,KAAK,CAAC;AAC5B;AAEA,SAASE,UAAUA,CAACH,IAAa,EAAW;EAC1C,OAAO,CAACD,OAAO,CAACC,IAAI,CAAC;AACvB;AAEA,SAASI,iBAAiBA,CAACC,SAAwB,EAAU;EAC3D,IAAIC,MAAM,GAAG,EAAE;EAEf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,SAAS,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACzC,IAAI,CAACF,SAAS,CAACE,CAAC,CAAC,EAAE;MACjB;IACF;IAEAD,MAAM,IAAIG,MAAM,CAACC,YAAY,CAACL,SAAS,CAACE,CAAC,CAAW,CAAC;EACvD;EAEA,OAAOD,MAAM;AACf;AAEA,SAASK,iBAAiBA,CAACC,IAAY,EAAc;EACnD,MAAMC,WAAW,GAAG,IAAIC,WAAW,CAACF,IAAI,CAACJ,MAAM,GAAG,CAAC,CAAC;EACpD,MAAMO,OAAO,GAAG,IAAIC,UAAU,CAACH,WAAW,CAAC;EAC3CE,OAAO,CAACE,OAAO,CAAC,CAACC,CAAC,EAAEX,CAAC,KAAK;IACxBQ,OAAO,CAACR,CAAC,CAAC,GAAGK,IAAI,CAACO,UAAU,CAACZ,CAAC,CAAC;EACjC,CAAC,CAAC;EAEF,OAAOQ,OAAO;AAChB;AAEA,SAASK,cAAcA,CAACC,KAAa,EAAU;EAC7C,OAAOC,cAAM,EAAEC,IAAI,CAACF,KAAK,EAAE,QAAQ,CAAC,CAACG,QAAQ,CAAC,MAAM,CAAC;AACvD;AAEA,SAASC,cAAcA,CAACJ,KAAa,EAAU;EAC7C,OAAOC,cAAM,EAAEC,IAAI,CAACF,KAAK,EAAE,MAAM,CAAC,CAACG,QAAQ,CAAC,QAAQ,CAAC;AACvD;AAEA,SAASE,4BAA4BA,CAAC1B,IAAY,EAAE;EAClD,MAAM2B,iBAAiB,GAAG,IAAIC,MAAM,CAAC,aAAa,CAAC;EACnD,OAAO5B,IAAI,EACP6B,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,EACpBA,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,EACpBC,OAAO,CAACH,iBAAiB,EAAE,EAAE,CAAC;AACpC;AAEA,SAASI,qBAAqBA,CAAC9B,KAAa,EAAsB;EAChE,OAAO,CAACF,OAAO,CAACE,KAAK,CAAC,GAAG+B,UAAU,CAAC/B,KAAK,CAAC,GAAGgC,SAAS;AACxD;AAEA,SAASC,WAAWA,CAAClC,IAAY,EAAEmC,OAAe,EAAiB;EACjE,OAAOnC,IAAI,CAACoC,KAAK,CAACD,OAAO,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateRandomNumber = generateRandomNumber;
|
|
7
|
-
exports.makeCall = makeCall;
|
|
8
|
-
exports.makeVibration = makeVibration;
|
|
9
|
-
exports.sleep = sleep;
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
function generateRandomNumber(n) {
|
|
12
|
-
return Math.floor(Math.random() * (9 * Math.pow(10, n - 1))) + Math.pow(10, n - 1);
|
|
13
|
-
}
|
|
14
|
-
function sleep(ms) {
|
|
15
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
16
|
-
}
|
|
17
|
-
function makeVibration() {
|
|
18
|
-
_reactNative.Vibration.vibrate();
|
|
19
|
-
}
|
|
20
|
-
async function makeCall(args) {
|
|
21
|
-
await _reactNative.Linking.openURL(`tel:${args?.number}`);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","generateRandomNumber","n","Math","floor","random","pow","sleep","ms","Promise","resolve","setTimeout","makeVibration","Vibration","vibrate","makeCall","args","Linking","openURL","number"],"sourceRoot":"../../../src","sources":["utils/utils.tsx"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,SAASC,oBAAoBA,CAACC,CAAS,EAAU;EAC/C,OACEC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAGF,IAAI,CAACG,GAAG,CAAC,EAAE,EAAEJ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAGC,IAAI,CAACG,GAAG,CAAC,EAAE,EAAEJ,CAAC,GAAG,CAAC,CAAC;AAE/E;AAEA,SAASK,KAAKA,CAACC,EAAU,EAAE;EACzB,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAEF,EAAE,CAAC,CAAC;AAC1D;AAEA,SAASI,aAAaA,CAAA,EAAS;EAC7BC,sBAAS,CAACC,OAAO,CAAC,CAAC;AACrB;AAEA,eAAeC,QAAQA,CAACC,IAAyB,EAAiB;EAChE,MAAMC,oBAAO,CAACC,OAAO,CAAC,OAAOF,IAAI,EAAEG,MAAM,EAAE,CAAC;AAC9C","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/storage.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
import { isNotEmpty } from "./string.js";
|
|
3
|
-
async function set(args) {
|
|
4
|
-
await AsyncStorage.setItem(args?.key, JSON.stringify(args?.value));
|
|
5
|
-
}
|
|
6
|
-
async function get(args) {
|
|
7
|
-
const data = await AsyncStorage.getItem(args?.key);
|
|
8
|
-
if (isNotEmpty(data)) {
|
|
9
|
-
return JSON.parse(data);
|
|
10
|
-
}
|
|
11
|
-
return data;
|
|
12
|
-
}
|
|
13
|
-
async function remove(args) {
|
|
14
|
-
await AsyncStorage.removeItem(args?.key);
|
|
15
|
-
}
|
|
16
|
-
async function merge(args) {
|
|
17
|
-
await AsyncStorage.mergeItem(args?.key, JSON.stringify(args?.value));
|
|
18
|
-
}
|
|
19
|
-
async function clearAll() {
|
|
20
|
-
await AsyncStorage.clear();
|
|
21
|
-
}
|
|
22
|
-
const storage = {
|
|
23
|
-
set,
|
|
24
|
-
get,
|
|
25
|
-
remove,
|
|
26
|
-
merge,
|
|
27
|
-
clearAll
|
|
28
|
-
};
|
|
29
|
-
export { storage };
|
|
30
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AsyncStorage","isNotEmpty","set","args","setItem","key","JSON","stringify","value","get","data","getItem","parse","remove","removeItem","merge","mergeItem","clearAll","clear","storage"],"sourceRoot":"../../../src","sources":["utils/storage.ts"],"mappings":"AAAA,OAAOA,YAAY,MAAM,2CAA2C;AAEpE,SAASC,UAAU,QAAQ,aAAU;AASrC,eAAeC,GAAGA,CAACC,IAAwB,EAAE;EAC3C,MAAMH,YAAY,CAACI,OAAO,CAACD,IAAI,EAAEE,GAAG,EAAEC,IAAI,CAACC,SAAS,CAACJ,IAAI,EAAEK,KAAK,CAAC,CAAC;AACpE;AAEA,eAAeC,GAAGA,CAACN,IAAwB,EAAE;EAC3C,MAAMO,IAAI,GAAG,MAAMV,YAAY,CAACW,OAAO,CAACR,IAAI,EAAEE,GAAG,CAAC;EAClD,IAAIJ,UAAU,CAACS,IAAI,CAAC,EAAE;IACpB,OAAOJ,IAAI,CAACM,KAAK,CAACF,IAAc,CAAC;EACnC;EAEA,OAAOA,IAAI;AACb;AAEA,eAAeG,MAAMA,CAACV,IAA2B,EAAE;EACjD,MAAMH,YAAY,CAACc,UAAU,CAACX,IAAI,EAAEE,GAAG,CAAC;AAC1C;AAEA,eAAeU,KAAKA,CAACZ,IAA0B,EAAE;EAC/C,MAAMH,YAAY,CAACgB,SAAS,CAACb,IAAI,EAAEE,GAAG,EAAEC,IAAI,CAACC,SAAS,CAACJ,IAAI,EAAEK,KAAK,CAAC,CAAC;AACtE;AAEA,eAAeS,QAAQA,CAAA,EAAG;EACxB,MAAMjB,YAAY,CAACkB,KAAK,CAAC,CAAC;AAC5B;AAEA,MAAMC,OAAO,GAAG;EACdjB,GAAG;EACHO,GAAG;EACHI,MAAM;EACNE,KAAK;EACLE;AACF,CAAC;AAED,SAASE,OAAO","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface StorageSetArgsType {
|
|
2
|
-
key: string;
|
|
3
|
-
value: unknown;
|
|
4
|
-
}
|
|
5
|
-
interface StorageGetArgsType {
|
|
6
|
-
key: string;
|
|
7
|
-
}
|
|
8
|
-
interface StorageRemoveArgsType {
|
|
9
|
-
key: string;
|
|
10
|
-
}
|
|
11
|
-
interface StorageMergeArgsType {
|
|
12
|
-
key: string;
|
|
13
|
-
value: unknown;
|
|
14
|
-
}
|
|
15
|
-
export type { StorageSetArgsType, StorageGetArgsType, StorageRemoveArgsType, StorageMergeArgsType, };
|
|
16
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/types/storage.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,qBAAqB;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,oBAAoB;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { StorageGetArgsType, StorageMergeArgsType, StorageRemoveArgsType, StorageSetArgsType } from '../types';
|
|
2
|
-
declare function set(args: StorageSetArgsType): Promise<void>;
|
|
3
|
-
declare function get(args: StorageGetArgsType): Promise<any>;
|
|
4
|
-
declare function remove(args: StorageRemoveArgsType): Promise<void>;
|
|
5
|
-
declare function merge(args: StorageMergeArgsType): Promise<void>;
|
|
6
|
-
declare function clearAll(): Promise<void>;
|
|
7
|
-
declare const storage: {
|
|
8
|
-
set: typeof set;
|
|
9
|
-
get: typeof get;
|
|
10
|
-
remove: typeof remove;
|
|
11
|
-
merge: typeof merge;
|
|
12
|
-
clearAll: typeof clearAll;
|
|
13
|
-
};
|
|
14
|
-
export { storage };
|
|
15
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/utils/storage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,iBAAe,GAAG,CAAC,IAAI,EAAE,kBAAkB,iBAE1C;AAED,iBAAe,GAAG,CAAC,IAAI,EAAE,kBAAkB,gBAO1C;AAED,iBAAe,MAAM,CAAC,IAAI,EAAE,qBAAqB,iBAEhD;AAED,iBAAe,KAAK,CAAC,IAAI,EAAE,oBAAoB,iBAE9C;AAED,iBAAe,QAAQ,kBAEtB;AAED,QAAA,MAAM,OAAO;;;;;;CAMZ,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/src/types/storage.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
interface StorageSetArgsType {
|
|
2
|
-
key: string;
|
|
3
|
-
value: unknown;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
interface StorageGetArgsType {
|
|
7
|
-
key: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface StorageRemoveArgsType {
|
|
11
|
-
key: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface StorageMergeArgsType {
|
|
15
|
-
key: string;
|
|
16
|
-
value: unknown;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type {
|
|
20
|
-
StorageSetArgsType,
|
|
21
|
-
StorageGetArgsType,
|
|
22
|
-
StorageRemoveArgsType,
|
|
23
|
-
StorageMergeArgsType,
|
|
24
|
-
};
|
package/src/utils/storage.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
|
|
3
|
-
import { isNotEmpty } from './string';
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
StorageGetArgsType,
|
|
7
|
-
StorageMergeArgsType,
|
|
8
|
-
StorageRemoveArgsType,
|
|
9
|
-
StorageSetArgsType,
|
|
10
|
-
} from '../types';
|
|
11
|
-
|
|
12
|
-
async function set(args: StorageSetArgsType) {
|
|
13
|
-
await AsyncStorage.setItem(args?.key, JSON.stringify(args?.value));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function get(args: StorageGetArgsType) {
|
|
17
|
-
const data = await AsyncStorage.getItem(args?.key);
|
|
18
|
-
if (isNotEmpty(data)) {
|
|
19
|
-
return JSON.parse(data as string);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function remove(args: StorageRemoveArgsType) {
|
|
26
|
-
await AsyncStorage.removeItem(args?.key);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function merge(args: StorageMergeArgsType) {
|
|
30
|
-
await AsyncStorage.mergeItem(args?.key, JSON.stringify(args?.value));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function clearAll() {
|
|
34
|
-
await AsyncStorage.clear();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const storage = {
|
|
38
|
-
set,
|
|
39
|
-
get,
|
|
40
|
-
remove,
|
|
41
|
-
merge,
|
|
42
|
-
clearAll,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export { storage };
|