react-native-android-overlay 0.1.0

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.
@@ -0,0 +1,414 @@
1
+ package tech.zmario.androidoverlay.service;
2
+
3
+ import android.app.Activity;
4
+ import android.app.ActivityManager;
5
+ import android.app.Application;
6
+ import android.app.Notification;
7
+ import android.app.NotificationChannel;
8
+ import android.app.NotificationManager;
9
+ import android.app.Service;
10
+ import android.content.Context;
11
+ import android.content.Intent;
12
+ import android.content.pm.ServiceInfo;
13
+ import android.os.Build;
14
+ import android.os.Bundle;
15
+ import android.os.Handler;
16
+ import android.os.IBinder;
17
+ import android.os.Looper;
18
+ import android.util.Log;
19
+ import android.view.Gravity;
20
+ import android.view.View;
21
+ import android.view.WindowManager;
22
+ import android.widget.FrameLayout;
23
+ import androidx.annotation.NonNull;
24
+ import androidx.core.app.NotificationCompat;
25
+ import com.facebook.react.ReactApplication;
26
+ import com.facebook.react.ReactHost;
27
+ import com.facebook.react.interfaces.fabric.ReactSurface;
28
+ import java.util.Map;
29
+ import java.util.concurrent.ConcurrentHashMap;
30
+ import tech.zmario.androidoverlay.view.OverlayContainerView;
31
+
32
+ public class OverlayService extends Service {
33
+
34
+ private static final String STOP_SERVICE_ACTION_NAME = "STOP_SERVICE_ACTION";
35
+ private static final String TAG = "OverlayService";
36
+ private static final String DEFAULT_CHANNEL_ID = "OverlayServiceChannel";
37
+ private static final int NOTIFICATION_ID = 1;
38
+ private static OverlayService instance = null;
39
+
40
+ private final Map<String, OverlayInstance> overlays = new ConcurrentHashMap<>();
41
+ private final Handler mainHandler = new Handler(Looper.getMainLooper());
42
+
43
+ private Application.ActivityLifecycleCallbacks lifecycleCallbacks = null;
44
+ private WindowManager windowManager;
45
+ private boolean isDestroyed = false;
46
+
47
+ public static OverlayService getInstance() {
48
+ return instance;
49
+ }
50
+
51
+ private ReactHost getReactHost() {
52
+ if (getApplication() instanceof ReactApplication reactApplication) {
53
+ return reactApplication.getReactHost();
54
+ }
55
+
56
+ return null;
57
+ }
58
+
59
+ @Override
60
+ public IBinder onBind(Intent intent) {
61
+ return null;
62
+ }
63
+
64
+ @Override
65
+ public void onCreate() {
66
+ super.onCreate();
67
+ instance = this;
68
+ isDestroyed = false;
69
+ windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
70
+
71
+ keepReactHostAlive();
72
+
73
+ lifecycleCallbacks =
74
+ new Application.ActivityLifecycleCallbacks() {
75
+ @Override
76
+ public void onActivityCreated(@NonNull Activity activity, Bundle savedInstanceState) {}
77
+
78
+ @Override
79
+ public void onActivityStarted(@NonNull Activity activity) {}
80
+
81
+ @Override
82
+ public void onActivityResumed(@NonNull Activity activity) {
83
+ keepReactHostAlive();
84
+ }
85
+
86
+ @Override
87
+ public void onActivityPaused(@NonNull Activity activity) {
88
+ mainHandler.postDelayed(() -> keepReactHostAlive(), 100);
89
+ }
90
+
91
+ @Override
92
+ public void onActivityStopped(@NonNull Activity activity) {}
93
+
94
+ @Override
95
+ public void onActivitySaveInstanceState(
96
+ @NonNull Activity activity, @NonNull Bundle outState) {}
97
+
98
+ @Override
99
+ public void onActivityDestroyed(@NonNull Activity activity) {
100
+ mainHandler.postDelayed(() -> keepReactHostAlive(), 100);
101
+ }
102
+ };
103
+
104
+ getApplication().registerActivityLifecycleCallbacks(lifecycleCallbacks);
105
+ Log.d(TAG, "Service onCreate");
106
+ }
107
+
108
+ private void keepReactHostAlive() {
109
+ if (isDestroyed) return;
110
+ ReactHost reactHost = getReactHost();
111
+
112
+ if (reactHost != null) {
113
+ reactHost.onHostResume(null);
114
+ }
115
+ }
116
+
117
+ private boolean isAppInForeground() {
118
+ ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo();
119
+ ActivityManager.getMyMemoryState(appProcessInfo);
120
+ return (appProcessInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND);
121
+ }
122
+
123
+ private void runOnMainThread(Runnable runnable) {
124
+ if (Looper.myLooper() == Looper.getMainLooper()) {
125
+ runnable.run();
126
+ } else {
127
+ mainHandler.post(runnable);
128
+ }
129
+ }
130
+
131
+ private void showOverlay(
132
+ String componentName,
133
+ double width,
134
+ double height,
135
+ double x,
136
+ double y,
137
+ String gravity,
138
+ boolean focusable,
139
+ boolean draggable,
140
+ boolean touchable) {
141
+ runOnMainThread(
142
+ () -> {
143
+ if (isDestroyed || overlays.containsKey(componentName) || windowManager == null) return;
144
+ Log.d(TAG, "Creating overlay component: " + componentName);
145
+
146
+ float density = getResources().getDisplayMetrics().density;
147
+ int screenWidth = getResources().getDisplayMetrics().widthPixels;
148
+
149
+ WindowManager.LayoutParams params =
150
+ OverlayLayoutParamsBuilder.build(
151
+ width, height, x, y, gravity, focusable, touchable, density, screenWidth);
152
+ ReactHost reactHost = getReactHost();
153
+
154
+ if (reactHost == null) return;
155
+
156
+ keepReactHostAlive();
157
+
158
+ ReactSurface reactSurface =
159
+ reactHost.createSurface(getApplicationContext(), componentName, null);
160
+ reactSurface.start();
161
+
162
+ View reactView = reactSurface.getView();
163
+ OverlayContainerView container =
164
+ new OverlayContainerView(OverlayService.this, windowManager, draggable);
165
+
166
+ container.addView(
167
+ reactView,
168
+ new FrameLayout.LayoutParams(
169
+ FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
170
+
171
+ try {
172
+ windowManager.addView(container, params);
173
+
174
+ OverlayInstance newInstance = new OverlayInstance(container, reactSurface);
175
+
176
+ overlays.put(componentName, newInstance);
177
+ } catch (Exception e) {
178
+ Log.e(TAG, "Failed to add window overlay", e);
179
+ reactSurface.stop();
180
+ }
181
+ });
182
+ }
183
+
184
+ public void stopOverlayInstance(String componentName) {
185
+ runOnMainThread(
186
+ () -> {
187
+ OverlayInstance inst = overlays.remove(componentName);
188
+ if (inst != null) {
189
+ Log.d(TAG, "Stopping overlay: " + componentName);
190
+ cleanUpInstance(inst);
191
+ }
192
+
193
+ if (overlays.isEmpty() && !isDestroyed) {
194
+ stopSelf();
195
+ }
196
+ });
197
+ }
198
+
199
+ public void startMove(String componentName) {
200
+ runOnMainThread(
201
+ () -> {
202
+ OverlayInstance inst = getOverlayInstance(componentName);
203
+ if (inst == null) return;
204
+ WindowManager.LayoutParams params =
205
+ (WindowManager.LayoutParams) inst.getOverlayView().getLayoutParams();
206
+ inst.setInitialX(params.x);
207
+ inst.setInitialY(params.y);
208
+ });
209
+ }
210
+
211
+ public void moveOverlay(String componentName, int dx, int dy) {
212
+ runOnMainThread(
213
+ () -> {
214
+ OverlayInstance inst = getOverlayInstance(componentName);
215
+ if (inst == null) return;
216
+ WindowManager.LayoutParams params =
217
+ (WindowManager.LayoutParams) inst.getOverlayView().getLayoutParams();
218
+
219
+ params.x = inst.getInitialX() + dx;
220
+ if ((params.gravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
221
+ params.y = inst.getInitialY() - dy;
222
+ } else {
223
+ params.y = inst.getInitialY() + dy;
224
+ }
225
+
226
+ try {
227
+ windowManager.updateViewLayout(inst.getOverlayView(), params);
228
+ } catch (Exception e) {
229
+ Log.e(TAG, "Failed to move overlay", e);
230
+ }
231
+ });
232
+ }
233
+
234
+ public void commitMove(String componentName) {
235
+ runOnMainThread(
236
+ () -> {
237
+ OverlayInstance inst = getOverlayInstance(componentName);
238
+
239
+ if (inst == null) return;
240
+ WindowManager.LayoutParams params =
241
+ (WindowManager.LayoutParams) inst.getOverlayView().getLayoutParams();
242
+
243
+ inst.setInitialX(params.x);
244
+ inst.setInitialY(params.y);
245
+ });
246
+ }
247
+
248
+ public void resizeOverlay(String componentName, int width, int height) {
249
+ runOnMainThread(
250
+ () -> {
251
+ OverlayInstance inst = getOverlayInstance(componentName);
252
+ if (inst == null) return;
253
+ WindowManager.LayoutParams params =
254
+ (WindowManager.LayoutParams) inst.getOverlayView().getLayoutParams();
255
+
256
+ if (params.width != width || params.height != height) {
257
+ params.width = width;
258
+ params.height = height;
259
+ try {
260
+ windowManager.updateViewLayout(inst.getOverlayView(), params);
261
+ } catch (Exception e) {
262
+ Log.e(TAG, "Failed to resize overlay", e);
263
+ }
264
+ }
265
+ });
266
+ }
267
+
268
+ @Override
269
+ public int onStartCommand(Intent intent, int flags, int startId) {
270
+ if (intent != null) {
271
+ String action = intent.getAction();
272
+
273
+ if (action != null && action.equals(STOP_SERVICE_ACTION_NAME)) {
274
+ stopSelf();
275
+ return START_NOT_STICKY;
276
+ }
277
+
278
+ if (action == null) {
279
+ boolean foreground = intent.getBooleanExtra("foreground", true);
280
+
281
+ if (foreground) {
282
+ Notification notification = createForegroundNotification(intent);
283
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
284
+ startForeground(
285
+ NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
286
+ } else {
287
+ startForeground(NOTIFICATION_ID, notification);
288
+ }
289
+ }
290
+
291
+ String componentName = intent.getStringExtra("componentName");
292
+ double width = intent.getDoubleExtra("width", -1);
293
+ double height = intent.getDoubleExtra("height", -1);
294
+ double x = intent.getDoubleExtra("x", 0);
295
+ double y = intent.getDoubleExtra("y", 150);
296
+ boolean focusable = intent.getBooleanExtra("focusable", false);
297
+ boolean draggable = intent.getBooleanExtra("draggable", true);
298
+ boolean touchable = intent.getBooleanExtra("touchable", true);
299
+ String gravity = intent.getStringExtra("gravity");
300
+
301
+ if (componentName == null) componentName = "Overlay";
302
+ if (gravity == null) gravity = "bottom";
303
+
304
+ showOverlay(componentName, width, height, x, y, gravity, focusable, draggable, touchable);
305
+ }
306
+ }
307
+ return START_STICKY;
308
+ }
309
+
310
+ private void cleanUpInstance(OverlayInstance inst) {
311
+ if (inst.getOverlayView() != null && windowManager != null) {
312
+ try {
313
+ inst.getOverlayView().removeAllViews();
314
+ windowManager.removeView(inst.getOverlayView());
315
+ } catch (Exception e) {
316
+ Log.e(TAG, "Error removing view", e);
317
+ }
318
+ }
319
+ if (inst.getReactSurface() != null) {
320
+ inst.getReactSurface().stop();
321
+ }
322
+ }
323
+
324
+ @Override
325
+ public void onDestroy() {
326
+ Log.d(TAG, "Service onDestroy");
327
+ isDestroyed = true;
328
+ instance = null;
329
+
330
+ if (lifecycleCallbacks != null) {
331
+ getApplication().unregisterActivityLifecycleCallbacks(lifecycleCallbacks);
332
+ lifecycleCallbacks = null;
333
+ }
334
+
335
+ ReactHost reactHost = getReactHost();
336
+
337
+ if (reactHost != null && !isAppInForeground()) {
338
+ reactHost.onHostPause();
339
+ }
340
+
341
+ stopForeground(STOP_FOREGROUND_REMOVE);
342
+
343
+ if (windowManager != null) {
344
+ for (OverlayInstance inst : overlays.values()) {
345
+ cleanUpInstance(inst);
346
+ }
347
+ }
348
+ overlays.clear();
349
+ windowManager = null;
350
+ super.onDestroy();
351
+ }
352
+
353
+ private void createNotificationChannel(String channelId, String channelName) {
354
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
355
+ NotificationChannel serviceChannel =
356
+ new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_MIN);
357
+ serviceChannel.setShowBadge(false);
358
+
359
+ NotificationManager manager = getSystemService(NotificationManager.class);
360
+ if (manager != null) {
361
+ manager.createNotificationChannel(serviceChannel);
362
+ }
363
+ }
364
+ }
365
+
366
+ private OverlayInstance getOverlayInstance(String componentName) {
367
+ if (windowManager == null || componentName == null) return null;
368
+ OverlayInstance inst = overlays.get(componentName);
369
+ if (inst == null || inst.getOverlayView() == null) return null;
370
+ return inst;
371
+ }
372
+
373
+ private Notification createForegroundNotification(Intent intent) {
374
+ String title = intent.getStringExtra("notificationTitle");
375
+ String text = intent.getStringExtra("notificationText");
376
+ String iconName = intent.getStringExtra("notificationIcon");
377
+ String channelId = intent.getStringExtra("channelId");
378
+ String channelName = intent.getStringExtra("channelName");
379
+
380
+ if (channelId == null) channelId = DEFAULT_CHANNEL_ID;
381
+ if (channelName == null) channelName = "Overlay Service";
382
+
383
+ createNotificationChannel(channelId, channelName);
384
+
385
+ int smallIcon = android.R.drawable.ic_media_play;
386
+ if (iconName != null) {
387
+ int resId = getResources().getIdentifier(iconName, "drawable", getPackageName());
388
+ if (resId == 0) {
389
+ resId = getResources().getIdentifier(iconName, "mipmap", getPackageName());
390
+ }
391
+ if (resId != 0) {
392
+ smallIcon = resId;
393
+ }
394
+ }
395
+
396
+ return new NotificationCompat.Builder(this, channelId)
397
+ .setContentTitle(title != null ? title : "Overlay running")
398
+ .setContentText(text != null ? text : "View is running in the background")
399
+ .setSmallIcon(smallIcon)
400
+ .setPriority(NotificationCompat.PRIORITY_MIN)
401
+ .setOngoing(true)
402
+ .build();
403
+ }
404
+
405
+ @Override
406
+ public void onTaskRemoved(Intent rootIntent) {
407
+ Intent stopIntent = new Intent(this, OverlayService.class);
408
+
409
+ stopIntent.setAction(STOP_SERVICE_ACTION_NAME);
410
+
411
+ this.startService(stopIntent);
412
+ super.onTaskRemoved(rootIntent);
413
+ }
414
+ }
@@ -0,0 +1,137 @@
1
+ package tech.zmario.androidoverlay.view;
2
+
3
+ import android.content.Context;
4
+ import android.util.DisplayMetrics;
5
+ import android.view.Gravity;
6
+ import android.view.MotionEvent;
7
+ import android.view.ViewConfiguration;
8
+ import android.view.WindowManager;
9
+ import android.widget.FrameLayout;
10
+
11
+ public class OverlayContainerView extends FrameLayout {
12
+
13
+ private final WindowManager windowManager;
14
+ private final boolean draggable;
15
+ private final int touchSlop;
16
+
17
+ private boolean isDragging = false;
18
+
19
+ private int initialX = 0;
20
+ private int initialY = 0;
21
+ private float initialTouchX = 0f;
22
+ private float initialTouchY = 0f;
23
+
24
+ public OverlayContainerView(Context context, WindowManager windowManager, boolean draggable) {
25
+ super(context);
26
+ this.windowManager = windowManager;
27
+ this.draggable = draggable;
28
+
29
+ ViewConfiguration vc = ViewConfiguration.get(context);
30
+ this.touchSlop = vc.getScaledTouchSlop();
31
+ }
32
+
33
+ @Override
34
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
35
+ if (!draggable) return super.onInterceptTouchEvent(ev);
36
+
37
+ switch (ev.getActionMasked()) {
38
+ case MotionEvent.ACTION_DOWN:
39
+ isDragging = false;
40
+ initialTouchX = ev.getRawX();
41
+ initialTouchY = ev.getRawY();
42
+
43
+ WindowManager.LayoutParams params = (WindowManager.LayoutParams) getLayoutParams();
44
+ if (params != null) {
45
+ initialX = params.x;
46
+ initialY = params.y;
47
+ }
48
+ break;
49
+
50
+ case MotionEvent.ACTION_MOVE:
51
+ float dx = Math.abs(ev.getRawX() - initialTouchX);
52
+ float dy = Math.abs(ev.getRawY() - initialTouchY);
53
+
54
+ if (dx > touchSlop || dy > touchSlop) {
55
+ isDragging = true;
56
+ return true;
57
+ }
58
+ break;
59
+
60
+ case MotionEvent.ACTION_UP:
61
+ case MotionEvent.ACTION_CANCEL:
62
+ isDragging = false;
63
+ break;
64
+ }
65
+ return super.onInterceptTouchEvent(ev);
66
+ }
67
+
68
+ @Override
69
+ public boolean onTouchEvent(MotionEvent event) {
70
+ if (!draggable) {
71
+ return super.onTouchEvent(event);
72
+ }
73
+
74
+ switch (event.getActionMasked()) {
75
+ case MotionEvent.ACTION_MOVE:
76
+ if (!isDragging) {
77
+ float dxCheck = Math.abs(event.getRawX() - initialTouchX);
78
+ float dyCheck = Math.abs(event.getRawY() - initialTouchY);
79
+
80
+ if (dxCheck > touchSlop || dyCheck > touchSlop) {
81
+ isDragging = true;
82
+ }
83
+ }
84
+
85
+ if (isDragging) {
86
+ WindowManager.LayoutParams params = (WindowManager.LayoutParams) getLayoutParams();
87
+
88
+ if (params == null) {
89
+ return true;
90
+ }
91
+
92
+ int totalDx = (int) (event.getRawX() - initialTouchX);
93
+ int totalDy = (int) (event.getRawY() - initialTouchY);
94
+
95
+ int targetX = initialX + totalDx;
96
+ int targetY;
97
+
98
+ if ((params.gravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
99
+ targetY = initialY - totalDy;
100
+ } else {
101
+ targetY = initialY + totalDy;
102
+ }
103
+
104
+ DisplayMetrics metrics = getResources().getDisplayMetrics();
105
+
106
+ int viewWidth = (params.width > 0) ? params.width : getWidth();
107
+ int viewHeight = (params.height > 0) ? params.height : getHeight();
108
+
109
+ int maxDragX = (metrics.widthPixels - viewWidth) / 2;
110
+ int maxDragY = metrics.heightPixels - viewHeight;
111
+
112
+ if (targetX < -maxDragX) targetX = -maxDragX;
113
+ if (targetX > maxDragX) targetX = maxDragX;
114
+ if (targetY < 0) targetY = 0;
115
+ if (targetY > maxDragY) targetY = maxDragY;
116
+
117
+ params.x = targetX;
118
+ params.y = targetY;
119
+
120
+ if (windowManager != null) {
121
+ try {
122
+ windowManager.updateViewLayout(this, params);
123
+ } catch (IllegalArgumentException ignored) {
124
+ }
125
+ }
126
+ }
127
+ break;
128
+
129
+ case MotionEvent.ACTION_UP:
130
+ case MotionEvent.ACTION_CANCEL:
131
+ isDragging = false;
132
+ break;
133
+ }
134
+
135
+ return true;
136
+ }
137
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('AndroidOverlay');
5
+ //# sourceMappingURL=NativeAndroidOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeAndroidOverlay.ts"],"mappings":";;AAAA,SAA2BA,mBAAmB,QAAQ,cAAc;AA0CpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ import AndroidOverlay from "./NativeAndroidOverlay.js";
4
+ export const OverlayManager = {
5
+ startOverlay(componentName, options = {}) {
6
+ AndroidOverlay.startOverlay(componentName, options);
7
+ },
8
+ hasPermission() {
9
+ return AndroidOverlay.hasPermission();
10
+ },
11
+ requestPermission() {
12
+ AndroidOverlay.requestPermission();
13
+ },
14
+ stopOverlay(componentName = 'Overlay') {
15
+ AndroidOverlay.stopOverlay(componentName);
16
+ },
17
+ resizeOverlay(width, height, componentName = 'Overlay') {
18
+ AndroidOverlay.resizeOverlay(width, height, componentName);
19
+ },
20
+ startMove(componentName = 'Overlay') {
21
+ AndroidOverlay.startMove(componentName);
22
+ },
23
+ moveOverlay(dx, dy, componentName = 'Overlay') {
24
+ AndroidOverlay.moveOverlay(dx, dy, componentName);
25
+ },
26
+ commitMove(componentName = 'Overlay') {
27
+ AndroidOverlay.commitMove(componentName);
28
+ }
29
+ };
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AndroidOverlay","OverlayManager","startOverlay","componentName","options","hasPermission","requestPermission","stopOverlay","resizeOverlay","width","height","startMove","moveOverlay","dx","dy","commitMove"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,cAAc,MAAM,2BAAwB;AAwBnD,OAAO,MAAMC,cAAc,GAAG;EAC5BC,YAAYA,CAACC,aAAqB,EAAEC,OAAuB,GAAG,CAAC,CAAC,EAAE;IAChEJ,cAAc,CAACE,YAAY,CAACC,aAAa,EAAEC,OAAO,CAAC;EACrD,CAAC;EAEDC,aAAaA,CAAA,EAAG;IACd,OAAOL,cAAc,CAACK,aAAa,CAAC,CAAC;EACvC,CAAC;EAEDC,iBAAiBA,CAAA,EAAG;IAClBN,cAAc,CAACM,iBAAiB,CAAC,CAAC;EACpC,CAAC;EAEDC,WAAWA,CAACJ,aAAa,GAAG,SAAS,EAAE;IACrCH,cAAc,CAACO,WAAW,CAACJ,aAAa,CAAC;EAC3C,CAAC;EAEDK,aAAaA,CAACC,KAAa,EAAEC,MAAc,EAAEP,aAAa,GAAG,SAAS,EAAE;IACtEH,cAAc,CAACQ,aAAa,CAACC,KAAK,EAAEC,MAAM,EAAEP,aAAa,CAAC;EAC5D,CAAC;EAEDQ,SAASA,CAACR,aAAa,GAAG,SAAS,EAAE;IACnCH,cAAc,CAACW,SAAS,CAACR,aAAa,CAAC;EACzC,CAAC;EAEDS,WAAWA,CAACC,EAAU,EAAEC,EAAU,EAAEX,aAAa,GAAG,SAAS,EAAE;IAC7DH,cAAc,CAACY,WAAW,CAACC,EAAE,EAAEC,EAAE,EAAEX,aAAa,CAAC;EACnD,CAAC;EAEDY,UAAUA,CAACZ,aAAa,GAAG,SAAS,EAAE;IACpCH,cAAc,CAACe,UAAU,CAACZ,aAAa,CAAC;EAC1C;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,29 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ hasPermission(): Promise<boolean>;
4
+ requestPermission(): void;
5
+ startOverlay(componentName: string, options?: {
6
+ width?: number;
7
+ height?: number;
8
+ x?: number;
9
+ y?: number;
10
+ gravity?: string;
11
+ draggable?: boolean;
12
+ touchable?: boolean;
13
+ focusable?: boolean;
14
+ foreground?: boolean;
15
+ notificationTitle?: string;
16
+ notificationText?: string;
17
+ notificationIcon?: string;
18
+ channelId?: string;
19
+ channelName?: string;
20
+ }): void;
21
+ stopOverlay(componentName: string): void;
22
+ resizeOverlay(width: number, height: number, componentName: string): void;
23
+ startMove(componentName: string): void;
24
+ moveOverlay(dx: number, dy: number, componentName: string): void;
25
+ commitMove(componentName: string): void;
26
+ }
27
+ declare const _default: Spec;
28
+ export default _default;
29
+ //# sourceMappingURL=NativeAndroidOverlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeAndroidOverlay.d.ts","sourceRoot":"","sources":["../../../src/NativeAndroidOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC,iBAAiB,IAAI,IAAI,CAAC;IAE1B,YAAY,CACV,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;QAErB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAE1B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GACA,IAAI,CAAC;IAER,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1E,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjE,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;;AAED,wBAAwE"}
@@ -0,0 +1,27 @@
1
+ export interface OverlayOptions {
2
+ width?: number;
3
+ height?: number;
4
+ x?: number;
5
+ y?: number;
6
+ gravity?: string;
7
+ draggable?: boolean;
8
+ touchable?: boolean;
9
+ focusable?: boolean;
10
+ foreground?: boolean;
11
+ notificationTitle?: string;
12
+ notificationText?: string;
13
+ notificationIcon?: string;
14
+ channelId?: string;
15
+ channelName?: string;
16
+ }
17
+ export declare const OverlayManager: {
18
+ startOverlay(componentName: string, options?: OverlayOptions): void;
19
+ hasPermission(): Promise<boolean>;
20
+ requestPermission(): void;
21
+ stopOverlay(componentName?: string): void;
22
+ resizeOverlay(width: number, height: number, componentName?: string): void;
23
+ startMove(componentName?: string): void;
24
+ moveOverlay(dx: number, dy: number, componentName?: string): void;
25
+ commitMove(componentName?: string): void;
26
+ };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc;gCACG,MAAM,YAAW,cAAc;;;;yBAgBtC,MAAM,UAAU,MAAM;;oBAQ3B,MAAM,MAAM,MAAM;;CAOnC,CAAC"}