@falconeta/capacitor-android-full-view 7.0.1 → 8.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.
@@ -10,8 +10,8 @@ Pod::Spec.new do |s|
10
10
  s.homepage = package['repository']['url']
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '14.0'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "AndroidFullView",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "AndroidFullView",
10
+ targets: ["AndroidFullViewPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "AndroidFullViewPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/AndroidFullViewPlugin"),
23
+ .testTarget(
24
+ name: "AndroidFullViewPluginTests",
25
+ dependencies: ["AndroidFullViewPlugin"],
26
+ path: "ios/Tests/AndroidFullViewPluginTests")
27
+ ]
28
+ )
package/README.md CHANGED
@@ -32,6 +32,8 @@ const { value } = await AndroidFullView.top();
32
32
 
33
33
  * [`top()`](#top)
34
34
  * [`bottom()`](#bottom)
35
+ * [`setResizeOnFullScreenEnabled(...)`](#setresizeonfullscreenenabled)
36
+ * [`getResizeOnFullScreenEnabled()`](#getresizeonfullscreenenabled)
35
37
  * [Interfaces](#interfaces)
36
38
 
37
39
  </docgen-index>
@@ -65,6 +67,34 @@ Returns bottom offset of the status bar
65
67
  --------------------
66
68
 
67
69
 
70
+ ### setResizeOnFullScreenEnabled(...)
71
+
72
+ ```typescript
73
+ setResizeOnFullScreenEnabled(options: ResizeOnFullScreenEnabledOptions) => Promise<void>
74
+ ```
75
+
76
+ Enables or disables the Android keyboard resize workaround used in fullscreen mode.
77
+
78
+ | Param | Type |
79
+ | ------------- | --------------------------------------------------------------------------------------------- |
80
+ | **`options`** | <code><a href="#resizeonfullscreenenabledoptions">ResizeOnFullScreenEnabledOptions</a></code> |
81
+
82
+ --------------------
83
+
84
+
85
+ ### getResizeOnFullScreenEnabled()
86
+
87
+ ```typescript
88
+ getResizeOnFullScreenEnabled() => Promise<ResizeOnFullScreenEnabledResult>
89
+ ```
90
+
91
+ Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.
92
+
93
+ **Returns:** <code>Promise&lt;<a href="#resizeonfullscreenenabledresult">ResizeOnFullScreenEnabledResult</a>&gt;</code>
94
+
95
+ --------------------
96
+
97
+
68
98
  ### Interfaces
69
99
 
70
100
 
@@ -74,4 +104,18 @@ Returns bottom offset of the status bar
74
104
  | ----------- | ------------------- |
75
105
  | **`value`** | <code>number</code> |
76
106
 
107
+
108
+ #### ResizeOnFullScreenEnabledOptions
109
+
110
+ | Prop | Type |
111
+ | ------------- | -------------------- |
112
+ | **`enabled`** | <code>boolean</code> |
113
+
114
+
115
+ #### ResizeOnFullScreenEnabledResult
116
+
117
+ | Prop | Type |
118
+ | ------------- | -------------------- |
119
+ | **`enabled`** | <code>boolean</code> |
120
+
77
121
  </docgen-api>
@@ -1,8 +1,8 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,18 +11,18 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.7.2'
14
+ classpath 'com.android.tools.build:gradle:8.13.0'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- namespace "com.falconeta.plugin.android.fullview"
22
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
21
+ namespace = "com.falconeta.plugin.android.fullview"
22
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
23
23
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -34,7 +34,7 @@ android {
34
34
  }
35
35
  }
36
36
  lintOptions {
37
- abortOnError false
37
+ abortOnError = false
38
38
  }
39
39
  compileOptions {
40
40
  sourceCompatibility JavaVersion.VERSION_21
@@ -1,14 +1,37 @@
1
1
  package com.falconeta.plugin.android.fullview;
2
2
 
3
+ import android.graphics.Rect;
3
4
  import android.util.DisplayMetrics;
4
5
  import android.view.View;
6
+ import android.view.Window;
7
+ import android.widget.FrameLayout;
8
+
9
+ import androidx.annotation.NonNull;
5
10
  import androidx.appcompat.app.AppCompatActivity;
11
+ import androidx.core.view.ViewCompat;
12
+ import androidx.core.view.WindowInsetsAnimationCompat;
13
+ import androidx.core.view.WindowInsetsCompat;
14
+
15
+ import com.getcapacitor.Bridge;
16
+ import com.getcapacitor.Logger;
17
+ import com.getcapacitor.PluginHandle;
18
+
19
+ import java.lang.reflect.Method;
20
+ import java.util.List;
6
21
 
7
22
  public class AndroidFullView {
8
23
 
9
- private AppCompatActivity activity;
24
+ private final Bridge bridge;
25
+ private final AppCompatActivity activity;
26
+ private boolean resizeOnFullScreenEnabled = true;
27
+ private boolean hooksInstalled = false;
28
+ private final View rootView;
29
+ private final View childOfContent;
30
+ private final FrameLayout.LayoutParams frameLayoutParams;
31
+ private int usableHeightPrevious = FrameLayout.LayoutParams.MATCH_PARENT;
10
32
 
11
- public AndroidFullView(AppCompatActivity activity) {
33
+ public AndroidFullView(Bridge bridge, AppCompatActivity activity) {
34
+ this.bridge = bridge;
12
35
  this.activity = activity;
13
36
  activity
14
37
  .getWindow()
@@ -19,6 +42,13 @@ public class AndroidFullView {
19
42
  View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR |
20
43
  View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
21
44
  );
45
+
46
+ FrameLayout content = activity.getWindow().getDecorView().findViewById(android.R.id.content);
47
+ rootView = content.getRootView();
48
+ childOfContent = content.getChildAt(0);
49
+ frameLayoutParams = childOfContent != null
50
+ ? (FrameLayout.LayoutParams) childOfContent.getLayoutParams()
51
+ : null;
22
52
  }
23
53
 
24
54
  public float getTop() {
@@ -43,4 +73,168 @@ public class AndroidFullView {
43
73
  }
44
74
  return (int) (navigationBarHeight / metrics.density);
45
75
  }
76
+
77
+ public void setResizeOnFullScreenEnabled(boolean enabled) {
78
+ resizeOnFullScreenEnabled = enabled;
79
+ ensureHooksInstalled();
80
+
81
+ if (!resizeOnFullScreenEnabled) {
82
+ restoreFullHeight();
83
+ }
84
+ }
85
+
86
+ public boolean isResizeOnFullScreenEnabled() {
87
+ return resizeOnFullScreenEnabled;
88
+ }
89
+
90
+ private void ensureHooksInstalled() {
91
+ if (hooksInstalled || rootView == null || frameLayoutParams == null) {
92
+ return;
93
+ }
94
+
95
+ ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
96
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
97
+
98
+ if (rootInsets == null) {
99
+ return insets;
100
+ }
101
+
102
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
103
+
104
+ if (showingKeyboard && resizeOnFullScreenEnabled) {
105
+ possiblyResizeChildOfContent(true);
106
+ } else if (!resizeOnFullScreenEnabled) {
107
+ restoreFullHeight();
108
+ }
109
+
110
+ return insets;
111
+ });
112
+
113
+ ViewCompat.setWindowInsetsAnimationCallback(
114
+ rootView,
115
+ new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {
116
+ @NonNull
117
+ @Override
118
+ public WindowInsetsCompat onProgress(
119
+ @NonNull WindowInsetsCompat insets,
120
+ @NonNull List<WindowInsetsAnimationCompat> runningAnimations
121
+ ) {
122
+ return insets;
123
+ }
124
+
125
+ @NonNull
126
+ @Override
127
+ public WindowInsetsAnimationCompat.BoundsCompat onStart(
128
+ @NonNull WindowInsetsAnimationCompat animation,
129
+ @NonNull WindowInsetsAnimationCompat.BoundsCompat bounds
130
+ ) {
131
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
132
+
133
+ if (rootInsets == null) {
134
+ return super.onStart(animation, bounds);
135
+ }
136
+
137
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
138
+ int imeHeight = rootInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
139
+ DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
140
+
141
+ if (resizeOnFullScreenEnabled) {
142
+ possiblyResizeChildOfContent(showingKeyboard);
143
+ } else {
144
+ restoreFullHeight();
145
+ }
146
+
147
+ dispatchKeyboardEvent(
148
+ showingKeyboard ? "keyboardWillShow" : "keyboardWillHide",
149
+ Math.round(imeHeight / displayMetrics.density)
150
+ );
151
+
152
+ return super.onStart(animation, bounds);
153
+ }
154
+
155
+ @Override
156
+ public void onEnd(@NonNull WindowInsetsAnimationCompat animation) {
157
+ super.onEnd(animation);
158
+
159
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
160
+
161
+ if (rootInsets == null) {
162
+ return;
163
+ }
164
+
165
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
166
+ int imeHeight = rootInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
167
+ DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
168
+
169
+ if (!showingKeyboard) {
170
+ restoreFullHeight();
171
+ }
172
+
173
+ dispatchKeyboardEvent(
174
+ showingKeyboard ? "keyboardDidShow" : "keyboardDidHide",
175
+ Math.round(imeHeight / displayMetrics.density)
176
+ );
177
+ }
178
+ }
179
+ );
180
+
181
+ hooksInstalled = true;
182
+ }
183
+
184
+ private void dispatchKeyboardEvent(String eventName, int size) {
185
+ try {
186
+ PluginHandle keyboardPluginHandle = bridge.getPlugin("Keyboard");
187
+
188
+ if (keyboardPluginHandle == null || keyboardPluginHandle.getInstance() == null) {
189
+ return;
190
+ }
191
+
192
+ Method onKeyboardEvent = keyboardPluginHandle
193
+ .getInstance()
194
+ .getClass()
195
+ .getDeclaredMethod("onKeyboardEvent", String.class, int.class);
196
+
197
+ onKeyboardEvent.setAccessible(true);
198
+ onKeyboardEvent.invoke(keyboardPluginHandle.getInstance(), eventName, size);
199
+ } catch (Exception exception) {
200
+ Logger.debug("Unable to forward keyboard event: " + exception.getMessage());
201
+ }
202
+ }
203
+
204
+ private void possiblyResizeChildOfContent(boolean keyboardShown) {
205
+ int usableHeightNow = keyboardShown ? computeUsableHeight() : FrameLayout.LayoutParams.MATCH_PARENT;
206
+
207
+ if (usableHeightPrevious != usableHeightNow) {
208
+ frameLayoutParams.height = usableHeightNow;
209
+ childOfContent.requestLayout();
210
+ usableHeightPrevious = usableHeightNow;
211
+ }
212
+ }
213
+
214
+ private void restoreFullHeight() {
215
+ if (frameLayoutParams == null || childOfContent == null) {
216
+ return;
217
+ }
218
+
219
+ frameLayoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
220
+ childOfContent.requestLayout();
221
+ usableHeightPrevious = FrameLayout.LayoutParams.MATCH_PARENT;
222
+ }
223
+
224
+ private int computeUsableHeight() {
225
+ Rect rect = new Rect();
226
+ childOfContent.getWindowVisibleDisplayFrame(rect);
227
+
228
+ return isOverlayingStatusBar() ? rect.bottom : rect.height();
229
+ }
230
+
231
+ @SuppressWarnings("deprecation")
232
+ private boolean isOverlayingStatusBar() {
233
+ Window window = activity.getWindow();
234
+
235
+ return (
236
+ (window.getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) ==
237
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
238
+ );
239
+ }
46
240
  }
@@ -1,6 +1,5 @@
1
1
  package com.falconeta.plugin.android.fullview;
2
2
 
3
- import android.app.Activity;
4
3
  import com.getcapacitor.JSObject;
5
4
  import com.getcapacitor.Plugin;
6
5
  import com.getcapacitor.PluginCall;
@@ -14,7 +13,7 @@ public class AndroidFullViewPlugin extends Plugin {
14
13
 
15
14
  @Override
16
15
  public void load() {
17
- this.implementation = new AndroidFullView(getActivity());
16
+ this.implementation = new AndroidFullView(getBridge(), getActivity());
18
17
  }
19
18
 
20
19
  @PluginMethod
@@ -34,4 +33,22 @@ public class AndroidFullViewPlugin extends Plugin {
34
33
  ret.put("value", navigationBarHeight);
35
34
  call.resolve(ret);
36
35
  }
36
+
37
+ @PluginMethod
38
+ public void setResizeOnFullScreenEnabled(PluginCall call) {
39
+ boolean enabled = call.getBoolean("enabled", true);
40
+
41
+ getBridge().executeOnMainThread(() -> {
42
+ implementation.setResizeOnFullScreenEnabled(enabled);
43
+ call.resolve();
44
+ });
45
+ }
46
+
47
+ @PluginMethod
48
+ public void getResizeOnFullScreenEnabled(PluginCall call) {
49
+ JSObject ret = new JSObject();
50
+
51
+ ret.put("enabled", implementation.isResizeOnFullScreenEnabled());
52
+ call.resolve(ret);
53
+ }
37
54
  }
package/dist/docs.json CHANGED
@@ -28,6 +28,36 @@
28
28
  "TopBottomReturn"
29
29
  ],
30
30
  "slug": "bottom"
31
+ },
32
+ {
33
+ "name": "setResizeOnFullScreenEnabled",
34
+ "signature": "(options: ResizeOnFullScreenEnabledOptions) => Promise<void>",
35
+ "parameters": [
36
+ {
37
+ "name": "options",
38
+ "docs": "",
39
+ "type": "ResizeOnFullScreenEnabledOptions"
40
+ }
41
+ ],
42
+ "returns": "Promise<void>",
43
+ "tags": [],
44
+ "docs": "Enables or disables the Android keyboard resize workaround used in fullscreen mode.",
45
+ "complexTypes": [
46
+ "ResizeOnFullScreenEnabledOptions"
47
+ ],
48
+ "slug": "setresizeonfullscreenenabled"
49
+ },
50
+ {
51
+ "name": "getResizeOnFullScreenEnabled",
52
+ "signature": "() => Promise<ResizeOnFullScreenEnabledResult>",
53
+ "parameters": [],
54
+ "returns": "Promise<ResizeOnFullScreenEnabledResult>",
55
+ "tags": [],
56
+ "docs": "Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.",
57
+ "complexTypes": [
58
+ "ResizeOnFullScreenEnabledResult"
59
+ ],
60
+ "slug": "getresizeonfullscreenenabled"
31
61
  }
32
62
  ],
33
63
  "properties": []
@@ -48,6 +78,38 @@
48
78
  "type": "number"
49
79
  }
