Skip to content

Commit 322abd8

Browse files
committed
Initial commit
0 parents  commit 322abd8

37 files changed

+17002
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
lib/

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@react-native-community', 'prettier'],
4+
rules: {
5+
'prettier/prettier': [
6+
'error',
7+
{
8+
quoteProps: 'consistent',
9+
singleQuote: true,
10+
tabWidth: 2,
11+
trailingComma: 'es5',
12+
useTabs: false,
13+
},
14+
],
15+
},
16+
};

.github/workflows/ci.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
test:
13+
name: Tests
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16.14
21+
cache: 'yarn'
22+
- name: Install Dependencies
23+
run: yarn install --frozen-lockfile
24+
- name: Run eslint
25+
run: yarn run lint
26+
- name: Run Prettier
27+
run: yarn run prettier-check
28+
- name: Run type check
29+
run: yarn run type-check
30+
- name: Run Tests
31+
run: yarn run test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
coverage

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"quoteProps": "consistent",
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"useTabs": false
7+
}

CODE_OF_CONDUCT.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Code of Conduct
2+
3+
4+
5+
## Why have a Code of Conduct?
6+
7+
As contributors and maintainers of this project, we are committed to providing a friendly, safe and welcoming environment for all, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
8+
9+
The goal of the Code of Conduct is to specify a baseline standard of behavior so that people with different social values and communication styles can talk about Accent effectively, productively, and respectfully, even in face of disagreements. The Code of Conduct also provides a mechanism for resolving conflicts in the community when they arise.
10+
11+
## Our Values
12+
13+
These are the values react-native-killswitch developers should aspire to:
14+
15+
- Be friendly and welcoming
16+
- Be patient
17+
- Remember that people have varying communication styles and that not everyone is using their native language. (Meaning and tone can be lost in translation.)
18+
- Be thoughtful
19+
- Productive communication requires effort. Think about how your words will be interpreted.
20+
- Remember that sometimes it is best to refrain entirely from commenting.
21+
- Be respectful
22+
- In particular, respect differences of opinion. It is important that we resolve disagreements and differing views constructively.
23+
- Avoid destructive behavior
24+
- Derailing: stay on topic; if you want to talk about something else, start a new conversation.
25+
- Unconstructive criticism: don't merely decry the current state of affairs; offer (or at least solicit) suggestions as to how things may be improved.
26+
- Snarking (pithy, unproductive, sniping comments).
27+
28+
The following actions are explicitly forbidden:
29+
30+
- Insulting, demeaning, hateful, or threatening remarks.
31+
- Discrimination based on age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
32+
- Bullying or systematic harassment.
33+
- Unwelcome sexual advances.
34+
- Incitement to any of these.
35+
36+
## Acknowledgements
37+
38+
This document was based on the Code of Conduct from the Elixir project.

LICENSE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright (c) 2023, Mirego
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
- Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
- Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
- Neither the name of the Mirego nor the names of its contributors may
13+
be used to endorse or promote products derived from this software without
14+
specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<div align="center">
2+
<img src="https://user-images.githubusercontent.com/11348/151395659-3ebe29b6-b1d6-44fa-bb44-c42146c7e99a.png" width="563" />
3+
4+
<p>
5+
<strong>React Native Killswitch</strong> is a library built by <a href="https://www.mirego.com">Mirego</a> that allows mobile developers to apply<br /> runtime version-specific behaviors to their React Native application.
6+
</p>
7+
</div>
8+
9+
## Installation
10+
11+
```sh
12+
npm install react-native-killswitch
13+
```
14+
15+
## Usage
16+
17+
The bare minimum needed to have a working killswitch is API keys for iOS and Android,
18+
the app language and the app version:
19+
20+
```js
21+
import { useKillswitch } from 'react-native-killswitch';
22+
23+
const { isOk } = useKillswitch({
24+
iosApiKey: iosApiKey,
25+
androidApiKey: androidApiKey,
26+
language: myAppLanguage,
27+
version: myAppVersion,
28+
});
29+
```
30+
31+
### Options
32+
33+
- `iosApiKey`
34+
A string taken from your killswitch back-end. The killswitch back-end will use
35+
this to send the correct behavior to your iOS users.
36+
37+
- `androidApiKey`
38+
A string taken from your killswitch back-end. The killswitch back-end will use
39+
this to send the correct behavior to your Android users.
40+
41+
- `language`
42+
A language code like "en" or "de". The killswitch back-end will use this to
43+
send a localized message to your users.
44+
45+
- `version`
46+
A version number like "1.0.0". The killswitch back-end will use this to send
47+
the correct behavior to your users.
48+
49+
- `apiHost`
50+
The host of the killswitch back-end. Defaults to: `https://killswitch.mirego.com`
51+
52+
- `useNativeUI`
53+
Use native alerts to display messages. Defaults to `true`
54+
55+
- `timeout`
56+
A number of milliseconds to wait for the back-end before returning `isOk = true`. Defaults to `2000`
57+
58+
## License
59+
60+
react-native-killswitch is © 2023 [Mirego](https://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](./LICENSE.md) file.
61+
62+
The shield logo is based on [this lovely icon by Kimmi Studio](https://thenounproject.com/icon/shield-1055246/), from The Noun Project. Used under a [Creative Commons BY 3.0](http://creativecommons.org/licenses/by/3.0/) license.
63+
64+
## About Mirego
65+
66+
[Mirego](https://www.mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of [talented people](https://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://www.mirego.org).
67+
68+
We also [love open-source software](https://open.mirego.com) and we try to give back to the community as much as we can.

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:metro-react-native-babel-preset'],
3+
};

example/.expo/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
> Why do I have a folder named ".expo" in my project?
2+
The ".expo" folder is created when an Expo project is started using "expo start" command.
3+
> What do the files contain?
4+
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
5+
- "settings.json": contains the server configuration that is used to serve the application manifest.
6+
> Should I commit the ".expo" folder?
7+
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
8+
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.

0 commit comments

Comments
 (0)