@hiloenergie/capacitor-plugin-safe-area 0.0.11 → 0.0.12-beta.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.
- package/HiloenergieCapacitorPluginSafeArea.podspec +17 -17
- package/README.md +225 -225
- package/android/build.gradle +58 -58
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/getcapacitor/community/plugins/safearea/SafeAreaPlugin.java +158 -158
- package/android/src/main/java/com/getcapacitor/community/plugins/safearea/SafeAreaView.java +48 -48
- package/dist/docs.json +3 -3
- package/dist/esm/controller.js +1 -1
- package/dist/esm/controller.js.map +1 -1
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = 'HiloenergieCapacitorPluginSafeArea'
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.license = package['license']
|
|
10
|
-
s.homepage = package['repository']['url']
|
|
11
|
-
s.author = package['author']
|
|
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'
|
|
15
|
-
s.dependency 'Capacitor'
|
|
16
|
-
s.swift_version = '5.1'
|
|
17
|
-
end
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'HiloenergieCapacitorPluginSafeArea'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
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'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.1'
|
|
17
|
+
end
|
package/README.md
CHANGED
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
<p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>
|
|
2
|
-
<h3 align="center">Safe Area</h3>
|
|
3
|
-
<p align="center"><strong><code>@capacitor-community/safe-area</code></strong></p>
|
|
4
|
-
<p align="center">
|
|
5
|
-
A plugin to expose the safe area insets from the native iOS/Android device to your web project.
|
|
6
|
-
</p>
|
|
7
|
-
|
|
8
|
-
<p align="center">
|
|
9
|
-
<img src="https://img.shields.io/maintenance/yes/2020?style=flat-square" />
|
|
10
|
-
<a href="https://github.com/capacitor-community/safe-area/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/safe-area/CI?style=flat-square" /></a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/l/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
12
|
-
<br>
|
|
13
|
-
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/dw/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/v/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
15
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
16
|
-
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-0-orange?style=flat-square" /></a>
|
|
17
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
## Maintainers
|
|
21
|
-
|
|
22
|
-
***This is a fork of [@capacitor-community/safe-area](https://github.com/capacitor-community/safe-area). Please make sure to sync up with the public package through pull requests so that we can eventually switch back to the
|
|
23
|
-
official plugin.***
|
|
24
|
-
|
|
25
|
-
| Maintainer | GitHub | Social |
|
|
26
|
-
| -----------| -------| -------|
|
|
27
|
-
| Kevin Pacheco | [PolymorphiK](https://github.com/PolymorphiK) | [@k_pacheco10](https://twitter.com/k_pacheco10) |
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
Soon(TM)
|
|
32
|
-
|
|
33
|
-
## Configuration
|
|
34
|
-
|
|
35
|
-
For Android, register plugin in your main activity.
|
|
36
|
-
|
|
37
|
-
```java
|
|
38
|
-
import com.getcapacitor.community.safearea.SafeAreaPlugin;
|
|
39
|
-
|
|
40
|
-
public class MainActivity extends BridgeActivity {
|
|
41
|
-
@Override
|
|
42
|
-
public void onCreate(Bundle savedInstanceState) {
|
|
43
|
-
super.onCreate(savedInstanceState);
|
|
44
|
-
|
|
45
|
-
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
|
|
46
|
-
add(SafeAreaPlugin.class);
|
|
47
|
-
}});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
Here is a bonus tip, to get full screen mode use this in your main activity. Requires Android **28+**
|
|
52
|
-
|
|
53
|
-
```java
|
|
54
|
-
@Override
|
|
55
|
-
public void onResume() {
|
|
56
|
-
super.onResume();
|
|
57
|
-
|
|
58
|
-
// Requires API 28+
|
|
59
|
-
this.getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
|
60
|
-
|
|
61
|
-
View decorView = this.getWindow().getDecorView();
|
|
62
|
-
|
|
63
|
-
decorView.setSystemUiVisibility(
|
|
64
|
-
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
|
65
|
-
// Set the content to appear under the system bars so that the
|
|
66
|
-
// content doesn't resize when the system bars hide and show.
|
|
67
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
68
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
69
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
70
|
-
// Hide the nav bar and status bar
|
|
71
|
-
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
72
|
-
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
To change the Android build version, change the **minSdkVersion** to at least 28 in the **variables.gradle** file. <br />
|
|
76
|
-
For more information please see Android's [immersive](https://developer.android.com/training/system-ui/immersive), and [short edges](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES) documentation.
|
|
77
|
-
|
|
78
|
-
## Usage
|
|
79
|
-
Register the plugin via the entry file of your project.
|
|
80
|
-
|
|
81
|
-
```javascript
|
|
82
|
-
// Register Capacitor Plugin...
|
|
83
|
-
import '@capacitor-community/safe-area';
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
It is **strongly** recomended that you use the **SafeAreaController** as it makes it super easy to use the plugin :)
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
import { SafeAreaController } from '@capacitor-community/safe-area';
|
|
91
|
-
|
|
92
|
-
// Initialize the controller.
|
|
93
|
-
SafeAreaController.load();
|
|
94
|
-
|
|
95
|
-
// Gets the insets object
|
|
96
|
-
// Shape
|
|
97
|
-
/*
|
|
98
|
-
{
|
|
99
|
-
top: number,
|
|
100
|
-
bottom: number,
|
|
101
|
-
right: number,
|
|
102
|
-
left: number,
|
|
103
|
-
}
|
|
104
|
-
*/
|
|
105
|
-
SafeAreaController.getInsets();
|
|
106
|
-
|
|
107
|
-
// Use this to listen for changes in the insets.
|
|
108
|
-
// i.e. when the device is rotated
|
|
109
|
-
SafeAreaController.addListener((insets) => {
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Use this to force the plugin to invoke the event
|
|
114
|
-
// Example, after you add a listener perhaps you invoke refresh
|
|
115
|
-
// to get the most up-to-date inset values.
|
|
116
|
-
SafeAreaController.refresh();
|
|
117
|
-
|
|
118
|
-
// Uninitialize the controller when you don't need it anymore.
|
|
119
|
-
SafeAreaController.unload();
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Once the **SafeAreaController** has been loaded, it will inject CSS variables for you to use in your style sheets.
|
|
123
|
-
|
|
124
|
-
```css
|
|
125
|
-
/* styling for every case Web, iOS, and/or Android */
|
|
126
|
-
.myContainer {
|
|
127
|
-
paddingTop: max(1.5rem, val(--safe-area-inset-top));
|
|
128
|
-
paddingLeft: max(1.5rem, val(--safe-area-inset-left));
|
|
129
|
-
paddingRight: max(1.5rem, val(--safe-area-inset-right));
|
|
130
|
-
paddingBottom: val(--safe-area-inset-bottom);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* If you need Android specific stying */
|
|
134
|
-
.myContainerForAndroidOnly {
|
|
135
|
-
paddingTop: max(1.5rem, val(--android-safe-area-inset-top));
|
|
136
|
-
paddingLeft: max(1.5rem, val(--android-safe-area-inset-left));
|
|
137
|
-
paddingRight: max(1.5rem, val(--android-safe-area-inset-right));
|
|
138
|
-
paddingBottom: val(--android-safe-area-inset-bottom);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* If you need iOS specific styling */
|
|
142
|
-
.myContainerForIOSOnly {
|
|
143
|
-
paddingTop: max(1.5rem, val(--ios-safe-area-inset-top));
|
|
144
|
-
paddingLeft: max(1.5rem, val(--ios-safe-area-inset-left));
|
|
145
|
-
paddingRight: max(1.5rem, val(--ios-safe-area-inset-right));
|
|
146
|
-
paddingBottom: val(--ios-safe-area-inset-bottom);
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
This can also be used with the styles attribute in something like React.js for example.
|
|
151
|
-
```jsx
|
|
152
|
-
// This div will grow to cover the area of the cutout
|
|
153
|
-
// this would be at the very top.
|
|
154
|
-
<div
|
|
155
|
-
style={{
|
|
156
|
-
height: "var(--safe-area-inset-top)",
|
|
157
|
-
backgroundColor: "#12005e"
|
|
158
|
-
}}>
|
|
159
|
-
</div>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
<details>
|
|
163
|
-
<summary>React - SafeAreaInsetsProvider</summary>
|
|
164
|
-
|
|
165
|
-
Here is a component that can be used by React.js developers. This handles everything for you via the SafeAreaController. There is a hook you can use as well called **useSafeAreaInsetsState** which will return a JSON object with top, bottom, right, and left number properties.
|
|
166
|
-
|
|
167
|
-
```javascript
|
|
168
|
-
import * as React from 'react';
|
|
169
|
-
import { SafeAreaController } from '@capacitor-community/safe-area';
|
|
170
|
-
|
|
171
|
-
const StateContext = React.createContext();
|
|
172
|
-
|
|
173
|
-
export const useSafeAreaInsetsState = () => {
|
|
174
|
-
const context = React.useContext(StateContext);
|
|
175
|
-
|
|
176
|
-
if(context === undefined)
|
|
177
|
-
throw new Error("Cannot use 'useSafeAreaInsetsState' outside of a SafeAreaInsetsProvider!");
|
|
178
|
-
|
|
179
|
-
return context;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const SafeAreaInsetsProvider = ({children}) => {
|
|
183
|
-
const [state, setState] = React.useState({
|
|
184
|
-
top: 0,
|
|
185
|
-
bottom: 0,
|
|
186
|
-
right: 0,
|
|
187
|
-
left: 0
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
React.useState(() => {
|
|
191
|
-
SafeAreaController.addListener((insets) => {
|
|
192
|
-
setState(insets);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
SafeAreaController.load();
|
|
196
|
-
|
|
197
|
-
return () => {
|
|
198
|
-
SafeAreaController.removeAllListeners();
|
|
199
|
-
SafeAreaController.unload();
|
|
200
|
-
}
|
|
201
|
-
}, []);
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<StateContext.Provider value={state}>
|
|
205
|
-
{children}
|
|
206
|
-
</StateContext.Provider>
|
|
207
|
-
)
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default SafeAreaInsetsProvider;
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
You can then use this provider ideally in the **index** file of your project.
|
|
214
|
-
|
|
215
|
-
```javascript
|
|
216
|
-
ReactDOM.render(
|
|
217
|
-
<React.StrictMode>
|
|
218
|
-
<SafeAreaInsetsProvider>
|
|
219
|
-
<App />
|
|
220
|
-
</SafeAreaInsetsProvider>
|
|
221
|
-
</React.StrictMode>,
|
|
222
|
-
document.getElementById('root')
|
|
223
|
-
);
|
|
224
|
-
```
|
|
225
|
-
</details>
|
|
1
|
+
<p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>
|
|
2
|
+
<h3 align="center">Safe Area</h3>
|
|
3
|
+
<p align="center"><strong><code>@capacitor-community/safe-area</code></strong></p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
A plugin to expose the safe area insets from the native iOS/Android device to your web project.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="https://img.shields.io/maintenance/yes/2020?style=flat-square" />
|
|
10
|
+
<a href="https://github.com/capacitor-community/safe-area/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/safe-area/CI?style=flat-square" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/l/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
12
|
+
<br>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/dw/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@capacitor-community/safe-area"><img src="https://img.shields.io/npm/v/@capacitor-community/safe-area?style=flat-square" /></a>
|
|
15
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
16
|
+
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-0-orange?style=flat-square" /></a>
|
|
17
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
## Maintainers
|
|
21
|
+
|
|
22
|
+
***This is a fork of [@capacitor-community/safe-area](https://github.com/capacitor-community/safe-area). Please make sure to sync up with the public package through pull requests so that we can eventually switch back to the
|
|
23
|
+
official plugin.***
|
|
24
|
+
|
|
25
|
+
| Maintainer | GitHub | Social |
|
|
26
|
+
| -----------| -------| -------|
|
|
27
|
+
| Kevin Pacheco | [PolymorphiK](https://github.com/PolymorphiK) | [@k_pacheco10](https://twitter.com/k_pacheco10) |
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Soon(TM)
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
For Android, register plugin in your main activity.
|
|
36
|
+
|
|
37
|
+
```java
|
|
38
|
+
import com.getcapacitor.community.safearea.SafeAreaPlugin;
|
|
39
|
+
|
|
40
|
+
public class MainActivity extends BridgeActivity {
|
|
41
|
+
@Override
|
|
42
|
+
public void onCreate(Bundle savedInstanceState) {
|
|
43
|
+
super.onCreate(savedInstanceState);
|
|
44
|
+
|
|
45
|
+
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
|
|
46
|
+
add(SafeAreaPlugin.class);
|
|
47
|
+
}});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
Here is a bonus tip, to get full screen mode use this in your main activity. Requires Android **28+**
|
|
52
|
+
|
|
53
|
+
```java
|
|
54
|
+
@Override
|
|
55
|
+
public void onResume() {
|
|
56
|
+
super.onResume();
|
|
57
|
+
|
|
58
|
+
// Requires API 28+
|
|
59
|
+
this.getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
|
60
|
+
|
|
61
|
+
View decorView = this.getWindow().getDecorView();
|
|
62
|
+
|
|
63
|
+
decorView.setSystemUiVisibility(
|
|
64
|
+
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
|
65
|
+
// Set the content to appear under the system bars so that the
|
|
66
|
+
// content doesn't resize when the system bars hide and show.
|
|
67
|
+
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
68
|
+
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
69
|
+
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
70
|
+
// Hide the nav bar and status bar
|
|
71
|
+
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
72
|
+
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
To change the Android build version, change the **minSdkVersion** to at least 28 in the **variables.gradle** file. <br />
|
|
76
|
+
For more information please see Android's [immersive](https://developer.android.com/training/system-ui/immersive), and [short edges](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES) documentation.
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
Register the plugin via the entry file of your project.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
// Register Capacitor Plugin...
|
|
83
|
+
import '@capacitor-community/safe-area';
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
It is **strongly** recomended that you use the **SafeAreaController** as it makes it super easy to use the plugin :)
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
import { SafeAreaController } from '@capacitor-community/safe-area';
|
|
91
|
+
|
|
92
|
+
// Initialize the controller.
|
|
93
|
+
SafeAreaController.load();
|
|
94
|
+
|
|
95
|
+
// Gets the insets object
|
|
96
|
+
// Shape
|
|
97
|
+
/*
|
|
98
|
+
{
|
|
99
|
+
top: number,
|
|
100
|
+
bottom: number,
|
|
101
|
+
right: number,
|
|
102
|
+
left: number,
|
|
103
|
+
}
|
|
104
|
+
*/
|
|
105
|
+
SafeAreaController.getInsets();
|
|
106
|
+
|
|
107
|
+
// Use this to listen for changes in the insets.
|
|
108
|
+
// i.e. when the device is rotated
|
|
109
|
+
SafeAreaController.addListener((insets) => {
|
|
110
|
+
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Use this to force the plugin to invoke the event
|
|
114
|
+
// Example, after you add a listener perhaps you invoke refresh
|
|
115
|
+
// to get the most up-to-date inset values.
|
|
116
|
+
SafeAreaController.refresh();
|
|
117
|
+
|
|
118
|
+
// Uninitialize the controller when you don't need it anymore.
|
|
119
|
+
SafeAreaController.unload();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Once the **SafeAreaController** has been loaded, it will inject CSS variables for you to use in your style sheets.
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
/* styling for every case Web, iOS, and/or Android */
|
|
126
|
+
.myContainer {
|
|
127
|
+
paddingTop: max(1.5rem, val(--safe-area-inset-top));
|
|
128
|
+
paddingLeft: max(1.5rem, val(--safe-area-inset-left));
|
|
129
|
+
paddingRight: max(1.5rem, val(--safe-area-inset-right));
|
|
130
|
+
paddingBottom: val(--safe-area-inset-bottom);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* If you need Android specific stying */
|
|
134
|
+
.myContainerForAndroidOnly {
|
|
135
|
+
paddingTop: max(1.5rem, val(--android-safe-area-inset-top));
|
|
136
|
+
paddingLeft: max(1.5rem, val(--android-safe-area-inset-left));
|
|
137
|
+
paddingRight: max(1.5rem, val(--android-safe-area-inset-right));
|
|
138
|
+
paddingBottom: val(--android-safe-area-inset-bottom);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* If you need iOS specific styling */
|
|
142
|
+
.myContainerForIOSOnly {
|
|
143
|
+
paddingTop: max(1.5rem, val(--ios-safe-area-inset-top));
|
|
144
|
+
paddingLeft: max(1.5rem, val(--ios-safe-area-inset-left));
|
|
145
|
+
paddingRight: max(1.5rem, val(--ios-safe-area-inset-right));
|
|
146
|
+
paddingBottom: val(--ios-safe-area-inset-bottom);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This can also be used with the styles attribute in something like React.js for example.
|
|
151
|
+
```jsx
|
|
152
|
+
// This div will grow to cover the area of the cutout
|
|
153
|
+
// this would be at the very top.
|
|
154
|
+
<div
|
|
155
|
+
style={{
|
|
156
|
+
height: "var(--safe-area-inset-top)",
|
|
157
|
+
backgroundColor: "#12005e"
|
|
158
|
+
}}>
|
|
159
|
+
</div>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
<details>
|
|
163
|
+
<summary>React - SafeAreaInsetsProvider</summary>
|
|
164
|
+
|
|
165
|
+
Here is a component that can be used by React.js developers. This handles everything for you via the SafeAreaController. There is a hook you can use as well called **useSafeAreaInsetsState** which will return a JSON object with top, bottom, right, and left number properties.
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
import * as React from 'react';
|
|
169
|
+
import { SafeAreaController } from '@capacitor-community/safe-area';
|
|
170
|
+
|
|
171
|
+
const StateContext = React.createContext();
|
|
172
|
+
|
|
173
|
+
export const useSafeAreaInsetsState = () => {
|
|
174
|
+
const context = React.useContext(StateContext);
|
|
175
|
+
|
|
176
|
+
if(context === undefined)
|
|
177
|
+
throw new Error("Cannot use 'useSafeAreaInsetsState' outside of a SafeAreaInsetsProvider!");
|
|
178
|
+
|
|
179
|
+
return context;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const SafeAreaInsetsProvider = ({children}) => {
|
|
183
|
+
const [state, setState] = React.useState({
|
|
184
|
+
top: 0,
|
|
185
|
+
bottom: 0,
|
|
186
|
+
right: 0,
|
|
187
|
+
left: 0
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
React.useState(() => {
|
|
191
|
+
SafeAreaController.addListener((insets) => {
|
|
192
|
+
setState(insets);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
SafeAreaController.load();
|
|
196
|
+
|
|
197
|
+
return () => {
|
|
198
|
+
SafeAreaController.removeAllListeners();
|
|
199
|
+
SafeAreaController.unload();
|
|
200
|
+
}
|
|
201
|
+
}, []);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<StateContext.Provider value={state}>
|
|
205
|
+
{children}
|
|
206
|
+
</StateContext.Provider>
|
|
207
|
+
)
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default SafeAreaInsetsProvider;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
You can then use this provider ideally in the **index** file of your project.
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
ReactDOM.render(
|
|
217
|
+
<React.StrictMode>
|
|
218
|
+
<SafeAreaInsetsProvider>
|
|
219
|
+
<App />
|
|
220
|
+
</SafeAreaInsetsProvider>
|
|
221
|
+
</React.StrictMode>,
|
|
222
|
+
document.getElementById('root')
|
|
223
|
+
);
|
|
224
|
+
```
|
|
225
|
+
</details>
|
package/android/build.gradle
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
buildscript {
|
|
9
|
-
repositories {
|
|
10
|
-
google()
|
|
11
|
-
mavenCentral()
|
|
12
|
-
}
|
|
13
|
-
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
apply plugin: 'com.android.library'
|
|
19
|
-
|
|
20
|
-
android {
|
|
21
|
-
namespace "com.getcapacitor.community.plugins.safearea"
|
|
22
|
-
|
|
23
|
-
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
26
|
-
versionCode 1
|
|
27
|
-
versionName "1.0"
|
|
28
|
-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
-
}
|
|
30
|
-
buildTypes {
|
|
31
|
-
release {
|
|
32
|
-
minifyEnabled false
|
|
33
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
lintOptions {
|
|
37
|
-
abortOnError false
|
|
38
|
-
}
|
|
39
|
-
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
repositories {
|
|
46
|
-
google()
|
|
47
|
-
mavenCentral()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
dependencies {
|
|
52
|
-
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
-
implementation project(':capacitor-android')
|
|
54
|
-
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
-
testImplementation "junit:junit:$junitVersion"
|
|
56
|
-
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
|
-
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
-
}
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "com.getcapacitor.community.plugins.safearea"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
testImplementation "junit:junit:$junitVersion"
|
|
56
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
-
</manifest>
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
</manifest>
|
package/android/src/main/java/com/getcapacitor/community/plugins/safearea/SafeAreaPlugin.java
CHANGED
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
package com.getcapacitor.community.plugins.safearea;
|
|
2
|
-
|
|
3
|
-
import android.annotation.SuppressLint;
|
|
4
|
-
import android.graphics.Insets;
|
|
5
|
-
import android.os.Build;
|
|
6
|
-
import android.view.DisplayCutout;
|
|
7
|
-
import android.view.View;
|
|
8
|
-
import android.view.ViewGroup;
|
|
9
|
-
import android.view.WindowInsets;
|
|
10
|
-
import android.widget.FrameLayout;
|
|
11
|
-
|
|
12
|
-
import com.getcapacitor.JSObject;
|
|
13
|
-
import com.getcapacitor.Plugin;
|
|
14
|
-
import com.getcapacitor.PluginCall;
|
|
15
|
-
import com.getcapacitor.PluginMethod;
|
|
16
|
-
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
17
|
-
|
|
18
|
-
@CapacitorPlugin(name = "SafeArea")
|
|
19
|
-
public class SafeAreaPlugin extends Plugin {
|
|
20
|
-
private static final String KEY_INSET = "insets";
|
|
21
|
-
private static final String EVENT_ON_INSETS_CHANGED = "safeAreaPluginsInsetChange";
|
|
22
|
-
private SafeAreaInsets safeAreaInsets = new com.getcapacitor.community.plugins.safearea.SafeAreaInsets();
|
|
23
|
-
private SafeAreaView safeAreaView;
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
public void load() {
|
|
27
|
-
this.getBridge().getActivity().runOnUiThread(() -> {
|
|
28
|
-
safeAreaView = new SafeAreaView(this.getBridge().getActivity(), (WindowInsets insets) -> {
|
|
29
|
-
this.getSafeArea(insets);
|
|
30
|
-
this.doNotify();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
FrameLayout.LayoutParams safeAreaPreviewParams = new FrameLayout.LayoutParams(
|
|
34
|
-
FrameLayout.LayoutParams.MATCH_PARENT,
|
|
35
|
-
FrameLayout.LayoutParams.MATCH_PARENT
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// Set SafeAreaView as sibling View of WebView
|
|
39
|
-
((ViewGroup) this.getBridge().getWebView().getParent()).addView(safeAreaView, safeAreaPreviewParams);
|
|
40
|
-
|
|
41
|
-
// Bring the WebView in front of the SafeAreaView
|
|
42
|
-
this.getBridge().getWebView().bringToFront();
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@PluginMethod
|
|
47
|
-
public void refresh(PluginCall call) {
|
|
48
|
-
this.doNotify();
|
|
49
|
-
call.success();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@PluginMethod
|
|
53
|
-
public void getSafeAreaInsets(PluginCall call) {
|
|
54
|
-
JSObject ret = new JSObject();
|
|
55
|
-
|
|
56
|
-
ret.put(SafeAreaPlugin.KEY_INSET, this.safeAreaInsets.toJSON());
|
|
57
|
-
|
|
58
|
-
call.success(ret);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
protected void getSafeArea(WindowInsets windowInsets) {
|
|
62
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
63
|
-
this.getSafeAreaR(windowInsets);
|
|
64
|
-
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
65
|
-
this.getSafeAreaQ(windowInsets);
|
|
66
|
-
} else {
|
|
67
|
-
this.getSafeAreaLollipop(windowInsets);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Cutout
|
|
71
|
-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
|
72
|
-
this.getSafeAreaCutout(windowInsets);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
float density = this.getBridge().getActivity().getResources().getDisplayMetrics().density;
|
|
76
|
-
|
|
77
|
-
this.applySafeAreaInsets(
|
|
78
|
-
Math.round(this.safeAreaInsets.top() / density),
|
|
79
|
-
Math.round(this.safeAreaInsets.bottom() / density),
|
|
80
|
-
Math.round(this.safeAreaInsets.left() / density),
|
|
81
|
-
Math.round(this.safeAreaInsets.right() / density)
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// api level 30
|
|
86
|
-
// Get insets (Mandatory System Gestures: https://developer.android.com/reference/android/view/WindowInsets#getMandatorySystemGestureInsets())
|
|
87
|
-
@SuppressLint("NewApi")
|
|
88
|
-
protected void getSafeAreaR(WindowInsets windowInsets) {
|
|
89
|
-
Insets finalInsets = windowInsets.getInsets(WindowInsets.Type.mandatorySystemGestures());
|
|
90
|
-
|
|
91
|
-
this.applySafeAreaInsets(
|
|
92
|
-
finalInsets.top,
|
|
93
|
-
finalInsets.bottom,
|
|
94
|
-
finalInsets.left,
|
|
95
|
-
finalInsets.right
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// api level 29
|
|
100
|
-
@SuppressLint("NewApi")
|
|
101
|
-
protected void getSafeAreaQ(WindowInsets windowInsets) {
|
|
102
|
-
Insets finalInsets = windowInsets.getMandatorySystemGestureInsets();
|
|
103
|
-
|
|
104
|
-
this.applySafeAreaInsets(
|
|
105
|
-
finalInsets.top,
|
|
106
|
-
finalInsets.bottom,
|
|
107
|
-
finalInsets.left,
|
|
108
|
-
finalInsets.right
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// api level 21
|
|
113
|
-
protected void getSafeAreaLollipop(WindowInsets windowInsets) {
|
|
114
|
-
this.applySafeAreaInsets(
|
|
115
|
-
windowInsets.getSystemWindowInsetTop(),
|
|
116
|
-
windowInsets.getStableInsetBottom(),
|
|
117
|
-
windowInsets.getStableInsetLeft(),
|
|
118
|
-
windowInsets.getStableInsetRight()
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// cutout (api level >= 28)
|
|
123
|
-
@SuppressLint("NewApi")
|
|
124
|
-
protected void getSafeAreaCutout(WindowInsets windowInsets) {
|
|
125
|
-
DisplayCutout cutout = windowInsets.getDisplayCutout();
|
|
126
|
-
if (cutout != null) {
|
|
127
|
-
this.applySafeAreaInsets(
|
|
128
|
-
Math.max(this.safeAreaInsets.top(), cutout.getSafeInsetTop()),
|
|
129
|
-
Math.max(this.safeAreaInsets.bottom(), cutout.getSafeInsetBottom()),
|
|
130
|
-
Math.max(this.safeAreaInsets.left(), cutout.getSafeInsetLeft()),
|
|
131
|
-
Math.max(this.safeAreaInsets.right(), cutout.getSafeInsetRight())
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
protected void doNotify() {
|
|
137
|
-
JSObject ret = new JSObject();
|
|
138
|
-
|
|
139
|
-
ret.put(SafeAreaPlugin.KEY_INSET, this.safeAreaInsets.toJSON());
|
|
140
|
-
|
|
141
|
-
this.notifyListeners(SafeAreaPlugin.EVENT_ON_INSETS_CHANGED, ret);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private void applySafeAreaInsets(int top, int bottom, int left, int right) {
|
|
145
|
-
View decorView = this.getBridge().getActivity().getWindow().getDecorView();
|
|
146
|
-
int uiVisibility = decorView.getSystemUiVisibility();
|
|
147
|
-
|
|
148
|
-
if ((uiVisibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) {
|
|
149
|
-
this.safeAreaInsets.bottom(bottom);
|
|
150
|
-
} else {
|
|
151
|
-
this.safeAreaInsets.bottom(0);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
this.safeAreaInsets.top(top);
|
|
155
|
-
this.safeAreaInsets.right(left);
|
|
156
|
-
this.safeAreaInsets.left(right);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
1
|
+
package com.getcapacitor.community.plugins.safearea;
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint;
|
|
4
|
+
import android.graphics.Insets;
|
|
5
|
+
import android.os.Build;
|
|
6
|
+
import android.view.DisplayCutout;
|
|
7
|
+
import android.view.View;
|
|
8
|
+
import android.view.ViewGroup;
|
|
9
|
+
import android.view.WindowInsets;
|
|
10
|
+
import android.widget.FrameLayout;
|
|
11
|
+
|
|
12
|
+
import com.getcapacitor.JSObject;
|
|
13
|
+
import com.getcapacitor.Plugin;
|
|
14
|
+
import com.getcapacitor.PluginCall;
|
|
15
|
+
import com.getcapacitor.PluginMethod;
|
|
16
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
17
|
+
|
|
18
|
+
@CapacitorPlugin(name = "SafeArea")
|
|
19
|
+
public class SafeAreaPlugin extends Plugin {
|
|
20
|
+
private static final String KEY_INSET = "insets";
|
|
21
|
+
private static final String EVENT_ON_INSETS_CHANGED = "safeAreaPluginsInsetChange";
|
|
22
|
+
private SafeAreaInsets safeAreaInsets = new com.getcapacitor.community.plugins.safearea.SafeAreaInsets();
|
|
23
|
+
private SafeAreaView safeAreaView;
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public void load() {
|
|
27
|
+
this.getBridge().getActivity().runOnUiThread(() -> {
|
|
28
|
+
safeAreaView = new SafeAreaView(this.getBridge().getActivity(), (WindowInsets insets) -> {
|
|
29
|
+
this.getSafeArea(insets);
|
|
30
|
+
this.doNotify();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
FrameLayout.LayoutParams safeAreaPreviewParams = new FrameLayout.LayoutParams(
|
|
34
|
+
FrameLayout.LayoutParams.MATCH_PARENT,
|
|
35
|
+
FrameLayout.LayoutParams.MATCH_PARENT
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Set SafeAreaView as sibling View of WebView
|
|
39
|
+
((ViewGroup) this.getBridge().getWebView().getParent()).addView(safeAreaView, safeAreaPreviewParams);
|
|
40
|
+
|
|
41
|
+
// Bring the WebView in front of the SafeAreaView
|
|
42
|
+
this.getBridge().getWebView().bringToFront();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@PluginMethod
|
|
47
|
+
public void refresh(PluginCall call) {
|
|
48
|
+
this.doNotify();
|
|
49
|
+
call.success();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@PluginMethod
|
|
53
|
+
public void getSafeAreaInsets(PluginCall call) {
|
|
54
|
+
JSObject ret = new JSObject();
|
|
55
|
+
|
|
56
|
+
ret.put(SafeAreaPlugin.KEY_INSET, this.safeAreaInsets.toJSON());
|
|
57
|
+
|
|
58
|
+
call.success(ret);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
protected void getSafeArea(WindowInsets windowInsets) {
|
|
62
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
63
|
+
this.getSafeAreaR(windowInsets);
|
|
64
|
+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
65
|
+
this.getSafeAreaQ(windowInsets);
|
|
66
|
+
} else {
|
|
67
|
+
this.getSafeAreaLollipop(windowInsets);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Cutout
|
|
71
|
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
|
72
|
+
this.getSafeAreaCutout(windowInsets);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
float density = this.getBridge().getActivity().getResources().getDisplayMetrics().density;
|
|
76
|
+
|
|
77
|
+
this.applySafeAreaInsets(
|
|
78
|
+
Math.round(this.safeAreaInsets.top() / density),
|
|
79
|
+
Math.round(this.safeAreaInsets.bottom() / density),
|
|
80
|
+
Math.round(this.safeAreaInsets.left() / density),
|
|
81
|
+
Math.round(this.safeAreaInsets.right() / density)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// api level 30
|
|
86
|
+
// Get insets (Mandatory System Gestures: https://developer.android.com/reference/android/view/WindowInsets#getMandatorySystemGestureInsets())
|
|
87
|
+
@SuppressLint("NewApi")
|
|
88
|
+
protected void getSafeAreaR(WindowInsets windowInsets) {
|
|
89
|
+
Insets finalInsets = windowInsets.getInsets(WindowInsets.Type.mandatorySystemGestures());
|
|
90
|
+
|
|
91
|
+
this.applySafeAreaInsets(
|
|
92
|
+
finalInsets.top,
|
|
93
|
+
finalInsets.bottom,
|
|
94
|
+
finalInsets.left,
|
|
95
|
+
finalInsets.right
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// api level 29
|
|
100
|
+
@SuppressLint("NewApi")
|
|
101
|
+
protected void getSafeAreaQ(WindowInsets windowInsets) {
|
|
102
|
+
Insets finalInsets = windowInsets.getMandatorySystemGestureInsets();
|
|
103
|
+
|
|
104
|
+
this.applySafeAreaInsets(
|
|
105
|
+
finalInsets.top,
|
|
106
|
+
finalInsets.bottom,
|
|
107
|
+
finalInsets.left,
|
|
108
|
+
finalInsets.right
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// api level 21
|
|
113
|
+
protected void getSafeAreaLollipop(WindowInsets windowInsets) {
|
|
114
|
+
this.applySafeAreaInsets(
|
|
115
|
+
windowInsets.getSystemWindowInsetTop(),
|
|
116
|
+
windowInsets.getStableInsetBottom(),
|
|
117
|
+
windowInsets.getStableInsetLeft(),
|
|
118
|
+
windowInsets.getStableInsetRight()
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// cutout (api level >= 28)
|
|
123
|
+
@SuppressLint("NewApi")
|
|
124
|
+
protected void getSafeAreaCutout(WindowInsets windowInsets) {
|
|
125
|
+
DisplayCutout cutout = windowInsets.getDisplayCutout();
|
|
126
|
+
if (cutout != null) {
|
|
127
|
+
this.applySafeAreaInsets(
|
|
128
|
+
Math.max(this.safeAreaInsets.top(), cutout.getSafeInsetTop()),
|
|
129
|
+
Math.max(this.safeAreaInsets.bottom(), cutout.getSafeInsetBottom()),
|
|
130
|
+
Math.max(this.safeAreaInsets.left(), cutout.getSafeInsetLeft()),
|
|
131
|
+
Math.max(this.safeAreaInsets.right(), cutout.getSafeInsetRight())
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
protected void doNotify() {
|
|
137
|
+
JSObject ret = new JSObject();
|
|
138
|
+
|
|
139
|
+
ret.put(SafeAreaPlugin.KEY_INSET, this.safeAreaInsets.toJSON());
|
|
140
|
+
|
|
141
|
+
this.notifyListeners(SafeAreaPlugin.EVENT_ON_INSETS_CHANGED, ret);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private void applySafeAreaInsets(int top, int bottom, int left, int right) {
|
|
145
|
+
View decorView = this.getBridge().getActivity().getWindow().getDecorView();
|
|
146
|
+
int uiVisibility = decorView.getSystemUiVisibility();
|
|
147
|
+
|
|
148
|
+
if ((uiVisibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) {
|
|
149
|
+
this.safeAreaInsets.bottom(bottom);
|
|
150
|
+
} else {
|
|
151
|
+
this.safeAreaInsets.bottom(0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this.safeAreaInsets.top(top);
|
|
155
|
+
this.safeAreaInsets.right(left);
|
|
156
|
+
this.safeAreaInsets.left(right);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
package com.getcapacitor.community.plugins.safearea;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.util.AttributeSet;
|
|
5
|
-
import android.view.View;
|
|
6
|
-
import android.view.WindowInsets;
|
|
7
|
-
import java.util.function.Consumer;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* SafeArea View
|
|
11
|
-
* WindowInsets monitor
|
|
12
|
-
*/
|
|
13
|
-
public class SafeAreaView extends View {
|
|
14
|
-
private Consumer<WindowInsets> callbackInsets;
|
|
15
|
-
|
|
16
|
-
public SafeAreaView(Context context) {
|
|
17
|
-
super(context);
|
|
18
|
-
init(null, 0, null);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public SafeAreaView(Context context, Consumer<WindowInsets> onApplyInsets) {
|
|
22
|
-
super(context);
|
|
23
|
-
init(null, 0, onApplyInsets);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public SafeAreaView(Context context, AttributeSet attrs) {
|
|
27
|
-
super(context, attrs);
|
|
28
|
-
init(attrs, 0, null);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public SafeAreaView(Context context, AttributeSet attrs, int defStyle) {
|
|
32
|
-
super(context, attrs, defStyle);
|
|
33
|
-
init(attrs, defStyle, null);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private void init(AttributeSet attrs, int defStyle, Consumer<WindowInsets> onApplyInsets) {
|
|
37
|
-
if (onApplyInsets == null) {
|
|
38
|
-
this.callbackInsets = (WindowInsets wInsts) -> {};
|
|
39
|
-
} else {
|
|
40
|
-
this.callbackInsets = onApplyInsets;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@Override
|
|
45
|
-
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
|
46
|
-
this.callbackInsets.accept(insets);
|
|
47
|
-
return super.onApplyWindowInsets(insets);
|
|
48
|
-
}
|
|
1
|
+
package com.getcapacitor.community.plugins.safearea;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.util.AttributeSet;
|
|
5
|
+
import android.view.View;
|
|
6
|
+
import android.view.WindowInsets;
|
|
7
|
+
import java.util.function.Consumer;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* SafeArea View
|
|
11
|
+
* WindowInsets monitor
|
|
12
|
+
*/
|
|
13
|
+
public class SafeAreaView extends View {
|
|
14
|
+
private Consumer<WindowInsets> callbackInsets;
|
|
15
|
+
|
|
16
|
+
public SafeAreaView(Context context) {
|
|
17
|
+
super(context);
|
|
18
|
+
init(null, 0, null);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public SafeAreaView(Context context, Consumer<WindowInsets> onApplyInsets) {
|
|
22
|
+
super(context);
|
|
23
|
+
init(null, 0, onApplyInsets);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public SafeAreaView(Context context, AttributeSet attrs) {
|
|
27
|
+
super(context, attrs);
|
|
28
|
+
init(attrs, 0, null);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public SafeAreaView(Context context, AttributeSet attrs, int defStyle) {
|
|
32
|
+
super(context, attrs, defStyle);
|
|
33
|
+
init(attrs, defStyle, null);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private void init(AttributeSet attrs, int defStyle, Consumer<WindowInsets> onApplyInsets) {
|
|
37
|
+
if (onApplyInsets == null) {
|
|
38
|
+
this.callbackInsets = (WindowInsets wInsts) -> {};
|
|
39
|
+
} else {
|
|
40
|
+
this.callbackInsets = onApplyInsets;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
|
46
|
+
this.callbackInsets.accept(insets);
|
|
47
|
+
return super.onApplyWindowInsets(insets);
|
|
48
|
+
}
|
|
49
49
|
}
|
package/dist/docs.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "addListener",
|
|
32
|
-
"signature": "(eventName: 'safeAreaPluginsInsetChange', listener: SafeAreaInsetsChangedCallback) => PluginListenerHandle",
|
|
32
|
+
"signature": "(eventName: 'safeAreaPluginsInsetChange', listener: SafeAreaInsetsChangedCallback) => Promise<PluginListenerHandle>",
|
|
33
33
|
"parameters": [
|
|
34
34
|
{
|
|
35
35
|
"name": "eventName",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"type": "SafeAreaInsetsChangedCallback"
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
|
-
"returns": "PluginListenerHandle",
|
|
45
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
46
46
|
"tags": [],
|
|
47
47
|
"docs": "",
|
|
48
48
|
"complexTypes": [
|
|
49
49
|
"PluginListenerHandle",
|
|
50
50
|
"SafeAreaInsetsChangedCallback"
|
|
51
51
|
],
|
|
52
|
-
"slug": "addlistenersafeareapluginsinsetchange"
|
|
52
|
+
"slug": "addlistenersafeareapluginsinsetchange-"
|
|
53
53
|
}
|
|
54
54
|
],
|
|
55
55
|
"properties": []
|
package/dist/esm/controller.js
CHANGED
|
@@ -14,7 +14,7 @@ export class SafeAreaController {
|
|
|
14
14
|
async load() {
|
|
15
15
|
var _a;
|
|
16
16
|
await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());
|
|
17
|
-
this.callback = this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
17
|
+
this.callback = await this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
18
18
|
this.updateInsets(result.insets);
|
|
19
19
|
this.injectCSSVariables();
|
|
20
20
|
this.notifyListeners();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,MAAM,OAAO,kBAAkB;IAU7B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QARnD,WAAM,GAAmB;YAC/B,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;SACR,CAAC;QAIA,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;;QACR,MAAM,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,EAAE,CAAA,CAAC;QAE9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,MAA4B,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,MAAM,OAAO,kBAAkB;IAU7B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QARnD,WAAM,GAAmB;YAC/B,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;SACR,CAAC;QAIA,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAA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AAE,oBAAoB,KAAK,yBAAyB,KAAK,IAAI,CAAC,CAAC;qBACvK;oBAAC,MAAM;gBACR;oBAAS;wBACP,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,qBAAqB,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;qBACjF;oBAAC,MAAM;aACT;SACF;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;QAE7D,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,MAAM;;QACJ,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEO,YAAY,CAAC,MAAsB;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAAA,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { PluginListenerHandle } from '@capacitor/core';
|
|
|
2
2
|
export interface SafeAreaPlugin {
|
|
3
3
|
refresh(): Promise<void>;
|
|
4
4
|
getSafeAreaInsets(): Promise<SafeAreaInsetsResult>;
|
|
5
|
-
addListener(eventName: 'safeAreaPluginsInsetChange', listener: SafeAreaInsetsChangedCallback): PluginListenerHandle
|
|
5
|
+
addListener(eventName: 'safeAreaPluginsInsetChange', listener: SafeAreaInsetsChangedCallback): Promise<PluginListenerHandle>;
|
|
6
6
|
}
|
|
7
7
|
export interface SafeAreaInsets {
|
|
8
8
|
top: number;
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -19,7 +19,7 @@ class SafeAreaController {
|
|
|
19
19
|
async load() {
|
|
20
20
|
var _a;
|
|
21
21
|
await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());
|
|
22
|
-
this.callback = this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
22
|
+
this.callback = await this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
23
23
|
this.updateInsets(result.insets);
|
|
24
24
|
this.injectCSSVariables();
|
|
25
25
|
this.notifyListeners();
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/controller.js","esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["import { Capacitor } from '@capacitor/core';\nexport class SafeAreaController {\n constructor(safeAreaPlugin) {\n this.safeAreaPlugin = safeAreaPlugin;\n this.insets = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.callback = undefined;\n this.listeners = [];\n }\n async load() {\n var _a;\n await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());\n this.callback = this.safeAreaPlugin.addListener(\"safeAreaPluginsInsetChange\", (result) => {\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n });\n await this.refresh();\n }\n addListener(listener) {\n this.listeners.push(listener);\n }\n removeListener(listener) {\n const index = this.listeners.indexOf(listener);\n if (index >= 0)\n delete this.listeners[index];\n }\n removeAllListeners() {\n this.listeners.length = 0;\n }\n injectCSSVariables() {\n for (const inset in this.insets) {\n switch (Capacitor.getPlatform()) {\n case \"android\":\n case \"ios\":\n {\n document.documentElement.style.setProperty(`--${Capacitor.getPlatform()}-safe-area-inset-${inset}`, `${this.insets[inset]}px`);\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, `var(--${Capacitor.getPlatform()}-safe-area-inset-${inset}, env(safe-area-inset-${inset}))`);\n }\n break;\n default:\n {\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, \"0px\");\n }\n break;\n }\n }\n }\n async refresh() {\n const result = await this.safeAreaPlugin.getSafeAreaInsets();\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n }\n getInsets() {\n return this.insets;\n }\n unload() {\n var _a;\n (_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove();\n }\n notifyListeners() {\n this.listeners.forEach((listener) => listener({ insets: this.insets }));\n }\n updateInsets(insets) {\n this.insets = insets;\n }\n}\n;\n//# sourceMappingURL=controller.js.map",";\nexport const SafeAreaInsetsChangeEventName = \"safeAreaPluginsInsetChange\";\n//# sourceMappingURL=definitions.js.map","import { WebPlugin } from '@capacitor/core';\nimport { SafeAreaInsetsChangeEventName } from './definitions';\nexport class SafeAreaWeb extends WebPlugin {\n /**\n * Call this whenever you want the EventOnInsetsChanged to be fired manually.\n */\n async refresh() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.notifyListeners(SafeAreaInsetsChangeEventName, {\n insets: dummy\n });\n }\n /**\n * Gets the current SafeAreaInsets.\n */\n getSafeAreaInsets() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0,\n };\n return new Promise((resolve) => {\n resolve({ insets: dummy });\n });\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { SafeAreaController } from './controller';\nconst SafeArea = registerPlugin('SafeArea', {\n web: () => import('./web').then(m => new m.SafeAreaWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nconst controller = new SafeAreaController(SafeArea);\nexport { controller as SafeAreaController };\n//# sourceMappingURL=index.js.map"],"names":["Capacitor","WebPlugin","registerPlugin"],"mappings":";;;;;;AACO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,CAAC,cAAc,EAAE;AAChC,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AAC7C,QAAQ,IAAI,CAAC,MAAM,GAAG;AACtB,YAAY,GAAG,EAAE,CAAC;AAClB,YAAY,MAAM,EAAE,CAAC;AACrB,YAAY,KAAK,EAAE,CAAC;AACpB,YAAY,IAAI,EAAE,CAAC;AACnB,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;AAClC,QAAQ,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;AAC5B,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,EAAE,CAAC;AACf,QAAQ,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACtF,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/controller.js","esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["import { Capacitor } from '@capacitor/core';\nexport class SafeAreaController {\n constructor(safeAreaPlugin) {\n this.safeAreaPlugin = safeAreaPlugin;\n this.insets = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.callback = undefined;\n this.listeners = [];\n }\n async load() {\n var _a;\n await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());\n this.callback = await this.safeAreaPlugin.addListener(\"safeAreaPluginsInsetChange\", (result) => {\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n });\n await this.refresh();\n }\n addListener(listener) {\n this.listeners.push(listener);\n }\n removeListener(listener) {\n const index = this.listeners.indexOf(listener);\n if (index >= 0)\n delete this.listeners[index];\n }\n removeAllListeners() {\n this.listeners.length = 0;\n }\n injectCSSVariables() {\n for (const inset in this.insets) {\n switch (Capacitor.getPlatform()) {\n case \"android\":\n case \"ios\":\n {\n document.documentElement.style.setProperty(`--${Capacitor.getPlatform()}-safe-area-inset-${inset}`, `${this.insets[inset]}px`);\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, `var(--${Capacitor.getPlatform()}-safe-area-inset-${inset}, env(safe-area-inset-${inset}))`);\n }\n break;\n default:\n {\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, \"0px\");\n }\n break;\n }\n }\n }\n async refresh() {\n const result = await this.safeAreaPlugin.getSafeAreaInsets();\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n }\n getInsets() {\n return this.insets;\n }\n unload() {\n var _a;\n (_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove();\n }\n notifyListeners() {\n this.listeners.forEach((listener) => listener({ insets: this.insets }));\n }\n updateInsets(insets) {\n this.insets = insets;\n }\n}\n;\n//# sourceMappingURL=controller.js.map",";\nexport const SafeAreaInsetsChangeEventName = \"safeAreaPluginsInsetChange\";\n//# sourceMappingURL=definitions.js.map","import { WebPlugin } from '@capacitor/core';\nimport { SafeAreaInsetsChangeEventName } from './definitions';\nexport class SafeAreaWeb extends WebPlugin {\n /**\n * Call this whenever you want the EventOnInsetsChanged to be fired manually.\n */\n async refresh() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.notifyListeners(SafeAreaInsetsChangeEventName, {\n insets: dummy\n });\n }\n /**\n * Gets the current SafeAreaInsets.\n */\n getSafeAreaInsets() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0,\n };\n return new Promise((resolve) => {\n resolve({ insets: dummy });\n });\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { SafeAreaController } from './controller';\nconst SafeArea = registerPlugin('SafeArea', {\n web: () => import('./web').then(m => new m.SafeAreaWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nconst controller = new SafeAreaController(SafeArea);\nexport { controller as SafeAreaController };\n//# sourceM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GAAG;AACxB,QAAQ,MAAM,KAAK,GAAG;AACtB,YAAY,GAAG,EAAE,CAAC;AAClB,YAAY,MAAM,EAAE,CAAC;AACrB,YAAY,KAAK,EAAE,CAAC;AACpB,YAAY,IAAI,EAAE,CAAC;AACnB,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK;AACxC,YAAY,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACvC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;AC7BA,MAAM,QAAQ,GAAGC,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7D,CAAC,CAAC,CAAC;AAGE,MAAC,UAAU,GAAG,IAAI,kBAAkB,CAAC,QAAQ;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -16,7 +16,7 @@ var capacitorSafeArea = (function (exports, core) {
|
|
|
16
16
|
async load() {
|
|
17
17
|
var _a;
|
|
18
18
|
await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());
|
|
19
|
-
this.callback = this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
19
|
+
this.callback = await this.safeAreaPlugin.addListener("safeAreaPluginsInsetChange", (result) => {
|
|
20
20
|
this.updateInsets(result.insets);
|
|
21
21
|
this.injectCSSVariables();
|
|
22
22
|
this.notifyListeners();
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/controller.js","esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["import { Capacitor } from '@capacitor/core';\nexport class SafeAreaController {\n constructor(safeAreaPlugin) {\n this.safeAreaPlugin = safeAreaPlugin;\n this.insets = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.callback = undefined;\n this.listeners = [];\n }\n async load() {\n var _a;\n await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());\n this.callback = this.safeAreaPlugin.addListener(\"safeAreaPluginsInsetChange\", (result) => {\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n });\n await this.refresh();\n }\n addListener(listener) {\n this.listeners.push(listener);\n }\n removeListener(listener) {\n const index = this.listeners.indexOf(listener);\n if (index >= 0)\n delete this.listeners[index];\n }\n removeAllListeners() {\n this.listeners.length = 0;\n }\n injectCSSVariables() {\n for (const inset in this.insets) {\n switch (Capacitor.getPlatform()) {\n case \"android\":\n case \"ios\":\n {\n document.documentElement.style.setProperty(`--${Capacitor.getPlatform()}-safe-area-inset-${inset}`, `${this.insets[inset]}px`);\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, `var(--${Capacitor.getPlatform()}-safe-area-inset-${inset}, env(safe-area-inset-${inset}))`);\n }\n break;\n default:\n {\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, \"0px\");\n }\n break;\n }\n }\n }\n async refresh() {\n const result = await this.safeAreaPlugin.getSafeAreaInsets();\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n }\n getInsets() {\n return this.insets;\n }\n unload() {\n var _a;\n (_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove();\n }\n notifyListeners() {\n this.listeners.forEach((listener) => listener({ insets: this.insets }));\n }\n updateInsets(insets) {\n this.insets = insets;\n }\n}\n;\n//# sourceMappingURL=controller.js.map",";\nexport const SafeAreaInsetsChangeEventName = \"safeAreaPluginsInsetChange\";\n//# sourceMappingURL=definitions.js.map","import { WebPlugin } from '@capacitor/core';\nimport { SafeAreaInsetsChangeEventName } from './definitions';\nexport class SafeAreaWeb extends WebPlugin {\n /**\n * Call this whenever you want the EventOnInsetsChanged to be fired manually.\n */\n async refresh() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.notifyListeners(SafeAreaInsetsChangeEventName, {\n insets: dummy\n });\n }\n /**\n * Gets the current SafeAreaInsets.\n */\n getSafeAreaInsets() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0,\n };\n return new Promise((resolve) => {\n resolve({ insets: dummy });\n });\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { SafeAreaController } from './controller';\nconst SafeArea = registerPlugin('SafeArea', {\n web: () => import('./web').then(m => new m.SafeAreaWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nconst controller = new SafeAreaController(SafeArea);\nexport { controller as SafeAreaController };\n//# sourceMappingURL=index.js.map"],"names":["Capacitor","WebPlugin","registerPlugin"],"mappings":";;;IACO,MAAM,kBAAkB,CAAC;IAChC,IAAI,WAAW,CAAC,cAAc,EAAE;IAChC,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IAC7C,QAAQ,IAAI,CAAC,MAAM,GAAG;IACtB,YAAY,GAAG,EAAE,CAAC;IAClB,YAAY,MAAM,EAAE,CAAC;IACrB,YAAY,KAAK,EAAE,CAAC;IACpB,YAAY,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC;IACV,QAAQ,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IAC5B,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,EAAE,CAAC;IACf,QAAQ,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/controller.js","esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["import { Capacitor } from '@capacitor/core';\nexport class SafeAreaController {\n constructor(safeAreaPlugin) {\n this.safeAreaPlugin = safeAreaPlugin;\n this.insets = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.callback = undefined;\n this.listeners = [];\n }\n async load() {\n var _a;\n await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove());\n this.callback = await this.safeAreaPlugin.addListener(\"safeAreaPluginsInsetChange\", (result) => {\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n });\n await this.refresh();\n }\n addListener(listener) {\n this.listeners.push(listener);\n }\n removeListener(listener) {\n const index = this.listeners.indexOf(listener);\n if (index >= 0)\n delete this.listeners[index];\n }\n removeAllListeners() {\n this.listeners.length = 0;\n }\n injectCSSVariables() {\n for (const inset in this.insets) {\n switch (Capacitor.getPlatform()) {\n case \"android\":\n case \"ios\":\n {\n document.documentElement.style.setProperty(`--${Capacitor.getPlatform()}-safe-area-inset-${inset}`, `${this.insets[inset]}px`);\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, `var(--${Capacitor.getPlatform()}-safe-area-inset-${inset}, env(safe-area-inset-${inset}))`);\n }\n break;\n default:\n {\n document.documentElement.style.setProperty(`--safe-area-inset-${inset}`, \"0px\");\n }\n break;\n }\n }\n }\n async refresh() {\n const result = await this.safeAreaPlugin.getSafeAreaInsets();\n this.updateInsets(result.insets);\n this.injectCSSVariables();\n this.notifyListeners();\n }\n getInsets() {\n return this.insets;\n }\n unload() {\n var _a;\n (_a = this.callback) === null || _a === void 0 ? void 0 : _a.remove();\n }\n notifyListeners() {\n this.listeners.forEach((listener) => listener({ insets: this.insets }));\n }\n updateInsets(insets) {\n this.insets = insets;\n }\n}\n;\n//# sourceMappingURL=controller.js.map",";\nexport const SafeAreaInsetsChangeEventName = \"safeAreaPluginsInsetChange\";\n//# sourceMappingURL=definitions.js.map","import { WebPlugin } from '@capacitor/core';\nimport { SafeAreaInsetsChangeEventName } from './definitions';\nexport class SafeAreaWeb extends WebPlugin {\n /**\n * Call this whenever you want the EventOnInsetsChanged to be fired manually.\n */\n async refresh() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n this.notifyListeners(SafeAreaInsetsChangeEventName, {\n insets: dummy\n });\n }\n /**\n * Gets the current SafeAreaInsets.\n */\n getSafeAreaInsets() {\n const dummy = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0,\n };\n return new Promise((resolve) => {\n resolve({ insets: dummy });\n });\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { SafeAreaController } from './controller';\nconst SafeArea = registerPlugin('SafeArea', {\n web: () => import('./web').then(m => new m.SafeAreaWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nconst controller = new SafeAreaController(SafeArea);\nexport { controller as SafeAreaController };\n//# sourceMappingURL=index.js.map"],"names":["Capacitor","WebPlugin","registerPlugin"],"mappings":";;;IACO,MAAM,kBAAkB,CAAC;IAChC,IAAI,WAAW,CAAC,cAAc,EAAE;IAChC,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IAC7C,QAAQ,IAAI,CAAC,MAAM,GAAG;IACtB,YAAY,GAAG,EAAE,CAAC;IAClB,YAAY,MAAM,EAAE,CAAC;IACrB,YAAY,KAAK,EAAE,CAAC;IACpB,YAAY,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC;IACV,QAAQ,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IAC5B,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,EAAE,CAAC;IACf,QAAQ,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,QAAQ,IAAI,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",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12-beta.0",
|
|
4
4
|
"description": "A plugin to expose the safe area insets from the native iOS/Android device to your web project.",
|
|
5
5
|
"author": "Kevin Pacheco",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@capacitor/android": "^
|
|
48
|
-
"@capacitor/core": "^
|
|
47
|
+
"@capacitor/android": "^6.1.0",
|
|
48
|
+
"@capacitor/core": "^6.1.0",
|
|
49
49
|
"@capacitor/docgen": "^0.2.1",
|
|
50
|
-
"@capacitor/ios": "^
|
|
51
|
-
"@ionic/eslint-config": "^0.
|
|
50
|
+
"@capacitor/ios": "^6.1.0",
|
|
51
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
52
52
|
"@ionic/prettier-config": "^3.1.0",
|
|
53
53
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
54
|
-
"eslint": "^8.
|
|
54
|
+
"eslint": "^8.57.0",
|
|
55
55
|
"prettier": "~3.0.0",
|
|
56
56
|
"prettier-plugin-java": "~2.2.0",
|
|
57
57
|
"rimraf": "^4.4.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"typescript": "~5.0.2"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@capacitor/core": "^
|
|
63
|
+
"@capacitor/core": "^6.1.0"
|
|
64
64
|
},
|
|
65
65
|
"prettier": "@ionic/prettier-config",
|
|
66
66
|
"swiftlint": "@ionic/swiftlint-config",
|