@haykmkrtich/react-native-patriot-native 1.0.1 → 1.0.3
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/LICENSE +21 -0
- package/README.md +107 -0
- package/package.json +19 -19
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hayk Mkrtich
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# React Native Patriot Native
|
|
2
|
+
|
|
3
|
+
A React Native module that enables seamless installation of WearOS watch faces directly from your React Native mobile application.
|
|
4
|
+
|
|
5
|
+
## Important Note for WearOS Development
|
|
6
|
+
|
|
7
|
+
This module is specifically designed for WearOS watch face companion apps. When developing a complete wearable product, it's crucial to follow the Google Play Console best practices:
|
|
8
|
+
|
|
9
|
+
1. Create two applications with **identical package names**:
|
|
10
|
+
- One for the mobile companion app (using this React Native module)
|
|
11
|
+
- One for the WearOS watch face itself
|
|
12
|
+
|
|
13
|
+
This package name consistency is required for proper functionality and distribution through the Google Play Store.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Install watch faces on paired WearOS devices
|
|
18
|
+
- Handle connection status with WearOS devices
|
|
19
|
+
- Promise-based API for easy integration
|
|
20
|
+
- Native Toast notifications for user feedback
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @haykmkrtich/react-native-patriot-native
|
|
26
|
+
# or
|
|
27
|
+
yarn add @haykmkrtich/react-native-patriot-native
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- React Native >= 0.60.0
|
|
33
|
+
- Android API level 21+ (Android 5.0 or later)
|
|
34
|
+
- Paired WearOS device
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { installWatchface } from '@haykmkrtich/react-native-patriot-native';
|
|
40
|
+
|
|
41
|
+
// Example: Installing a watch face
|
|
42
|
+
try {
|
|
43
|
+
await installWatchface('com.example.watchface.package');
|
|
44
|
+
// Watch face installation initiated on the connected WearOS device
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Handle errors (e.g., no connected device, installation failed)
|
|
47
|
+
console.error(error);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API Reference
|
|
52
|
+
|
|
53
|
+
### `installWatchface(packageName: string): Promise<void>`
|
|
54
|
+
|
|
55
|
+
Initiates the installation of a watch face on the connected WearOS device.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
- `packageName` (string): The package name of the watch face to install from the Google Play Store.
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
- Promise that resolves when the installation request is successfully sent to the watch.
|
|
64
|
+
- Promise rejection if:
|
|
65
|
+
- No WearOS device is connected
|
|
66
|
+
- Installation process fails
|
|
67
|
+
|
|
68
|
+
#### Error Codes
|
|
69
|
+
|
|
70
|
+
- `NO_NODES`: No connected WearOS device found
|
|
71
|
+
- `INSTALL_FAILED`: Installation process failed
|
|
72
|
+
|
|
73
|
+
## How It Works
|
|
74
|
+
|
|
75
|
+
The module uses the WearOS Remote API to:
|
|
76
|
+
1. Check for connected WearOS devices
|
|
77
|
+
2. Send an installation request to the connected watch
|
|
78
|
+
3. Open the Google Play Store page for the specified watch face package
|
|
79
|
+
|
|
80
|
+
The user will receive a prompt on their WearOS device to install the watch face.
|
|
81
|
+
|
|
82
|
+
## Requirements for Android
|
|
83
|
+
|
|
84
|
+
Add the following to your app's `build.gradle`:
|
|
85
|
+
|
|
86
|
+
```gradle
|
|
87
|
+
dependencies {
|
|
88
|
+
implementation 'com.google.android.gms:play-services-wearable:18.1.0'
|
|
89
|
+
implementation 'androidx.wear:wear-remote-interactions:1.0.0'
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Contributing
|
|
94
|
+
|
|
95
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
100
|
+
|
|
101
|
+
## Author
|
|
102
|
+
|
|
103
|
+
Hayk Mkrtich
|
|
104
|
+
|
|
105
|
+
## Support
|
|
106
|
+
|
|
107
|
+
For issues and feature requests, please [create an issue](https://github.com/HaykMkrtich/react-native-patriot-native/issues) on GitHub.
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@haykmkrtich/react-native-patriot-native",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "index.ts",
|
|
5
|
-
"files": [
|
|
6
|
-
"index.ts",
|
|
7
|
-
"android/"
|
|
8
|
-
],
|
|
9
|
-
"keywords": ["react-native", "wearos", "watchface"],
|
|
10
|
-
"author": "Hayk Mkrtich",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/
|
|
15
|
-
},
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@haykmkrtich/react-native-patriot-native",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"main": "index.ts",
|
|
5
|
+
"files": [
|
|
6
|
+
"index.ts",
|
|
7
|
+
"android/"
|
|
8
|
+
],
|
|
9
|
+
"keywords": ["react-native", "wearos", "watchface"],
|
|
10
|
+
"author": "Hayk Mkrtich",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/HaykMkrtich/react-native-patriot-native"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
}
|
|
19
|
+
}
|