react-native-inapp-inspector 1.1.11 → 1.1.12
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/dist/commonjs/components/AnalyticsDetail.js +57 -486
- package/dist/commonjs/components/AnalyticsEventCard.js +25 -25
- package/dist/commonjs/components/ConsoleLogCard.js +3 -1
- package/dist/commonjs/components/ReduxTreeView.d.ts +0 -14
- package/dist/commonjs/components/ReduxTreeView.js +43 -448
- package/dist/commonjs/components/TouchableScale.js +8 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/helpers/index.d.ts +2 -0
- package/dist/commonjs/helpers/index.js +89 -1
- package/dist/commonjs/index.js +299 -272
- package/dist/esm/components/AnalyticsDetail.js +58 -487
- package/dist/esm/components/AnalyticsEventCard.js +25 -25
- package/dist/esm/components/ConsoleLogCard.js +3 -1
- package/dist/esm/components/ReduxTreeView.d.ts +0 -14
- package/dist/esm/components/ReduxTreeView.js +43 -441
- package/dist/esm/components/TouchableScale.js +9 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/index.js +87 -1
- package/dist/esm/index.js +302 -275
- package/example/package-lock.json +33 -74
- package/example/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Clipboard, Platform, ToastAndroid, Alert } from 'react-native';
|
|
1
|
+
import { Clipboard, Platform, ToastAndroid, Alert, NativeModules } from 'react-native';
|
|
2
2
|
// Stylesheet
|
|
3
3
|
import { AppColors } from '../styles/AppColors';
|
|
4
4
|
// Constants
|
|
@@ -216,3 +216,89 @@ export const formatDateTimeToAnalytics = (ts) => {
|
|
|
216
216
|
second: '2-digit',
|
|
217
217
|
});
|
|
218
218
|
};
|
|
219
|
+
export const getBundleIdentifier = () => {
|
|
220
|
+
const RNDeviceInfo = NativeModules.RNDeviceInfo;
|
|
221
|
+
if (RNDeviceInfo && typeof RNDeviceInfo.bundleId === 'string') {
|
|
222
|
+
return RNDeviceInfo.bundleId;
|
|
223
|
+
}
|
|
224
|
+
if (RNDeviceInfo && typeof RNDeviceInfo.getBundleId === 'function') {
|
|
225
|
+
try {
|
|
226
|
+
const res = RNDeviceInfo.getBundleId();
|
|
227
|
+
if (typeof res === 'string')
|
|
228
|
+
return res;
|
|
229
|
+
}
|
|
230
|
+
catch (e) { }
|
|
231
|
+
}
|
|
232
|
+
const ExponentConstants = NativeModules.ExponentConstants;
|
|
233
|
+
if (ExponentConstants && ExponentConstants.manifest) {
|
|
234
|
+
const manifest = ExponentConstants.manifest;
|
|
235
|
+
if (manifest.ios && manifest.ios.bundleIdentifier) {
|
|
236
|
+
return manifest.ios.bundleIdentifier;
|
|
237
|
+
}
|
|
238
|
+
if (manifest.android && manifest.android.package) {
|
|
239
|
+
return manifest.android.package;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const ExpoApplication = NativeModules.ExpoApplication;
|
|
243
|
+
if (ExpoApplication && typeof ExpoApplication.applicationId === 'string') {
|
|
244
|
+
return ExpoApplication.applicationId;
|
|
245
|
+
}
|
|
246
|
+
const SourceCode = NativeModules.SourceCode;
|
|
247
|
+
if (SourceCode && typeof SourceCode.scriptURL === 'string') {
|
|
248
|
+
const url = SourceCode.scriptURL;
|
|
249
|
+
if (url.includes('assets/')) {
|
|
250
|
+
try {
|
|
251
|
+
const match = url.match(/assets\/([^/?#]+)/);
|
|
252
|
+
if (match && match[1]) {
|
|
253
|
+
return match[1];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (e) { }
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return 'org.reactjs.native.example';
|
|
260
|
+
};
|
|
261
|
+
export const getAppName = () => {
|
|
262
|
+
// Try iOS via PlatformConstants
|
|
263
|
+
const constants = NativeModules.PlatformConstants;
|
|
264
|
+
if (constants && typeof constants.interfaceIdiom === 'string') {
|
|
265
|
+
// On iOS, try to get display name from the main bundle
|
|
266
|
+
const SettingsManager = NativeModules.SettingsManager;
|
|
267
|
+
if (SettingsManager && SettingsManager.settings) {
|
|
268
|
+
const appName = SettingsManager.settings.AppleLocale
|
|
269
|
+
? undefined
|
|
270
|
+
: undefined;
|
|
271
|
+
// Fallback: try to parse from SourceCode
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Try react-native-device-info
|
|
275
|
+
const RNDeviceInfo = NativeModules.RNDeviceInfo;
|
|
276
|
+
if (RNDeviceInfo && typeof RNDeviceInfo.appName === 'string') {
|
|
277
|
+
return RNDeviceInfo.appName;
|
|
278
|
+
}
|
|
279
|
+
// Try Expo
|
|
280
|
+
const ExpoApplication = NativeModules.ExpoApplication;
|
|
281
|
+
if (ExpoApplication && typeof ExpoApplication.applicationName === 'string') {
|
|
282
|
+
return ExpoApplication.applicationName;
|
|
283
|
+
}
|
|
284
|
+
const ExponentConstants = NativeModules.ExponentConstants;
|
|
285
|
+
if (ExponentConstants && ExponentConstants.manifest) {
|
|
286
|
+
const manifest = ExponentConstants.manifest;
|
|
287
|
+
if (manifest.name)
|
|
288
|
+
return manifest.name;
|
|
289
|
+
}
|
|
290
|
+
// Android: try to get from AndroidInfoModule
|
|
291
|
+
const AppInfo = NativeModules.AppInfo;
|
|
292
|
+
if (AppInfo && typeof AppInfo.appName === 'string') {
|
|
293
|
+
return AppInfo.appName;
|
|
294
|
+
}
|
|
295
|
+
// Fallback: derive from bundle ID (last segment, cleaned up)
|
|
296
|
+
const bundleId = getBundleIdentifier();
|
|
297
|
+
if (bundleId && bundleId !== 'org.reactjs.native.example') {
|
|
298
|
+
const parts = bundleId.split('.');
|
|
299
|
+
const last = parts[parts.length - 1];
|
|
300
|
+
// Capitalize first letter
|
|
301
|
+
return last ? last.charAt(0).toUpperCase() + last.slice(1) : 'App';
|
|
302
|
+
}
|
|
303
|
+
return 'App';
|
|
304
|
+
};
|