@capgo/capacitor-home-indicator 7.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,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 = 'CapgoHomeIndicator'
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/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapgoHomeIndicator",
6
+ platforms: [.iOS(.v14)],
7
+ products: [
8
+ .library(
9
+ name: "CapgoHomeIndicator",
10
+ targets: ["CapgoHomeIndicatorPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "CapgoHomeIndicatorPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/CapgoHomeIndicatorPlugin"),
23
+ .testTarget(
24
+ name: "CapgoHomeIndicatorPluginTests",
25
+ dependencies: ["CapgoHomeIndicatorPlugin"],
26
+ path: "ios/Tests/CapgoHomeIndicatorPluginTests")
27
+ ]
28
+ )
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @capgo/home-indicator
2
+ <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
3
+
4
+ <div align="center">
5
+ <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
+ <h2><a href="https://capgo.app/consulting/?ref=plugin"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
7
+ </div>
8
+
9
+ hide and show home button indicator in Capacitor app
10
+
11
+ # Android
12
+
13
+ To be able to hide the home indicator on Android, you need to
14
+ update your `MainActivity.java` file to add the following code:
15
+
16
+ ```java
17
+ // ...
18
+
19
+ import android.os.Build;
20
+ import android.os.Bundle;
21
+
22
+ import com.getcapacitor.BridgeActivity;
23
+
24
+ public class MainActivity extends BridgeActivity {
25
+
26
+
27
+ void fixSafeArea() {
28
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
29
+ getWindow().setDecorFitsSystemWindows(false);
30
+ }
31
+ }
32
+
33
+ @Override
34
+ protected void onCreate(Bundle savedInstanceState) {
35
+ super.onCreate(savedInstanceState);
36
+ fixSafeArea();
37
+ }
38
+ // on resume
39
+ @Override
40
+ public void onResume() {
41
+ super.onResume();
42
+ fixSafeArea();
43
+ }
44
+
45
+ // on pause
46
+ @Override
47
+ public void onPause() {
48
+ super.onPause();
49
+ fixSafeArea();
50
+ }
51
+ }
52
+ ```
53
+
54
+ And the update styles.xml to add the following code:
55
+
56
+ ```xml
57
+ <item name="android:statusBarColor">
58
+ @android:color/transparent
59
+ </item>
60
+ ```
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ npm install @capgo/home-indicator
66
+ npx cap sync
67
+ ```
68
+
69
+ ## API
70
+
71
+ <docgen-index>
72
+
73
+ * [`hide()`](#hide)
74
+ * [`show()`](#show)
75
+ * [`isHidden()`](#ishidden)
76
+ * [`getPluginVersion()`](#getpluginversion)
77
+
78
+ </docgen-index>
79
+
80
+ <docgen-api>
81
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
82
+
83
+ ### hide()
84
+
85
+ ```typescript
86
+ hide() => Promise<void>
87
+ ```
88
+
89
+ Hide the home indicator.
90
+
91
+ **Since:** 0.0.1
92
+
93
+ --------------------
94
+
95
+
96
+ ### show()
97
+
98
+ ```typescript
99
+ show() => Promise<void>
100
+ ```
101
+
102
+ Show the home indicator.
103
+
104
+ **Since:** 0.0.1
105
+
106
+ --------------------
107
+
108
+
109
+ ### isHidden()
110
+
111
+ ```typescript
112
+ isHidden() => Promise<{ hidden: boolean; }>
113
+ ```
114
+
115
+ Get the home indicator status.
116
+
117
+ **Returns:** <code>Promise&lt;{ hidden: boolean; }&gt;</code>
118
+
119
+ **Since:** 0.0.1
120
+
121
+ --------------------
122
+
123
+
124
+ ### getPluginVersion()
125
+
126
+ ```typescript
127
+ getPluginVersion() => Promise<{ version: string; }>
128
+ ```
129
+
130
+ Get the native Capacitor plugin version
131
+
132
+ **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
133
+
134
+ --------------------
135
+
136
+ </docgen-api>
137
+
138
+ ### CSS Variables
139
+
140
+ You can use `--safe-area-inset-bottom` to make sure your content is not hidden by the home indicator
141
+ This variable is injected by the plugin for android.
142
+ It's useful if you set real fullscreen mode on android.
143
+ with :
144
+ ```java
145
+ getWindow().setDecorFitsSystemWindows(false);
146
+ ```
147
+
148
+
149
+ # Credits
150
+
151
+ This plugin was created originally for [Kick.com](https://kick.com) by [Capgo](https://capgo.app)
@@ -0,0 +1,58 @@
1
+ ext {
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'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.7.3'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace "ee.forgr.home_indicator"
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
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_21
41
+ targetCompatibility JavaVersion.VERSION_21
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
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,175 @@
1
+ package ee.forgr.home_indicator;
2
+
3
+ import android.content.res.Configuration;
4
+ import android.os.Build;
5
+ import android.os.Handler;
6
+ import android.util.Log;
7
+ import android.view.OrientationEventListener;
8
+ import android.view.View;
9
+ import android.view.WindowInsets;
10
+ import com.getcapacitor.JSObject;
11
+ import com.getcapacitor.Plugin;
12
+ import com.getcapacitor.PluginCall;
13
+ import com.getcapacitor.PluginMethod;
14
+ import com.getcapacitor.annotation.CapacitorPlugin;
15
+
16
+ @CapacitorPlugin(name = "HomeIndicator")
17
+ public class HomeIndicatorPlugin extends Plugin {
18
+
19
+ public final String PLUGIN_VERSION = "7.1.1";
20
+ private OrientationEventListener orientationEventListener;
21
+ private int previousOrientation = Configuration.ORIENTATION_UNDEFINED;
22
+
23
+ public void UiChangeListener() {
24
+ final View decorView = this.getBridge().getActivity().getWindow().getDecorView();
25
+ decorView.setOnSystemUiVisibilityChangeListener(
26
+ new View.OnSystemUiVisibilityChangeListener() {
27
+ @Override
28
+ public void onSystemUiVisibilityChange(int visibility) {
29
+ Log.i("HomeIndicator", "onSystemUiVisibilityChange");
30
+ HomeIndicatorPlugin.this.setCssVar();
31
+ }
32
+ }
33
+ );
34
+ }
35
+
36
+ private void setCssVar() {
37
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
38
+ WindowInsets windowInsets = this.getBridge().getActivity().getWindow().getDecorView().getRootWindowInsets();
39
+ if (windowInsets == null) {
40
+ return;
41
+ }
42
+ var res = windowInsets.getInsets(WindowInsets.Type.systemBars());
43
+ float density = this.getBridge().getActivity().getResources().getDisplayMetrics().density;
44
+ getBridge()
45
+ .getWebView()
46
+ .evaluateJavascript(
47
+ "document.documentElement.style.setProperty('--safe-area-inset-bottom', '" + res.bottom / density + "px');",
48
+ null
49
+ );
50
+ getBridge()
51
+ .getWebView()
52
+ .evaluateJavascript(
53
+ "document.documentElement.style.setProperty('--safe-area-inset-top', '" + res.top / density + "px');",
54
+ null
55
+ );
56
+ getBridge()
57
+ .getWebView()
58
+ .evaluateJavascript(
59
+ "document.documentElement.style.setProperty('--safe-area-inset-right', '" + res.right / density + "px');",
60
+ null
61
+ );
62
+ getBridge()
63
+ .getWebView()
64
+ .evaluateJavascript(
65
+ "document.documentElement.style.setProperty('--safe-area-inset-left', '" + res.left / density + "px');",
66
+ null
67
+ );
68
+ }
69
+ }
70
+
71
+ @PluginMethod
72
+ public void getPluginVersion(final PluginCall call) {
73
+ try {
74
+ final JSObject ret = new JSObject();
75
+ ret.put("version", this.PLUGIN_VERSION);
76
+ call.resolve(ret);
77
+ } catch (final Exception e) {
78
+ call.reject("Could not get plugin version", e);
79
+ }
80
+ }
81
+
82
+ @Override
83
+ public void load() {
84
+ super.load();
85
+ this.UiChangeListener();
86
+ getActivity().runOnUiThread(
87
+ new Runnable() {
88
+ @Override
89
+ public void run() {
90
+ // Don't set any UI visibility flags on load - let the app control this
91
+ HomeIndicatorPlugin.this.setCssVar();
92
+ }
93
+ }
94
+ );
95
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
96
+ // start task after 500ms in android
97
+ new Handler().postDelayed(
98
+ new Runnable() {
99
+ @Override
100
+ public void run() {
101
+ HomeIndicatorPlugin.this.setCssVar();
102
+ }
103
+ },
104
+ 1000
105
+ );
106
+ }
107
+ // Add orientation change listener
108
+ orientationEventListener = new OrientationEventListener(getContext()) {
109
+ @Override
110
+ public void onOrientationChanged(int orientation) {
111
+ int currentOrientation = HomeIndicatorPlugin.this.bridge.getActivity().getResources().getConfiguration().orientation;
112
+ if (currentOrientation != previousOrientation) {
113
+ previousOrientation = currentOrientation;
114
+ Log.i("HomeIndicator", "onOrientationChanged " + currentOrientation);
115
+ HomeIndicatorPlugin.this.setCssVar();
116
+ }
117
+ HomeIndicatorPlugin.this.setCssVar();
118
+ }
119
+ };
120
+ orientationEventListener.enable();
121
+ }
122
+
123
+ @PluginMethod
124
+ public void hide(PluginCall call) {
125
+ getActivity().runOnUiThread(
126
+ new Runnable() {
127
+ @Override
128
+ public void run() {
129
+ View decorView = getActivity().getWindow().getDecorView();
130
+ int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
131
+ decorView.setSystemUiVisibility(uiOptions);
132
+ HomeIndicatorPlugin.this.setCssVar();
133
+ JSObject ret = new JSObject();
134
+ call.resolve(ret);
135
+ }
136
+ }
137
+ );
138
+ }
139
+
140
+ @PluginMethod
141
+ public void show(PluginCall call) {
142
+ getActivity().runOnUiThread(
143
+ new Runnable() {
144
+ @Override
145
+ public void run() {
146
+ View decorView = getActivity().getWindow().getDecorView();
147
+ // Get current flags and remove only the navigation-related ones
148
+ int currentFlags = decorView.getSystemUiVisibility();
149
+ int newFlags = currentFlags & ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
150
+ decorView.setSystemUiVisibility(newFlags);
151
+ HomeIndicatorPlugin.this.setCssVar();
152
+ JSObject ret = new JSObject();
153
+ call.resolve(ret);
154
+ }
155
+ }
156
+ );
157
+ }
158
+
159
+ @PluginMethod
160
+ public void isHidden(PluginCall call) {
161
+ getActivity().runOnUiThread(
162
+ new Runnable() {
163
+ @Override
164
+ public void run() {
165
+ View decorView = getActivity().getWindow().getDecorView();
166
+ int uiOptions = decorView.getSystemUiVisibility();
167
+ HomeIndicatorPlugin.this.setCssVar();
168
+ JSObject ret = new JSObject();
169
+ ret.put("hidden", (uiOptions & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
170
+ call.resolve(ret);
171
+ }
172
+ }
173
+ );
174
+ }
175
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "api": {
3
+ "name": "HomeIndicatorPlugin",
4
+ "slug": "homeindicatorplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "hide",
10
+ "signature": "() => Promise<void>",
11
+ "parameters": [],
12
+ "returns": "Promise<void>",
13
+ "tags": [
14
+ {
15
+ "name": "since",
16
+ "text": "0.0.1"
17
+ },
18
+ {
19
+ "name": "return"
20
+ }
21
+ ],
22
+ "docs": "Hide the home indicator.",
23
+ "complexTypes": [],
24
+ "slug": "hide"
25
+ },
26
+ {
27
+ "name": "show",
28
+ "signature": "() => Promise<void>",
29
+ "parameters": [],
30
+ "returns": "Promise<void>",
31
+ "tags": [
32
+ {
33
+ "name": "since",
34
+ "text": "0.0.1"
35
+ },
36
+ {
37
+ "name": "return"
38
+ }
39
+ ],
40
+ "docs": "Show the home indicator.",
41
+ "complexTypes": [],
42
+ "slug": "show"
43
+ },
44
+ {
45
+ "name": "isHidden",
46
+ "signature": "() => Promise<{ hidden: boolean; }>",
47
+ "parameters": [],
48
+ "returns": "Promise<{ hidden: boolean; }>",
49
+ "tags": [
50
+ {
51
+ "name": "since",
52
+ "text": "0.0.1"
53
+ },
54
+ {
55
+ "name": "return"
56
+ }
57
+ ],
58
+ "docs": "Get the home indicator status.",
59
+ "complexTypes": [],
60
+ "slug": "ishidden"
61
+ },
62
+ {
63
+ "name": "getPluginVersion",
64
+ "signature": "() => Promise<{ version: string; }>",
65
+ "parameters": [],
66
+ "returns": "Promise<{ version: string; }>",
67
+ "tags": [
68
+ {
69
+ "name": "returns",
70
+ "text": "an Promise with version for this device"
71
+ },
72
+ {
73
+ "name": "throws",
74
+ "text": "An error if the something went wrong"
75
+ }
76
+ ],
77
+ "docs": "Get the native Capacitor plugin version",
78
+ "complexTypes": [],
79
+ "slug": "getpluginversion"
80
+ }
81
+ ],
82
+ "properties": []
83
+ },
84
+ "interfaces": [],
85
+ "enums": [],
86
+ "typeAliases": [],
87
+ "pluginConfigs": []
88
+ }
@@ -0,0 +1,34 @@
1
+ export interface HomeIndicatorPlugin {
2
+ /**
3
+ * Hide the home indicator.
4
+ *
5
+ * @since 0.0.1
6
+ * @return {Promise<void>}
7
+ */
8
+ hide(): Promise<void>;
9
+ /**
10
+ * Show the home indicator.
11
+ *
12
+ * @since 0.0.1
13
+ * @return {Promise<void>}
14
+ */
15
+ show(): Promise<void>;
16
+ /**
17
+ * Get the home indicator status.
18
+ *
19
+ * @since 0.0.1
20
+ * @return {Promise<{hidden: boolean}>}
21
+ */
22
+ isHidden(): Promise<{
23
+ hidden: boolean;
24
+ }>;
25
+ /**
26
+ * Get the native Capacitor plugin version
27
+ *
28
+ * @returns {Promise<{ id: string }>} an Promise with version for this device
29
+ * @throws An error if the something went wrong
30
+ */
31
+ getPluginVersion(): Promise<{
32
+ version: string;
33
+ }>;
34
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface HomeIndicatorPlugin {\n /**\n * Hide the home indicator.\n *\n * @since 0.0.1\n * @return {Promise<void>}\n */\n hide(): Promise<void>;\n /**\n * Show the home indicator.\n *\n * @since 0.0.1\n * @return {Promise<void>}\n */\n show(): Promise<void>;\n /**\n * Get the home indicator status.\n *\n * @since 0.0.1\n * @return {Promise<{hidden: boolean}>}\n */\n isHidden(): Promise<{ hidden: boolean }>;\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { HomeIndicatorPlugin } from './definitions';
2
+ declare const HomeIndicator: HomeIndicatorPlugin;
3
+ export * from './definitions';
4
+ export { HomeIndicator };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const HomeIndicator = registerPlugin('HomeIndicator', {
3
+ web: () => import('./web').then((m) => new m.HomeIndicatorWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { HomeIndicator };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CACjE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HomeIndicatorPlugin } from './definitions';\n\nconst HomeIndicator = registerPlugin<HomeIndicatorPlugin>('HomeIndicator', {\n web: () => import('./web').then((m) => new m.HomeIndicatorWeb()),\n});\n\nexport * from './definitions';\nexport { HomeIndicator };\n"]}
@@ -0,0 +1,12 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { HomeIndicatorPlugin } from './definitions';
3
+ export declare class HomeIndicatorWeb extends WebPlugin implements HomeIndicatorPlugin {
4
+ hide(): Promise<void>;
5
+ show(): Promise<void>;
6
+ isHidden(): Promise<{
7
+ hidden: boolean;
8
+ }>;
9
+ getPluginVersion(): Promise<{
10
+ version: string;
11
+ }>;
12
+ }
@@ -0,0 +1,21 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class HomeIndicatorWeb extends WebPlugin {
3
+ async hide() {
4
+ this.unimplemented('Not implemented on web.');
5
+ console.log('hide');
6
+ }
7
+ async show() {
8
+ this.unimplemented('Not implemented on web.');
9
+ console.log('show');
10
+ }
11
+ async isHidden() {
12
+ this.unimplemented('Not implemented on web.');
13
+ console.log('getStatus');
14
+ return { hidden: true };
15
+ }
16
+ async getPluginVersion() {
17
+ console.warn('Cannot get plugin version in web');
18
+ return { version: 'default' };
19
+ }
20
+ }
21
+ //# sourceMappingURL=web.js.map
@@ -0,0 +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,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { HomeIndicatorPlugin } from './definitions';\n\nexport class HomeIndicatorWeb extends WebPlugin implements HomeIndicatorPlugin {\n async hide(): Promise<void> {\n this.unimplemented('Not implemented on web.');\n console.log('hide');\n }\n async show(): Promise<void> {\n this.unimplemented('Not implemented on web.');\n console.log('show');\n }\n async isHidden(): Promise<{ hidden: boolean }> {\n this.unimplemented('Not implemented on web.');\n console.log('getStatus');\n return { hidden: true };\n }\n async getPluginVersion(): Promise<{ version: string }> {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const HomeIndicator = core.registerPlugin('HomeIndicator', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.HomeIndicatorWeb()),
7
+ });
8
+
9
+ class HomeIndicatorWeb extends core.WebPlugin {
10
+ async hide() {
11
+ this.unimplemented('Not implemented on web.');
12
+ console.log('hide');
13
+ }
14
+ async show() {
15
+ this.unimplemented('Not implemented on web.');
16
+ console.log('show');
17
+ }
18
+ async isHidden() {
19
+ this.unimplemented('Not implemented on web.');
20
+ console.log('getStatus');
21
+ return { hidden: true };
22
+ }
23
+ async getPluginVersion() {
24
+ console.warn('Cannot get plugin version in web');
25
+ return { version: 'default' };
26
+ }
27
+ }
28
+
29
+ var web = /*#__PURE__*/Object.freeze({
30
+ __proto__: null,
31
+ HomeIndicatorWeb: HomeIndicatorWeb
32
+ });
33
+
34
+ exports.HomeIndicator = HomeIndicator;
35
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HomeIndicator = registerPlugin('HomeIndicator', {\n web: () => import('./web').then((m) => new m.HomeIndicatorWeb()),\n});\nexport * from './definitions';\nexport { HomeIndicator };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class HomeIndicatorWeb extends WebPlugin {\n async hide() {\n this.unimplemented('Not implemented on web.');\n console.log('hide');\n }\n async show() {\n this.unimplemented('Not implemented on web.');\n console.log('show');\n }\n async isHidden() {\n this.unimplemented('Not implemented on web.');\n console.log('getStatus');\n return { hidden: true };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AAC3B,IAAI;AACJ,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AAC3B,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAChC,QAAQ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;AACxD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AACrC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,38 @@
1
+ var capacitorCapgoHomeIndicator = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const HomeIndicator = core.registerPlugin('HomeIndicator', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.HomeIndicatorWeb()),
6
+ });
7
+
8
+ class HomeIndicatorWeb extends core.WebPlugin {
9
+ async hide() {
10
+ this.unimplemented('Not implemented on web.');
11
+ console.log('hide');
12
+ }
13
+ async show() {
14
+ this.unimplemented('Not implemented on web.');
15
+ console.log('show');
16
+ }
17
+ async isHidden() {
18
+ this.unimplemented('Not implemented on web.');
19
+ console.log('getStatus');
20
+ return { hidden: true };
21
+ }
22
+ async getPluginVersion() {
23
+ console.warn('Cannot get plugin version in web');
24
+ return { version: 'default' };
25
+ }
26
+ }
27
+
28
+ var web = /*#__PURE__*/Object.freeze({
29
+ __proto__: null,
30
+ HomeIndicatorWeb: HomeIndicatorWeb
31
+ });
32
+
33
+ exports.HomeIndicator = HomeIndicator;
34
+
35
+ return exports;
36
+
37
+ })({}, capacitorExports);
38
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HomeIndicator = registerPlugin('HomeIndicator', {\n web: () => import('./web').then((m) => new m.HomeIndicatorWeb()),\n});\nexport * from './definitions';\nexport { HomeIndicator };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class HomeIndicatorWeb extends WebPlugin {\n async hide() {\n this.unimplemented('Not implemented on web.');\n console.log('hide');\n }\n async show() {\n this.unimplemented('Not implemented on web.');\n console.log('show');\n }\n async isHidden() {\n this.unimplemented('Not implemented on web.');\n console.log('getStatus');\n return { hidden: true };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IAC3B,IAAI;IACJ,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IAC3B,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IACrD,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAChC,QAAQ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;IACxD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;IACrC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -0,0 +1,72 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ extension CAPBridgeViewController {
5
+
6
+ private struct Holder {
7
+ static var setHomeIndicator: Bool = false
8
+ }
9
+
10
+ public func getHomeIndicator() -> Bool {
11
+ return Holder.setHomeIndicator
12
+ }
13
+
14
+ public func hideHomeIndicator(_ ishomeIndicatorVisible: Bool) {
15
+ Holder.setHomeIndicator = ishomeIndicatorVisible
16
+ self.setNeedsUpdateOfHomeIndicatorAutoHidden()
17
+ }
18
+
19
+ override public var prefersHomeIndicatorAutoHidden: Bool {
20
+
21
+ return Holder.setHomeIndicator
22
+
23
+ }
24
+ }
25
+
26
+ @objc(CapgoHomeIndicatorPlugin)
27
+ public class CapgoHomeIndicatorPlugin: CAPPlugin, CAPBridgedPlugin {
28
+
29
+ public let identifier = "CapgoHomeIndicatorPlugin"
30
+ public let jsName = "HomeIndicator"
31
+ public let pluginMethods: [CAPPluginMethod] = [
32
+ CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise),
33
+ CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
34
+ CAPPluginMethod(name: "isHidden", returnType: CAPPluginReturnPromise),
35
+ CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
36
+ ]
37
+
38
+ private let pluginVersion = "7.1.5"
39
+
40
+ @objc func getPluginVersion(_ call: CAPPluginCall) {
41
+ call.resolve(["version": self.pluginVersion])
42
+ }
43
+ @objc func hide(_ call: CAPPluginCall) {
44
+ guard let bridgeVC = self.bridge?.viewController as? CAPBridgeViewController else {
45
+ call.reject("")
46
+ return
47
+ }
48
+ DispatchQueue.main.async {
49
+ bridgeVC.hideHomeIndicator(true)
50
+ call.resolve()
51
+ }
52
+ }
53
+
54
+ @objc func show(_ call: CAPPluginCall) {
55
+ guard let bridgeVC = self.bridge?.viewController as? CAPBridgeViewController else {
56
+ call.reject("")
57
+ return
58
+ }
59
+ DispatchQueue.main.async {
60
+ bridgeVC.hideHomeIndicator(false)
61
+ call.resolve()
62
+ }
63
+ }
64
+
65
+ @objc func isHidden(_ call: CAPPluginCall) {
66
+ guard let bridgeVC = self.bridge?.viewController as? CAPBridgeViewController else {
67
+ call.reject("")
68
+ return
69
+ }
70
+ call.resolve(["hidden": bridgeVC.getHomeIndicator()])
71
+ }
72
+ }
@@ -0,0 +1,13 @@
1
+ import XCTest
2
+ import Capacitor
3
+ @testable import CapgoHomeIndicatorPlugin
4
+
5
+ class CapgoHomeIndicatorPluginTests: XCTestCase {
6
+
7
+ func testExample() {
8
+ // This is an example of a functional test case for a plugin.
9
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
10
+
11
+ XCTAssert(true, "Plugin tests need to be implemented")
12
+ }
13
+ }
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@capgo/capacitor-home-indicator",
3
+ "version": "7.1.6",
4
+ "description": "hide and show home button indicator in Capacitor app",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
16
+ "CapgoHomeIndicator.podspec"
17
+ ],
18
+ "author": "Martin Donadieu <martin@capgo.app>",
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Cap-go/capacitor-home-indicator/.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Cap-go/capacitor-home-indicator/issues"
26
+ },
27
+ "keywords": [
28
+ "capacitor",
29
+ "plugin",
30
+ "home indicator",
31
+ "ios",
32
+ "native"
33
+ ],
34
+ "scripts": {
35
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
36
+ "verify:ios": "xcodebuild -scheme CapgoHomeIndicator -destination generic/platform=iOS",
37
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
38
+ "verify:web": "npm run build",
39
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
40
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
41
+ "eslint": "eslint . --ext ts",
42
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
43
+ "swiftlint": "node-swiftlint",
44
+ "docgen": "docgen --api HomeIndicatorPlugin --output-readme README.md --output-json dist/docs.json",
45
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
46
+ "clean": "rimraf ./dist",
47
+ "watch": "tsc --watch",
48
+ "prepublishOnly": "npm run build"
49
+ },
50
+ "devDependencies": {
51
+ "@capacitor/android": "^7.0.0",
52
+ "@capacitor/core": "^7.0.0",
53
+ "@capacitor/docgen": "^0.3.0",
54
+ "@capacitor/ios": "^7.0.0",
55
+ "@ionic/eslint-config": "^0.4.0",
56
+ "@ionic/prettier-config": "^4.0.0",
57
+ "@ionic/swiftlint-config": "^2.0.0",
58
+ "eslint": "^8.57.0",
59
+ "prettier": "^3.4.2",
60
+ "prettier-plugin-java": "^2.6.6",
61
+ "rimraf": "^6.0.1",
62
+ "rollup": "^4.30.1",
63
+ "swiftlint": "^2.0.0",
64
+ "typescript": "~4.1.5"
65
+ },
66
+ "peerDependencies": {
67
+ "@capacitor/core": ">=7.0.0"
68
+ },
69
+ "prettier": "@ionic/prettier-config",
70
+ "swiftlint": "@ionic/swiftlint-config",
71
+ "eslintConfig": {
72
+ "extends": "@ionic/eslint-config/recommended"
73
+ },
74
+ "capacitor": {
75
+ "ios": {
76
+ "src": "ios"
77
+ },
78
+ "android": {
79
+ "src": "android"
80
+ }
81
+ }
82
+ }