react-native-inapp-inspector 2.5.0 → 2.5.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/README.ar.md +151 -53
- package/README.de.md +150 -52
- package/README.es.md +139 -42
- package/README.fr.md +151 -53
- package/README.hi.md +141 -43
- package/README.ja.md +150 -69
- package/README.ko.md +153 -55
- package/README.md +73 -14
- package/README.pt-BR.md +152 -54
- package/README.ru.md +153 -55
- package/README.zh-CN.md +95 -219
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +154 -9
- package/dist/commonjs/capture.d.ts +5 -2
- package/dist/commonjs/capture.js +1 -1
- package/dist/commonjs/components/Inspector/FabLauncher.js +12 -12
- package/dist/commonjs/components/Inspector/FloatingCaptureWidget.js +17 -17
- package/dist/commonjs/components/Inspector/InspectorHeader.js +41 -41
- package/dist/commonjs/components/Inspector/MainScreen.js +15 -15
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +52 -34
- package/dist/commonjs/components/Inspector/MediaPreviewModal.d.ts +20 -18
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +744 -304
- package/dist/commonjs/components/NetworkIcons.d.ts +12 -0
- package/dist/commonjs/components/NetworkIcons.js +56 -3
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/i18n/locales/ar.json +1 -1
- package/dist/commonjs/i18n/locales/bn.json +1 -1
- package/dist/commonjs/i18n/locales/de.json +1 -1
- package/dist/commonjs/i18n/locales/en.json +1 -1
- package/dist/commonjs/i18n/locales/es.json +1 -1
- package/dist/commonjs/i18n/locales/fr.json +1 -1
- package/dist/commonjs/i18n/locales/gu.json +1 -1
- package/dist/commonjs/i18n/locales/hi.json +1 -1
- package/dist/commonjs/i18n/locales/id.json +1 -1
- package/dist/commonjs/i18n/locales/it.json +1 -1
- package/dist/commonjs/i18n/locales/ja.json +1 -1
- package/dist/commonjs/i18n/locales/kn.json +1 -1
- package/dist/commonjs/i18n/locales/ko.json +1 -1
- package/dist/commonjs/i18n/locales/ml.json +1 -1
- package/dist/commonjs/i18n/locales/mr.json +1 -1
- package/dist/commonjs/i18n/locales/nl.json +1 -1
- package/dist/commonjs/i18n/locales/pa.json +1 -1
- package/dist/commonjs/i18n/locales/pl.json +1 -1
- package/dist/commonjs/i18n/locales/pt.json +1 -1
- package/dist/commonjs/i18n/locales/ru.json +1 -1
- package/dist/commonjs/i18n/locales/ta.json +1 -1
- package/dist/commonjs/i18n/locales/te.json +1 -1
- package/dist/commonjs/i18n/locales/tr.json +1 -1
- package/dist/commonjs/i18n/locales/vi.json +1 -1
- package/dist/commonjs/i18n/locales/zh.json +1 -1
- package/dist/commonjs/index.js +1 -1
- package/dist/commonjs/native/NativeInspector.d.ts +4 -0
- package/dist/commonjs/native/NativeInspector.js +1 -1
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/commonjs/types/interfaces.d.ts +2 -0
- package/dist/esm/capture.d.ts +5 -2
- package/dist/esm/capture.js +1 -1
- package/dist/esm/components/Inspector/FabLauncher.js +37 -37
- package/dist/esm/components/Inspector/FloatingCaptureWidget.js +30 -30
- package/dist/esm/components/Inspector/InspectorHeader.js +34 -34
- package/dist/esm/components/Inspector/MainScreen.js +51 -51
- package/dist/esm/components/Inspector/MediaGalleryTab.js +100 -82
- package/dist/esm/components/Inspector/MediaPreviewModal.d.ts +20 -18
- package/dist/esm/components/Inspector/MediaPreviewModal.js +774 -334
- package/dist/esm/components/NetworkIcons.d.ts +12 -0
- package/dist/esm/components/NetworkIcons.js +256 -203
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/i18n/locales/ar.json +1 -1
- package/dist/esm/i18n/locales/bn.json +1 -1
- package/dist/esm/i18n/locales/de.json +1 -1
- package/dist/esm/i18n/locales/en.json +1 -1
- package/dist/esm/i18n/locales/es.json +1 -1
- package/dist/esm/i18n/locales/fr.json +1 -1
- package/dist/esm/i18n/locales/gu.json +1 -1
- package/dist/esm/i18n/locales/hi.json +1 -1
- package/dist/esm/i18n/locales/id.json +1 -1
- package/dist/esm/i18n/locales/it.json +1 -1
- package/dist/esm/i18n/locales/ja.json +1 -1
- package/dist/esm/i18n/locales/kn.json +1 -1
- package/dist/esm/i18n/locales/ko.json +1 -1
- package/dist/esm/i18n/locales/ml.json +1 -1
- package/dist/esm/i18n/locales/mr.json +1 -1
- package/dist/esm/i18n/locales/nl.json +1 -1
- package/dist/esm/i18n/locales/pa.json +1 -1
- package/dist/esm/i18n/locales/pl.json +1 -1
- package/dist/esm/i18n/locales/pt.json +1 -1
- package/dist/esm/i18n/locales/ru.json +1 -1
- package/dist/esm/i18n/locales/ta.json +1 -1
- package/dist/esm/i18n/locales/te.json +1 -1
- package/dist/esm/i18n/locales/tr.json +1 -1
- package/dist/esm/i18n/locales/vi.json +1 -1
- package/dist/esm/i18n/locales/zh.json +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/native/NativeInspector.d.ts +4 -0
- package/dist/esm/native/NativeInspector.js +1 -1
- package/dist/esm/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/esm/types/interfaces.d.ts +2 -0
- package/ios/NetworkInspectorModule.mm +487 -224
- package/package.json +1 -1
- package/react-native-inapp-inspector.podspec +1 -1
- package/src/native/NativeInspector.ts +22 -0
- package/src/native/NativeNetworkInspector.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.inappinspector
|
|
2
2
|
|
|
3
|
+
import android.app.Activity
|
|
3
4
|
import android.app.ActivityManager
|
|
4
5
|
import android.content.Context
|
|
5
6
|
import android.content.Intent
|
|
@@ -23,6 +24,7 @@ import android.view.PixelCopy
|
|
|
23
24
|
import android.view.View
|
|
24
25
|
import android.view.Window
|
|
25
26
|
import com.facebook.react.bridge.Arguments
|
|
27
|
+
import com.facebook.react.bridge.BaseActivityEventListener
|
|
26
28
|
import com.facebook.react.bridge.Promise
|
|
27
29
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
28
30
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
@@ -35,6 +37,9 @@ import java.io.File
|
|
|
35
37
|
import java.io.FileOutputStream
|
|
36
38
|
import java.io.PrintWriter
|
|
37
39
|
import java.io.StringWriter
|
|
40
|
+
import java.text.SimpleDateFormat
|
|
41
|
+
import java.util.Date
|
|
42
|
+
import java.util.Locale
|
|
38
43
|
import java.util.Timer
|
|
39
44
|
import java.util.TimerTask
|
|
40
45
|
import java.util.concurrent.Executors
|
|
@@ -69,6 +74,91 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
69
74
|
private var defaultHandler: Thread.UncaughtExceptionHandler? = null
|
|
70
75
|
private var isProtectionEnabled = false
|
|
71
76
|
|
|
77
|
+
private var pendingPickPromise: Promise? = null
|
|
78
|
+
private val PICK_MEDIA_REQUEST_CODE = 49281
|
|
79
|
+
|
|
80
|
+
private val activityEventListener = object : BaseActivityEventListener() {
|
|
81
|
+
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
82
|
+
if (requestCode == PICK_MEDIA_REQUEST_CODE) {
|
|
83
|
+
val promise = pendingPickPromise
|
|
84
|
+
pendingPickPromise = null
|
|
85
|
+
if (promise == null) return
|
|
86
|
+
|
|
87
|
+
if (resultCode != Activity.RESULT_OK || data?.data == null) {
|
|
88
|
+
promise.resolve(null)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
captureExecutor.execute {
|
|
93
|
+
try {
|
|
94
|
+
val uri = data.data!!
|
|
95
|
+
val dir = getCapturesDirectory()
|
|
96
|
+
val contentResolver = reactContext.contentResolver
|
|
97
|
+
val mimeType = contentResolver.getType(uri) ?: ""
|
|
98
|
+
val isVideo = mimeType.startsWith("video/")
|
|
99
|
+
val isGif = mimeType.contains("gif")
|
|
100
|
+
val ext = when {
|
|
101
|
+
isVideo -> "mp4"
|
|
102
|
+
isGif -> "gif"
|
|
103
|
+
mimeType.contains("png") -> "png"
|
|
104
|
+
else -> "jpg"
|
|
105
|
+
}
|
|
106
|
+
val type = when {
|
|
107
|
+
isVideo -> "video"
|
|
108
|
+
isGif -> "gif"
|
|
109
|
+
else -> "image"
|
|
110
|
+
}
|
|
111
|
+
val timeStamp = System.currentTimeMillis()
|
|
112
|
+
val filename = "rn_iai_${timeStamp}_imported_${(1000..9999).random()}.${ext}"
|
|
113
|
+
val destFile = File(dir, filename)
|
|
114
|
+
|
|
115
|
+
contentResolver.openInputStream(uri)?.use { input ->
|
|
116
|
+
FileOutputStream(destFile).use { output ->
|
|
117
|
+
input.copyTo(output)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
val map = Arguments.createMap().apply {
|
|
122
|
+
putString("id", filename)
|
|
123
|
+
putString("type", type)
|
|
124
|
+
putString("format", ext)
|
|
125
|
+
putString("uri", Uri.fromFile(destFile).toString())
|
|
126
|
+
putString("filename", filename)
|
|
127
|
+
putDouble("sizeBytes", destFile.length().toDouble())
|
|
128
|
+
putDouble("timestamp", destFile.lastModified().toDouble())
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (type == "video") {
|
|
132
|
+
try {
|
|
133
|
+
val thumbBaseName = filename.substringBeforeLast(".")
|
|
134
|
+
val thumbFile = File(dir, "${thumbBaseName}_thumb.jpg")
|
|
135
|
+
val retriever = MediaMetadataRetriever()
|
|
136
|
+
retriever.setDataSource(destFile.absolutePath)
|
|
137
|
+
val bmp = retriever.getFrameAtTime(0, MediaMetadataRetriever.OPTION_CLOSEST_SYNC)
|
|
138
|
+
if (bmp != null) {
|
|
139
|
+
FileOutputStream(thumbFile).use { fos ->
|
|
140
|
+
bmp.compress(Bitmap.CompressFormat.JPEG, 80, fos)
|
|
141
|
+
}
|
|
142
|
+
bmp.recycle()
|
|
143
|
+
map.putString("thumbnailUri", Uri.fromFile(thumbFile).toString())
|
|
144
|
+
}
|
|
145
|
+
retriever.release()
|
|
146
|
+
} catch (e: Exception) {}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
promise.resolve(map)
|
|
150
|
+
} catch (e: Exception) {
|
|
151
|
+
promise.reject("PICK_ERROR", e.message ?: "Failed to import media", e)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
init {
|
|
159
|
+
reactContext.addActivityEventListener(activityEventListener)
|
|
160
|
+
}
|
|
161
|
+
|
|
72
162
|
|
|
73
163
|
override fun getName(): String {
|
|
74
164
|
return MODULE_NAME
|
|
@@ -737,6 +827,17 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
737
827
|
return dir
|
|
738
828
|
}
|
|
739
829
|
|
|
830
|
+
/**
|
|
831
|
+
* Generates a filename in the format: rn_iai_{YYYYMMDD_HHmmss_SSS}_{fileType}_{random6}.{ext}
|
|
832
|
+
*/
|
|
833
|
+
private fun generateCaptureFilename(fileType: String, ext: String): String {
|
|
834
|
+
val dateFormat = SimpleDateFormat("yyyyMMdd_HHmmss_SSS", Locale.US)
|
|
835
|
+
val dateStamp = dateFormat.format(Date())
|
|
836
|
+
val chars = "abcdefghijklmnopqrstuvwxyz0123456789"
|
|
837
|
+
val random = (1..6).map { chars.random() }.joinToString("")
|
|
838
|
+
return "rn_iai_${dateStamp}_${fileType}_${random}.$ext"
|
|
839
|
+
}
|
|
840
|
+
|
|
740
841
|
private fun getActiveWindow(): Window? {
|
|
741
842
|
return reactContext.currentActivity?.window
|
|
742
843
|
}
|
|
@@ -847,7 +948,7 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
847
948
|
}
|
|
848
949
|
|
|
849
950
|
val timestamp = System.currentTimeMillis()
|
|
850
|
-
val filename = "
|
|
951
|
+
val filename = generateCaptureFilename("screenshot", ext)
|
|
851
952
|
val file = File(getCapturesDirectory(), filename)
|
|
852
953
|
|
|
853
954
|
val bos = ByteArrayOutputStream()
|
|
@@ -979,7 +1080,7 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
979
1080
|
recordedFrames.clear()
|
|
980
1081
|
}
|
|
981
1082
|
|
|
982
|
-
val filename = "
|
|
1083
|
+
val filename = generateCaptureFilename("video", "mp4")
|
|
983
1084
|
val file = File(getCapturesDirectory(), filename)
|
|
984
1085
|
|
|
985
1086
|
var width = 720
|
|
@@ -991,7 +1092,8 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
991
1092
|
width = firstFrame.width
|
|
992
1093
|
height = firstFrame.height
|
|
993
1094
|
|
|
994
|
-
val
|
|
1095
|
+
val thumbBaseName = filename.substringBeforeLast(".").replace("_video_", "_thumb_")
|
|
1096
|
+
val thumbFile = File(getCapturesDirectory(), "${thumbBaseName}.jpg")
|
|
995
1097
|
FileOutputStream(thumbFile).use { fos ->
|
|
996
1098
|
firstFrame.compress(Bitmap.CompressFormat.JPEG, 85, fos)
|
|
997
1099
|
}
|
|
@@ -1041,7 +1143,7 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
1041
1143
|
captureExecutor.execute {
|
|
1042
1144
|
try {
|
|
1043
1145
|
val timestamp = System.currentTimeMillis()
|
|
1044
|
-
val gifFile = File(getCapturesDirectory(), "
|
|
1146
|
+
val gifFile = File(getCapturesDirectory(), generateCaptureFilename("anim", "gif"))
|
|
1045
1147
|
|
|
1046
1148
|
val cleanUri = if (videoUri.startsWith("file://")) videoUri.substring(7) else videoUri
|
|
1047
1149
|
val sourceFile = File(cleanUri)
|
|
@@ -1124,7 +1226,9 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
1124
1226
|
val files = dir.listFiles() ?: emptyArray()
|
|
1125
1227
|
val jsonArr = org.json.JSONArray()
|
|
1126
1228
|
|
|
1127
|
-
files.sortedByDescending { it.lastModified() }
|
|
1229
|
+
files.sortedByDescending { it.lastModified() }
|
|
1230
|
+
.filter { !it.name.contains("_thumb_") && !it.name.startsWith("thumb_") }
|
|
1231
|
+
.forEach { file ->
|
|
1128
1232
|
val ext = file.extension.lowercase()
|
|
1129
1233
|
val type = when (ext) {
|
|
1130
1234
|
"mp4", "mov" -> "video"
|
|
@@ -1143,8 +1247,14 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
1143
1247
|
}
|
|
1144
1248
|
|
|
1145
1249
|
if (type == "video") {
|
|
1146
|
-
|
|
1147
|
-
val
|
|
1250
|
+
// Try new naming convention: replace _video_ with _thumb_ in base name
|
|
1251
|
+
val thumbBaseName = file.nameWithoutExtension.replace("_video_", "_thumb_")
|
|
1252
|
+
var thumbFile = File(dir, "${thumbBaseName}.jpg")
|
|
1253
|
+
// Fallback: legacy naming convention (thumb_{timestamp}.jpg)
|
|
1254
|
+
if (!thumbFile.exists()) {
|
|
1255
|
+
val suffix = file.nameWithoutExtension.removePrefix("video_")
|
|
1256
|
+
thumbFile = File(dir, "thumb_${suffix}.jpg")
|
|
1257
|
+
}
|
|
1148
1258
|
if (thumbFile.exists()) {
|
|
1149
1259
|
obj.put("thumbnailUri", Uri.fromFile(thumbFile).toString())
|
|
1150
1260
|
} else {
|
|
@@ -1204,6 +1314,40 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
1204
1314
|
}
|
|
1205
1315
|
}
|
|
1206
1316
|
|
|
1317
|
+
@ReactMethod
|
|
1318
|
+
fun pickMedia(options: ReadableMap?, promise: Promise) {
|
|
1319
|
+
val activity = reactContext.currentActivity
|
|
1320
|
+
if (activity == null) {
|
|
1321
|
+
promise.reject("NO_ACTIVITY", "Current activity is null")
|
|
1322
|
+
return
|
|
1323
|
+
}
|
|
1324
|
+
pendingPickPromise = promise
|
|
1325
|
+
val mediaType = if (options?.hasKey("mediaType") == true) options.getString("mediaType") else "any"
|
|
1326
|
+
|
|
1327
|
+
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
|
1328
|
+
when (mediaType) {
|
|
1329
|
+
"image" -> {
|
|
1330
|
+
type = "image/*"
|
|
1331
|
+
}
|
|
1332
|
+
"video" -> {
|
|
1333
|
+
type = "video/*"
|
|
1334
|
+
}
|
|
1335
|
+
else -> {
|
|
1336
|
+
type = "*/*"
|
|
1337
|
+
putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("image/*", "video/*"))
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
addCategory(Intent.CATEGORY_OPENABLE)
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
try {
|
|
1344
|
+
activity.startActivityForResult(Intent.createChooser(intent, "Select Media"), PICK_MEDIA_REQUEST_CODE)
|
|
1345
|
+
} catch (e: Exception) {
|
|
1346
|
+
pendingPickPromise = null
|
|
1347
|
+
promise.reject("PICK_LAUNCH_ERROR", e.message ?: "Failed to open media picker", e)
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1207
1351
|
@ReactMethod
|
|
1208
1352
|
fun copyMediaToClipboard(filePath: String, promise: Promise) {
|
|
1209
1353
|
val activity = reactContext.currentActivity ?: reactContext
|
|
@@ -1279,8 +1423,9 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
1279
1423
|
}
|
|
1280
1424
|
|
|
1281
1425
|
val sourceBitmap = if (cleanPath.startsWith("content://")) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1426
|
+
reactContext.contentResolver.openInputStream(Uri.parse(cleanPath))?.use { input ->
|
|
1427
|
+
android.graphics.BitmapFactory.decodeStream(input)
|
|
1428
|
+
}
|
|
1284
1429
|
} else {
|
|
1285
1430
|
android.graphics.BitmapFactory.decodeFile(cleanPath)
|
|
1286
1431
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ScreenshotOptions, ScreenshotResult, RecordingOptions, RecordingResult, GifConversionOptions, CapturedMediaItem } from './native/NativeInspector';
|
|
2
|
-
export type { ScreenshotOptions, ScreenshotResult, RecordingOptions, RecordingResult, GifConversionOptions, CapturedMediaItem, };
|
|
1
|
+
import { ScreenshotOptions, ScreenshotResult, RecordingOptions, RecordingResult, GifConversionOptions, CapturedMediaItem, PickMediaOptions } from './native/NativeInspector';
|
|
2
|
+
export type { ScreenshotOptions, ScreenshotResult, RecordingOptions, RecordingResult, GifConversionOptions, CapturedMediaItem, PickMediaOptions, };
|
|
3
3
|
export type ImageFormat = 'png' | 'jpeg' | 'webp';
|
|
4
4
|
export type AudioSource = 'none' | 'app' | 'mic' | 'mixed';
|
|
5
5
|
export type RecordingFormat = 'mp4' | 'gif';
|
|
6
|
+
export declare const generateCaptureId: (fileType: string, ext: string) => string;
|
|
6
7
|
export declare const ScreenCapture: {
|
|
7
8
|
takeScreenshot: (options?: ScreenshotOptions) => Promise<ScreenshotResult | null>;
|
|
8
9
|
captureScreenshot: (options?: ScreenshotOptions) => Promise<ScreenshotResult | null>;
|
|
@@ -14,6 +15,7 @@ export declare const ScreenCapture: {
|
|
|
14
15
|
getMediaList: () => Promise<CapturedMediaItem[]>;
|
|
15
16
|
deleteMedia: (uri: string) => Promise<boolean>;
|
|
16
17
|
clearAllMedia: () => Promise<boolean>;
|
|
18
|
+
pickMedia: (options?: PickMediaOptions) => Promise<CapturedMediaItem | null>;
|
|
17
19
|
};
|
|
18
20
|
export declare const ScreenRecorder: {
|
|
19
21
|
takeScreenshot: (options?: ScreenshotOptions) => Promise<ScreenshotResult | null>;
|
|
@@ -26,5 +28,6 @@ export declare const ScreenRecorder: {
|
|
|
26
28
|
getMediaList: () => Promise<CapturedMediaItem[]>;
|
|
27
29
|
deleteMedia: (uri: string) => Promise<boolean>;
|
|
28
30
|
clearAllMedia: () => Promise<boolean>;
|
|
31
|
+
pickMedia: (options?: PickMediaOptions) => Promise<CapturedMediaItem | null>;
|
|
29
32
|
};
|
|
30
33
|
export default ScreenCapture;
|
package/dist/commonjs/capture.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScreenRecorder=exports.ScreenCapture=void 0;const NativeInspector_1=require("./native/NativeInspector");exports.ScreenCapture={takeScreenshot:async e=>(0,NativeInspector_1.takeNativeScreenshot)(e),captureScreenshot:async e=>(0,NativeInspector_1.takeNativeScreenshot)(e),startRecording:async e=>(0,NativeInspector_1.startNativeVideoRecording)(e),stopRecording:async()=>(0,NativeInspector_1.stopNativeVideoRecording)(),isRecording:async()=>(0,NativeInspector_1.isNativeRecordingActive)(),playVideo:async e=>(0,NativeInspector_1.playNativeVideo)(e),convertToGif:async(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScreenRecorder=exports.ScreenCapture=exports.generateCaptureId=void 0;const NativeInspector_1=require("./native/NativeInspector"),generateCaptureId=(e,n)=>{const t=new Date,r=(a,s=2)=>String(a).padStart(s,"0"),c=`${t.getFullYear()}${r(t.getMonth()+1)}${r(t.getDate())}_${r(t.getHours())}${r(t.getMinutes())}${r(t.getSeconds())}_${r(t.getMilliseconds(),3)}`,o="abcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let a=0;a<6;a++)i+=o[Math.floor(Math.random()*o.length)];return`rn_iai_${c}_${e}_${i}.${n}`};exports.generateCaptureId=generateCaptureId,exports.ScreenCapture={takeScreenshot:async e=>(0,NativeInspector_1.takeNativeScreenshot)(e),captureScreenshot:async e=>(0,NativeInspector_1.takeNativeScreenshot)(e),startRecording:async e=>(0,NativeInspector_1.startNativeVideoRecording)(e),stopRecording:async()=>(0,NativeInspector_1.stopNativeVideoRecording)(),isRecording:async()=>(0,NativeInspector_1.isNativeRecordingActive)(),playVideo:async e=>(0,NativeInspector_1.playNativeVideo)(e),convertToGif:async(e,n)=>(0,NativeInspector_1.convertNativeVideoToGif)(e,n),getMediaList:async()=>(0,NativeInspector_1.fetchCapturedMediaList)(),deleteMedia:async e=>(0,NativeInspector_1.deleteCapturedMediaFile)(e),clearAllMedia:async()=>(0,NativeInspector_1.clearAllCapturedMediaFiles)(),pickMedia:async e=>(0,NativeInspector_1.pickNativeMedia)(e)},exports.ScreenRecorder=exports.ScreenCapture,exports.default=exports.ScreenCapture;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,o,n,s){s===void 0&&(s=n);var c=Object.getOwnPropertyDescriptor(o,n);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[n]}}),Object.defineProperty(i,s,c)}):(function(i,o,n,s){s===void 0&&(s=n),i[s]=o[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}):function(i,o){i.default=o}),__importStar=this&&this.__importStar||(function(){var i=function(o){return i=Object.getOwnPropertyNames||function(n){var s=[];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(s[s.length]=c);return s},i(o)};return function(o){if(o&&o.__esModule)return o;var n={};if(o!=null)for(var s=i(o),c=0;c<s.length;c++)s[c]!=="default"&&__createBinding(n,o,s[c]);return __setModuleDefault(n,o),n}})(),__importDefault=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});const react_1=__importStar(require("react")),react_native_1=require("react-native"),react_native_linear_gradient_1=__importDefault(require("react-native-linear-gradient")),InspectorContext_1=require("./InspectorContext"),TouchableScale_1=__importDefault(require("../TouchableScale")),AppHeaderLogo_1=__importDefault(require("../AppHeaderLogo")),NetworkIcons_1=require("../NetworkIcons"),capture_1=require("../../capture"),NativeInspector_1=require("../../native/NativeInspector"),toast_1=require("../../helpers/toast"),helpers_1=require("../../helpers"),constants_1=require("../../constants"),AppColors_1=require("../../styles/AppColors"),AppFonts_1=require("../../styles/AppFonts"),styles_1=__importDefault(require("../../styles")),i18n_1=require("../../i18n"),MediaPreviewModal_1=require("./MediaPreviewModal"),FabLauncher=()=>{const{setVisible:i,isMinimized:o,setIsMinimized:n,dismissInspector:s,appIcon:c,fabPan:l,fabPanResponder:ie,fabDraggedRef:T,pulseAnim:k,fabShineAnim:oe,refreshMediaCount:m,captureFps:L,captureScale:E,captureBitrate:O,captureMaxDurationSeconds:q,captureAudioMode:H,previewMediaItem:W,setPreviewMediaItem:C}=(0,InspectorContext_1.useInspector)(),{width:S,height:b}=(0,react_native_1.useWindowDimensions)(),{t:a}=(0,i18n_1.useTranslation)(),[X]=(0,react_1.useState)(()=>(0,helpers_1.getAppVersionAndBuild)().formatted),[p,I]=(0,react_1.useState)(!1),[Z,D]=(0,react_1.useState)(0),v=(0,react_1.useRef)(null),[G,B]=(0,react_1.useState)(!1),[z,_]=(0,react_1.useState)(!1),f=(0,react_1.useRef)(!1),x=(0,react_1.useRef)(new react_native_1.Animated.Value(0)).current,P=(0,react_1.useRef)(new react_native_1.Animated.Value(1)).current,y=(0,react_1.useRef)({x:0,y:0});(0,react_1.useEffect)(()=>{const e=l.x.addListener(r=>y.current.x=r.value),t=l.y.addListener(r=>y.current.y=r.value);return()=>{l.x.removeListener(e),l.y.removeListener(t)}},[l]);const u=68,V=8,U=(0,react_1.useCallback)(()=>{const e=y.current.x,t=y.current.y,r=20,A=180,g=S-r-u/2+e,M=b-A-u/2+t;let N=e,F=t,R=!1;g<V+u/2?(N=e+(V+u/2-g),R=!0):g>S-V-u/2&&(N=e-(g-(S-V-u/2)),R=!0);const Y=react_native_1.Platform.OS==="ios"?60:40,$=react_native_1.Platform.OS==="ios"?40:24;M<Y+u/2?(F=t+(Y+u/2-M),R=!0):M>b-$-u/2&&(F=t-(M-(b-$-u/2)),R=!0),R&&react_native_1.Animated.spring(l,{toValue:{x:N,y:F},useNativeDriver:!1,tension:80,friction:8}).start()},[l,S,b]),K=(0,react_1.useRef)(react_native_1.PanResponder.create({onStartShouldSetPanResponder:()=>!1,onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>4||Math.abs(t.dy)>4,onPanResponderGrant:()=>{T.current=!0,l.setOffset({x:y.current.x,y:y.current.y}),l.setValue({x:0,y:0}),f.current=!1,_(!1),B(!0),P.setValue(1),react_native_1.Animated.spring(x,{toValue:1,useNativeDriver:!0,tension:80,friction:8}).start()},onPanResponderMove:(e,t)=>{l.setValue({x:t.dx,y:t.dy});const r=t.moveY,A=t.moveX,g=r>b-140&&Math.abs(A-S/2)<85;g&&!f.current?(f.current=!0,_(!0),(0,NativeInspector_1.triggerNativeHaptic)("medium"),react_native_1.Animated.spring(P,{toValue:1.25,useNativeDriver:!0,tension:100,friction:6}).start()):!g&&f.current&&(f.current=!1,_(!1),react_native_1.Animated.spring(P,{toValue:1,useNativeDriver:!0,tension:100,friction:6}).start())},onPanResponderRelease:()=>{const e=f.current;l.flattenOffset(),react_native_1.Animated.timing(x,{toValue:0,duration:180,useNativeDriver:!0}).start(()=>{B(!1),_(!1),f.current=!1}),e?((0,NativeInspector_1.triggerNativeHaptic)("heavy"),s(),(0,toast_1.showToast)(a("common.inspectorDismissed","In-App Inspector closed for this session"))):U(),setTimeout(()=>{T.current=!1},100)},onPanResponderTerminate:()=>{l.flattenOffset(),T.current=!1,react_native_1.Animated.timing(x,{toValue:0,duration:180,useNativeDriver:!0}).start(()=>{B(!1),_(!1),f.current=!1})}})).current,d=(0,react_1.useRef)(new react_native_1.Animated.ValueXY({x:0,y:0})).current,w=(0,react_1.useRef)({x:0,y:0});(0,react_1.useEffect)(()=>{const e=d.x.addListener(r=>w.current.x=r.value),t=d.y.addListener(r=>w.current.y=r.value);return()=>{d.x.removeListener(e),d.y.removeListener(t)}},[d]);const h=(0,react_1.useRef)(!1),J=(0,react_1.useRef)(react_native_1.PanResponder.create({onStartShouldSetPanResponder:()=>!1,onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>4||Math.abs(t.dy)>4,onPanResponderGrant:()=>{h.current=!0,d.setOffset({x:w.current.x,y:w.current.y}),d.setValue({x:0,y:0})},onPanResponderMove:react_native_1.Animated.event([null,{dx:d.x,dy:d.y}],{useNativeDriver:!1}),onPanResponderRelease:()=>{d.flattenOffset();const e=w.current.y,t=-(b-(react_native_1.Platform.OS==="ios"?34:18)-70),r=react_native_1.Platform.OS==="ios"?34:18;if(e<t||e>r){const A=Math.max(t,Math.min(r,e));react_native_1.Animated.spring(d,{toValue:{x:w.current.x,y:A},useNativeDriver:!1,tension:80,friction:8}).start()}setTimeout(()=>{h.current=!1},50)},onPanResponderTerminate:()=>{d.flattenOffset(),h.current=!1}})).current;(0,react_1.useEffect)(()=>{capture_1.ScreenCapture.isRecording().then(e=>{I(!!e)}).catch(()=>{})},[]),(0,react_1.useEffect)(()=>(p?(D(0),v.current=setInterval(()=>{D(e=>e+1)},1e3)):(v.current&&(clearInterval(v.current),v.current=null),D(0)),()=>{v.current&&clearInterval(v.current)}),[p]);const Q=(0,react_1.useCallback)(async()=>{if(!h.current)try{(0,NativeInspector_1.triggerNativeHaptic)("light");const e=await capture_1.ScreenCapture.takeScreenshot({format:"png",quality:.9,hideInspector:!0});if(e){(0,NativeInspector_1.triggerNativeHaptic)("success");const t=(0,capture_1.generateCaptureId)("screenshot",e.format||"png"),r={id:t,type:"image",format:e.format,uri:e.uri,filename:e.uri.split("/").pop()||t,sizeBytes:e.sizeBytes,timestamp:e.timestamp,width:e.width,height:e.height};C(r),m?.().catch(()=>{}),(0,toast_1.showToast)(a("header.screenshotCaptured","Screenshot captured"))}else(0,toast_1.showToast)(a("header.screenshotFailed","Failed to capture screenshot"))}catch{(0,toast_1.showToast)(a("header.screenshotError","Error capturing screenshot"))}},[m,a]),ee=(0,react_1.useCallback)(async()=>{if(!h.current)try{if(p){(0,NativeInspector_1.triggerNativeHaptic)("medium");const e=await capture_1.ScreenCapture.stopRecording();if(I(!1),e){(0,NativeInspector_1.triggerNativeHaptic)("success");const t=(0,capture_1.generateCaptureId)("video",e.format),r={id:t,type:e.format==="gif"?"gif":"video",format:e.format,uri:e.uri,filename:e.uri.split("/").pop()||t,sizeBytes:e.sizeBytes,timestamp:e.timestamp,durationMs:e.durationMs,width:e.width,height:e.height,hasAudio:e.hasAudio,thumbnailUri:e.thumbnailUri};C(r),m?.().catch(()=>{}),(0,toast_1.showToast)(a("header.recordingSaved",{duration:(e.durationMs/1e3).toFixed(1),defaultValue:`Recording saved (${(e.durationMs/1e3).toFixed(1)}s)`}))}}else(0,NativeInspector_1.triggerNativeHaptic)("medium"),await capture_1.ScreenCapture.startRecording({fps:L,scale:E,audioSource:H,bitrate:O>0?O:void 0,maxDurationSeconds:q})?(I(!0),(0,toast_1.showToast)(a("header.recordingStarted","Recording started"))):(0,toast_1.showToast)(a("header.recordingStartFailed","Failed to start recording"))}catch{(0,toast_1.showToast)(a("header.recordingError","Error during screen recording")),I(!1)}},[p,L,E,O,q,H,m,a]),j=(0,react_1.useCallback)(()=>{h.current||((0,NativeInspector_1.triggerNativeHaptic)("light"),n?.(!1),i(!0))},[n,i]),te=(0,react_1.useCallback)(()=>{h.current||((0,NativeInspector_1.triggerNativeHaptic)("light"),n?.(!1),i(!1))},[n,i]),re=e=>{const t=Math.floor(e/60),r=e%60;return`${t}:${r<10?"0":""}${r}`};return<>
|
|
2
2
|
|
|
3
|
-
{
|
|
3
|
+
{o?<react_native_1.Animated.View style={[fabStyles.playerContainer,{transform:d.getTranslateTransform()}]}{...J.panHandlers}>
|
|
4
4
|
|
|
5
5
|
<react_native_linear_gradient_1.default colors={[AppColors_1.AppColors.indigo600,AppColors_1.AppColors.violet600]}start={{x:0,y:0}}end={{x:1,y:1}}style={fabStyles.gradientBg}pointerEvents="none"/>
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
<react_native_1.TouchableOpacity activeOpacity={.75}onPress={
|
|
9
|
-
<AppHeaderLogo_1.default size={36}customIcon={
|
|
8
|
+
<react_native_1.TouchableOpacity activeOpacity={.75}onPress={j}style={fabStyles.brandSection}accessibilityRole="button"accessibilityLabel={a("mediaGallery.expand","Expand Inspector")}>
|
|
9
|
+
<AppHeaderLogo_1.default size={36}customIcon={c}shape="circle"/>
|
|
10
10
|
<react_native_1.View style={fabStyles.titleWrapper}>
|
|
11
11
|
<react_native_1.Text style={fabStyles.appTitle}numberOfLines={1}>
|
|
12
12
|
{(0,helpers_1.getAppName)()}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<TouchableScale_1.default onPress={Q}hitSlop={{top:6,bottom:6,left:4,right:4}}style={fabStyles.actionBtn}>
|
|
38
38
|
<NetworkIcons_1.ScreenshotCaptureIcon size={12}color={AppColors_1.AppColors.white}/>
|
|
39
39
|
<react_native_1.Text style={fabStyles.actionText}>
|
|
40
|
-
{
|
|
40
|
+
{a("header.photo","Photo")}
|
|
41
41
|
</react_native_1.Text>
|
|
42
42
|
</TouchableScale_1.default>
|
|
43
43
|
|
|
@@ -45,24 +45,24 @@
|
|
|
45
45
|
<TouchableScale_1.default onPress={ee}hitSlop={{top:6,bottom:6,left:4,right:4}}style={[fabStyles.actionBtn,p&&fabStyles.recordingBtnActive]}>
|
|
46
46
|
{p?<react_native_1.View style={fabStyles.recordingDot}/>:<NetworkIcons_1.ScreenRecordIcon size={12}color={AppColors_1.AppColors.white}/>}
|
|
47
47
|
<react_native_1.Text style={[fabStyles.actionText,p&&{color:AppColors_1.AppColors.red300}]}>
|
|
48
|
-
{p?`${
|
|
48
|
+
{p?`${a("header.rec","REC")} ${re(Z)}`:a("header.record","Record")}
|
|
49
49
|
</react_native_1.Text>
|
|
50
50
|
</TouchableScale_1.default>
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
<TouchableScale_1.default onPress={
|
|
53
|
+
<TouchableScale_1.default onPress={j}hitSlop={{top:6,bottom:6,left:4,right:4}}accessibilityRole="button"accessibilityLabel={a("common.expand","Expand")}style={fabStyles.actionBtnSquare}>
|
|
54
54
|
<NetworkIcons_1.MaximizeIcon size={12}color={AppColors_1.AppColors.white}/>
|
|
55
55
|
</TouchableScale_1.default>
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
<TouchableScale_1.default onPress={te}hitSlop={{top:6,bottom:6,left:4,right:6}}accessibilityRole="button"accessibilityLabel={
|
|
58
|
+
<TouchableScale_1.default onPress={te}hitSlop={{top:6,bottom:6,left:4,right:6}}accessibilityRole="button"accessibilityLabel={a("common.close","Close")}style={fabStyles.actionBtnSquare}>
|
|
59
59
|
<NetworkIcons_1.CloseWhite size={10}color={AppColors_1.AppColors.white}/>
|
|
60
60
|
</TouchableScale_1.default>
|
|
61
61
|
</react_native_1.View>
|
|
62
62
|
</react_native_1.Animated.View>:<react_native_1.Animated.View style={[styles_1.default.fabWrapper,{transform:l.getTranslateTransform()}]}{...K.panHandlers}>
|
|
63
|
-
<TouchableScale_1.default style={{alignItems:"center",justifyContent:"center"}}onPress={()=>{T.current||((0,NativeInspector_1.triggerNativeHaptic)("light"),
|
|
63
|
+
<TouchableScale_1.default style={{alignItems:"center",justifyContent:"center"}}onPress={()=>{T.current||((0,NativeInspector_1.triggerNativeHaptic)("light"),i(!0))}}hitSlop={10}>
|
|
64
64
|
<react_native_1.Animated.View style={[styles_1.default.fabPulseRing,{transform:[{scale:k}]}]}/>
|
|
65
|
-
<AppHeaderLogo_1.default size={68}customIcon={
|
|
65
|
+
<AppHeaderLogo_1.default size={68}customIcon={c}shape="circle"/>
|
|
66
66
|
</TouchableScale_1.default>
|
|
67
67
|
</react_native_1.Animated.View>}
|
|
68
68
|
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
<NetworkIcons_1.CloseWhite size={18}color={AppColors_1.AppColors.white}/>
|
|
73
73
|
</react_native_1.View>
|
|
74
74
|
<react_native_1.Text style={[fabStyles.dismissTargetLabel,z&&fabStyles.dismissTargetLabelActive]}>
|
|
75
|
-
{z?
|
|
75
|
+
{z?a("common.releaseToHide","Release to hide"):a("common.dragToHide","Drag here to hide")}
|
|
76
76
|
</react_native_1.Text>
|
|
77
77
|
</react_native_1.Animated.View>}
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
<MediaPreviewModal_1.MediaPreviewModal item={
|
|
80
|
+
<MediaPreviewModal_1.MediaPreviewModal item={W}visible={!!W}onClose={()=>C(null)}onDelete={async e=>{await capture_1.ScreenCapture.deleteMedia(e.uri),m?.().catch(()=>{}),C(null)}}onConvertToGif={async e=>{const t=await capture_1.ScreenCapture.convertToGif(e.uri,{fps:12,width:480});if(t){m?.().catch(()=>{});const r=(0,capture_1.generateCaptureId)("anim","gif");C({id:r,type:"gif",format:"gif",uri:t.uri,filename:t.uri.split("/").pop()||r,sizeBytes:t.sizeBytes,timestamp:t.timestamp,durationMs:t.durationMs})}}}/>
|
|
81
81
|
</>},fabStyles=react_native_1.StyleSheet.create({dismissTargetContainer:{position:"absolute",bottom:react_native_1.Platform.OS==="ios"?42:26,left:0,right:0,alignItems:"center",justifyContent:"center",zIndex:999998},dismissTargetCircle:{width:54,height:54,borderRadius:27,backgroundColor:"rgba(23, 23, 37, 0.82)",borderWidth:1.5,borderColor:"rgba(255, 255, 255, 0.28)",alignItems:"center",justifyContent:"center",shadowColor:AppColors_1.AppColors.black,shadowOffset:{width:0,height:6},shadowOpacity:.4,shadowRadius:10,elevation:16},dismissTargetCircleActive:{backgroundColor:AppColors_1.AppColors.red600,borderColor:AppColors_1.AppColors.red300,shadowColor:AppColors_1.AppColors.red600,shadowOpacity:.65,shadowRadius:18,transform:[{scale:1.06}]},dismissTargetLabel:{marginTop:6,fontFamily:AppFonts_1.AppFonts.interSemiBold,fontSize:11,color:"rgba(255, 255, 255, 0.85)",textShadowColor:"rgba(0, 0, 0, 0.6)",textShadowOffset:{width:0,height:1},textShadowRadius:3},dismissTargetLabelActive:{color:AppColors_1.AppColors.red300,fontFamily:AppFonts_1.AppFonts.interBold},playerContainer:{position:"absolute",bottom:react_native_1.Platform.OS==="ios"?34:18,left:12,right:12,minHeight:58,flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:16,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.28)",paddingHorizontal:12,paddingVertical:7,gap:8,zIndex:99999,elevation:25,shadowColor:AppColors_1.AppColors.indigo600,shadowOffset:{width:0,height:8},shadowOpacity:.45,shadowRadius:14,overflow:"hidden"},gradientBg:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:16},playerShineClip:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:16,overflow:"hidden"},playerShineStreak:{position:"absolute",top:-60,width:75,height:200},brandSection:{flexDirection:"row",alignItems:"center",gap:9,flex:1,minWidth:0,paddingVertical:2,overflow:"hidden"},titleWrapper:{flex:1,minWidth:0,justifyContent:"center",gap:2},appTitle:{fontFamily:AppFonts_1.AppFonts.interBold,fontSize:13.5,color:AppColors_1.AppColors.white,letterSpacing:-.2},versionRow:{flexDirection:"row",alignItems:"center",gap:4,minWidth:0},versionChip:{flexDirection:"row",alignItems:"center",backgroundColor:`${AppColors_1.AppColors.white}1F`,borderRadius:5,paddingHorizontal:5,paddingVertical:1.5,gap:3,borderWidth:1,borderColor:`${AppColors_1.AppColors.white}2E`,flexShrink:1,minWidth:0},versionChipText:{fontFamily:AppFonts_1.AppFonts.interMedium,fontSize:8.5,color:`${AppColors_1.AppColors.white}EB`,letterSpacing:.1},actionsRow:{flexDirection:"row",alignItems:"center",gap:4.5,flexShrink:0},actionBtn:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:"rgba(255, 255, 255, 0.22)",paddingHorizontal:8,paddingVertical:5.5,borderRadius:7,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.32)"},actionBtnSquare:{alignItems:"center",justifyContent:"center",width:27,height:27,backgroundColor:"rgba(255, 255, 255, 0.22)",borderRadius:7,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.32)"},recordingBtnActive:{backgroundColor:"rgba(239, 68, 68, 0.32)",borderColor:AppColors_1.AppColors.red500},recordingDot:{width:6,height:6,borderRadius:3,backgroundColor:AppColors_1.AppColors.red500},actionText:{fontFamily:AppFonts_1.AppFonts.interSemiBold,fontSize:10.5,color:AppColors_1.AppColors.white}});exports.default=FabLauncher;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,a,
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,a,s,n){n===void 0&&(n=s);var i=Object.getOwnPropertyDescriptor(a,s);(!i||("get"in i?!a.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return a[s]}}),Object.defineProperty(r,n,i)}):(function(r,a,s,n){n===void 0&&(n=s),r[n]=a[s]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,a){Object.defineProperty(r,"default",{enumerable:!0,value:a})}):function(r,a){r.default=a}),__importStar=this&&this.__importStar||(function(){var r=function(a){return r=Object.getOwnPropertyNames||function(s){var n=[];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[n.length]=i);return n},r(a)};return function(a){if(a&&a.__esModule)return a;var s={};if(a!=null)for(var n=r(a),i=0;i<n.length;i++)n[i]!=="default"&&__createBinding(s,a,n[i]);return __setModuleDefault(s,a),s}})(),__importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FloatingCaptureWidget=void 0;const react_1=__importStar(require("react")),react_native_1=require("react-native"),react_native_linear_gradient_1=__importDefault(require("react-native-linear-gradient")),InspectorContext_1=require("./InspectorContext"),TouchableScale_1=__importDefault(require("../TouchableScale")),NetworkIcons_1=require("../NetworkIcons"),capture_1=require("../../capture"),NativeInspector_1=require("../../native/NativeInspector"),toast_1=require("../../helpers/toast"),AppColors_1=require("../../styles/AppColors"),AppFonts_1=require("../../styles/AppFonts"),i18n_1=require("../../i18n"),MediaPreviewModal_1=require("./MediaPreviewModal"),FloatingCaptureWidget=()=>{const{refreshMediaCount:r,captureFps:a,captureScale:s,captureBitrate:n,captureMaxDurationSeconds:i,captureAudioMode:C,activeTab:A,settingsPage:M,peekMode:E,previewMediaItem:v,setPreviewMediaItem:p}=(0,InspectorContext_1.useInspector)(),{t:d}=(0,i18n_1.useTranslation)(),[f,h]=(0,react_1.useState)(!1),[V,y]=(0,react_1.useState)(!1),[P,_]=(0,react_1.useState)(0),u=(0,react_1.useRef)(null),g=(0,react_1.useRef)(new react_native_1.Animated.Value(1)).current,w=(0,react_1.useRef)(new react_native_1.Animated.Value(0)).current,c=(0,react_1.useRef)(new react_native_1.Animated.ValueXY({x:0,y:0})).current,l=(0,react_1.useRef)({x:0,y:0});(0,react_1.useEffect)(()=>{const e=c.x.addListener(o=>l.current.x=o.value),t=c.y.addListener(o=>l.current.y=o.value);return()=>{c.x.removeListener(e),c.y.removeListener(t)}},[c]);const m=(0,react_1.useRef)(!1),F=(0,react_1.useRef)(react_native_1.PanResponder.create({onStartShouldSetPanResponder:()=>!0,onStartShouldSetPanResponderCapture:()=>!1,onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>2||Math.abs(t.dy)>2,onMoveShouldSetPanResponderCapture:(e,t)=>Math.abs(t.dx)>4||Math.abs(t.dy)>4,onPanResponderGrant:()=>{m.current=!0,c.setOffset({x:l.current.x,y:l.current.y}),c.setValue({x:0,y:0})},onPanResponderMove:react_native_1.Animated.event([null,{dx:c.x,dy:c.y}],{useNativeDriver:!1}),onPanResponderTerminationRequest:()=>!1,onShouldBlockNativeResponder:()=>!0,onPanResponderRelease:()=>{c.flattenOffset(),setTimeout(()=>{m.current=!1},100);const{width:e,height:t}=react_native_1.Dimensions.get("window"),o=e/2-20,x=-o,R=20,T=-(t-140),b=l.current.x,S=l.current.y;if(b<x||b>o||S<T||S>R){const B=Math.min(Math.max(b,x),o),q=Math.min(Math.max(S,T),R);react_native_1.Animated.spring(c,{toValue:{x:B,y:q},friction:7,tension:50,useNativeDriver:!1}).start()}},onPanResponderTerminate:()=>{c.flattenOffset(),m.current=!1}})).current;(0,react_1.useEffect)(()=>{capture_1.ScreenCapture.isRecording().then(e=>{h(e)}).catch(()=>{})},[]),(0,react_1.useEffect)(()=>{let e=null;return f?(_(0),u.current=setInterval(()=>{_(t=>t+1)},1e3),e=react_native_1.Animated.loop(react_native_1.Animated.sequence([react_native_1.Animated.timing(g,{toValue:1.15,duration:500,useNativeDriver:!0}),react_native_1.Animated.timing(g,{toValue:1,duration:500,useNativeDriver:!0})])),e.start()):(u.current&&(clearInterval(u.current),u.current=null),_(0),g.setValue(1)),()=>{u.current&&clearInterval(u.current),e&&e.stop()}},[f,g]);const D=(0,react_1.useCallback)(async()=>{if(!m.current)try{(0,NativeInspector_1.triggerNativeHaptic)("light"),y(!0),await new Promise(t=>setTimeout(t,60));const e=await capture_1.ScreenCapture.takeScreenshot({format:"png",quality:.9,hideInspector:!1});if(y(!1),react_native_1.Animated.sequence([react_native_1.Animated.timing(w,{toValue:.65,duration:70,useNativeDriver:!0}),react_native_1.Animated.timing(w,{toValue:0,duration:200,useNativeDriver:!0})]).start(),e){(0,NativeInspector_1.triggerNativeHaptic)("success");const t=(0,capture_1.generateCaptureId)("screenshot",e.format||"png"),o={id:t,type:"image",format:e.format,uri:e.uri,filename:e.uri.split("/").pop()||t,sizeBytes:e.sizeBytes,timestamp:e.timestamp,width:e.width,height:e.height};p(o),r?.().catch(()=>{}),(0,toast_1.showToast)(d("header.screenshotCaptured","Screenshot captured"))}else(0,toast_1.showToast)(d("header.screenshotFailed","Failed to capture screenshot"))}catch{y(!1),(0,toast_1.showToast)(d("header.screenshotError","Error capturing screenshot"))}},[r,w,d]),I=(0,react_1.useCallback)(async()=>{if(!m.current)try{if(f){(0,NativeInspector_1.triggerNativeHaptic)("medium");const e=await capture_1.ScreenCapture.stopRecording();if(h(!1),e){(0,NativeInspector_1.triggerNativeHaptic)("success");const t=(0,capture_1.generateCaptureId)("video",e.format),o={id:t,type:e.format==="gif"?"gif":"video",format:e.format,uri:e.uri,filename:e.uri.split("/").pop()||t,sizeBytes:e.sizeBytes,timestamp:e.timestamp,durationMs:e.durationMs,width:e.width,height:e.height,hasAudio:e.hasAudio,thumbnailUri:e.thumbnailUri};p(o),r?.().catch(()=>{}),(0,toast_1.showToast)(d("header.recordingSaved",{duration:(e.durationMs/1e3).toFixed(1),defaultValue:`Recording saved (${(e.durationMs/1e3).toFixed(1)}s)`}))}}else(0,NativeInspector_1.triggerNativeHaptic)("medium"),h(!0),await capture_1.ScreenCapture.startRecording({fps:a,scale:s,audioSource:C,bitrate:n>0?n:void 0,maxDurationSeconds:i})?(0,toast_1.showToast)(d("header.recordingStarted","Recording started")):(h(!1),(0,toast_1.showToast)(d("header.recordingStartFailed","Failed to start recording")))}catch{(0,toast_1.showToast)(d("header.recordingError","Error during screen recording")),h(!1)}},[f,a,s,n,i,C,r,d]),O=e=>{const t=Math.floor(e/60),o=e%60;return`${t<10?"0":""}${t}:${o<10?"0":""}${o}`};return A==="media"||M==="media"?null:<>
|
|
2
2
|
|
|
3
3
|
<react_native_1.Animated.View pointerEvents="none"style={[styles.flashOverlay,{opacity:w}]}/>
|
|
4
4
|
|
|
5
|
-
{!V&&<react_native_1.Animated.View{...
|
|
5
|
+
{!V&&!v&&<react_native_1.Animated.View{...F.panHandlers}style={[styles.container,{transform:c.getTranslateTransform()}]}>
|
|
6
6
|
|
|
7
|
-
{
|
|
8
|
-
<TouchableScale_1.default onPress={
|
|
7
|
+
{f?<react_native_1.View style={styles.recordingShadowWrapper}>
|
|
8
|
+
<TouchableScale_1.default onPress={I}style={styles.recordingPillWrapper}>
|
|
9
9
|
<react_native_linear_gradient_1.default colors={["#E11D48","#BE123C"]}start={{x:0,y:0}}end={{x:1,y:0}}style={styles.recordingPill}>
|
|
10
|
-
<react_native_1.Animated.View style={[styles.recordingDot,{transform:[{scale:
|
|
10
|
+
<react_native_1.Animated.View style={[styles.recordingDot,{transform:[{scale:g}]}]}/>
|
|
11
11
|
<react_native_1.Text style={styles.recordingText}>
|
|
12
|
-
REC {
|
|
12
|
+
REC {O(P)}
|
|
13
13
|
</react_native_1.Text>
|
|
14
14
|
<react_native_1.View style={styles.stopIconBadge}>
|
|
15
15
|
<react_native_1.View style={styles.stopIconSquare}/>
|
|
@@ -19,17 +19,12 @@
|
|
|
19
19
|
</react_native_1.View>:<react_native_1.View style={styles.dockShadowWrapper}>
|
|
20
20
|
<react_native_linear_gradient_1.default colors={["#0E1326","#1A1E38","#0E1326"]}start={{x:0,y:0}}end={{x:1,y:0}}style={styles.dockBar}>
|
|
21
21
|
|
|
22
|
-
<
|
|
23
|
-
<NetworkIcons_1.GripVerticalIcon size={13}color="rgba(255, 255, 255, 0.45)"/>
|
|
24
|
-
</react_native_1.View>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<TouchableScale_1.default onPress={O}style={styles.menuItemBtn}accessible={!0}accessibilityLabel="Take Screenshot">
|
|
22
|
+
<TouchableScale_1.default onPress={D}style={styles.menuItemBtn}accessible={!0}accessibilityLabel="Take Screenshot">
|
|
28
23
|
<react_native_1.View style={[styles.menuItemIconCircle,{backgroundColor:"rgba(56, 189, 248, 0.22)"}]}>
|
|
29
24
|
<NetworkIcons_1.ScreenshotCaptureIcon size={14}color={AppColors_1.AppColors.sky400}/>
|
|
30
25
|
</react_native_1.View>
|
|
31
26
|
<react_native_1.Text style={styles.menuItemText}>
|
|
32
|
-
{
|
|
27
|
+
{d("header.screenshot","Screenshot")}
|
|
33
28
|
</react_native_1.Text>
|
|
34
29
|
</TouchableScale_1.default>
|
|
35
30
|
|
|
@@ -37,18 +32,23 @@
|
|
|
37
32
|
<react_native_1.View style={styles.dockDivider}/>
|
|
38
33
|
|
|
39
34
|
|
|
40
|
-
<TouchableScale_1.default onPress={
|
|
35
|
+
<TouchableScale_1.default onPress={I}style={styles.menuItemBtn}accessible={!0}accessibilityLabel={d("header.recordScreen","Record Screen")}>
|
|
41
36
|
<react_native_1.View style={[styles.menuItemIconCircle,{backgroundColor:"rgba(244, 63, 94, 0.24)"}]}>
|
|
42
37
|
<NetworkIcons_1.ScreenRecordIcon size={14}color={AppColors_1.AppColors.rose400||"#FB7185"}/>
|
|
43
38
|
</react_native_1.View>
|
|
44
39
|
<react_native_1.Text style={styles.menuItemText}>
|
|
45
|
-
{
|
|
40
|
+
{d("header.record","Record")}
|
|
46
41
|
</react_native_1.Text>
|
|
47
42
|
</TouchableScale_1.default>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<react_native_1.View style={styles.dragGripArea}>
|
|
46
|
+
<NetworkIcons_1.GripVerticalIcon size={14}color="rgba(255, 255, 255, 0.55)"/>
|
|
47
|
+
</react_native_1.View>
|
|
48
48
|
</react_native_linear_gradient_1.default>
|
|
49
49
|
</react_native_1.View>}
|
|
50
50
|
</react_native_1.Animated.View>}
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
<MediaPreviewModal_1.MediaPreviewModal item={
|
|
54
|
-
</>};exports.FloatingCaptureWidget=FloatingCaptureWidget;const styles=react_native_1.StyleSheet.create({flashOverlay:{...react_native_1.StyleSheet.absoluteFillObject,backgroundColor:AppColors_1.AppColors.white,zIndex:999999},container:{position:"absolute",bottom:react_native_1.Platform.OS==="ios"?22:16,alignSelf:"center",alignItems:"center",justifyContent:"center",zIndex:999999,elevation:999999},dockShadowWrapper:{borderRadius:24,backgroundColor:"#0D1120",...react_native_1.Platform.select({ios:{shadowColor:AppColors_1.AppColors.black,shadowOffset:{width:0,height:6},shadowOpacity:.45,shadowRadius:14},android:{elevation:16}})},dockBar:{flexDirection:"row",alignItems:"center",borderRadius:24,
|
|
53
|
+
<MediaPreviewModal_1.MediaPreviewModal item={v}visible={!!v}onClose={()=>p(null)}onDelete={async e=>{await capture_1.ScreenCapture.deleteMedia(e.uri),r?.().catch(()=>{}),p(null)}}onConvertToGif={async e=>{const t=await capture_1.ScreenCapture.convertToGif(e.uri,{fps:12,width:480});if(t){r?.().catch(()=>{});const o=(0,capture_1.generateCaptureId)("anim","gif");p({id:o,type:"gif",format:"gif",uri:t.uri,filename:t.uri.split("/").pop()||o,sizeBytes:t.sizeBytes,timestamp:t.timestamp,durationMs:t.durationMs})}}}/>
|
|
54
|
+
</>};exports.FloatingCaptureWidget=FloatingCaptureWidget;const styles=react_native_1.StyleSheet.create({flashOverlay:{...react_native_1.StyleSheet.absoluteFillObject,backgroundColor:AppColors_1.AppColors.white,zIndex:999999},container:{position:"absolute",bottom:react_native_1.Platform.OS==="ios"?22:16,alignSelf:"center",alignItems:"center",justifyContent:"center",zIndex:999999,elevation:999999},dockShadowWrapper:{borderRadius:24,backgroundColor:"#0D1120",...react_native_1.Platform.select({ios:{shadowColor:AppColors_1.AppColors.black,shadowOffset:{width:0,height:6},shadowOpacity:.45,shadowRadius:14},android:{elevation:16}})},dockBar:{flexDirection:"row",alignItems:"center",borderRadius:24,overflow:"hidden"},dragGripArea:{paddingLeft:6,paddingRight:12,paddingVertical:10,alignItems:"center",justifyContent:"center"},dockDivider:{width:1,height:18,backgroundColor:"rgba(255, 255, 255, 0.14)"},menuItemBtn:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:7,paddingVertical:8.5,paddingHorizontal:12},menuItemIconCircle:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},menuItemText:{fontFamily:AppFonts_1.AppFonts.interSemiBold,fontSize:12,color:AppColors_1.AppColors.white,letterSpacing:.1},recordingShadowWrapper:{borderRadius:22,alignItems:"center",justifyContent:"center",...react_native_1.Platform.select({ios:{shadowColor:"#E11D48",shadowOffset:{width:0,height:4},shadowOpacity:.5,shadowRadius:12},android:{elevation:14}})},recordingPillWrapper:{borderRadius:22,overflow:"hidden"},recordingPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:38,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:"rgba(255, 255, 255, 0.45)"},recordingDot:{width:8,height:8,borderRadius:4,backgroundColor:"#FFFFFF"},recordingText:{fontFamily:AppFonts_1.AppFonts.interBold,fontSize:12,color:AppColors_1.AppColors.white,letterSpacing:.4},stopIconBadge:{width:18,height:18,borderRadius:9,backgroundColor:"rgba(255, 255, 255, 0.28)",alignItems:"center",justifyContent:"center",marginLeft:3},stopIconSquare:{width:6,height:6,borderRadius:1.5,backgroundColor:AppColors_1.AppColors.white}});exports.default=exports.FloatingCaptureWidget;
|