50
80
  ]
81
+ },
82
+ {
83
+ "name": "ResizeOnFullScreenEnabledOptions",
84
+ "slug": "resizeonfullscreenenabledoptions",
85
+ "docs": "",
86
+ "tags": [],
87
+ "methods": [],
88
+ "properties": [
89
+ {
90
+ "name": "enabled",
91
+ "tags": [],
92
+ "docs": "",
93
+ "complexTypes": [],
94
+ "type": "boolean"
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "name": "ResizeOnFullScreenEnabledResult",
100
+ "slug": "resizeonfullscreenenabledresult",
101
+ "docs": "",
102
+ "tags": [],
103
+ "methods": [],
104
+ "properties": [
105
+ {
106
+ "name": "enabled",
107
+ "tags": [],
108
+ "docs": "",
109
+ "complexTypes": [],
110
+ "type": "boolean"
111
+ }
112
+ ]
51
113
  }
52
114
  ],
53
115
  "enums": [],
@@ -7,7 +7,21 @@ export interface AndroidFullViewPlugin {
7
7
  * Returns bottom offset of the status bar
8
8
  */
9
9
  bottom(): Promise<TopBottomReturn>;
10
+ /**
11
+ * Enables or disables the Android keyboard resize workaround used in fullscreen mode.
12
+ */
13
+ setResizeOnFullScreenEnabled(options: ResizeOnFullScreenEnabledOptions): Promise<void>;
14
+ /**
15
+ * Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.
16
+ */
17
+ getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;
10
18
  }
11
19
  export interface TopBottomReturn {
12
20
  value: number;
13
21
  }
22
+ export interface ResizeOnFullScreenEnabledOptions {
23
+ enabled: boolean;
24
+ }
25
+ export interface ResizeOnFullScreenEnabledResult {
26
+ enabled: boolean;
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AndroidFullViewPlugin {\n /**\n * Returns top offset of the status bar\n */\n top(): Promise<TopBottomReturn>;\n\n /**\n * Returns bottom offset of the status bar\n */\n bottom(): Promise<TopBottomReturn>;\n}\n\nexport interface TopBottomReturn {\n value: number;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AndroidFullViewPlugin {\n /**\n * Returns top offset of the status bar\n */\n top(): Promise<TopBottomReturn>;\n\n /**\n * Returns bottom offset of the status bar\n */\n bottom(): Promise<TopBottomReturn>;\n\n /**\n * Enables or disables the Android keyboard resize workaround used in fullscreen mode.\n */\n setResizeOnFullScreenEnabled(\n options: ResizeOnFullScreenEnabledOptions,\n ): Promise<void>;\n\n /**\n * Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.\n */\n getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;\n}\n\nexport interface TopBottomReturn {\n value: number;\n}\n\nexport interface ResizeOnFullScreenEnabledOptions {\n enabled: boolean;\n}\n\nexport interface ResizeOnFullScreenEnabledResult {\n enabled: boolean;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { AndroidFullViewPlugin, TopBottomReturn } from './definitions';
2
+ import type { AndroidFullViewPlugin, ResizeOnFullScreenEnabledOptions, ResizeOnFullScreenEnabledResult, TopBottomReturn } from './definitions';
3
3
  export declare class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {
4
4
  top(): Promise<TopBottomReturn>;
5
5
  bottom(): Promise<TopBottomReturn>;
6
+ setResizeOnFullScreenEnabled(_options: ResizeOnFullScreenEnabledOptions): Promise<void>;
7
+ getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;
6
8
  }
package/dist/esm/web.js CHANGED
@@ -6,5 +6,9 @@ export class AndroidFullViewWeb extends WebPlugin {
6
6
  async bottom() {
7
7
  return { value: 0 };
8
8
  }
9
+ async setResizeOnFullScreenEnabled(_options) { }
10
+ async getResizeOnFullScreenEnabled() {
11
+ return { enabled: true };
12
+ }
9
13
  }
10
14
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,GAAG;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AndroidFullViewPlugin, TopBottomReturn } from './definitions';\n\nexport class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {\n async top(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async bottom(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,GAAG;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,4BAA4B,CAChC,QAA0C,IAC1B,CAAC;IAEnB,KAAK,CAAC,4BAA4B;QAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AndroidFullViewPlugin,\n ResizeOnFullScreenEnabledOptions,\n ResizeOnFullScreenEnabledResult,\n TopBottomReturn,\n} from './definitions';\n\nexport class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {\n async top(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async bottom(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async setResizeOnFullScreenEnabled(\n _options: ResizeOnFullScreenEnabledOptions,\n ): Promise<void> {}\n\n async getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult> {\n return { enabled: true };\n }\n}\n"]}
@@ -13,6 +13,10 @@ class AndroidFullViewWeb extends core.WebPlugin {
13
13
  async bottom() {
14
14
  return { value: 0 };
15
15
  }
16
+ async setResizeOnFullScreenEnabled(_options) { }
17
+ async getResizeOnFullScreenEnabled() {
18
+ return { enabled: true };
19
+ }
16
20
  }
17
21
 
18
22
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,GAAG,GAAG;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n async setResizeOnFullScreenEnabled(_options) { }\n async getResizeOnFullScreenEnabled() {\n return { enabled: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,GAAG,GAAG;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ,IAAI,MAAM,4BAA4B,CAAC,QAAQ,EAAE,EAAE;AACnD,IAAI,MAAM,4BAA4B,GAAG;AACzC,QAAQ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -12,6 +12,10 @@ var capacitorAndroidFullView = (function (exports, core) {
12
12
  async bottom() {
13
13
  return { value: 0 };
14
14
  }
15
+ async setResizeOnFullScreenEnabled(_options) { }
16
+ async getResizeOnFullScreenEnabled() {
17
+ return { enabled: true };
18
+ }
15
19
  }
16
20
 
17
21
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,GAAG,GAAG;IAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B;IACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n async setResizeOnFullScreenEnabled(_options) { }\n async getResizeOnFullScreenEnabled() {\n return { enabled: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,GAAG,GAAG;IAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ,IAAI,MAAM,4BAA4B,CAAC,QAAQ,EAAE,EAAE;IACnD,IAAI,MAAM,4BAA4B,GAAG;IACzC,QAAQ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import Foundation
2
+
3
+ @objc public class AndroidFullView: NSObject {
4
+ private var resizeOnFullScreenEnabled = true
5
+
6
+ @objc public func top() -> Float {
7
+ return 0
8
+ }
9
+
10
+ @objc public func bottom() -> Int {
11
+ return 0
12
+ }
13
+
14
+ @objc public func setResizeOnFullScreenEnabled(_ enabled: Bool) {
15
+ resizeOnFullScreenEnabled = enabled
16
+ }
17
+
18
+ @objc public func getResizeOnFullScreenEnabled() -> Bool {
19
+ return resizeOnFullScreenEnabled
20
+ }
21
+ }
@@ -0,0 +1,42 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ /**
5
+ * Please read the Capacitor iOS Plugin Development Guide
6
+ * here: https://capacitorjs.com/docs/plugins/ios
7
+ */
8
+ @objc(AndroidFullView)
9
+ public class AndroidFullViewPlugin: CAPPlugin, CAPBridgedPlugin {
10
+ public let identifier = "AndroidFullViewPlugin"
11
+ public let jsName = "AndroidFullView"
12
+ public let pluginMethods: [CAPPluginMethod] = [
13
+ CAPPluginMethod(name: "top", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "bottom", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "setResizeOnFullScreenEnabled", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "getResizeOnFullScreenEnabled", returnType: CAPPluginReturnPromise)
17
+ ]
18
+ private let implementation = AndroidFullView()
19
+
20
+ @objc func top(_ call: CAPPluginCall) {
21
+ call.resolve([
22
+ "value": implementation.top()
23
+ ])
24
+ }
25
+
26
+ @objc func bottom(_ call: CAPPluginCall) {
27
+ call.resolve([
28
+ "value": implementation.bottom()
29
+ ])
30
+ }
31
+
32
+ @objc func setResizeOnFullScreenEnabled(_ call: CAPPluginCall) {
33
+ implementation.setResizeOnFullScreenEnabled(call.getBool("enabled", true))
34
+ call.resolve()
35
+ }
36
+
37
+ @objc func getResizeOnFullScreenEnabled(_ call: CAPPluginCall) {
38
+ call.resolve([
39
+ "enabled": implementation.getResizeOnFullScreenEnabled()
40
+ ])
41
+ }
42
+ }
@@ -0,0 +1,23 @@
1
+ import XCTest
2
+ @testable import Plugin
3
+
4
+ class AndroidFullViewTests: XCTestCase {
5
+ override func setUp() {
6
+ super.setUp()
7
+ // Put setup code here. This method is called before the invocation of each test method in the class.
8
+ }
9
+
10
+ override func tearDown() {
11
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
12
+ super.tearDown()
13
+ }
14
+
15
+ func testTop() {
16
+
17
+ let implementation = AndroidFullView()
18
+ let value = 0
19
+ let result = implementation.top()
20
+
21
+ XCTAssertEqual(value, result)
22
+ }
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falconeta/capacitor-android-full-view",
3
- "version": "7.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "Capacitor plugin for retrieving proper top offset, bottom offset and set full screen ONLY for android",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,7 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
14
16
  "FalconetaCapacitorAndroidFullView.podspec"
15
17
  ],
16
18
  "author": "Owls Department",
@@ -44,23 +46,23 @@
44
46
  "prepublishOnly": "npm run build"
45
47
  },
46
48
  "devDependencies": {
47
- "@capacitor/android": "^7.0.0",
48
- "@capacitor/core": "^7.0.0",
49
- "@capacitor/docgen": "^0.3.0",
50
- "@capacitor/ios": "^7.0.0",
49
+ "@capacitor/android": "^8.0.0",
50
+ "@capacitor/core": "^8.0.0",
51
+ "@capacitor/docgen": "^0.3.1",
52
+ "@capacitor/ios": "^8.0.0",
51
53
  "@ionic/eslint-config": "^0.4.0",
52
54
  "@ionic/prettier-config": "^4.0.0",
53
55
  "@ionic/swiftlint-config": "^2.0.0",
54
- "eslint": "^8.57.0",
55
- "prettier": "^3.4.2",
56
- "prettier-plugin-java": "^2.6.6",
57
- "rimraf": "^6.0.1",
58
- "rollup": "^4.30.1",
56
+ "eslint": "^8.57.1",
57
+ "prettier": "^3.6.2",
58
+ "prettier-plugin-java": "^2.7.7",
59
+ "rimraf": "^6.1.0",
60
+ "rollup": "^4.53.2",
59
61
  "swiftlint": "^2.0.0",
60
- "typescript": "~4.1.5"
62
+ "typescript": "^5.9.3"
61
63
  },
62
64
  "peerDependencies": {
63
- "@capacitor/core": ">=7.0.0"
65
+ "@capacitor/core": ">=8.0.0"
64
66
  },
65
67
  "prettier": "@ionic/prettier-config",
66
68
  "swiftlint": "@ionic/swiftlint-config",
@@ -1,7 +0,0 @@
1
- import Foundation
2
-
3
- @objc public class AndroidFullView: NSObject {
4
- @objc public func top() -> Float {
5
- return 0
6
- }
7
- }
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,8 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(AndroidFullView, "AndroidFullView",
7
- CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
8
- )
@@ -1,17 +0,0 @@
1
- import Foundation
2
- import Capacitor
3
-
4
- /**
5
- * Please read the Capacitor iOS Plugin Development Guide
6
- * here: https://capacitorjs.com/docs/plugins/ios
7
- */
8
- @objc(AndroidFullView)
9
- public class AndroidFullViewPlugin: CAPPlugin {
10
- private let implementation = AndroidFullView()
11
-
12
- @objc func top(_ call: CAPPluginCall) {
13
- call.resolve([
14
- "value": implementation.top()
15
- ])
16
- }
17
- }
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>$(DEVELOPMENT_LANGUAGE)</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>FMWK</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleVersion</key>
20
- <string>$(CURRENT_PROJECT_VERSION)</string>
21
- <key>NSPrincipalClass</key>
22
- <string></string>
23
- </dict>
24
- </plist>