react-native-google-mobile-ads 12.1.1 → 12.1.2
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/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +25 -22
- package/lib/commonjs/common/index.js +1 -140
- package/lib/commonjs/common/index.js.map +1 -1
- package/lib/commonjs/common/validate.js +0 -89
- package/lib/commonjs/common/validate.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/common/index.js +1 -78
- package/lib/module/common/index.js.map +1 -1
- package/lib/module/common/validate.js +0 -81
- package/lib/module/common/validate.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/common/index.d.ts +0 -26
- package/lib/typescript/common/index.d.ts.map +1 -1
- package/lib/typescript/common/validate.d.ts +0 -35
- package/lib/typescript/common/validate.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/common/index.ts +1 -81
- package/src/common/validate.ts +0 -98
- package/src/version.ts +1 -1
- package/lib/commonjs/common/Base64.js +0 -102
- package/lib/commonjs/common/Base64.js.map +0 -1
- package/lib/commonjs/common/MutatableParams.js +0 -50
- package/lib/commonjs/common/MutatableParams.js.map +0 -1
- package/lib/commonjs/common/ReferenceBase.js +0 -49
- package/lib/commonjs/common/ReferenceBase.js.map +0 -1
- package/lib/commonjs/common/deeps.js +0 -85
- package/lib/commonjs/common/deeps.js.map +0 -1
- package/lib/commonjs/common/id.js +0 -72
- package/lib/commonjs/common/id.js.map +0 -1
- package/lib/commonjs/common/path.js +0 -125
- package/lib/commonjs/common/path.js.map +0 -1
- package/lib/commonjs/common/promise.js +0 -64
- package/lib/commonjs/common/promise.js.map +0 -1
- package/lib/commonjs/common/serialize.js +0 -48
- package/lib/commonjs/common/serialize.js.map +0 -1
- package/lib/module/common/Base64.js +0 -93
- package/lib/module/common/Base64.js.map +0 -1
- package/lib/module/common/MutatableParams.js +0 -43
- package/lib/module/common/MutatableParams.js.map +0 -1
- package/lib/module/common/ReferenceBase.js +0 -42
- package/lib/module/common/ReferenceBase.js.map +0 -1
- package/lib/module/common/deeps.js +0 -79
- package/lib/module/common/deeps.js.map +0 -1
- package/lib/module/common/id.js +0 -65
- package/lib/module/common/id.js.map +0 -1
- package/lib/module/common/path.js +0 -110
- package/lib/module/common/path.js.map +0 -1
- package/lib/module/common/promise.js +0 -58
- package/lib/module/common/promise.js.map +0 -1
- package/lib/module/common/serialize.js +0 -41
- package/lib/module/common/serialize.js.map +0 -1
- package/lib/typescript/common/Base64.d.ts +0 -15
- package/lib/typescript/common/Base64.d.ts.map +0 -1
- package/lib/typescript/common/MutatableParams.d.ts +0 -10
- package/lib/typescript/common/MutatableParams.d.ts.map +0 -1
- package/lib/typescript/common/ReferenceBase.d.ts +0 -12
- package/lib/typescript/common/ReferenceBase.d.ts.map +0 -1
- package/lib/typescript/common/deeps.d.ts +0 -19
- package/lib/typescript/common/deeps.d.ts.map +0 -1
- package/lib/typescript/common/id.d.ts +0 -12
- package/lib/typescript/common/id.d.ts.map +0 -1
- package/lib/typescript/common/path.d.ts +0 -44
- package/lib/typescript/common/path.d.ts.map +0 -1
- package/lib/typescript/common/promise.d.ts +0 -14
- package/lib/typescript/common/promise.d.ts.map +0 -1
- package/lib/typescript/common/serialize.d.ts +0 -6
- package/lib/typescript/common/serialize.d.ts.map +0 -1
- package/src/common/Base64.ts +0 -114
- package/src/common/MutatableParams.ts +0 -50
- package/src/common/ReferenceBase.ts +0 -45
- package/src/common/deeps.ts +0 -88
- package/src/common/id.ts +0 -74
- package/src/common/path.ts +0 -114
- package/src/common/promise.ts +0 -66
- package/src/common/serialize.ts +0 -43
|
@@ -17,6 +17,7 @@ package io.invertase.googlemobileads;
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
import android.app.Activity;
|
|
20
21
|
import android.view.ViewGroup;
|
|
21
22
|
import androidx.annotation.NonNull;
|
|
22
23
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -44,7 +45,6 @@ import io.invertase.googlemobileads.common.SharedUtils;
|
|
|
44
45
|
import java.util.ArrayList;
|
|
45
46
|
import java.util.List;
|
|
46
47
|
import java.util.Map;
|
|
47
|
-
import java.util.Objects;
|
|
48
48
|
import javax.annotation.Nonnull;
|
|
49
49
|
import javax.annotation.Nullable;
|
|
50
50
|
import org.json.JSONException;
|
|
@@ -167,12 +167,14 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
167
167
|
}
|
|
168
168
|
BaseAdView adView;
|
|
169
169
|
if (ReactNativeGoogleMobileAdsCommon.isAdManagerUnit(reactViewGroup.getUnitId())) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
Activity currentActivity = ((ReactContext) reactViewGroup.getContext()).getCurrentActivity();
|
|
171
|
+
if (currentActivity != null) {
|
|
172
|
+
// in order to display the debug menu for GAM ads we need the activity context
|
|
173
|
+
// https://github.com/invertase/react-native-google-mobile-ads/issues/188
|
|
174
|
+
adView = new AdManagerAdView(currentActivity);
|
|
175
|
+
} else {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
176
178
|
} else {
|
|
177
179
|
adView = new AdView(reactViewGroup.getContext());
|
|
178
180
|
}
|
|
@@ -255,24 +257,25 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
BaseAdView adView = initAdView(reactViewGroup);
|
|
258
|
-
adView
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
if (adView != null) {
|
|
261
|
+
adView.setAdUnitId(unitId);
|
|
262
|
+
reactViewGroup.setIsFluid(false);
|
|
263
|
+
if (adView instanceof AdManagerAdView) {
|
|
264
|
+
if (sizes.contains(AdSize.FLUID)) {
|
|
265
|
+
reactViewGroup.setIsFluid(true);
|
|
266
|
+
((AdManagerAdView) adView).setAdSizes(AdSize.FLUID);
|
|
267
|
+
} else {
|
|
268
|
+
((AdManagerAdView) adView).setAdSizes(sizes.toArray(new AdSize[0]));
|
|
269
|
+
}
|
|
270
|
+
if (manualImpressionsEnabled) {
|
|
271
|
+
((AdManagerAdView) adView).setManualImpressionsEnabled(true);
|
|
272
|
+
}
|
|
265
273
|
} else {
|
|
266
|
-
|
|
274
|
+
adView.setAdSize(sizes.get(0));
|
|
267
275
|
}
|
|
268
|
-
if (manualImpressionsEnabled) {
|
|
269
|
-
((AdManagerAdView) adView).setManualImpressionsEnabled(true);
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
adView.setAdSize(sizes.get(0));
|
|
273
|
-
}
|
|
274
276
|
|
|
275
|
-
|
|
277
|
+
adView.loadAd(request);
|
|
278
|
+
}
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
private void sendEvent(ReactNativeAdView reactViewGroup, String type, WritableMap payload) {
|
|
@@ -4,39 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
getDataUrlParts: true,
|
|
8
|
-
once: true,
|
|
9
|
-
isError: true,
|
|
10
7
|
hasOwnProperty: true,
|
|
11
|
-
isPropertySet: true
|
|
12
|
-
stripTrailingSlash: true,
|
|
13
|
-
isIOS: true,
|
|
14
|
-
isAndroid: true,
|
|
15
|
-
tryJSONParse: true,
|
|
16
|
-
tryJSONStringify: true,
|
|
17
|
-
Base64: true,
|
|
18
|
-
ReferenceBase: true
|
|
8
|
+
isPropertySet: true
|
|
19
9
|
};
|
|
20
|
-
exports.Base64 = void 0;
|
|
21
|
-
Object.defineProperty(exports, "ReferenceBase", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _ReferenceBase.ReferenceBase;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
exports.getDataUrlParts = getDataUrlParts;
|
|
28
10
|
exports.hasOwnProperty = hasOwnProperty;
|
|
29
|
-
exports.isAndroid = void 0;
|
|
30
|
-
exports.isError = isError;
|
|
31
|
-
exports.isIOS = void 0;
|
|
32
11
|
exports.isPropertySet = isPropertySet;
|
|
33
|
-
exports.once = once;
|
|
34
|
-
exports.stripTrailingSlash = stripTrailingSlash;
|
|
35
|
-
exports.tryJSONParse = tryJSONParse;
|
|
36
|
-
exports.tryJSONStringify = tryJSONStringify;
|
|
37
|
-
var _reactNative = require("react-native");
|
|
38
|
-
var Base64 = _interopRequireWildcard(require("./Base64"));
|
|
39
|
-
exports.Base64 = Base64;
|
|
40
12
|
var _validate = require("./validate");
|
|
41
13
|
Object.keys(_validate).forEach(function (key) {
|
|
42
14
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -49,45 +21,6 @@ Object.keys(_validate).forEach(function (key) {
|
|
|
49
21
|
}
|
|
50
22
|
});
|
|
51
23
|
});
|
|
52
|
-
var _id = require("./id");
|
|
53
|
-
Object.keys(_id).forEach(function (key) {
|
|
54
|
-
if (key === "default" || key === "__esModule") return;
|
|
55
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
56
|
-
if (key in exports && exports[key] === _id[key]) return;
|
|
57
|
-
Object.defineProperty(exports, key, {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () {
|
|
60
|
-
return _id[key];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
var _path = require("./path");
|
|
65
|
-
Object.keys(_path).forEach(function (key) {
|
|
66
|
-
if (key === "default" || key === "__esModule") return;
|
|
67
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
68
|
-
if (key in exports && exports[key] === _path[key]) return;
|
|
69
|
-
Object.defineProperty(exports, key, {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function () {
|
|
72
|
-
return _path[key];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
var _promise = require("./promise");
|
|
77
|
-
Object.keys(_promise).forEach(function (key) {
|
|
78
|
-
if (key === "default" || key === "__esModule") return;
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
80
|
-
if (key in exports && exports[key] === _promise[key]) return;
|
|
81
|
-
Object.defineProperty(exports, key, {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function () {
|
|
84
|
-
return _promise[key];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
var _ReferenceBase = require("./ReferenceBase");
|
|
89
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
90
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
91
24
|
/*
|
|
92
25
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
93
26
|
*
|
|
@@ -105,82 +38,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
105
38
|
*
|
|
106
39
|
*/
|
|
107
40
|
|
|
108
|
-
function getDataUrlParts(dataUrlString) {
|
|
109
|
-
const isBase64 = dataUrlString.includes(';base64');
|
|
110
|
-
let [mediaType, base64String] = dataUrlString.split(',');
|
|
111
|
-
if (!mediaType || !base64String) {
|
|
112
|
-
return {
|
|
113
|
-
base64String: undefined,
|
|
114
|
-
mediaType: undefined
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
mediaType = mediaType.replace('data:', '').replace(';base64', '');
|
|
118
|
-
if (base64String && base64String.includes('%')) {
|
|
119
|
-
base64String = decodeURIComponent(base64String);
|
|
120
|
-
}
|
|
121
|
-
if (!isBase64) {
|
|
122
|
-
base64String = Base64.btoa(base64String);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
base64String,
|
|
126
|
-
mediaType
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function once(fn, context) {
|
|
130
|
-
let onceResult;
|
|
131
|
-
let ranOnce = false;
|
|
132
|
-
return function onceInner() {
|
|
133
|
-
if (!ranOnce) {
|
|
134
|
-
ranOnce = true;
|
|
135
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
136
|
-
args[_key] = arguments[_key];
|
|
137
|
-
}
|
|
138
|
-
onceResult = fn.apply(context || this, args);
|
|
139
|
-
}
|
|
140
|
-
return onceResult;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function isError(value) {
|
|
144
|
-
if (Object.prototype.toString.call(value) === '[object Error]') {
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
return value instanceof Error;
|
|
148
|
-
}
|
|
149
41
|
function hasOwnProperty(target, property) {
|
|
150
42
|
return Object.hasOwnProperty.call(target, property);
|
|
151
43
|
}
|
|
152
44
|
function isPropertySet(target, property) {
|
|
153
45
|
return hasOwnProperty(target, property) && !(0, _validate.isUndefined)(target[property]);
|
|
154
46
|
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Remove a trailing forward slash from a string if it exists
|
|
158
|
-
*
|
|
159
|
-
* @param string
|
|
160
|
-
* @returns {*}
|
|
161
|
-
*/
|
|
162
|
-
function stripTrailingSlash(string) {
|
|
163
|
-
if (!(0, _validate.isString)(string)) {
|
|
164
|
-
return string;
|
|
165
|
-
}
|
|
166
|
-
return string.endsWith('/') ? string.slice(0, -1) : string;
|
|
167
|
-
}
|
|
168
|
-
const isIOS = _reactNative.Platform.OS === 'ios';
|
|
169
|
-
exports.isIOS = isIOS;
|
|
170
|
-
const isAndroid = _reactNative.Platform.OS === 'android';
|
|
171
|
-
exports.isAndroid = isAndroid;
|
|
172
|
-
function tryJSONParse(string) {
|
|
173
|
-
try {
|
|
174
|
-
return string && JSON.parse(string);
|
|
175
|
-
} catch (jsonError) {
|
|
176
|
-
return string;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function tryJSONStringify(data) {
|
|
180
|
-
try {
|
|
181
|
-
return JSON.stringify(data);
|
|
182
|
-
} catch (jsonError) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_validate","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","target","property","isPropertySet","isUndefined"],"sourceRoot":"../../../src","sources":["common/index.ts"],"mappings":";;;;;;;;;;;AAiBA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,SAASE,cAAcA,CAACO,MAAe,EAAEC,QAAqB,EAAE;EACrE,OAAOb,MAAM,CAACK,cAAc,CAACC,IAAI,CAACM,MAAM,EAAEC,QAAQ,CAAC;AACrD;AAEO,SAASC,aAAaA,CAACF,MAAe,EAAEC,QAAqB,EAAE;EACpE,OACER,cAAc,CAACO,MAAM,EAAEC,QAAQ,CAAC,IAChC,CAAC,IAAAE,qBAAW,EAAEH,MAAM,CAAkCC,QAAQ,CAAC,CAAC;AAEpE"}
|
|
@@ -3,24 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isAlphaNumericUnderscore = isAlphaNumericUnderscore;
|
|
7
6
|
exports.isArray = isArray;
|
|
8
7
|
exports.isBoolean = isBoolean;
|
|
9
|
-
exports.isDate = isDate;
|
|
10
|
-
exports.isFinite = isFinite;
|
|
11
8
|
exports.isFunction = isFunction;
|
|
12
|
-
exports.isInteger = isInteger;
|
|
13
9
|
exports.isNull = isNull;
|
|
14
|
-
exports.isNumber = isNumber;
|
|
15
10
|
exports.isObject = isObject;
|
|
16
11
|
exports.isOneOf = isOneOf;
|
|
17
12
|
exports.isString = isString;
|
|
18
13
|
exports.isUndefined = isUndefined;
|
|
19
14
|
exports.isValidUrl = isValidUrl;
|
|
20
|
-
exports.noop = noop;
|
|
21
|
-
exports.objectKeyValuesAreStrings = objectKeyValuesAreStrings;
|
|
22
|
-
exports.validateOptionalNativeDependencyExists = validateOptionalNativeDependencyExists;
|
|
23
|
-
var _reactNative = require("react-native");
|
|
24
15
|
/*
|
|
25
16
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
26
17
|
*
|
|
@@ -38,21 +29,6 @@ var _reactNative = require("react-native");
|
|
|
38
29
|
*
|
|
39
30
|
*/
|
|
40
31
|
|
|
41
|
-
const AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;
|
|
42
|
-
function objectKeyValuesAreStrings(object) {
|
|
43
|
-
if (!isObject(object)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
const entries = Object.entries(object);
|
|
47
|
-
for (let i = 0; i < entries.length; i++) {
|
|
48
|
-
const [key, value] = entries[i];
|
|
49
|
-
if (!isString(key) || !isString(value)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
32
|
/**
|
|
57
33
|
* Simple is null check.
|
|
58
34
|
*
|
|
@@ -73,17 +49,6 @@ function isObject(value) {
|
|
|
73
49
|
return value ? typeof value === 'object' && !Array.isArray(value) && !isNull(value) : false;
|
|
74
50
|
}
|
|
75
51
|
|
|
76
|
-
/**
|
|
77
|
-
* Simple is date check
|
|
78
|
-
* https://stackoverflow.com/a/44198641
|
|
79
|
-
* @param value
|
|
80
|
-
* @returns {boolean}
|
|
81
|
-
*/
|
|
82
|
-
function isDate(value) {
|
|
83
|
-
// use the global isNaN() and not Number.isNaN() since it will validate an Invalid Date
|
|
84
|
-
return value && Object.prototype.toString.call(value) === '[object Date]' && !isNaN(value);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
52
|
/**
|
|
88
53
|
* Simple is function check
|
|
89
54
|
*
|
|
@@ -103,33 +68,6 @@ function isString(value) {
|
|
|
103
68
|
return typeof value === 'string';
|
|
104
69
|
}
|
|
105
70
|
|
|
106
|
-
/**
|
|
107
|
-
* Simple is number check
|
|
108
|
-
* @param value
|
|
109
|
-
* @return {boolean}
|
|
110
|
-
*/
|
|
111
|
-
function isNumber(value) {
|
|
112
|
-
return typeof value === 'number';
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Simple finite check
|
|
117
|
-
* @param value
|
|
118
|
-
* @returns {boolean}
|
|
119
|
-
*/
|
|
120
|
-
function isFinite(value) {
|
|
121
|
-
return Number.isFinite(value);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Simple integer check
|
|
126
|
-
* @param value
|
|
127
|
-
* @returns {boolean}
|
|
128
|
-
*/
|
|
129
|
-
function isInteger(value) {
|
|
130
|
-
return Number.isInteger(value);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
71
|
/**
|
|
134
72
|
* Simple is boolean check
|
|
135
73
|
*
|
|
@@ -158,16 +96,6 @@ function isUndefined(value) {
|
|
|
158
96
|
return typeof value === 'undefined';
|
|
159
97
|
}
|
|
160
98
|
|
|
161
|
-
/**
|
|
162
|
-
* /^[a-zA-Z0-9_]+$/
|
|
163
|
-
*
|
|
164
|
-
* @param value
|
|
165
|
-
* @returns {boolean}
|
|
166
|
-
*/
|
|
167
|
-
function isAlphaNumericUnderscore(value) {
|
|
168
|
-
return AlphaNumericUnderscore.test(value);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
99
|
/**
|
|
172
100
|
* URL test
|
|
173
101
|
* @param url
|
|
@@ -192,21 +120,4 @@ function isOneOf(value) {
|
|
|
192
120
|
}
|
|
193
121
|
return oneOf.includes(value);
|
|
194
122
|
}
|
|
195
|
-
function noop() {
|
|
196
|
-
// noop-🐈
|
|
197
|
-
}
|
|
198
|
-
function validateOptionalNativeDependencyExists(firebaseJsonKey, apiName, nativeFnExists) {
|
|
199
|
-
if (nativeFnExists) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
let errorMessage = "You attempted to use an optional API that's not enabled natively. \n\n To enable ";
|
|
203
|
-
errorMessage += apiName;
|
|
204
|
-
errorMessage += ` please set the 'react-native' -> '${firebaseJsonKey}' key to true in your firebase.json file`;
|
|
205
|
-
if (_reactNative.Platform.OS === 'android') {
|
|
206
|
-
errorMessage += ' and rebuild your Android app.';
|
|
207
|
-
} else {
|
|
208
|
-
errorMessage += ', re-run pod install and rebuild your iOS app. ' + "If you're not using Pods then make sure you've have downloaded the necessary Firebase iOS SDK dependencies for this API.";
|
|
209
|
-
}
|
|
210
|
-
throw new Error(errorMessage);
|
|
211
|
-
}
|
|
212
123
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["isNull","value","isObject","Array","isArray","isFunction","isString","isBoolean","isUndefined","IS_VALID_URL_REGEX","isValidUrl","url","test","isOneOf","oneOf","arguments","length","undefined","includes"],"sourceRoot":"../../../src","sources":["common/validate.ts"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAACC,KAAc,EAAE;EACrC,OAAOA,KAAK,KAAK,IAAI;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAACD,KAAc,EAAE;EACvC,OAAOA,KAAK,GAAG,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC,GAAG,KAAK;AAC7F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,UAAUA,CAACJ,KAAc,EAAE;EACzC,OAAOA,KAAK,GAAG,OAAOA,KAAK,KAAK,UAAU,GAAG,KAAK;AACpD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASK,QAAQA,CAACL,KAAc,EAAE;EACvC,OAAO,OAAOA,KAAK,KAAK,QAAQ;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,SAASA,CAACN,KAAc,EAAE;EACxC,OAAO,OAAOA,KAAK,KAAK,SAAS;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,OAAOA,CAACH,KAAc,EAAE;EACtC,OAAOE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,WAAWA,CAACP,KAAc,EAAsB;EAC9D,OAAO,OAAOA,KAAK,KAAK,WAAW;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMQ,kBAAkB,GAAG,2BAA2B;AAC/C,SAASC,UAAUA,CAACC,GAAW,EAAE;EACtC,OAAOF,kBAAkB,CAACG,IAAI,CAACD,GAAG,CAAC;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,OAAOA,CAACZ,KAAc,EAAyB;EAAA,IAAvBa,KAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC3D,IAAI,CAACX,OAAO,CAACU,KAAK,CAAC,EAAE;IACnB,OAAO,KAAK;EACd;EACA,OAAOA,KAAK,CAACI,QAAQ,CAACjB,KAAK,CAAC;AAC9B"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -15,89 +15,12 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { Platform } from 'react-native';
|
|
19
|
-
import * as Base64 from './Base64';
|
|
20
|
-
import { isString, isUndefined } from './validate';
|
|
21
|
-
export * from './id';
|
|
22
|
-
export * from './path';
|
|
23
|
-
export * from './promise';
|
|
24
18
|
export * from './validate';
|
|
25
|
-
|
|
26
|
-
export { ReferenceBase } from './ReferenceBase';
|
|
27
|
-
export function getDataUrlParts(dataUrlString) {
|
|
28
|
-
const isBase64 = dataUrlString.includes(';base64');
|
|
29
|
-
let [mediaType, base64String] = dataUrlString.split(',');
|
|
30
|
-
if (!mediaType || !base64String) {
|
|
31
|
-
return {
|
|
32
|
-
base64String: undefined,
|
|
33
|
-
mediaType: undefined
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
mediaType = mediaType.replace('data:', '').replace(';base64', '');
|
|
37
|
-
if (base64String && base64String.includes('%')) {
|
|
38
|
-
base64String = decodeURIComponent(base64String);
|
|
39
|
-
}
|
|
40
|
-
if (!isBase64) {
|
|
41
|
-
base64String = Base64.btoa(base64String);
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
base64String,
|
|
45
|
-
mediaType
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export function once(fn, context) {
|
|
49
|
-
let onceResult;
|
|
50
|
-
let ranOnce = false;
|
|
51
|
-
return function onceInner() {
|
|
52
|
-
if (!ranOnce) {
|
|
53
|
-
ranOnce = true;
|
|
54
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
-
args[_key] = arguments[_key];
|
|
56
|
-
}
|
|
57
|
-
onceResult = fn.apply(context || this, args);
|
|
58
|
-
}
|
|
59
|
-
return onceResult;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export function isError(value) {
|
|
63
|
-
if (Object.prototype.toString.call(value) === '[object Error]') {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
return value instanceof Error;
|
|
67
|
-
}
|
|
19
|
+
import { isUndefined } from './validate';
|
|
68
20
|
export function hasOwnProperty(target, property) {
|
|
69
21
|
return Object.hasOwnProperty.call(target, property);
|
|
70
22
|
}
|
|
71
23
|
export function isPropertySet(target, property) {
|
|
72
24
|
return hasOwnProperty(target, property) && !isUndefined(target[property]);
|
|
73
25
|
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Remove a trailing forward slash from a string if it exists
|
|
77
|
-
*
|
|
78
|
-
* @param string
|
|
79
|
-
* @returns {*}
|
|
80
|
-
*/
|
|
81
|
-
export function stripTrailingSlash(string) {
|
|
82
|
-
if (!isString(string)) {
|
|
83
|
-
return string;
|
|
84
|
-
}
|
|
85
|
-
return string.endsWith('/') ? string.slice(0, -1) : string;
|
|
86
|
-
}
|
|
87
|
-
export const isIOS = Platform.OS === 'ios';
|
|
88
|
-
export const isAndroid = Platform.OS === 'android';
|
|
89
|
-
export function tryJSONParse(string) {
|
|
90
|
-
try {
|
|
91
|
-
return string && JSON.parse(string);
|
|
92
|
-
} catch (jsonError) {
|
|
93
|
-
return string;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export function tryJSONStringify(data) {
|
|
97
|
-
try {
|
|
98
|
-
return JSON.stringify(data);
|
|
99
|
-
} catch (jsonError) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["isUndefined","hasOwnProperty","target","property","Object","call","isPropertySet"],"sourceRoot":"../../../src","sources":["common/index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,YAAY;AAC1B,SAASA,WAAW,QAAQ,YAAY;AAExC,OAAO,SAASC,cAAcA,CAACC,MAAe,EAAEC,QAAqB,EAAE;EACrE,OAAOC,MAAM,CAACH,cAAc,CAACI,IAAI,CAACH,MAAM,EAAEC,QAAQ,CAAC;AACrD;AAEA,OAAO,SAASG,aAAaA,CAACJ,MAAe,EAAEC,QAAqB,EAAE;EACpE,OACEF,cAAc,CAACC,MAAM,EAAEC,QAAQ,CAAC,IAChC,CAACH,WAAW,CAAEE,MAAM,CAAkCC,QAAQ,CAAC,CAAC;AAEpE"}
|
|
@@ -15,22 +15,6 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { Platform } from 'react-native';
|
|
19
|
-
const AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;
|
|
20
|
-
export function objectKeyValuesAreStrings(object) {
|
|
21
|
-
if (!isObject(object)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
const entries = Object.entries(object);
|
|
25
|
-
for (let i = 0; i < entries.length; i++) {
|
|
26
|
-
const [key, value] = entries[i];
|
|
27
|
-
if (!isString(key) || !isString(value)) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
18
|
/**
|
|
35
19
|
* Simple is null check.
|
|
36
20
|
*
|
|
@@ -51,17 +35,6 @@ export function isObject(value) {
|
|
|
51
35
|
return value ? typeof value === 'object' && !Array.isArray(value) && !isNull(value) : false;
|
|
52
36
|
}
|
|
53
37
|
|
|
54
|
-
/**
|
|
55
|
-
* Simple is date check
|
|
56
|
-
* https://stackoverflow.com/a/44198641
|
|
57
|
-
* @param value
|
|
58
|
-
* @returns {boolean}
|
|
59
|
-
*/
|
|
60
|
-
export function isDate(value) {
|
|
61
|
-
// use the global isNaN() and not Number.isNaN() since it will validate an Invalid Date
|
|
62
|
-
return value && Object.prototype.toString.call(value) === '[object Date]' && !isNaN(value);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
38
|
/**
|
|
66
39
|
* Simple is function check
|
|
67
40
|
*
|
|
@@ -81,33 +54,6 @@ export function isString(value) {
|
|
|
81
54
|
return typeof value === 'string';
|
|
82
55
|
}
|
|
83
56
|
|
|
84
|
-
/**
|
|
85
|
-
* Simple is number check
|
|
86
|
-
* @param value
|
|
87
|
-
* @return {boolean}
|
|
88
|
-
*/
|
|
89
|
-
export function isNumber(value) {
|
|
90
|
-
return typeof value === 'number';
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Simple finite check
|
|
95
|
-
* @param value
|
|
96
|
-
* @returns {boolean}
|
|
97
|
-
*/
|
|
98
|
-
export function isFinite(value) {
|
|
99
|
-
return Number.isFinite(value);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Simple integer check
|
|
104
|
-
* @param value
|
|
105
|
-
* @returns {boolean}
|
|
106
|
-
*/
|
|
107
|
-
export function isInteger(value) {
|
|
108
|
-
return Number.isInteger(value);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
57
|
/**
|
|
112
58
|
* Simple is boolean check
|
|
113
59
|
*
|
|
@@ -136,16 +82,6 @@ export function isUndefined(value) {
|
|
|
136
82
|
return typeof value === 'undefined';
|
|
137
83
|
}
|
|
138
84
|
|
|
139
|
-
/**
|
|
140
|
-
* /^[a-zA-Z0-9_]+$/
|
|
141
|
-
*
|
|
142
|
-
* @param value
|
|
143
|
-
* @returns {boolean}
|
|
144
|
-
*/
|
|
145
|
-
export function isAlphaNumericUnderscore(value) {
|
|
146
|
-
return AlphaNumericUnderscore.test(value);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
85
|
/**
|
|
150
86
|
* URL test
|
|
151
87
|
* @param url
|
|
@@ -170,21 +106,4 @@ export function isOneOf(value) {
|
|
|
170
106
|
}
|
|
171
107
|
return oneOf.includes(value);
|
|
172
108
|
}
|
|
173
|
-
export function noop() {
|
|
174
|
-
// noop-🐈
|
|
175
|
-
}
|
|
176
|
-
export function validateOptionalNativeDependencyExists(firebaseJsonKey, apiName, nativeFnExists) {
|
|
177
|
-
if (nativeFnExists) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
let errorMessage = "You attempted to use an optional API that's not enabled natively. \n\n To enable ";
|
|
181
|
-
errorMessage += apiName;
|
|
182
|
-
errorMessage += ` please set the 'react-native' -> '${firebaseJsonKey}' key to true in your firebase.json file`;
|
|
183
|
-
if (Platform.OS === 'android') {
|
|
184
|
-
errorMessage += ' and rebuild your Android app.';
|
|
185
|
-
} else {
|
|
186
|
-
errorMessage += ', re-run pod install and rebuild your iOS app. ' + "If you're not using Pods then make sure you've have downloaded the necessary Firebase iOS SDK dependencies for this API.";
|
|
187
|
-
}
|
|
188
|
-
throw new Error(errorMessage);
|
|
189
|
-
}
|
|
190
109
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["isNull","value","isObject","Array","isArray","isFunction","isString","isBoolean","isUndefined","IS_VALID_URL_REGEX","isValidUrl","url","test","isOneOf","oneOf","arguments","length","undefined","includes"],"sourceRoot":"../../../src","sources":["common/validate.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,KAAc,EAAE;EACrC,OAAOA,KAAK,KAAK,IAAI;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CAACD,KAAc,EAAE;EACvC,OAAOA,KAAK,GAAG,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAI,CAACD,MAAM,CAACC,KAAK,CAAC,GAAG,KAAK;AAC7F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAACJ,KAAc,EAAE;EACzC,OAAOA,KAAK,GAAG,OAAOA,KAAK,KAAK,UAAU,GAAG,KAAK;AACpD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,QAAQA,CAACL,KAAc,EAAE;EACvC,OAAO,OAAOA,KAAK,KAAK,QAAQ;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,SAASA,CAACN,KAAc,EAAE;EACxC,OAAO,OAAOA,KAAK,KAAK,SAAS;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,OAAOA,CAACH,KAAc,EAAE;EACtC,OAAOE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,WAAWA,CAACP,KAAc,EAAsB;EAC9D,OAAO,OAAOA,KAAK,KAAK,WAAW;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMQ,kBAAkB,GAAG,2BAA2B;AACtD,OAAO,SAASC,UAAUA,CAACC,GAAW,EAAE;EACtC,OAAOF,kBAAkB,CAACG,IAAI,CAACD,GAAG,CAAC;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,OAAOA,CAACZ,KAAc,EAAyB;EAAA,IAAvBa,KAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC3D,IAAI,CAACX,OAAO,CAACU,KAAK,CAAC,EAAE;IACnB,OAAO,KAAK;EACd;EACA,OAAOA,KAAK,CAACI,QAAQ,CAACjB,KAAK,CAAC;AAC9B"}
|
package/lib/module/version.js
CHANGED