├── .gitignore
├── .npmignore
├── .watchmanconfig
├── LICENSE
├── README.md
├── android
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── pilloxa
│ │ └── backgroundjob
│ │ ├── BackgroundJob.java
│ │ ├── BackgroundJobModule.java
│ │ ├── BackgroundJobPackage.java
│ │ ├── ExactJob.java
│ │ ├── ExactJobDispatcher.java
│ │ ├── ReactNativeEventStarter.java
│ │ └── Utils.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_notification.png
│ ├── drawable-mdpi
│ └── ic_notification.png
│ ├── drawable-xhdpi
│ └── ic_notification.png
│ └── drawable-xxhdpi
│ └── ic_notification.png
├── circle.yml
├── example
├── .babelrc
├── .buckconfig
├── .flowconfig
├── .gitignore
├── .watchmanconfig
├── __tests__
│ ├── index.android.js
│ └── index.ios.js
├── android
│ ├── app
│ │ ├── BUCK
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── backtest
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ │ └── res
│ │ │ ├── drawable-hdpi-v11
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-hdpi-v9
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-mdpi-v11
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-mdpi-v9
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xhdpi-v11
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xhdpi-v9
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xxhdpi-v11
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xxhdpi-v9
│ │ │ └── ic_notification.png
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_notification.png
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── keystores
│ │ ├── BUCK
│ │ └── debug.keystore.properties
│ └── settings.gradle
├── app.json
├── index.ios.js
├── index.js
├── ios
│ ├── backtest-tvOS
│ │ └── Info.plist
│ ├── backtest-tvOSTests
│ │ └── Info.plist
│ ├── backtest.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ ├── backtest-tvOS.xcscheme
│ │ │ └── backtest.xcscheme
│ ├── backtest
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.xib
│ │ ├── Images.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ └── main.m
│ └── backtestTests
│ │ ├── Info.plist
│ │ └── backtestTests.m
├── package.json
└── yarn.lock
├── index.js
├── package.json
├── tests
├── assure-not-foreground.sh
└── bg-working.sh
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | android/build
3 | android/local.properties
4 | android/.gradle/
5 | android/local.properties
6 | android/.idea
7 | *.iml
8 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | android/build
3 | android/.gradle/
4 | *.iml
5 | example/
6 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {
2 | "ignore_dirs": [
3 | "node_modules",
4 | ".git"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017, Viktor Eriksson
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.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-background-job [](https://badge.fury.io/js/react-native-background-job) [](https://circleci.com/gh/vikeri/react-native-background-job)
2 |
3 | Schedule background jobs that run your JavaScript when your app is in the background or if you feel brave even in foreground.
4 |
5 | The jobs will run even if the app has been closed and, by default, also persists over restarts.
6 |
7 | This library relies on React Native's [`HeadlessJS`](https://facebook.github.io/react-native/docs/headless-js-android.html) which is currently only supported on Android.
8 |
9 | On the native side it uses either [`Firebase JobDispatcher`](https://github.com/firebase/firebase-jobdispatcher-android) or a [`AlarmManager`](https://developer.android.com/reference/android/app/AlarmManager.html).
10 |
11 | - Firebase JobDispatcher (default): The jobs can't be scheduled exactly and depending on the Android API version different `period` time is allowed. `FirebaseJobDispatcher` is the most battery efficient backward compatible way of scheduling background tasks.
12 |
13 | - AlarmManager by setting `exact` to `true`: Simple propriatery implementation that is only ment to be used while testing. It only cares about executing on time, all other parameters are ignored - job is not persisted on reboot.
14 |
15 | ## Requirements
16 |
17 | - RN 0.36+
18 | - Android API 16+
19 |
20 | ## Supported platforms
21 |
22 | - Android
23 |
24 | Want iOS? Go in and vote for Headless JS to be implemented for iOS: [Product pains](https://productpains.com/post/react-native/headless-js-for-ios)
25 |
26 | ## Getting started
27 |
28 | `$ yarn add react-native-background-job`
29 |
30 | or
31 |
32 | `$ npm install react-native-background-job --save`
33 |
34 | ### Mostly automatic installation
35 |
36 | `$ react-native link react-native-background-job`
37 |
38 | ### Manual installation
39 |
40 |
49 |
50 | #### Android
51 |
52 | 1. Open up `android/app/src/main/java/[...]/MainApplication.java`
53 |
54 | - Add `import com.pilloxa.backgroundjob.BackgroundJobPackage;` to the imports at the top of the file.
55 | - Add `new BackgroundJobPackage()` to the list returned by the `getPackages()` method.
56 |
57 | 2. Append the following lines to `android/settings.gradle`:
58 |
59 | include ':react-native-background-job'
60 | project(':react-native-background-job').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-job/android')
61 |
62 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle` and bump the minSdkVersion to 21:
63 |
64 | compile project(':react-native-background-job')
65 |
66 | ## Usage
67 |
68 | The jobs have to be registered each time React Native starts, this is done using the `register` function. Since HeadlessJS does not mount any components the `register` function must be run outside of any class definitions (see [example/index.android.js](example/index.android.js#L24-L35))
69 |
70 | Registering the job does not mean that the job is scheduled, it just informs React Native that this `job` function should be tied to this `jobKey`. The job is then scheduled using the `schedule` function. **By default, the job will not fire while the app is in the foreground**. This is since the job is run on the only JavaScript thread and if running the job when app is in the foreground it would freeze the app. By setting `allowExecutionInForeground` to `true` you allow this behavior. It is recommended that you do't use this, but for quick jobs should be fine.
71 |
72 | For a full example check out [example/index.android.js](example/index.android.js)
73 |
74 | ## API
75 |
76 |
77 |
78 | #### Table of Contents
79 |
80 | - [register](#register)
81 | - [Parameters](#parameters)
82 | - [Examples](#examples)
83 | - [schedule](#schedule)
84 | - [Parameters](#parameters-1)
85 | - [Examples](#examples-1)
86 | - [cancel](#cancel)
87 | - [Parameters](#parameters-2)
88 | - [Examples](#examples-2)
89 | - [cancelAll](#cancelall)
90 | - [Examples](#examples-3)
91 | - [setGlobalWarnings](#setglobalwarnings)
92 | - [Parameters](#parameters-3)
93 | - [Examples](#examples-4)
94 | - [isAppIgnoringBatteryOptimization](#isappignoringbatteryoptimization)
95 | - [Parameters](#parameters-4)
96 | - [Examples](#examples-5)
97 |
98 | ### register
99 |
100 | [index.js:39-55](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L39-L55 "Source code on GitHub")
101 |
102 | Registers the job and the functions they should run.
103 |
104 | This has to run on each initialization of React Native and it has to run in the global scope and not inside any
105 | component life cycle methods. See example project. Only registering the job will not schedule the job.
106 | It has to be scheduled by `schedule` to start running.
107 |
108 | #### Parameters
109 |
110 | - `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
111 | - `obj.jobKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A unique key for the job
112 | - `obj.job` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The JS-function that will be run
113 |
114 | #### Examples
115 |
116 | ```javascript
117 | import BackgroundJob from 'react-native-background-job';
118 |
119 | const backgroundJob = {
120 | jobKey: "myJob",
121 | job: () => console.log("Running in background")
122 | };
123 |
124 | BackgroundJob.register(backgroundJob);
125 | ```
126 |
127 | ### schedule
128 |
129 | [index.js:95-142](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L95-L142 "Source code on GitHub")
130 |
131 | Schedules a new job.
132 |
133 | This only has to be run once while `register` has to be run on each initialization of React Native.
134 |
135 | #### Parameters
136 |
137 | - `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
138 | - `obj.jobKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A unique key for the job that was used for registering, and be used for canceling in later stage.
139 | - `obj.timeout` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The amount of time (in ms) after which the React instance should be terminated regardless of whether the task has completed or not. (optional, default `2000`)
140 | - `obj.period` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The frequency to run the job with (in ms). This number is not exact, Android may modify it to save batteries. Note: For Android > N, the minimum is 900 0000 (15 min). (optional, default `900000`)
141 | - `obj.persist` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If the job should persist over a device restart. (optional, default `true`)
142 | - `obj.override` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether this Job should replace pre-existing jobs with the same key. (optional, default `true`)
143 | - `obj.networkType` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Only run for specific network requirements. (optional, default `NETWORK_TYPE_NONE`)
144 | - `obj.requiresCharging` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Only run job when device is charging, (not respected by pre Android N devices) [docs](https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setRequiresCharging(boolean)) (optional, default `false`)
145 | - `obj.requiresDeviceIdle` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Only run job when the device is idle, (not respected by pre Android N devices) [docs](https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setRequiresDeviceIdle(boolean)) (optional, default `false`)
146 | - `obj.exact` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Schedule an job to be triggered precisely at the provided period. Note that this is not power-efficient way of doing things. (optional, default `false`)
147 | - `obj.allowWhileIdle` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allow the scheduled job to execute also while it is in doze mode. (optional, default `false`)
148 | - `obj.allowExecutionInForeground` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allow the scheduled job to be executed even when the app is in foreground. Use it only for short running jobs. (optional, default `false`)
149 | - `obj.notificationText` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** For Android SDK > 26, what should the notification text be (optional, default `"Running in background..."`)
150 | - `obj.notificationTitle` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** For Android SDK > 26, what should the notification title be (optional, default `"Background job"`)
151 |
152 | #### Examples
153 |
154 | ```javascript
155 | import BackgroundJob from 'react-native-background-job';
156 |
157 | const backgroundJob = {
158 | jobKey: "myJob",
159 | job: () => console.log("Running in background")
160 | };
161 |
162 | BackgroundJob.register(backgroundJob);
163 |
164 | var backgroundSchedule = {
165 | jobKey: "myJob",
166 | }
167 |
168 | BackgroundJob.schedule(backgroundSchedule)
169 | .then(() => console.log("Success"))
170 | .catch(err => console.err(err));
171 | ```
172 |
173 | ### cancel
174 |
175 | [index.js:156-166](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L156-L166 "Source code on GitHub")
176 |
177 | Cancel a specific job
178 |
179 | #### Parameters
180 |
181 | - `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
182 | - `obj.jobKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The unique key for the job
183 |
184 | #### Examples
185 |
186 | ```javascript
187 | import BackgroundJob from 'react-native-background-job';
188 |
189 | BackgroundJob.cancel({jobKey: 'myJob'})
190 | .then(() => console.log("Success"))
191 | .catch(err => console.err(err));
192 | ```
193 |
194 | ### cancelAll
195 |
196 | [index.js:177-187](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L177-L187 "Source code on GitHub")
197 |
198 | Cancels all the scheduled jobs
199 |
200 | #### Examples
201 |
202 | ```javascript
203 | import BackgroundJob from 'react-native-background-job';
204 |
205 | BackgroundJob.cancelAll()
206 | .then(() => console.log("Success"))
207 | .catch(err => console.err(err));
208 | ```
209 |
210 | ### setGlobalWarnings
211 |
212 | [index.js:199-201](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L199-L201 "Source code on GitHub")
213 |
214 | Sets the global warning level
215 |
216 | #### Parameters
217 |
218 | - `warn` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
219 |
220 | #### Examples
221 |
222 | ```javascript
223 | import BackgroundJob from 'react-native-background-job';
224 |
225 | BackgroundJob.setGlobalWarnings(false);
226 | ```
227 |
228 | ### isAppIgnoringBatteryOptimization
229 |
230 | [index.js:213-229](https://github.com/vikeri/react-native-background-job/blob/ff0fe73675342c38e391093f64d9e25dafe6d4f2/index.js#L213-L229 "Source code on GitHub")
231 |
232 | Checks Whether app is optimising battery using Doze,returns Boolean.
233 |
234 | #### Parameters
235 |
236 | - `callback` **Callback** gets called with according parameters after result is received from Android module.
237 |
238 | #### Examples
239 |
240 | ```javascript
241 | import BackgroundJob from 'react-native-background-job';
242 |
243 | BackgroundJob.isAppIgnoringBatteryOptimization((err, isIgnoring) => console.log(`Callback: isIgnoring = ${isIgnoring}`))
244 | .then(isIgnoring => console.log(`Promise: isIgnoring = ${isIgnoring}`))
245 | .catch(err => console.err(err));
246 | ```
247 |
248 | ## Troubleshooting
249 |
250 | ### `No task registered for key myJob`
251 |
252 | Make sure you call the `register` function at the global scope (i.e. not in any component life cycle methods (render, iDidMount etc)). Since the components are not rendered in Headless mode if you run the register function there it will not run in the background and hence the library will not find which function to run.
253 |
254 | See [example project](https://github.com/vikeri/react-native-background-job/blob/c0e4bc8e9dd692695169d6c9855d39e2ff917a61/example/index.android.js#L20-L25)
255 |
256 | ### `AppState.currentState` is `"active"` when I'm running my Headless task in the background
257 |
258 | This is a [React Native issue](https://github.com/facebook/react-native/issues/11561), you can get around it by calling `NativeModules.AppState.getCurrentAppState` directly instead.
259 |
260 | ### My job always runs in the background even if I specified `requiresCharging`, `requiresDeviceIdle` or a specific `networkType`
261 |
262 | This is an [Android issue](https://code.google.com/p/android/issues/detail?id=81265), it seems that you can not have these restrictions at the same time as you have a periodic interval for pre Android N devices.
263 |
264 | ## Pull Request Details
265 |
266 | ### Included function for checking if the app is ignoring battery optimizations. #62
267 |
268 | In Android SDK versions greater than 23, Doze is being used by apps by default, in order to optimize battery by temporarily turning off background tasks when the phone is left undisturbed for some hours.
269 |
270 | But, some apps may require background tasks to keep running, ignoring doze and not optimizing battery (this means battery needs to be traded off for performance as per required). Apps that require continuous syncing of data to the server at short intervals of time are examples of such apps.
271 |
272 | It would be good if the developer can check whether the app is optimizing battery. If it is, the user can be notified that the app would not perform as per expected and it will work properly only if the user manually removes it from the battery optimizing apps list which can be found in
273 | Settings-> Battery -> Options (button on top right) -> Battery Optimization and then selecting "All Apps" to change the battery optimization settings for the particular app.
274 |
275 | The Changes that have been made are specifically for that purpose, a function (isAppIgnoringBatteryOptimization) has been included. It checks if the app is ignoring battery optimization and returns false if it is optimizing battery (in which case the user has to manually remove it from battery settings) and true otherwise.
276 |
277 | Logic has also been added for scheduling the task by ignoring battery optimizations, if the app has been manually removed from the battery optimization list in settings (by the User).
278 |
279 | ## Sponsored by
280 |
281 | [](http://pilloxa.com)
282 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | maven {
5 | url 'https://maven.google.com/'
6 | name 'Google'
7 | }
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.1'
11 | }
12 | }
13 |
14 | apply plugin: 'com.android.library'
15 |
16 | def DEFAULT_COMPILE_SDK_VERSION = 28
17 | def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
18 | def DEFAULT_TARGET_SDK_VERSION = 28
19 |
20 | android {
21 | compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
22 | buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
23 |
24 | // Uncomment to develop with yarn link into node_modules
25 | // compileOptions.incremental = false
26 | defaultConfig {
27 | minSdkVersion 16
28 | targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
29 | versionCode 2
30 | versionName "2.0"
31 | ndk {
32 | abiFilters "armeabi-v7a", "x86"
33 | }
34 | }
35 | lintOptions {
36 | warning 'InvalidPackage'
37 | }
38 | }
39 |
40 | repositories {
41 | jcenter()
42 | maven {
43 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
44 | url "$rootDir/../node_modules/react-native/android"
45 | }
46 | maven {
47 | url 'https://maven.google.com/'
48 | name 'Google'
49 | }
50 | }
51 |
52 | dependencies {
53 | implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
54 | implementation 'com.facebook.react:react-native:+'
55 | implementation 'androidx.annotation:annotation:1.1.0'
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Dec 05 13:47:01 PST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/BackgroundJob.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import android.os.Bundle;
4 | import android.util.Log;
5 | import com.firebase.jobdispatcher.JobParameters;
6 | import com.firebase.jobdispatcher.JobService;
7 |
8 | public class BackgroundJob extends JobService {
9 | private static final String LOG_TAG = BackgroundJob.class.getSimpleName();
10 | private ReactNativeEventStarter reactNativeEventStarter;
11 |
12 | @Override public void onCreate() {
13 | super.onCreate();
14 | reactNativeEventStarter = new ReactNativeEventStarter(this);
15 | }
16 |
17 | @Override public boolean onStartJob(JobParameters jobParameters) {
18 | Log.d(LOG_TAG, "onStartJob() called with: jobParameters = [" + jobParameters + "]");
19 | Bundle jobBundle = jobParameters.getExtras();
20 | if (jobBundle != null) {
21 | reactNativeEventStarter.trigger(jobBundle);
22 | } else {
23 | throw new RuntimeException("No job parameters provided for job:" + jobParameters.getTag());
24 | }
25 | return false; // No more work going on in this service
26 | }
27 |
28 | @Override public boolean onStopJob(JobParameters params) {
29 | Log.d(LOG_TAG, "onStopJob() called with: params = [" + params + "]");
30 | return true; // Yes, we should retry this job again
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/BackgroundJobModule.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.os.PowerManager;
7 | import androidx.annotation.Nullable;
8 | import android.util.Log;
9 |
10 | import com.facebook.react.bridge.Callback;
11 | import com.facebook.react.bridge.ReactApplicationContext;
12 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
13 | import com.facebook.react.bridge.ReactMethod;
14 | import com.firebase.jobdispatcher.Constraint;
15 | import com.firebase.jobdispatcher.FirebaseJobDispatcher;
16 | import com.firebase.jobdispatcher.GooglePlayDriver;
17 | import com.firebase.jobdispatcher.Job;
18 | import com.firebase.jobdispatcher.Lifetime;
19 | import com.firebase.jobdispatcher.RetryStrategy;
20 | import com.firebase.jobdispatcher.Trigger;
21 |
22 | import java.util.HashMap;
23 | import java.util.Map;
24 | import java.util.concurrent.TimeUnit;
25 |
26 | import static com.firebase.jobdispatcher.FirebaseJobDispatcher.CANCEL_RESULT_SUCCESS;
27 | import static com.firebase.jobdispatcher.FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS;
28 |
29 | class BackgroundJobModule extends ReactContextBaseJavaModule {
30 | private static final String LOG_TAG = BackgroundJobModule.class.getSimpleName();
31 |
32 | private static final String NETWORK_TYPE_UNMETERED = "UNMETERED";
33 | private static final String NETWORK_TYPE_ANY = "ANY";
34 |
35 | private FirebaseJobDispatcher mJobDispatcher;
36 |
37 | @Override public void initialize() {
38 | super.initialize();
39 | Log.d(LOG_TAG, "Initializing BackgroundJob");
40 | if (mJobDispatcher == null) {
41 | mJobDispatcher =
42 | new FirebaseJobDispatcher(new GooglePlayDriver(getReactApplicationContext()));
43 | }
44 | }
45 |
46 | BackgroundJobModule(ReactApplicationContext reactContext) {
47 | super(reactContext);
48 | }
49 |
50 | @ReactMethod
51 | public void schedule(String jobKey, int timeout, int period, boolean persist, boolean override,
52 | int networkType, boolean requiresCharging, boolean requiresDeviceIdle, boolean exact,boolean allowWhileIdle,
53 | boolean allowExecutionInForeground, String notificationTitle, String notificationText, Callback callback) {
54 | final Bundle jobBundle = new Bundle();
55 | jobBundle.putString("jobKey", jobKey);
56 | jobBundle.putString("notificationTitle", notificationTitle);
57 | jobBundle.putString("notificationText", notificationText);
58 | jobBundle.putLong("timeout", timeout);
59 | jobBundle.putBoolean("persist", persist);
60 | jobBundle.putBoolean("override", override);
61 | jobBundle.putLong("period", period);
62 | jobBundle.putInt("networkType", networkType);
63 | jobBundle.putBoolean("allowWhileIdle",allowWhileIdle);
64 | jobBundle.putBoolean("requiresCharging", requiresCharging);
65 | jobBundle.putBoolean("requiresDeviceIdle", requiresDeviceIdle);
66 | jobBundle.putBoolean("allowExecutionInForeground", allowExecutionInForeground);
67 |
68 | Log.d(LOG_TAG, "Scheduling job with:" + jobBundle.toString());
69 |
70 | final boolean scheduled;
71 | if (exact) {
72 | scheduled = scheduleExactJob(jobKey, period, override, jobBundle);
73 | } else {
74 | scheduled =
75 | scheduleBackgroundJob(jobKey, period, persist, override, networkType, requiresCharging,
76 | jobBundle);
77 | }
78 | callback.invoke(scheduled);
79 | }
80 |
81 | /**
82 | * Schedule a new background job that will be triggered via {@link FirebaseJobDispatcher}.
83 | */
84 | private boolean scheduleBackgroundJob(String jobKey, int period, boolean persist,
85 | boolean override, int networkType, boolean requiresCharging, Bundle jobBundle) {
86 | int periodInSeconds = (int) TimeUnit.MILLISECONDS.toSeconds(period);
87 | Job.Builder jobBuilder = mJobDispatcher.newJobBuilder()
88 | .setService(BackgroundJob.class)
89 | .setExtras(jobBundle)
90 | .setTag(jobKey)
91 | .setTrigger(Trigger.executionWindow(periodInSeconds, periodInSeconds))
92 | .setLifetime(persist ? Lifetime.FOREVER : Lifetime.UNTIL_NEXT_BOOT)
93 | .setRecurring(true)
94 | .setReplaceCurrent(override)
95 | .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR);
96 | if (requiresCharging) {
97 | jobBuilder.addConstraint(Constraint.DEVICE_CHARGING);
98 | }
99 | if (networkType == Constraint.ON_ANY_NETWORK || networkType == Constraint.ON_UNMETERED_NETWORK) {
100 | jobBuilder.addConstraint(networkType);
101 | }
102 | if (mJobDispatcher.schedule(jobBuilder.build()) == SCHEDULE_RESULT_SUCCESS) {
103 | Log.d(LOG_TAG, "Successfully scheduled: " + jobKey);
104 | return true;
105 | } else {
106 | Log.w(LOG_TAG, "Failed to schedule: " + jobKey);
107 | return false;
108 | }
109 | }
110 |
111 | /**
112 | * Similar to scheduleBackgroundJob but will use simple custom implementation that will trigger
113 | * the job in the exact manner.
114 | */
115 | private boolean scheduleExactJob(String jobKey, long period, boolean override, Bundle jobBundle) {
116 | return ExactJobDispatcher.schedule(getReactApplicationContext(), jobKey, period, override,
117 | jobBundle);
118 | }
119 |
120 | @ReactMethod public void cancel(String jobKey, Callback callback) {
121 | Log.d(LOG_TAG, "Cancelling job: " + jobKey);
122 | boolean canceled = ExactJobDispatcher.cancel(getReactApplicationContext(), jobKey);
123 | canceled = mJobDispatcher.cancel(jobKey) == CANCEL_RESULT_SUCCESS || canceled;
124 | callback.invoke(canceled);
125 | }
126 |
127 | @ReactMethod public void cancelAll(Callback callback) {
128 | Log.d(LOG_TAG, "Cancelling all jobs");
129 | final boolean exactCanceled = ExactJobDispatcher.cancelAll(getReactApplicationContext());
130 | final boolean allBackgroundCanceled = mJobDispatcher.cancelAll() == CANCEL_RESULT_SUCCESS;
131 | callback.invoke(exactCanceled && allBackgroundCanceled);
132 | }
133 | @ReactMethod public void isAppIgnoringBatteryOptimization(Callback callback){
134 | String packageName = getReactApplicationContext().getPackageName();
135 | PowerManager pm = (PowerManager) getReactApplicationContext().getSystemService(Context.POWER_SERVICE);
136 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
137 | callback.invoke(pm.isIgnoringBatteryOptimizations(packageName));
138 | }else{
139 | callback.invoke(true);
140 | }
141 | }
142 | @Override public String getName() {
143 | return "BackgroundJob";
144 | }
145 |
146 | @Nullable @Override public Map getConstants() {
147 | Log.d(LOG_TAG, "Getting constants");
148 | HashMap constants = new HashMap<>();
149 | constants.put(NETWORK_TYPE_UNMETERED, Constraint.ON_UNMETERED_NETWORK);
150 | constants.put(NETWORK_TYPE_ANY, Constraint.ON_ANY_NETWORK);
151 | return constants;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/BackgroundJobPackage.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 | import java.util.Collections;
9 | import java.util.List;
10 |
11 | public class BackgroundJobPackage implements ReactPackage {
12 | @Override public List createNativeModules(ReactApplicationContext reactContext) {
13 | return Collections.singletonList(new BackgroundJobModule(reactContext));
14 | }
15 |
16 | public List> createJSModules() {
17 | return Collections.emptyList();
18 | }
19 |
20 | @Override public List createViewManagers(ReactApplicationContext reactContext) {
21 | return Collections.emptyList();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/ExactJob.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import android.app.IntentService;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import androidx.annotation.Nullable;
7 | import java.util.Set;
8 |
9 | public class ExactJob extends IntentService {
10 | public ExactJob() {
11 | super(ExactJob.class.getSimpleName());
12 | }
13 |
14 | @Override protected void onHandleIntent(@Nullable Intent intent) {
15 | if (intent != null) {
16 | Set scheduledJobs = ExactJobDispatcher.getScheduledExactJobs(this);
17 | Bundle extras = intent.getExtras();
18 | String jobKey = extras.getString("jobKey");
19 | // Check if the job has been canceled meanwhile
20 | if (scheduledJobs.contains(jobKey)) {
21 | new ReactNativeEventStarter(this).trigger(extras);
22 | long period = extras.getLong("period", 2000);
23 | boolean override = extras.getBoolean("override", false);
24 | // Re-schedule the job with the same parameters
25 | ExactJobDispatcher.schedule(this, jobKey, period, override, extras);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/ExactJobDispatcher.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import android.app.AlarmManager;
4 | import android.app.PendingIntent;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.SharedPreferences;
8 | import android.os.Build;
9 | import android.os.Bundle;
10 |
11 | import java.util.HashSet;
12 | import java.util.Set;
13 |
14 | public class ExactJobDispatcher {
15 | private ExactJobDispatcher() {
16 | // No instance
17 | }
18 |
19 | public static boolean schedule(Context context, String jobKey, long period, boolean override,
20 | Bundle jobBundle) {
21 | AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
22 | long triggerAt = System.currentTimeMillis() + period;
23 | Intent intent = new Intent(context, ExactJob.class);
24 | intent.putExtras(jobBundle);
25 | PendingIntent pendingIntent = PendingIntent.getService(context, jobKey.hashCode(), intent,
26 | override ? PendingIntent.FLAG_CANCEL_CURRENT : PendingIntent.FLAG_ONE_SHOT);
27 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ) {
28 | if(jobBundle.getBoolean("allowWhileIdle") && Build.VERSION.SDK_INT > Build.VERSION_CODES.M){
29 | alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP,triggerAt,pendingIntent);
30 | }
31 | else {
32 | alarmManager.setExact(AlarmManager.RTC_WAKEUP, triggerAt, pendingIntent);
33 | }
34 | } else {
35 | // Same was alarmManager.setExact on older versions
36 | alarmManager.set(AlarmManager.RTC_WAKEUP, triggerAt, pendingIntent);
37 | }
38 | storeScheduledExactJob(context, jobKey);
39 | return true;
40 | }
41 |
42 | public static boolean cancel(Context context, String jobKey) {
43 | removeScheduledExactJob(context, jobKey);
44 | return true;
45 | }
46 |
47 | public static boolean cancelAll(Context context) {
48 | removeAllScheduledExactJobs(context);
49 | return true;
50 | }
51 |
52 | private static void removeScheduledExactJob(Context context, String jobKey) {
53 | SharedPreferences sharedPreferences = getSharedPreferences(context);
54 | Set jobs = sharedPreferences.getStringSet("jobs", new HashSet());
55 | jobs.remove(jobKey);
56 | sharedPreferences.edit().putStringSet("jobs", jobs).apply();
57 | }
58 |
59 | private static SharedPreferences getSharedPreferences(Context context) {
60 | return context.getSharedPreferences(ExactJobDispatcher.class.getSimpleName(),
61 | Context.MODE_PRIVATE);
62 | }
63 |
64 | private static void removeAllScheduledExactJobs(Context context) {
65 | SharedPreferences sharedPreferences = getSharedPreferences(context);
66 | sharedPreferences.edit().remove("jobs").apply();
67 | }
68 |
69 | private static void storeScheduledExactJob(Context context, String jobKey) {
70 | SharedPreferences sharedPreferences = getSharedPreferences(context);
71 | Set jobs = sharedPreferences.getStringSet("jobs", new HashSet());
72 | jobs.add(jobKey);
73 | sharedPreferences.edit().putStringSet("jobs", jobs).apply();
74 | }
75 |
76 | public static Set getScheduledExactJobs(Context context) {
77 | SharedPreferences sharedPreferences = getSharedPreferences(context);
78 | return sharedPreferences.getStringSet("jobs", new HashSet());
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/ReactNativeEventStarter.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 | import android.os.Bundle;
7 | import androidx.annotation.NonNull;
8 | import android.util.Log;
9 | import com.facebook.react.HeadlessJsTaskService;
10 | import com.facebook.react.ReactApplication;
11 | import com.facebook.react.ReactNativeHost;
12 | import com.facebook.react.bridge.Arguments;
13 | import com.facebook.react.jstasks.HeadlessJsTaskConfig;
14 | import javax.annotation.Nullable;
15 | import android.annotation.SuppressLint;
16 | import android.app.Notification;
17 | import android.app.NotificationChannel;
18 | import android.app.NotificationManager;
19 | import android.os.Build;
20 |
21 | public class ReactNativeEventStarter {
22 | private static final String LOG_TAG = ReactNativeEventStarter.class.getSimpleName();
23 | private final ReactNativeHost reactNativeHost;
24 | private final Context context;
25 | private static final String CONTEXT_TITLE_SETTING = "CONTEXT_TITLE_SETTING";
26 | private static final String CONTEXT_TEXT_SETTING = "CONTEXT_TEXT_SETTING";
27 | private static final String SETTINGS_KEY = "Background_Job_Settings";
28 |
29 | public ReactNativeEventStarter(@NonNull Context context) {
30 | this.context = context;
31 | reactNativeHost = ((ReactApplication) context.getApplicationContext()).getReactNativeHost();
32 | }
33 |
34 | public void trigger(@NonNull Bundle jobBundle) {
35 | Log.d(LOG_TAG, "trigger() called with: jobBundle = [" + jobBundle + "]");
36 | boolean appInForeground = Utils.isReactNativeAppInForeground(reactNativeHost);
37 | boolean allowExecutionInForeground = jobBundle.getBoolean("allowExecutionInForeground", false);
38 | SharedPreferences.Editor editor = this.context.getSharedPreferences(SETTINGS_KEY, Context.MODE_PRIVATE).edit();
39 | editor.putString(CONTEXT_TEXT_SETTING,jobBundle.getString("notificationText"));
40 | editor.putString(CONTEXT_TITLE_SETTING, jobBundle.getString("notificationTitle"));
41 | editor.apply();
42 | if (!appInForeground || allowExecutionInForeground) {
43 | // Will execute if the app is in background, or in forground but it has permision to do so
44 | MyHeadlessJsTaskService.start(context, jobBundle);
45 | }
46 | }
47 |
48 | public static class MyHeadlessJsTaskService extends HeadlessJsTaskService {
49 | private static final String LOG_TAG = MyHeadlessJsTaskService.class.getSimpleName();
50 |
51 | @Override
52 | @SuppressLint("WrongConstant")
53 | public void onCreate() {
54 | super.onCreate();
55 |
56 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
57 | Context mContext = this.getApplicationContext();
58 | String CHANNEL_ID = "Background job";
59 |
60 | NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_ID, NotificationManager.IMPORTANCE_LOW);
61 | ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel);
62 |
63 | SharedPreferences preferences = mContext.getSharedPreferences(SETTINGS_KEY, MODE_PRIVATE);
64 | String contextTitle = preferences.getString(CONTEXT_TITLE_SETTING, "Running in background...");
65 | String contextText = preferences.getString(CONTEXT_TEXT_SETTING, "Background job");
66 |
67 | Notification notification =
68 | new Notification.Builder(mContext, CHANNEL_ID)
69 | .setContentTitle(contextTitle)
70 | .setContentText(contextText)
71 | .setSmallIcon(R.drawable.ic_notification)
72 | .build();
73 |
74 | startForeground(1, notification);
75 | }
76 | }
77 |
78 | @Nullable @Override protected HeadlessJsTaskConfig getTaskConfig(Intent intent) {
79 | Log.d(LOG_TAG, "getTaskConfig() called with: intent = [" + intent + "]");
80 | Bundle extras = intent.getExtras();
81 | boolean allowExecutionInForeground = extras.getBoolean("allowExecutionInForeground", false);
82 | long timeout = extras.getLong("timeout", 2000);
83 | // For task with quick execution period additional check is required
84 | ReactNativeHost reactNativeHost =
85 | ((ReactApplication) getApplicationContext()).getReactNativeHost();
86 | boolean appInForeground = Utils.isReactNativeAppInForeground(reactNativeHost);
87 | if (appInForeground && !allowExecutionInForeground) {
88 | return null;
89 | }
90 | return new HeadlessJsTaskConfig(intent.getStringExtra("jobKey"), Arguments.fromBundle(extras),
91 | timeout, allowExecutionInForeground);
92 | }
93 |
94 | public static void start(Context context, Bundle jobBundle) {
95 | Log.d(LOG_TAG,
96 | "start() called with: context = [" + context + "], jobBundle = [" + jobBundle + "]");
97 | Intent starter = new Intent(context, MyHeadlessJsTaskService.class);
98 | starter.putExtras(jobBundle);
99 |
100 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
101 | context.startForegroundService(starter);
102 | }else{
103 | context.startService(starter);
104 | }
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pilloxa/backgroundjob/Utils.java:
--------------------------------------------------------------------------------
1 | package com.pilloxa.backgroundjob;
2 |
3 | import androidx.annotation.NonNull;
4 | import com.facebook.react.ReactNativeHost;
5 | import com.facebook.react.bridge.ReactContext;
6 | import com.facebook.react.common.LifecycleState;
7 |
8 | public class Utils {
9 | private Utils() {
10 | //no instance
11 | }
12 |
13 | /** Check whether on not the React Native application is in foreground. */
14 | public static boolean isReactNativeAppInForeground(@NonNull ReactNativeHost reactNativeHost) {
15 | if (!reactNativeHost.hasInstance()) {
16 | // If the app was force-stopped the instace will be destroyed. The instance can't be created from a background thread.
17 | return false;
18 | }
19 | ReactContext reactContext = reactNativeHost.getReactInstanceManager().getCurrentReactContext();
20 | return reactContext != null && reactContext.getLifecycleState() == LifecycleState.RESUMED;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/android/src/main/res/drawable-hdpi/ic_notification.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/android/src/main/res/drawable-mdpi/ic_notification.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xhdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/android/src/main/res/drawable-xhdpi/ic_notification.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/android/src/main/res/drawable-xxhdpi/ic_notification.png
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | node:
3 | version: 7
4 | environment:
5 | PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/example/node_modules/.bin"
6 | JAVA_OPTS: "-Xms518m -Xmx2048m"
7 | GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
8 |
9 | dependencies:
10 | pre:
11 | - echo y | android update sdk --no-ui --all --filter "android-25"
12 | - echo y | android update sdk --no-ui --all --filter "build-tools-25.0.2"
13 | override:
14 | - cd example && yarn
15 | - cd example/android && ./gradlew --stacktrace app:dependencies
16 | cache_directories:
17 | - ~/.android
18 | - ~/.gradle
19 |
20 | test:
21 | override:
22 | # start the emulator
23 | - emulator -avd circleci-android22 -no-window:
24 | background: true
25 | parallel: true
26 | # wait for it to have booted
27 | - circle-android wait-for-boot
28 | - adb shell pm grant com.backtest android.permission.SYSTEM_ALERT_WINDOW
29 | # install react native
30 | - cd example/android && ./gradlew installDebug
31 | # run tests against the emulator.
32 | - tests/assure-not-foreground.sh
33 | - tests/bg-working.sh
34 |
--------------------------------------------------------------------------------
/example/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
--------------------------------------------------------------------------------
/example/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/example/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | .*/Libraries/react-native/React.js
15 |
16 | ; Ignore polyfills
17 | .*/Libraries/polyfills/.*
18 |
19 | ; Ignore metro
20 | .*/node_modules/metro/.*
21 |
22 | [include]
23 |
24 | [libs]
25 | node_modules/react-native/Libraries/react-native/react-native-interface.js
26 | node_modules/react-native/flow/
27 | node_modules/react-native/flow-github/
28 |
29 | [options]
30 | emoji=true
31 |
32 | module.system=haste
33 | module.system.haste.use_name_reducers=true
34 | # get basename
35 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
36 | # strip .js or .js.flow suffix
37 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
38 | # strip .ios suffix
39 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
40 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
41 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
42 | module.system.haste.paths.blacklist=.*/__tests__/.*
43 | module.system.haste.paths.blacklist=.*/__mocks__/.*
44 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.*
45 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.*
46 |
47 | munge_underscores=true
48 |
49 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
50 |
51 | module.file_ext=.js
52 | module.file_ext=.jsx
53 | module.file_ext=.json
54 | module.file_ext=.native.js
55 |
56 | suppress_type=$FlowIssue
57 | suppress_type=$FlowFixMe
58 | suppress_type=$FlowFixMeProps
59 | suppress_type=$FlowFixMeState
60 |
61 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
62 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
64 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
65 |
66 | [version]
67 | ^0.75.0
68 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | *.keystore
43 |
44 | # fastlane
45 | #
46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47 | # screenshots whenever they are needed.
48 | # For more information about the recommended setup visit:
49 | # https://docs.fastlane.tools/best-practices/source-control/
50 |
51 | fastlane/report.xml
52 | fastlane/Preview.html
53 | fastlane/screenshots
54 | .vscode/
55 | jsconfig.json
56 | */fastlane/report.xml
57 | */fastlane/Preview.html
58 | */fastlane/screenshots
59 |
60 | # Bundle artifact
61 | *.jsbundle
62 |
--------------------------------------------------------------------------------
/example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/example/__tests__/index.android.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.android.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/example/__tests__/index.ios.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.ios.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/example/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | lib_deps = []
12 |
13 | for jarfile in glob(['libs/*.jar']):
14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15 | lib_deps.append(':' + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
21 | for aarfile in glob(['libs/*.aar']):
22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23 | lib_deps.append(':' + name)
24 | android_prebuilt_aar(
25 | name = name,
26 | aar = aarfile,
27 | )
28 |
29 | android_library(
30 | name = "all-libs",
31 | exported_deps = lib_deps,
32 | )
33 |
34 | android_library(
35 | name = "app-code",
36 | srcs = glob([
37 | "src/main/java/**/*.java",
38 | ]),
39 | deps = [
40 | ":all-libs",
41 | ":build_config",
42 | ":res",
43 | ],
44 | )
45 |
46 | android_build_config(
47 | name = "build_config",
48 | package = "com.backtest",
49 | )
50 |
51 | android_resource(
52 | name = "res",
53 | package = "com.backtest",
54 | res = "src/main/res",
55 | )
56 |
57 | android_binary(
58 | name = "app",
59 | keystore = "//android/keystores:debug",
60 | manifest = "src/main/AndroidManifest.xml",
61 | package_type = "debug",
62 | deps = [
63 | ":app-code",
64 | ],
65 | )
66 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // the root of your project, i.e. where "package.json" lives
37 | * root: "../../",
38 | *
39 | * // where to put the JS bundle asset in debug mode
40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
41 | *
42 | * // where to put the JS bundle asset in release mode
43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
44 | *
45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
46 | * // require('./image.png')), in debug mode
47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
48 | *
49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
50 | * // require('./image.png')), in release mode
51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
52 | *
53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
57 | * // for example, you might want to remove it from here.
58 | * inputExcludes: ["android/**", "ios/**"],
59 | *
60 | * // override which node gets called and with what additional arguments
61 | * nodeExecutableAndArgs: ["node"]
62 | *
63 | * // supply additional arguments to the packager
64 | * extraPackagerArgs: []
65 | * ]
66 | */
67 |
68 | def ci = System.getenv('CI') == 'true';
69 | if (ci) {
70 | project.ext.react = [
71 | bundleInDebug: true,
72 | entryFile: "index.js"
73 | ]
74 | } else {
75 |
76 | project.ext.react = [
77 | entryFile: "index.js"
78 | ]
79 | }
80 |
81 | apply from: "../../node_modules/react-native/react.gradle"
82 |
83 | /**
84 | * Set this to true to create two separate APKs instead of one:
85 | * - An APK that only works on ARM devices
86 | * - An APK that only works on x86 devices
87 | * The advantage is the size of the APK is reduced by about 4MB.
88 | * Upload all the APKs to the Play Store and people will download
89 | * the correct one based on the CPU architecture of their device.
90 | */
91 | def enableSeparateBuildPerCPUArchitecture = false
92 |
93 | /**
94 | * Run Proguard to shrink the Java bytecode in release builds.
95 | */
96 | def enableProguardInReleaseBuilds = false
97 |
98 | def getUser() {
99 | System.getenv('USER')
100 | }
101 |
102 |
103 | def getPassword(String currentUser, String keyChain) {
104 | def ci = System.getenv('CI') == 'true';
105 | if (ci) {
106 | ''
107 | } else {
108 | def stdout = new ByteArrayOutputStream()
109 | def stderr = new ByteArrayOutputStream()
110 | exec {
111 | commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
112 | standardOutput = stdout
113 | errorOutput = stderr
114 | ignoreExitValue true
115 | }
116 | //noinspection GroovyAssignabilityCheck
117 | stdout.toString().trim()
118 | }
119 | }
120 | android {
121 | compileSdkVersion rootProject.ext.compileSdkVersion
122 | buildToolsVersion rootProject.ext.buildToolsVersion
123 | defaultConfig {
124 | applicationId "com.backtest"
125 | minSdkVersion rootProject.ext.minSdkVersion
126 | targetSdkVersion rootProject.ext.targetSdkVersion
127 | versionCode 1
128 | versionName "1.0"
129 | ndk {
130 | abiFilters "armeabi-v7a", "x86"
131 | }
132 | }
133 |
134 | signingConfigs {
135 | //release {
136 | //storeFile file("bgjb.keystore")
137 | //storePassword pass
138 | //keyAlias "bgjb"
139 | //keyPassword pass
140 | //}
141 | }
142 |
143 | splits {
144 | abi {
145 | reset()
146 | enable enableSeparateBuildPerCPUArchitecture
147 | universalApk false // If true, also generate a universal APK
148 | include "armeabi-v7a", "x86"
149 | }
150 | }
151 | buildTypes {
152 | //release {
153 | //minifyEnabled enableProguardInReleaseBuilds
154 | //signingConfig signingConfigs.release
155 | //proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
156 | //}
157 | }
158 | // applicationVariants are e.g. debug, release
159 | applicationVariants.all { variant ->
160 | variant.outputs.each { output ->
161 | // For each separate APK per architecture, set a unique version code as described here:
162 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
163 | def versionCodes = ["armeabi-v7a":1, "x86":2]
164 | def abi = output.getFilter(OutputFile.ABI)
165 | if (abi != null) {
166 | // null for the universal-debug, universal-release variants
167 | output.versionCodeOverride =
168 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
169 | }
170 | }
171 | }
172 | }
173 |
174 | dependencies {
175 | compile project(':react-native-background-job')
176 | compile fileTree(include: ['*.jar'], dir: 'libs')
177 | compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
178 | compile 'com.facebook.react:react-native:+'
179 | // From node_modules
180 | }
181 |
182 | // Run this once to be able to run the application with BUCK
183 | // puts all compile dependencies into folder libs for BUCK to use
184 | task copyDownloadableDepsToLibs(type: Copy) {
185 | from configurations.compile
186 | into 'libs'
187 | }
188 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/backtest/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.backtest;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "backtest";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/backtest/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.backtest;
2 |
3 | import android.app.Application;
4 |
5 | import com.facebook.react.ReactApplication;
6 | import com.pilloxa.backgroundjob.BackgroundJobPackage;
7 | import com.facebook.react.ReactInstanceManager;
8 | import com.facebook.react.ReactNativeHost;
9 | import com.facebook.react.ReactPackage;
10 | import com.facebook.react.shell.MainReactPackage;
11 | import com.facebook.soloader.SoLoader;
12 |
13 | import java.util.Arrays;
14 | import java.util.List;
15 |
16 | public class MainApplication extends Application implements ReactApplication {
17 |
18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19 | @Override
20 | public boolean getUseDeveloperSupport() {
21 | return BuildConfig.DEBUG;
22 | }
23 |
24 | @Override
25 | protected List getPackages() {
26 | return Arrays.asList(
27 | new MainReactPackage(),
28 | new BackgroundJobPackage()
29 | );
30 | }
31 |
32 | @Override
33 | protected String getJSMainModuleName() {
34 | return "index";
35 | }
36 | };
37 |
38 | @Override
39 | public ReactNativeHost getReactNativeHost() {
40 | return mReactNativeHost;
41 | }
42 |
43 | @Override
44 | public void onCreate() {
45 | super.onCreate();
46 | SoLoader.init(this, /* native exopackage */ false);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-hdpi-v11/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-hdpi-v11/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-hdpi-v9/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-hdpi-v9/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-hdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-hdpi/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-mdpi-v11/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-mdpi-v11/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-mdpi-v9/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-mdpi-v9/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-mdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-mdpi/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xhdpi-v11/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xhdpi-v11/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xhdpi-v9/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xhdpi-v9/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xhdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xhdpi/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxhdpi-v11/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xxhdpi-v11/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxhdpi-v9/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xxhdpi-v9/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxhdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/drawable-xxhdpi/ic_notification.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | backtest
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | maven {
7 | // For developing the example app, expect this library to be installed as a node module
8 | // inside of the example app. So traverse from `./android/example/node_modules/react-native-maps/android`
9 | // to `./android/example/node_modules/react-native/android`.
10 | // react-native should be installed since it's a peer dependency
11 | url "$projectDir/../node_modules/react-native/android"
12 | }
13 | maven {
14 | url 'https://maven.google.com/'
15 | name 'Google'
16 | }
17 | }
18 | dependencies {
19 | classpath 'com.android.tools.build:gradle:2.3.3'
20 | // NOTE: Do not place your application dependencies here; they belong
21 | // in the individual module build.gradle files
22 | }
23 | }
24 |
25 | allprojects {
26 | repositories {
27 | mavenLocal()
28 | jcenter()
29 | maven {
30 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
31 | url "$rootDir/../node_modules/react-native/android"
32 | }
33 | maven {
34 | // For developing the example app, expect this library to be installed as a node module
35 | // inside of the example app. So traverse from `./android/example/node_modules/react-native-maps/android`
36 | // to `./android/example/node_modules/react-native/android`.
37 | // react-native should be installed since it's a peer dependency
38 | url "$projectDir/../../react-native/android"
39 | }
40 | maven {
41 | url 'https://maven.google.com/'
42 | name 'Google'
43 | }
44 | }
45 | }
46 |
47 | ext {
48 | buildToolsVersion = "26.0.1"
49 | minSdkVersion = 16
50 | compileSdkVersion = 26
51 | targetSdkVersion = 26
52 | supportLibVersion = "26.1.0"
53 | }
54 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | org.gradle.parallel=true
19 | rg.gradle.jvmargs=-Xmx1536M
20 |
21 | android.useDeprecatedNdk=true
22 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vikeri/react-native-background-job/83cde8515a2d8e3af8fa0475f6fd233386a3af2d/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Apr 03 18:42:25 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/example/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/example/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'backtest'
2 | include ':react-native-background-job'
3 | project(':react-native-background-job').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-job/android')
4 |
5 | include ':app'
6 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backtest",
3 | "displayName": "backtest"
4 | }
--------------------------------------------------------------------------------
/example/index.ios.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from "react";
8 | import {
9 | AppRegistry,
10 | TouchableHighlight,
11 | StyleSheet,
12 | Text,
13 | View
14 | } from "react-native";
15 |
16 | import BackgroundJob from "react-native-background-job";
17 | console.log(BackgroundJob);
18 | const myJobKey = "Hej";
19 |
20 | // This has to run outside of the component definition since the component is never
21 | // instantiated when running in headless mode
22 | BackgroundJob.register({
23 | jobKey: myJobKey,
24 | job: () => console.log("Background Job fired!")
25 | });
26 |
27 | export default class backtest extends Component {
28 | constructor(props) {
29 | super(props);
30 | this.state = { jobs: [] };
31 | }
32 |
33 | getAll() {
34 | BackgroundJob.getAll({
35 | callback: jobs => {
36 | this.setState({ jobs });
37 | console.log("Jobs:", jobs);
38 | }
39 | });
40 | }
41 |
42 | render() {
43 | return (
44 |
45 |
46 | Testing BackgroundJob
47 |
48 |
49 | Try connecting the device to the developer console, schedule an event and then quit the app.
50 |
51 |
52 | Scheduled jobs:
53 | {this.state.jobs.map(({ jobKey }) => jobKey)}
54 |
55 | {
58 | BackgroundJob.schedule({
59 | jobKey: myJobKey,
60 | period: 5000,
61 | timeout: 5000,
62 | networkType: BackgroundJob.NETWORK_TYPE_UNMETERED
63 | });
64 | this.getAll();
65 | }}
66 | >
67 | Schedule
68 |
69 | {
72 | BackgroundJob.cancel({ jobKey: myJobKey });
73 | this.getAll();
74 | }}
75 | >
76 | Cancel
77 |
78 | {
81 | BackgroundJob.cancelAll();
82 | this.getAll();
83 | }}
84 | >
85 | CancelAll
86 |
87 | {
90 | BackgroundJob.getAll({ callback: console.log });
91 | }}
92 | >
93 | GetAll
94 |
95 |
96 | );
97 | }
98 | componentDidMount() {
99 | this.getAll();
100 | }
101 | }
102 |
103 | const styles = StyleSheet.create({
104 | button: { padding: 20, backgroundColor: "#ccc", marginBottom: 10 },
105 | container: {
106 | flex: 1,
107 | justifyContent: "center",
108 | alignItems: "center",
109 | backgroundColor: "#F5FCFF"
110 | },
111 | welcome: { fontSize: 20, textAlign: "center", margin: 10 },
112 | instructions: { textAlign: "center", color: "#333333", marginBottom: 5 }
113 | });
114 |
115 | AppRegistry.registerComponent("backtest", () => backtest);
116 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from "react";
8 | import {
9 | AppRegistry,
10 | TouchableHighlight,
11 | StyleSheet,
12 | Text,
13 | View
14 | } from "react-native";
15 |
16 | import BackgroundJob from "react-native-background-job";
17 |
18 | const regularJobKey = "regularJobKey";
19 | const exactJobKey = "exactJobKey";
20 | const foregroundJobKey = "foregroundJobKey";
21 | /**
22 | * In Android SDK versions greater than 23, Doze is being used by apps by default,
23 | * in order to optimize battery by temporarily turning off background tasks when
24 | * the phone is left undisturbed for some hours.
25 | *
26 | * But, some apps may require background tasks to keep running, ignoring doze and
27 | * not optimizing battery (this means battery needs to be traded off for performance
28 | * as per required).
29 | *
30 | * Such jobs can be scheduled as everRunningJob is scheduled below.
31 | * It may be scheduled as normal jobs are, but they wont behave as expected. Doze
32 | * feature will disable the running background jobs if the phone remains undisturbed
33 | * for some time.
34 | *
35 | * So everRunningJob scheduled below can be scheduled by checking if is ignoring
36 | * optimizations.If true, schedule the job in the callback, else we notify the
37 | * user to manually remove the app from the battery optimization list.
38 | */
39 | const everRunningJobKey = "everRunningJobKey";
40 |
41 | // This has to run outside of the component definition since the component is never
42 | // instantiated when running in headless mode
43 | BackgroundJob.register({
44 | jobKey: regularJobKey,
45 | job: () => console.log(`Background Job fired!. Key = ${regularJobKey}`)
46 | });
47 | BackgroundJob.register({
48 | jobKey: exactJobKey,
49 | job: () => {
50 | console.log(`${new Date()}Exact Job fired!. Key = ${exactJobKey}`);
51 | }
52 | });
53 | BackgroundJob.register({
54 | jobKey: foregroundJobKey,
55 | job: () => console.log(`Exact Job fired!. Key = ${foregroundJobKey}`)
56 | });
57 | BackgroundJob.register({
58 | jobKey: everRunningJobKey,
59 | job: () => console.log(`Ever Running Job fired! Key=${everRunningJobKey}`)
60 | });
61 |
62 | export default class backtest extends Component {
63 | constructor(props) {
64 | super(props);
65 | this.state = { jobs: [] };
66 | }
67 |
68 | render() {
69 | return (
70 |
71 | Testing BackgroundJob
72 |
73 | Try connecting the device to the developer console, schedule an event
74 | and then quit the app.
75 |
76 |
77 | Scheduled jobs:
78 | {this.state.jobs.map(({ jobKey }) => jobKey)}
79 |
80 | {
83 | BackgroundJob.schedule({
84 | jobKey: regularJobKey,
85 | notificationTitle: "Notification title",
86 | notificationText: "Notification text",
87 | period: 15000
88 | });
89 | }}
90 | >
91 | Schedule regular job
92 |
93 | {
96 | BackgroundJob.schedule({
97 | jobKey: exactJobKey,
98 | period: 1000,
99 | exact: true
100 | });
101 | }}
102 | >
103 | Schedule exact job
104 |
105 | {
108 | BackgroundJob.schedule({
109 | jobKey: foregroundJobKey,
110 | period: 1000,
111 | exact: true,
112 | allowExecutionInForeground: true
113 | });
114 | }}
115 | >
116 | Schedule exact foreground job
117 |
118 | {
121 | BackgroundJob.isAppIgnoringBatteryOptimization(
122 | (error, ignoringOptimization) => {
123 | if (ignoringOptimization === true) {
124 | BackgroundJob.schedule({
125 | jobKey: everRunningJobKey,
126 | period: 1000,
127 | exact: true,
128 | allowWhileIdle: true
129 | });
130 | } else {
131 | console.log(
132 | "To ensure app functions properly,please manually remove app from battery optimization menu."
133 | );
134 | //Dispay a toast or alert to user indicating that the app needs to be removed from battery optimization list, for the job to get fired regularly
135 | }
136 | }
137 | );
138 | }}
139 | >
140 | Schedule ever running job
141 |
142 | {
145 | BackgroundJob.cancel({ jobKey: regularJobKey });
146 | }}
147 | >
148 | Cancel regular job
149 |
150 | {
153 | BackgroundJob.cancelAll();
154 | }}
155 | >
156 | CancelAll
157 |
158 |
159 | );
160 | }
161 | componentDidMount() {
162 | // BackgroundJob.schedule({
163 | // jobKey: exactJobKey,
164 | // period: 1000,
165 | // timeout: 10000,
166 | // exact: true
167 | // });
168 | }
169 | }
170 |
171 | const styles = StyleSheet.create({
172 | button: { padding: 20, backgroundColor: "#ccc", marginBottom: 10 },
173 | container: {
174 | flex: 1,
175 | justifyContent: "center",
176 | alignItems: "center",
177 | backgroundColor: "#F5FCFF"
178 | },
179 | welcome: { fontSize: 20, textAlign: "center", margin: 10 },
180 | instructions: { textAlign: "center", color: "#333333", marginBottom: 5 }
181 | });
182 |
183 | AppRegistry.registerComponent("backtest", () => backtest);
184 |
--------------------------------------------------------------------------------
/example/ios/backtest-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 |
44 | NSExceptionDomains
45 |
46 | localhost
47 |
48 | NSExceptionAllowsInsecureHTTPLoads
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/example/ios/backtest-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/backtest.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 | /* Begin PBXBuildFile section */
9 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
10 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
11 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
12 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
13 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
14 | 00E356F31AD99517003FC87E /* backtestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* backtestTests.m */; };
15 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
16 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
17 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
18 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
19 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
20 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
21 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
22 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
23 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
25 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
26 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
27 | 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
28 | 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; };
29 | 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; };
30 | 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; };
31 | 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; };
32 | 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; };
33 | 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; };
34 | 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
35 | 2DCD954D1E0B4F2C00145EB5 /* backtestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* backtestTests.m */; };
36 | 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
37 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
38 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
39 | ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
40 | /* End PBXBuildFile section */
41 |
42 | /* Begin PBXContainerItemProxy section */
43 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
44 | isa = PBXContainerItemProxy;
45 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
46 | proxyType = 2;
47 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
48 | remoteInfo = RCTActionSheet;
49 | };
50 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
51 | isa = PBXContainerItemProxy;
52 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
53 | proxyType = 2;
54 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
55 | remoteInfo = RCTGeolocation;
56 | };
57 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
58 | isa = PBXContainerItemProxy;
59 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
60 | proxyType = 2;
61 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
62 | remoteInfo = RCTImage;
63 | };
64 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
65 | isa = PBXContainerItemProxy;
66 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
67 | proxyType = 2;
68 | remoteGlobalIDString = 58B511DB1A9E6C8500147676;
69 | remoteInfo = RCTNetwork;
70 | };
71 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
72 | isa = PBXContainerItemProxy;
73 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
74 | proxyType = 2;
75 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
76 | remoteInfo = RCTVibration;
77 | };
78 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
79 | isa = PBXContainerItemProxy;
80 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
81 | proxyType = 1;
82 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
83 | remoteInfo = backtest;
84 | };
85 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
86 | isa = PBXContainerItemProxy;
87 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
88 | proxyType = 2;
89 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
90 | remoteInfo = RCTSettings;
91 | };
92 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
93 | isa = PBXContainerItemProxy;
94 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
95 | proxyType = 2;
96 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
97 | remoteInfo = RCTWebSocket;
98 | };
99 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
100 | isa = PBXContainerItemProxy;
101 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
102 | proxyType = 2;
103 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
104 | remoteInfo = React;
105 | };
106 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
107 | isa = PBXContainerItemProxy;
108 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
109 | proxyType = 1;
110 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7;
111 | remoteInfo = "backtest-tvOS";
112 | };
113 | 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {
114 | isa = PBXContainerItemProxy;
115 | containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
116 | proxyType = 2;
117 | remoteGlobalIDString = ADD01A681E09402E00F6D226;
118 | remoteInfo = "RCTBlob-tvOS";
119 | };
120 | 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {
121 | isa = PBXContainerItemProxy;
122 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
123 | proxyType = 2;
124 | remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;
125 | remoteInfo = fishhook;
126 | };
127 | 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {
128 | isa = PBXContainerItemProxy;
129 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
130 | proxyType = 2;
131 | remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
132 | remoteInfo = "fishhook-tvOS";
133 | };
134 | 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */ = {
135 | isa = PBXContainerItemProxy;
136 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
137 | proxyType = 2;
138 | remoteGlobalIDString = EBF21BDC1FC498900052F4D5;
139 | remoteInfo = jsinspector;
140 | };
141 | 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */ = {
142 | isa = PBXContainerItemProxy;
143 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
144 | proxyType = 2;
145 | remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;
146 | remoteInfo = "jsinspector-tvOS";
147 | };
148 | 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */ = {
149 | isa = PBXContainerItemProxy;
150 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
151 | proxyType = 2;
152 | remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
153 | remoteInfo = "third-party";
154 | };
155 | 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */ = {
156 | isa = PBXContainerItemProxy;
157 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
158 | proxyType = 2;
159 | remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
160 | remoteInfo = "third-party-tvOS";
161 | };
162 | 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */ = {
163 | isa = PBXContainerItemProxy;
164 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
165 | proxyType = 2;
166 | remoteGlobalIDString = 139D7E881E25C6D100323FB7;
167 | remoteInfo = "double-conversion";
168 | };
169 | 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */ = {
170 | isa = PBXContainerItemProxy;
171 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
172 | proxyType = 2;
173 | remoteGlobalIDString = 3D383D621EBD27B9005632C8;
174 | remoteInfo = "double-conversion-tvOS";
175 | };
176 | 2DF0FFEA2056DD460020B375 /* PBXContainerItemProxy */ = {
177 | isa = PBXContainerItemProxy;
178 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
179 | proxyType = 2;
180 | remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
181 | remoteInfo = privatedata;
182 | };
183 | 2DF0FFEC2056DD460020B375 /* PBXContainerItemProxy */ = {
184 | isa = PBXContainerItemProxy;
185 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
186 | proxyType = 2;
187 | remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
188 | remoteInfo = "privatedata-tvOS";
189 | };
190 | 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = {
191 | isa = PBXContainerItemProxy;
192 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
193 | proxyType = 2;
194 | remoteGlobalIDString = 2D2A283A1D9B042B00D4039D;
195 | remoteInfo = "RCTImage-tvOS";
196 | };
197 | 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = {
198 | isa = PBXContainerItemProxy;
199 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
200 | proxyType = 2;
201 | remoteGlobalIDString = 2D2A28471D9B043800D4039D;
202 | remoteInfo = "RCTLinking-tvOS";
203 | };
204 | 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
205 | isa = PBXContainerItemProxy;
206 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
207 | proxyType = 2;
208 | remoteGlobalIDString = 2D2A28541D9B044C00D4039D;
209 | remoteInfo = "RCTNetwork-tvOS";
210 | };
211 | 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
212 | isa = PBXContainerItemProxy;
213 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
214 | proxyType = 2;
215 | remoteGlobalIDString = 2D2A28611D9B046600D4039D;
216 | remoteInfo = "RCTSettings-tvOS";
217 | };
218 | 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = {
219 | isa = PBXContainerItemProxy;
220 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
221 | proxyType = 2;
222 | remoteGlobalIDString = 2D2A287B1D9B048500D4039D;
223 | remoteInfo = "RCTText-tvOS";
224 | };
225 | 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = {
226 | isa = PBXContainerItemProxy;
227 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
228 | proxyType = 2;
229 | remoteGlobalIDString = 2D2A28881D9B049200D4039D;
230 | remoteInfo = "RCTWebSocket-tvOS";
231 | };
232 | 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = {
233 | isa = PBXContainerItemProxy;
234 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
235 | proxyType = 2;
236 | remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
237 | remoteInfo = "React-tvOS";
238 | };
239 | 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = {
240 | isa = PBXContainerItemProxy;
241 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
242 | proxyType = 2;
243 | remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
244 | remoteInfo = yoga;
245 | };
246 | 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = {
247 | isa = PBXContainerItemProxy;
248 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
249 | proxyType = 2;
250 | remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
251 | remoteInfo = "yoga-tvOS";
252 | };
253 | 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = {
254 | isa = PBXContainerItemProxy;
255 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
256 | proxyType = 2;
257 | remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4;
258 | remoteInfo = cxxreact;
259 | };
260 | 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
261 | isa = PBXContainerItemProxy;
262 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
263 | proxyType = 2;
264 | remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
265 | remoteInfo = "cxxreact-tvOS";
266 | };
267 | 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
268 | isa = PBXContainerItemProxy;
269 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
270 | proxyType = 2;
271 | remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4;
272 | remoteInfo = jschelpers;
273 | };
274 | 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
275 | isa = PBXContainerItemProxy;
276 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
277 | proxyType = 2;
278 | remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
279 | remoteInfo = "jschelpers-tvOS";
280 | };
281 | 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = {
282 | isa = PBXContainerItemProxy;
283 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
284 | proxyType = 2;
285 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
286 | remoteInfo = RCTAnimation;
287 | };
288 | 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = {
289 | isa = PBXContainerItemProxy;
290 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
291 | proxyType = 2;
292 | remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
293 | remoteInfo = "RCTAnimation-tvOS";
294 | };
295 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
296 | isa = PBXContainerItemProxy;
297 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
298 | proxyType = 2;
299 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
300 | remoteInfo = RCTLinking;
301 | };
302 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
303 | isa = PBXContainerItemProxy;
304 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
305 | proxyType = 2;
306 | remoteGlobalIDString = 58B5119B1A9E6C1200147676;
307 | remoteInfo = RCTText;
308 | };
309 | ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */ = {
310 | isa = PBXContainerItemProxy;
311 | containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
312 | proxyType = 2;
313 | remoteGlobalIDString = 358F4ED71D1E81A9004DF814;
314 | remoteInfo = RCTBlob;
315 | };
316 | /* End PBXContainerItemProxy section */
317 |
318 | /* Begin PBXFileReference section */
319 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; };
320 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; };
321 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; };
322 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; };
323 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; };
324 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; };
325 | 00E356EE1AD99517003FC87E /* backtestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = backtestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
326 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
327 | 00E356F21AD99517003FC87E /* backtestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = backtestTests.m; sourceTree = ""; };
328 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
329 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; };
330 | 13B07F961A680F5B00A75B9A /* backtest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = backtest.app; sourceTree = BUILT_PRODUCTS_DIR; };
331 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = backtest/AppDelegate.h; sourceTree = ""; };
332 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = backtest/AppDelegate.m; sourceTree = ""; };
333 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
334 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = backtest/Images.xcassets; sourceTree = ""; };
335 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = backtest/Info.plist; sourceTree = ""; };
336 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = backtest/main.m; sourceTree = ""; };
337 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; };
338 | 2D02E47B1E0B4A5D006451C7 /* backtest-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "backtest-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
339 | 2D02E4901E0B4A5D006451C7 /* backtest-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "backtest-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
340 | 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
341 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; };
342 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; };
343 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; };
344 | ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; };
345 | /* End PBXFileReference section */
346 |
347 | /* Begin PBXFrameworksBuildPhase section */
348 | 00E356EB1AD99517003FC87E /* Frameworks */ = {
349 | isa = PBXFrameworksBuildPhase;
350 | buildActionMask = 2147483647;
351 | files = (
352 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */,
353 | );
354 | runOnlyForDeploymentPostprocessing = 0;
355 | };
356 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
357 | isa = PBXFrameworksBuildPhase;
358 | buildActionMask = 2147483647;
359 | files = (
360 | ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
361 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
362 | 146834051AC3E58100842450 /* libReact.a in Frameworks */,
363 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
364 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
365 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
366 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
367 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
368 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
369 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
370 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
371 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
372 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
373 | C33D50EBF8D24E498023B5FC /* libRNBackgroundJob.a in Frameworks */,
374 | );
375 | runOnlyForDeploymentPostprocessing = 0;
376 | };
377 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = {
378 | isa = PBXFrameworksBuildPhase;
379 | buildActionMask = 2147483647;
380 | files = (
381 | 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */,
382 | 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,
383 | 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,
384 | 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */,
385 | 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */,
386 | 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */,
387 | 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */,
388 | 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */,
389 | );
390 | runOnlyForDeploymentPostprocessing = 0;
391 | };
392 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = {
393 | isa = PBXFrameworksBuildPhase;
394 | buildActionMask = 2147483647;
395 | files = (
396 | 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */,
397 | );
398 | runOnlyForDeploymentPostprocessing = 0;
399 | };
400 | /* End PBXFrameworksBuildPhase section */
401 |
402 | /* Begin PBXGroup section */
403 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = {
404 | isa = PBXGroup;
405 | children = (
406 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
407 | );
408 | name = Products;
409 | sourceTree = "";
410 | };
411 | 00C302B61ABCB90400DB3ED1 /* Products */ = {
412 | isa = PBXGroup;
413 | children = (
414 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
415 | );
416 | name = Products;
417 | sourceTree = "";
418 | };
419 | 00C302BC1ABCB91800DB3ED1 /* Products */ = {
420 | isa = PBXGroup;
421 | children = (
422 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
423 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */,
424 | );
425 | name = Products;
426 | sourceTree = "";
427 | };
428 | 00C302D41ABCB9D200DB3ED1 /* Products */ = {
429 | isa = PBXGroup;
430 | children = (
431 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
432 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */,
433 | );
434 | name = Products;
435 | sourceTree = "";
436 | };
437 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = {
438 | isa = PBXGroup;
439 | children = (
440 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
441 | );
442 | name = Products;
443 | sourceTree = "";
444 | };
445 | 00E356EF1AD99517003FC87E /* backtestTests */ = {
446 | isa = PBXGroup;
447 | children = (
448 | 00E356F21AD99517003FC87E /* backtestTests.m */,
449 | 00E356F01AD99517003FC87E /* Supporting Files */,
450 | );
451 | path = backtestTests;
452 | sourceTree = "";
453 | };
454 | 00E356F01AD99517003FC87E /* Supporting Files */ = {
455 | isa = PBXGroup;
456 | children = (
457 | 00E356F11AD99517003FC87E /* Info.plist */,
458 | );
459 | name = "Supporting Files";
460 | sourceTree = "";
461 | };
462 | 139105B71AF99BAD00B5F7CC /* Products */ = {
463 | isa = PBXGroup;
464 | children = (
465 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
466 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */,
467 | );
468 | name = Products;
469 | sourceTree = "";
470 | };
471 | 139FDEE71B06529A00C62182 /* Products */ = {
472 | isa = PBXGroup;
473 | children = (
474 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
475 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,
476 | 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */,
477 | 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */,
478 | );
479 | name = Products;
480 | sourceTree = "";
481 | };
482 | 13B07FAE1A68108700A75B9A /* backtest */ = {
483 | isa = PBXGroup;
484 | children = (
485 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */,
486 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
487 | 13B07FB01A68108700A75B9A /* AppDelegate.m */,
488 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
489 | 13B07FB61A68108700A75B9A /* Info.plist */,
490 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
491 | 13B07FB71A68108700A75B9A /* main.m */,
492 | );
493 | name = backtest;
494 | sourceTree = "";
495 | };
496 | 146834001AC3E56700842450 /* Products */ = {
497 | isa = PBXGroup;
498 | children = (
499 | 146834041AC3E56700842450 /* libReact.a */,
500 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */,
501 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */,
502 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */,
503 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */,
504 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
505 | 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
506 | 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
507 | 2DF0FFDF2056DD460020B375 /* libjsinspector.a */,
508 | 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */,
509 | 2DF0FFE32056DD460020B375 /* libthird-party.a */,
510 | 2DF0FFE52056DD460020B375 /* libthird-party.a */,
511 | 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */,
512 | 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */,
513 | 2DF0FFEB2056DD460020B375 /* libprivatedata.a */,
514 | 2DF0FFED2056DD460020B375 /* libprivatedata-tvOS.a */,
515 | );
516 | name = Products;
517 | sourceTree = "";
518 | };
519 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
520 | isa = PBXGroup;
521 | children = (
522 | 2D16E6891FA4F8E400B85C8A /* libReact.a */,
523 | );
524 | name = Frameworks;
525 | sourceTree = "";
526 | };
527 | 5E91572E1DD0AC6500FF2AA8 /* Products */ = {
528 | isa = PBXGroup;
529 | children = (
530 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
531 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
532 | );
533 | name = Products;
534 | sourceTree = "";
535 | };
536 | 78C398B11ACF4ADC00677621 /* Products */ = {
537 | isa = PBXGroup;
538 | children = (
539 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
540 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */,
541 | );
542 | name = Products;
543 | sourceTree = "";
544 | };
545 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
546 | isa = PBXGroup;
547 | children = (
548 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
549 | 146833FF1AC3E56700842450 /* React.xcodeproj */,
550 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
551 | ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */,
552 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
553 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
554 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
555 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
556 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
557 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
558 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
559 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
560 | BC353540E031425A8F02FBC2 /* RNBackgroundJob.xcodeproj */,
561 | );
562 | name = Libraries;
563 | sourceTree = "";
564 | };
565 | 832341B11AAA6A8300B99B32 /* Products */ = {
566 | isa = PBXGroup;
567 | children = (
568 | 832341B51AAA6A8300B99B32 /* libRCTText.a */,
569 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */,
570 | );
571 | name = Products;
572 | sourceTree = "";
573 | };
574 | 83CBB9F61A601CBA00E9B192 = {
575 | isa = PBXGroup;
576 | children = (
577 | 13B07FAE1A68108700A75B9A /* backtest */,
578 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
579 | 00E356EF1AD99517003FC87E /* backtestTests */,
580 | 83CBBA001A601CBA00E9B192 /* Products */,
581 | 2D16E6871FA4F8E400B85C8A /* Frameworks */,
582 | );
583 | indentWidth = 2;
584 | sourceTree = "";
585 | tabWidth = 2;
586 | usesTabs = 0;
587 | };
588 | 83CBBA001A601CBA00E9B192 /* Products */ = {
589 | isa = PBXGroup;
590 | children = (
591 | 13B07F961A680F5B00A75B9A /* backtest.app */,
592 | 00E356EE1AD99517003FC87E /* backtestTests.xctest */,
593 | 2D02E47B1E0B4A5D006451C7 /* backtest-tvOS.app */,
594 | 2D02E4901E0B4A5D006451C7 /* backtest-tvOSTests.xctest */,
595 | );
596 | name = Products;
597 | sourceTree = "";
598 | };
599 | ADBDB9201DFEBF0600ED6528 /* Products */ = {
600 | isa = PBXGroup;
601 | children = (
602 | ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */,
603 | 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */,
604 | );
605 | name = Products;
606 | sourceTree = "";
607 | };
608 | /* End PBXGroup section */
609 |
610 | /* Begin PBXNativeTarget section */
611 | 00E356ED1AD99517003FC87E /* backtestTests */ = {
612 | isa = PBXNativeTarget;
613 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "backtestTests" */;
614 | buildPhases = (
615 | 00E356EA1AD99517003FC87E /* Sources */,
616 | 00E356EB1AD99517003FC87E /* Frameworks */,
617 | 00E356EC1AD99517003FC87E /* Resources */,
618 | );
619 | buildRules = (
620 | );
621 | dependencies = (
622 | 00E356F51AD99517003FC87E /* PBXTargetDependency */,
623 | );
624 | name = backtestTests;
625 | productName = backtestTests;
626 | productReference = 00E356EE1AD99517003FC87E /* backtestTests.xctest */;
627 | productType = "com.apple.product-type.bundle.unit-test";
628 | };
629 | 13B07F861A680F5B00A75B9A /* backtest */ = {
630 | isa = PBXNativeTarget;
631 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "backtest" */;
632 | buildPhases = (
633 | 13B07F871A680F5B00A75B9A /* Sources */,
634 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
635 | 13B07F8E1A680F5B00A75B9A /* Resources */,
636 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
637 | );
638 | buildRules = (
639 | );
640 | dependencies = (
641 | );
642 | name = backtest;
643 | productName = "Hello World";
644 | productReference = 13B07F961A680F5B00A75B9A /* backtest.app */;
645 | productType = "com.apple.product-type.application";
646 | };
647 | 2D02E47A1E0B4A5D006451C7 /* backtest-tvOS */ = {
648 | isa = PBXNativeTarget;
649 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "backtest-tvOS" */;
650 | buildPhases = (
651 | 2D02E4771E0B4A5D006451C7 /* Sources */,
652 | 2D02E4781E0B4A5D006451C7 /* Frameworks */,
653 | 2D02E4791E0B4A5D006451C7 /* Resources */,
654 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */,
655 | );
656 | buildRules = (
657 | );
658 | dependencies = (
659 | );
660 | name = "backtest-tvOS";
661 | productName = "backtest-tvOS";
662 | productReference = 2D02E47B1E0B4A5D006451C7 /* backtest-tvOS.app */;
663 | productType = "com.apple.product-type.application";
664 | };
665 | 2D02E48F1E0B4A5D006451C7 /* backtest-tvOSTests */ = {
666 | isa = PBXNativeTarget;
667 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "backtest-tvOSTests" */;
668 | buildPhases = (
669 | 2D02E48C1E0B4A5D006451C7 /* Sources */,
670 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */,
671 | 2D02E48E1E0B4A5D006451C7 /* Resources */,
672 | );
673 | buildRules = (
674 | );
675 | dependencies = (
676 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */,
677 | );
678 | name = "backtest-tvOSTests";
679 | productName = "backtest-tvOSTests";
680 | productReference = 2D02E4901E0B4A5D006451C7 /* backtest-tvOSTests.xctest */;
681 | productType = "com.apple.product-type.bundle.unit-test";
682 | };
683 | /* End PBXNativeTarget section */
684 |
685 | /* Begin PBXProject section */
686 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
687 | isa = PBXProject;
688 | attributes = {
689 | LastUpgradeCheck = 610;
690 | ORGANIZATIONNAME = Facebook;
691 | TargetAttributes = {
692 | 00E356ED1AD99517003FC87E = {
693 | CreatedOnToolsVersion = 6.2;
694 | TestTargetID = 13B07F861A680F5B00A75B9A;
695 | };
696 | 2D02E47A1E0B4A5D006451C7 = {
697 | CreatedOnToolsVersion = 8.2.1;
698 | ProvisioningStyle = Automatic;
699 | };
700 | 2D02E48F1E0B4A5D006451C7 = {
701 | CreatedOnToolsVersion = 8.2.1;
702 | ProvisioningStyle = Automatic;
703 | TestTargetID = 2D02E47A1E0B4A5D006451C7;
704 | };
705 | };
706 | };
707 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "backtest" */;
708 | compatibilityVersion = "Xcode 3.2";
709 | developmentRegion = English;
710 | hasScannedForEncodings = 0;
711 | knownRegions = (
712 | en,
713 | Base,
714 | );
715 | mainGroup = 83CBB9F61A601CBA00E9B192;
716 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
717 | projectDirPath = "";
718 | projectReferences = (
719 | {
720 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
721 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
722 | },
723 | {
724 | ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */;
725 | ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
726 | },
727 | {
728 | ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */;
729 | ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
730 | },
731 | {
732 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
733 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
734 | },
735 | {
736 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
737 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
738 | },
739 | {
740 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
741 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
742 | },
743 | {
744 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
745 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
746 | },
747 | {
748 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
749 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
750 | },
751 | {
752 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
753 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
754 | },
755 | {
756 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
757 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
758 | },
759 | {
760 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
761 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
762 | },
763 | {
764 | ProductGroup = 146834001AC3E56700842450 /* Products */;
765 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
766 | },
767 | );
768 | projectRoot = "";
769 | targets = (
770 | 13B07F861A680F5B00A75B9A /* backtest */,
771 | 00E356ED1AD99517003FC87E /* backtestTests */,
772 | 2D02E47A1E0B4A5D006451C7 /* backtest-tvOS */,
773 | 2D02E48F1E0B4A5D006451C7 /* backtest-tvOSTests */,
774 | );
775 | };
776 | /* End PBXProject section */
777 |
778 | /* Begin PBXReferenceProxy section */
779 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
780 | isa = PBXReferenceProxy;
781 | fileType = archive.ar;
782 | path = libRCTActionSheet.a;
783 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
784 | sourceTree = BUILT_PRODUCTS_DIR;
785 | };
786 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
787 | isa = PBXReferenceProxy;
788 | fileType = archive.ar;
789 | path = libRCTGeolocation.a;
790 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
791 | sourceTree = BUILT_PRODUCTS_DIR;
792 | };
793 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
794 | isa = PBXReferenceProxy;
795 | fileType = archive.ar;
796 | path = libRCTImage.a;
797 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
798 | sourceTree = BUILT_PRODUCTS_DIR;
799 | };
800 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
801 | isa = PBXReferenceProxy;
802 | fileType = archive.ar;
803 | path = libRCTNetwork.a;
804 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
805 | sourceTree = BUILT_PRODUCTS_DIR;
806 | };
807 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
808 | isa = PBXReferenceProxy;
809 | fileType = archive.ar;
810 | path = libRCTVibration.a;
811 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
812 | sourceTree = BUILT_PRODUCTS_DIR;
813 | };
814 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
815 | isa = PBXReferenceProxy;
816 | fileType = archive.ar;
817 | path = libRCTSettings.a;
818 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
819 | sourceTree = BUILT_PRODUCTS_DIR;
820 | };
821 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
822 | isa = PBXReferenceProxy;
823 | fileType = archive.ar;
824 | path = libRCTWebSocket.a;
825 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
826 | sourceTree = BUILT_PRODUCTS_DIR;
827 | };
828 | 146834041AC3E56700842450 /* libReact.a */ = {
829 | isa = PBXReferenceProxy;
830 | fileType = archive.ar;
831 | path = libReact.a;
832 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
833 | sourceTree = BUILT_PRODUCTS_DIR;
834 | };
835 | 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */ = {
836 | isa = PBXReferenceProxy;
837 | fileType = archive.ar;
838 | path = "libRCTBlob-tvOS.a";
839 | remoteRef = 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */;
840 | sourceTree = BUILT_PRODUCTS_DIR;
841 | };
842 | 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */ = {
843 | isa = PBXReferenceProxy;
844 | fileType = archive.ar;
845 | path = libfishhook.a;
846 | remoteRef = 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */;
847 | sourceTree = BUILT_PRODUCTS_DIR;
848 | };
849 | 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */ = {
850 | isa = PBXReferenceProxy;
851 | fileType = archive.ar;
852 | path = "libfishhook-tvOS.a";
853 | remoteRef = 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */;
854 | sourceTree = BUILT_PRODUCTS_DIR;
855 | };
856 | 2DF0FFDF2056DD460020B375 /* libjsinspector.a */ = {
857 | isa = PBXReferenceProxy;
858 | fileType = archive.ar;
859 | path = libjsinspector.a;
860 | remoteRef = 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */;
861 | sourceTree = BUILT_PRODUCTS_DIR;
862 | };
863 | 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */ = {
864 | isa = PBXReferenceProxy;
865 | fileType = archive.ar;
866 | path = "libjsinspector-tvOS.a";
867 | remoteRef = 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */;
868 | sourceTree = BUILT_PRODUCTS_DIR;
869 | };
870 | 2DF0FFE32056DD460020B375 /* libthird-party.a */ = {
871 | isa = PBXReferenceProxy;
872 | fileType = archive.ar;
873 | path = "libthird-party.a";
874 | remoteRef = 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */;
875 | sourceTree = BUILT_PRODUCTS_DIR;
876 | };
877 | 2DF0FFE52056DD460020B375 /* libthird-party.a */ = {
878 | isa = PBXReferenceProxy;
879 | fileType = archive.ar;
880 | path = "libthird-party.a";
881 | remoteRef = 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */;
882 | sourceTree = BUILT_PRODUCTS_DIR;
883 | };
884 | 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */ = {
885 | isa = PBXReferenceProxy;
886 | fileType = archive.ar;
887 | path = "libdouble-conversion.a";
888 | remoteRef = 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */;
889 | sourceTree = BUILT_PRODUCTS_DIR;
890 | };
891 | 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */ = {
892 | isa = PBXReferenceProxy;
893 | fileType = archive.ar;
894 | path = "libdouble-conversion.a";
895 | remoteRef = 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */;
896 | sourceTree = BUILT_PRODUCTS_DIR;
897 | };
898 | 2DF0FFEB2056DD460020B375 /* libprivatedata.a */ = {
899 | isa = PBXReferenceProxy;
900 | fileType = archive.ar;
901 | path = libprivatedata.a;
902 | remoteRef = 2DF0FFEA2056DD460020B375 /* PBXContainerItemProxy */;
903 | sourceTree = BUILT_PRODUCTS_DIR;
904 | };
905 | 2DF0FFED2056DD460020B375 /* libprivatedata-tvOS.a */ = {
906 | isa = PBXReferenceProxy;
907 | fileType = archive.ar;
908 | path = "libprivatedata-tvOS.a";
909 | remoteRef = 2DF0FFEC2056DD460020B375 /* PBXContainerItemProxy */;
910 | sourceTree = BUILT_PRODUCTS_DIR;
911 | };
912 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
913 | isa = PBXReferenceProxy;
914 | fileType = archive.ar;
915 | path = "libRCTImage-tvOS.a";
916 | remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */;
917 | sourceTree = BUILT_PRODUCTS_DIR;
918 | };
919 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = {
920 | isa = PBXReferenceProxy;
921 | fileType = archive.ar;
922 | path = "libRCTLinking-tvOS.a";
923 | remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */;
924 | sourceTree = BUILT_PRODUCTS_DIR;
925 | };
926 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = {
927 | isa = PBXReferenceProxy;
928 | fileType = archive.ar;
929 | path = "libRCTNetwork-tvOS.a";
930 | remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */;
931 | sourceTree = BUILT_PRODUCTS_DIR;
932 | };
933 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = {
934 | isa = PBXReferenceProxy;
935 | fileType = archive.ar;
936 | path = "libRCTSettings-tvOS.a";
937 | remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */;
938 | sourceTree = BUILT_PRODUCTS_DIR;
939 | };
940 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = {
941 | isa = PBXReferenceProxy;
942 | fileType = archive.ar;
943 | path = "libRCTText-tvOS.a";
944 | remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */;
945 | sourceTree = BUILT_PRODUCTS_DIR;
946 | };
947 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = {
948 | isa = PBXReferenceProxy;
949 | fileType = archive.ar;
950 | path = "libRCTWebSocket-tvOS.a";
951 | remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */;
952 | sourceTree = BUILT_PRODUCTS_DIR;
953 | };
954 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = {
955 | isa = PBXReferenceProxy;
956 | fileType = archive.ar;
957 | path = libReact.a;
958 | remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */;
959 | sourceTree = BUILT_PRODUCTS_DIR;
960 | };
961 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = {
962 | isa = PBXReferenceProxy;
963 | fileType = archive.ar;
964 | path = libyoga.a;
965 | remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */;
966 | sourceTree = BUILT_PRODUCTS_DIR;
967 | };
968 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = {
969 | isa = PBXReferenceProxy;
970 | fileType = archive.ar;
971 | path = libyoga.a;
972 | remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */;
973 | sourceTree = BUILT_PRODUCTS_DIR;
974 | };
975 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = {
976 | isa = PBXReferenceProxy;
977 | fileType = archive.ar;
978 | path = libcxxreact.a;
979 | remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */;
980 | sourceTree = BUILT_PRODUCTS_DIR;
981 | };
982 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = {
983 | isa = PBXReferenceProxy;
984 | fileType = archive.ar;
985 | path = libcxxreact.a;
986 | remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */;
987 | sourceTree = BUILT_PRODUCTS_DIR;
988 | };
989 | 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = {
990 | isa = PBXReferenceProxy;
991 | fileType = archive.ar;
992 | path = libjschelpers.a;
993 | remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */;
994 | sourceTree = BUILT_PRODUCTS_DIR;
995 | };
996 | 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = {
997 | isa = PBXReferenceProxy;
998 | fileType = archive.ar;
999 | path = libjschelpers.a;
1000 | remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */;
1001 | sourceTree = BUILT_PRODUCTS_DIR;
1002 | };
1003 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
1004 | isa = PBXReferenceProxy;
1005 | fileType = archive.ar;
1006 | path = libRCTAnimation.a;
1007 | remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
1008 | sourceTree = BUILT_PRODUCTS_DIR;
1009 | };
1010 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
1011 | isa = PBXReferenceProxy;
1012 | fileType = archive.ar;
1013 | path = libRCTAnimation.a;
1014 | remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
1015 | sourceTree = BUILT_PRODUCTS_DIR;
1016 | };
1017 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
1018 | isa = PBXReferenceProxy;
1019 | fileType = archive.ar;
1020 | path = libRCTLinking.a;
1021 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
1022 | sourceTree = BUILT_PRODUCTS_DIR;
1023 | };
1024 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
1025 | isa = PBXReferenceProxy;
1026 | fileType = archive.ar;
1027 | path = libRCTText.a;
1028 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
1029 | sourceTree = BUILT_PRODUCTS_DIR;
1030 | };
1031 | ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */ = {
1032 | isa = PBXReferenceProxy;
1033 | fileType = archive.ar;
1034 | path = libRCTBlob.a;
1035 | remoteRef = ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */;
1036 | sourceTree = BUILT_PRODUCTS_DIR;
1037 | };
1038 | /* End PBXReferenceProxy section */
1039 |
1040 | /* Begin PBXResourcesBuildPhase section */
1041 | 00E356EC1AD99517003FC87E /* Resources */ = {
1042 | isa = PBXResourcesBuildPhase;
1043 | buildActionMask = 2147483647;
1044 | files = (
1045 | );
1046 | runOnlyForDeploymentPostprocessing = 0;
1047 | };
1048 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
1049 | isa = PBXResourcesBuildPhase;
1050 | buildActionMask = 2147483647;
1051 | files = (
1052 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
1053 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
1054 | );
1055 | runOnlyForDeploymentPostprocessing = 0;
1056 | };
1057 | 2D02E4791E0B4A5D006451C7 /* Resources */ = {
1058 | isa = PBXResourcesBuildPhase;
1059 | buildActionMask = 2147483647;
1060 | files = (
1061 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */,
1062 | );
1063 | runOnlyForDeploymentPostprocessing = 0;
1064 | };
1065 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = {
1066 | isa = PBXResourcesBuildPhase;
1067 | buildActionMask = 2147483647;
1068 | files = (
1069 | );
1070 | runOnlyForDeploymentPostprocessing = 0;
1071 | };
1072 | /* End PBXResourcesBuildPhase section */
1073 |
1074 | /* Begin PBXShellScriptBuildPhase section */
1075 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
1076 | isa = PBXShellScriptBuildPhase;
1077 | buildActionMask = 2147483647;
1078 | files = (
1079 | );
1080 | inputPaths = (
1081 | );
1082 | name = "Bundle React Native code and images";
1083 | outputPaths = (
1084 | );
1085 | runOnlyForDeploymentPostprocessing = 0;
1086 | shellPath = /bin/sh;
1087 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
1088 | };
1089 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
1090 | isa = PBXShellScriptBuildPhase;
1091 | buildActionMask = 2147483647;
1092 | files = (
1093 | );
1094 | inputPaths = (
1095 | );
1096 | name = "Bundle React Native Code And Images";
1097 | outputPaths = (
1098 | );
1099 | runOnlyForDeploymentPostprocessing = 0;
1100 | shellPath = /bin/sh;
1101 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
1102 | };
1103 | /* End PBXShellScriptBuildPhase section */
1104 |
1105 | /* Begin PBXSourcesBuildPhase section */
1106 | 00E356EA1AD99517003FC87E /* Sources */ = {
1107 | isa = PBXSourcesBuildPhase;
1108 | buildActionMask = 2147483647;
1109 | files = (
1110 | 00E356F31AD99517003FC87E /* backtestTests.m in Sources */,
1111 | );
1112 | runOnlyForDeploymentPostprocessing = 0;
1113 | };
1114 | 13B07F871A680F5B00A75B9A /* Sources */ = {
1115 | isa = PBXSourcesBuildPhase;
1116 | buildActionMask = 2147483647;
1117 | files = (
1118 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
1119 | 13B07FC11A68108700A75B9A /* main.m in Sources */,
1120 | );
1121 | runOnlyForDeploymentPostprocessing = 0;
1122 | };
1123 | 2D02E4771E0B4A5D006451C7 /* Sources */ = {
1124 | isa = PBXSourcesBuildPhase;
1125 | buildActionMask = 2147483647;
1126 | files = (
1127 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */,
1128 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */,
1129 | );
1130 | runOnlyForDeploymentPostprocessing = 0;
1131 | };
1132 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = {
1133 | isa = PBXSourcesBuildPhase;
1134 | buildActionMask = 2147483647;
1135 | files = (
1136 | 2DCD954D1E0B4F2C00145EB5 /* backtestTests.m in Sources */,
1137 | );
1138 | runOnlyForDeploymentPostprocessing = 0;
1139 | };
1140 | /* End PBXSourcesBuildPhase section */
1141 |
1142 | /* Begin PBXTargetDependency section */
1143 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
1144 | isa = PBXTargetDependency;
1145 | target = 13B07F861A680F5B00A75B9A /* backtest */;
1146 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
1147 | };
1148 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = {
1149 | isa = PBXTargetDependency;
1150 | target = 2D02E47A1E0B4A5D006451C7 /* backtest-tvOS */;
1151 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */;
1152 | };
1153 | /* End PBXTargetDependency section */
1154 |
1155 | /* Begin PBXVariantGroup section */
1156 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
1157 | isa = PBXVariantGroup;
1158 | children = (
1159 | 13B07FB21A68108700A75B9A /* Base */,
1160 | );
1161 | name = LaunchScreen.xib;
1162 | path = backtest;
1163 | sourceTree = "";
1164 | };
1165 | /* End PBXVariantGroup section */
1166 |
1167 | /* Begin XCBuildConfiguration section */
1168 | 00E356F61AD99517003FC87E /* Debug */ = {
1169 | isa = XCBuildConfiguration;
1170 | buildSettings = {
1171 | BUNDLE_LOADER = "$(TEST_HOST)";
1172 | GCC_PREPROCESSOR_DEFINITIONS = (
1173 | "DEBUG=1",
1174 | "$(inherited)",
1175 | );
1176 | INFOPLIST_FILE = backtestTests/Info.plist;
1177 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1178 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1179 | OTHER_LDFLAGS = (
1180 | "-ObjC",
1181 | "-lc++",
1182 | );
1183 | PRODUCT_NAME = "$(TARGET_NAME)";
1184 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/backtest.app/backtest";
1185 | LIBRARY_SEARCH_PATHS = (
1186 | "$(inherited)",
1187 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1188 | );
1189 | };
1190 | name = Debug;
1191 | };
1192 | 00E356F71AD99517003FC87E /* Release */ = {
1193 | isa = XCBuildConfiguration;
1194 | buildSettings = {
1195 | BUNDLE_LOADER = "$(TEST_HOST)";
1196 | COPY_PHASE_STRIP = NO;
1197 | INFOPLIST_FILE = backtestTests/Info.plist;
1198 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1199 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1200 | OTHER_LDFLAGS = (
1201 | "-ObjC",
1202 | "-lc++",
1203 | );
1204 | PRODUCT_NAME = "$(TARGET_NAME)";
1205 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/backtest.app/backtest";
1206 | LIBRARY_SEARCH_PATHS = (
1207 | "$(inherited)",
1208 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1209 | );
1210 | };
1211 | name = Release;
1212 | };
1213 | 13B07F941A680F5B00A75B9A /* Debug */ = {
1214 | isa = XCBuildConfiguration;
1215 | buildSettings = {
1216 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1217 | CURRENT_PROJECT_VERSION = 1;
1218 | DEAD_CODE_STRIPPING = NO;
1219 | INFOPLIST_FILE = backtest/Info.plist;
1220 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1221 | OTHER_LDFLAGS = (
1222 | "$(inherited)",
1223 | "-ObjC",
1224 | "-lc++",
1225 | );
1226 | PRODUCT_NAME = backtest;
1227 | VERSIONING_SYSTEM = "apple-generic";
1228 | };
1229 | name = Debug;
1230 | };
1231 | 13B07F951A680F5B00A75B9A /* Release */ = {
1232 | isa = XCBuildConfiguration;
1233 | buildSettings = {
1234 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1235 | CURRENT_PROJECT_VERSION = 1;
1236 | INFOPLIST_FILE = backtest/Info.plist;
1237 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1238 | OTHER_LDFLAGS = (
1239 | "$(inherited)",
1240 | "-ObjC",
1241 | "-lc++",
1242 | );
1243 | PRODUCT_NAME = backtest;
1244 | VERSIONING_SYSTEM = "apple-generic";
1245 | };
1246 | name = Release;
1247 | };
1248 | 2D02E4971E0B4A5E006451C7 /* Debug */ = {
1249 | isa = XCBuildConfiguration;
1250 | buildSettings = {
1251 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
1252 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1253 | CLANG_ANALYZER_NONNULL = YES;
1254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1255 | CLANG_WARN_INFINITE_RECURSION = YES;
1256 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1257 | DEBUG_INFORMATION_FORMAT = dwarf;
1258 | ENABLE_TESTABILITY = YES;
1259 | GCC_NO_COMMON_BLOCKS = YES;
1260 | INFOPLIST_FILE = "backtest-tvOS/Info.plist";
1261 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1262 | OTHER_LDFLAGS = (
1263 | "-ObjC",
1264 | "-lc++",
1265 | );
1266 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.backtest-tvOS";
1267 | PRODUCT_NAME = "$(TARGET_NAME)";
1268 | SDKROOT = appletvos;
1269 | TARGETED_DEVICE_FAMILY = 3;
1270 | TVOS_DEPLOYMENT_TARGET = 9.2;
1271 | };
1272 | name = Debug;
1273 | };
1274 | 2D02E4981E0B4A5E006451C7 /* Release */ = {
1275 | isa = XCBuildConfiguration;
1276 | buildSettings = {
1277 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
1278 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1279 | CLANG_ANALYZER_NONNULL = YES;
1280 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1281 | CLANG_WARN_INFINITE_RECURSION = YES;
1282 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1283 | COPY_PHASE_STRIP = NO;
1284 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1285 | GCC_NO_COMMON_BLOCKS = YES;
1286 | INFOPLIST_FILE = "backtest-tvOS/Info.plist";
1287 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1288 | OTHER_LDFLAGS = (
1289 | "-ObjC",
1290 | "-lc++",
1291 | );
1292 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.backtest-tvOS";
1293 | PRODUCT_NAME = "$(TARGET_NAME)";
1294 | SDKROOT = appletvos;
1295 | TARGETED_DEVICE_FAMILY = 3;
1296 | TVOS_DEPLOYMENT_TARGET = 9.2;
1297 | };
1298 | name = Release;
1299 | };
1300 | 2D02E4991E0B4A5E006451C7 /* Debug */ = {
1301 | isa = XCBuildConfiguration;
1302 | buildSettings = {
1303 | BUNDLE_LOADER = "$(TEST_HOST)";
1304 | CLANG_ANALYZER_NONNULL = YES;
1305 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1306 | CLANG_WARN_INFINITE_RECURSION = YES;
1307 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1308 | DEBUG_INFORMATION_FORMAT = dwarf;
1309 | ENABLE_TESTABILITY = YES;
1310 | GCC_NO_COMMON_BLOCKS = YES;
1311 | INFOPLIST_FILE = "backtest-tvOSTests/Info.plist";
1312 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1313 | OTHER_LDFLAGS = (
1314 | "-ObjC",
1315 | "-lc++",
1316 | );
1317 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.backtest-tvOSTests";
1318 | PRODUCT_NAME = "$(TARGET_NAME)";
1319 | SDKROOT = appletvos;
1320 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/backtest-tvOS.app/backtest-tvOS";
1321 | TVOS_DEPLOYMENT_TARGET = 10.1;
1322 | };
1323 | name = Debug;
1324 | };
1325 | 2D02E49A1E0B4A5E006451C7 /* Release */ = {
1326 | isa = XCBuildConfiguration;
1327 | buildSettings = {
1328 | BUNDLE_LOADER = "$(TEST_HOST)";
1329 | CLANG_ANALYZER_NONNULL = YES;
1330 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1331 | CLANG_WARN_INFINITE_RECURSION = YES;
1332 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1333 | COPY_PHASE_STRIP = NO;
1334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1335 | GCC_NO_COMMON_BLOCKS = YES;
1336 | INFOPLIST_FILE = "backtest-tvOSTests/Info.plist";
1337 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1338 | OTHER_LDFLAGS = (
1339 | "-ObjC",
1340 | "-lc++",
1341 | );
1342 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.backtest-tvOSTests";
1343 | PRODUCT_NAME = "$(TARGET_NAME)";
1344 | SDKROOT = appletvos;
1345 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/backtest-tvOS.app/backtest-tvOS";
1346 | TVOS_DEPLOYMENT_TARGET = 10.1;
1347 | };
1348 | name = Release;
1349 | };
1350 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
1351 | isa = XCBuildConfiguration;
1352 | buildSettings = {
1353 | ALWAYS_SEARCH_USER_PATHS = NO;
1354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1355 | CLANG_CXX_LIBRARY = "libc++";
1356 | CLANG_ENABLE_MODULES = YES;
1357 | CLANG_ENABLE_OBJC_ARC = YES;
1358 | CLANG_WARN_BOOL_CONVERSION = YES;
1359 | CLANG_WARN_CONSTANT_CONVERSION = YES;
1360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1361 | CLANG_WARN_EMPTY_BODY = YES;
1362 | CLANG_WARN_ENUM_CONVERSION = YES;
1363 | CLANG_WARN_INT_CONVERSION = YES;
1364 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1365 | CLANG_WARN_UNREACHABLE_CODE = YES;
1366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1368 | COPY_PHASE_STRIP = NO;
1369 | ENABLE_STRICT_OBJC_MSGSEND = YES;
1370 | GCC_C_LANGUAGE_STANDARD = gnu99;
1371 | GCC_DYNAMIC_NO_PIC = NO;
1372 | GCC_OPTIMIZATION_LEVEL = 0;
1373 | GCC_PREPROCESSOR_DEFINITIONS = (
1374 | "DEBUG=1",
1375 | "$(inherited)",
1376 | );
1377 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
1378 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1379 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1380 | GCC_WARN_UNDECLARED_SELECTOR = YES;
1381 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1382 | GCC_WARN_UNUSED_FUNCTION = YES;
1383 | GCC_WARN_UNUSED_VARIABLE = YES;
1384 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1385 | MTL_ENABLE_DEBUG_INFO = YES;
1386 | ONLY_ACTIVE_ARCH = YES;
1387 | SDKROOT = iphoneos;
1388 | };
1389 | name = Debug;
1390 | };
1391 | 83CBBA211A601CBA00E9B192 /* Release */ = {
1392 | isa = XCBuildConfiguration;
1393 | buildSettings = {
1394 | ALWAYS_SEARCH_USER_PATHS = NO;
1395 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1396 | CLANG_CXX_LIBRARY = "libc++";
1397 | CLANG_ENABLE_MODULES = YES;
1398 | CLANG_ENABLE_OBJC_ARC = YES;
1399 | CLANG_WARN_BOOL_CONVERSION = YES;
1400 | CLANG_WARN_CONSTANT_CONVERSION = YES;
1401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1402 | CLANG_WARN_EMPTY_BODY = YES;
1403 | CLANG_WARN_ENUM_CONVERSION = YES;
1404 | CLANG_WARN_INT_CONVERSION = YES;
1405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1406 | CLANG_WARN_UNREACHABLE_CODE = YES;
1407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1409 | COPY_PHASE_STRIP = YES;
1410 | ENABLE_NS_ASSERTIONS = NO;
1411 | ENABLE_STRICT_OBJC_MSGSEND = YES;
1412 | GCC_C_LANGUAGE_STANDARD = gnu99;
1413 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1414 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1415 | GCC_WARN_UNDECLARED_SELECTOR = YES;
1416 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1417 | GCC_WARN_UNUSED_FUNCTION = YES;
1418 | GCC_WARN_UNUSED_VARIABLE = YES;
1419 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1420 | MTL_ENABLE_DEBUG_INFO = NO;
1421 | SDKROOT = iphoneos;
1422 | VALIDATE_PRODUCT = YES;
1423 | };
1424 | name = Release;
1425 | };
1426 | /* End XCBuildConfiguration section */
1427 |
1428 | /* Begin XCConfigurationList section */
1429 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "backtestTests" */ = {
1430 | isa = XCConfigurationList;
1431 | buildConfigurations = (
1432 | 00E356F61AD99517003FC87E /* Debug */,
1433 | 00E356F71AD99517003FC87E /* Release */,
1434 | );
1435 | defaultConfigurationIsVisible = 0;
1436 | defaultConfigurationName = Release;
1437 | };
1438 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "backtest" */ = {
1439 | isa = XCConfigurationList;
1440 | buildConfigurations = (
1441 | 13B07F941A680F5B00A75B9A /* Debug */,
1442 | 13B07F951A680F5B00A75B9A /* Release */,
1443 | );
1444 | defaultConfigurationIsVisible = 0;
1445 | defaultConfigurationName = Release;
1446 | };
1447 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "backtest-tvOS" */ = {
1448 | isa = XCConfigurationList;
1449 | buildConfigurations = (
1450 | 2D02E4971E0B4A5E006451C7 /* Debug */,
1451 | 2D02E4981E0B4A5E006451C7 /* Release */,
1452 | );
1453 | defaultConfigurationIsVisible = 0;
1454 | defaultConfigurationName = Release;
1455 | };
1456 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "backtest-tvOSTests" */ = {
1457 | isa = XCConfigurationList;
1458 | buildConfigurations = (
1459 | 2D02E4991E0B4A5E006451C7 /* Debug */,
1460 | 2D02E49A1E0B4A5E006451C7 /* Release */,
1461 | );
1462 | defaultConfigurationIsVisible = 0;
1463 | defaultConfigurationName = Release;
1464 | };
1465 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "backtest" */ = {
1466 | isa = XCConfigurationList;
1467 | buildConfigurations = (
1468 | 83CBBA201A601CBA00E9B192 /* Debug */,
1469 | 83CBBA211A601CBA00E9B192 /* Release */,
1470 | );
1471 | defaultConfigurationIsVisible = 0;
1472 | defaultConfigurationName = Release;
1473 | };
1474 | /* End XCConfigurationList section */
1475 | };
1476 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
1477 | }
1478 |
--------------------------------------------------------------------------------
/example/ios/backtest.xcodeproj/xcshareddata/xcschemes/backtest-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/example/ios/backtest.xcodeproj/xcshareddata/xcschemes/backtest.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/example/ios/backtest/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | @interface AppDelegate : UIResponder
11 |
12 | @property (nonatomic, strong) UIWindow *window;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/example/ios/backtest/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import "AppDelegate.h"
9 |
10 | #import
11 | #import
12 |
13 | @implementation AppDelegate
14 |
15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 | {
17 | NSURL *jsCodeLocation;
18 |
19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
20 |
21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
22 | moduleName:@"backtest"
23 | initialProperties:nil
24 | launchOptions:launchOptions];
25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
26 |
27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
28 | UIViewController *rootViewController = [UIViewController new];
29 | rootViewController.view = rootView;
30 | self.window.rootViewController = rootViewController;
31 | [self.window makeKeyAndVisible];
32 | return YES;
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/example/ios/backtest/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/example/ios/backtest/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/example/ios/backtest/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/backtest/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | backtest
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UIViewControllerBasedStatusBarAppearance
40 |
41 | NSLocationWhenInUseUsageDescription
42 |
43 | NSAppTransportSecurity
44 |
45 |
46 | NSExceptionDomains
47 |
48 | localhost
49 |
50 | NSExceptionAllowsInsecureHTTPLoads
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/example/ios/backtest/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/example/ios/backtestTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/backtestTests/backtestTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | #import
12 | #import
13 |
14 | #define TIMEOUT_SECONDS 600
15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
16 |
17 | @interface backtestTests : XCTestCase
18 |
19 | @end
20 |
21 | @implementation backtestTests
22 |
23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24 | {
25 | if (test(view)) {
26 | return YES;
27 | }
28 | for (UIView *subview in [view subviews]) {
29 | if ([self findSubviewInView:subview matching:test]) {
30 | return YES;
31 | }
32 | }
33 | return NO;
34 | }
35 |
36 | - (void)testRendersWelcomeScreen
37 | {
38 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40 | BOOL foundElement = NO;
41 |
42 | __block NSString *redboxError = nil;
43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
44 | if (level >= RCTLogLevelError) {
45 | redboxError = message;
46 | }
47 | });
48 |
49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
52 |
53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
55 | return YES;
56 | }
57 | return NO;
58 | }];
59 | }
60 |
61 | RCTSetLogFunction(RCTDefaultLogFunction);
62 |
63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65 | }
66 |
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backtest",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start",
7 | "postinstall": "rm -rf node_modules/react-native-background-job/example && rm -rf node_modules/react-native-background-job/node_modules"
8 | },
9 | "dependencies": {
10 | "react": "16.4.1",
11 | "react-native": "0.56.0",
12 | "react-native-background-job": "file:../"
13 | },
14 | "devDependencies": {
15 | "babel-preset-react-native": "5.0.2"
16 | },
17 | "jest": {
18 | "preset": "react-native"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | import { NativeModules, AppRegistry, Platform } from "react-native";
3 |
4 | const AppState = NativeModules.AppState;
5 | const tag = "BackgroundJob:";
6 | const jobModule = Platform.select({
7 | ios: {},
8 | android: NativeModules.BackgroundJob
9 | });
10 | const jobs = {};
11 | var globalWarning = __DEV__;
12 |
13 | const BackgroundJob = {
14 | NETWORK_TYPE_UNMETERED: jobModule.UNMETERED,
15 | NETWORK_TYPE_ANY: jobModule.ANY,
16 | NETWORK_TYPE_NONE: -1,
17 | /**
18 | * Registers the job and the functions they should run.
19 | *
20 | * This has to run on each initialization of React Native and it has to run in the global scope and not inside any
21 | * component life cycle methods. See example project. Only registering the job will not schedule the job.
22 | * It has to be scheduled by `schedule` to start running.
23 | *
24 | * @param {Object} obj
25 | * @param {string} obj.jobKey A unique key for the job
26 | * @param {function} obj.job The JS-function that will be run
27 | *
28 | * @example
29 | * import BackgroundJob from 'react-native-background-job';
30 | *
31 | * const backgroundJob = {
32 | * jobKey: "myJob",
33 | * job: () => console.log("Running in background")
34 | * };
35 | *
36 | * BackgroundJob.register(backgroundJob);
37 | *
38 | */
39 | register: function({ jobKey, job }) {
40 | const existingJob = jobs[jobKey];
41 |
42 | if (!existingJob || !existingJob.registered) {
43 | var fn = async () => {
44 | job();
45 | };
46 |
47 | AppRegistry.registerHeadlessTask(jobKey, () => fn);
48 |
49 | if (existingJob) {
50 | jobs[jobKey].registered = true;
51 | } else {
52 | jobs[jobKey] = { registered: true, job };
53 | }
54 | }
55 | },
56 |
57 | /**
58 | * Schedules a new job.
59 | *
60 | * This only has to be run once while `register` has to be run on each initialization of React Native.
61 | *
62 | * @param {Object} obj
63 | * @param {string} obj.jobKey A unique key for the job that was used for registering, and be used for canceling in later stage.
64 | * @param {number} [obj.timeout = 2000] The amount of time (in ms) after which the React instance should be terminated regardless of whether the task has completed or not.
65 | * @param {number} [obj.period = 900000] The frequency to run the job with (in ms). This number is not exact, Android may modify it to save batteries. Note: For Android > N, the minimum is 900 0000 (15 min).
66 | * @param {boolean} [obj.persist = true] If the job should persist over a device restart.
67 | * @param {boolean} [obj.override = true] Whether this Job should replace pre-existing jobs with the same key.
68 | * @param {number} [obj.networkType = NETWORK_TYPE_NONE] Only run for specific network requirements.
69 | * @param {boolean} [obj.requiresCharging = false] Only run job when device is charging, (not respected by pre Android N devices) [docs](https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setRequiresCharging(boolean))
70 | * @param {boolean} [obj.requiresDeviceIdle = false] Only run job when the device is idle, (not respected by pre Android N devices) [docs](https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setRequiresDeviceIdle(boolean))
71 | * @param {boolean} [obj.exact = false] Schedule an job to be triggered precisely at the provided period. Note that this is not power-efficient way of doing things.
72 | * @param {boolean} [obj.allowWhileIdle=false] Allow the scheduled job to execute also while it is in doze mode.
73 | * @param {string} [obj.notificationText="Running in background..."] For Android SDK > 26, what should the notification text be
74 | * @param {string} [obj.notificationTitle="Background job"] For Android SDK > 26, what should the notification title be
75 | * @param {boolean} [obj.allowExecutionInForeground = false] Allow the scheduled job to be executed even when the app is in foreground. Use it only for short running jobs.
76 | *
77 | * @example
78 | * import BackgroundJob from 'react-native-background-job';
79 | *
80 | * const backgroundJob = {
81 | * jobKey: "myJob",
82 | * job: () => console.log("Running in background")
83 | * };
84 | *
85 | * BackgroundJob.register(backgroundJob);
86 | *
87 | * var backgroundSchedule = {
88 | * jobKey: "myJob",
89 | * }
90 | *
91 | * BackgroundJob.schedule(backgroundSchedule)
92 | * .then(() => console.log("Success"))
93 | * .catch(err => console.err(err));
94 | */
95 | schedule: function({
96 | jobKey,
97 | timeout = 2000,
98 | period = 900000,
99 | persist = true,
100 | override = true,
101 | networkType = this.NETWORK_TYPE_NONE,
102 | requiresCharging = false,
103 | requiresDeviceIdle = false,
104 | exact = false,
105 | allowWhileIdle = false,
106 | allowExecutionInForeground = false,
107 | notificationText = "Running in background...",
108 | notificationTitle = "Background job"
109 | }) {
110 | return new Promise((resolve, reject) => {
111 | const savedJob = jobs[jobKey];
112 |
113 | if (!savedJob) {
114 | reject(
115 | `${tag} The job ${jobKey} has not been registered, you must register it before you can schedule it.`
116 | );
117 | } else {
118 | jobModule.schedule(
119 | jobKey,
120 | timeout,
121 | period,
122 | persist,
123 | override,
124 | networkType,
125 | requiresCharging,
126 | requiresDeviceIdle,
127 | exact,
128 | allowWhileIdle,
129 | allowExecutionInForeground,
130 | notificationTitle,
131 | notificationText,
132 | scheduled => {
133 | if (scheduled) {
134 | resolve();
135 | } else {
136 | reject(`The job ${jobKey} was unsuccessfully scheduled.`);
137 | }
138 | }
139 | );
140 | }
141 | });
142 | },
143 | /**
144 | * Cancel a specific job
145 | *
146 | * @param {Object} obj
147 | * @param {string} obj.jobKey The unique key for the job
148 | *
149 | * @example
150 | * import BackgroundJob from 'react-native-background-job';
151 | *
152 | * BackgroundJob.cancel({jobKey: 'myJob'})
153 | * .then(() => console.log("Success"))
154 | * .catch(err => console.err(err));
155 | */
156 | cancel: function({ jobKey }) {
157 | return new Promise((resolve, reject) => {
158 | jobModule.cancel(jobKey, canceled => {
159 | if (canceled) {
160 | resolve();
161 | } else {
162 | reject(`The job ${jobKey} was unsuccessfully canceled.`);
163 | }
164 | });
165 | });
166 | },
167 | /**
168 | * Cancels all the scheduled jobs
169 | *
170 | * @example
171 | * import BackgroundJob from 'react-native-background-job';
172 | *
173 | * BackgroundJob.cancelAll()
174 | * .then(() => console.log("Success"))
175 | * .catch(err => console.err(err));
176 | */
177 | cancelAll: function() {
178 | return new Promise((resolve, reject) => {
179 | jobModule.cancelAll(canceled => {
180 | if (canceled) {
181 | resolve();
182 | } else {
183 | reject(`All the jobs were unsuccessfully canceled.`);
184 | }
185 | });
186 | });
187 | },
188 | /**
189 | * Sets the global warning level
190 | *
191 | * @param {boolean} warn
192 | *
193 | * @example
194 | * import BackgroundJob from 'react-native-background-job';
195 | *
196 | * BackgroundJob.setGlobalWarnings(false);
197 | *
198 | */
199 | setGlobalWarnings: function(warn) {
200 | globalWarning = warn;
201 | },
202 | /**
203 | * Checks Whether app is optimising battery using Doze,returns Boolean.
204 | *
205 | * @param {Callback} callback gets called with according parameters after result is received from Android module.
206 | * @example
207 | * import BackgroundJob from 'react-native-background-job';
208 | *
209 | * BackgroundJob.isAppIgnoringBatteryOptimization((err, isIgnoring) => console.log(`Callback: isIgnoring = ${isIgnoring}`))
210 | * .then(isIgnoring => console.log(`Promise: isIgnoring = ${isIgnoring}`))
211 | * .catch(err => console.err(err));
212 | */
213 | isAppIgnoringBatteryOptimization: function(callback) {
214 | return new Promise((resolve, reject) => {
215 | jobModule.isAppIgnoringBatteryOptimization(ignoringOptimization => {
216 | if (ignoringOptimization != null) {
217 | if (callback) {
218 | callback("", ignoringOptimization);
219 | }
220 | resolve(ignoringOptimization);
221 | } else {
222 | if (callback) {
223 | callback("error", null);
224 | }
225 | reject("error");
226 | }
227 | });
228 | });
229 | }
230 | };
231 | if (Platform.OS == "ios") {
232 | Object.keys(BackgroundJob).map(v => {
233 | BackgroundJob[v] = () => {
234 | if (globalWarning) {
235 | console.warn(
236 | "react-native-background-job is not available on iOS yet. See https://github.com/vikeri/react-native-background-job#supported-platforms"
237 | );
238 | }
239 | };
240 | });
241 | }
242 | module.exports = BackgroundJob;
243 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-background-job",
3 | "version": "2.3.1",
4 | "description": "Schedule background jobs in React Native that run your JavaScript when your app is in the background.",
5 | "main": "index.js",
6 | "repository": "https://github.com/vikeri/react-native-background-job",
7 | "scripts": {
8 | "test": "echo \"No test specified\"",
9 | "precommit": "lint-staged",
10 | "document": "documentation readme --readme-file README.md -s \"API\" -g"
11 | },
12 | "keywords": [
13 | "react-native",
14 | "background-job"
15 | ],
16 | "author": "Viktor Eriksson ",
17 | "license": "MIT",
18 | "peerDependencies": {
19 | "react-native": ">= 0.36.0"
20 | },
21 | "devDependencies": {
22 | "documentation": "^8.1.2",
23 | "husky": "^1.1.1",
24 | "lint-staged": "^7.3.0",
25 | "prettier": "^1.2.2"
26 | },
27 | "lint-staged": {
28 | "*.js": [
29 | "prettier --write",
30 | "git add"
31 | ],
32 | "./index.js": [
33 | "npm run document",
34 | "git add"
35 | ]
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tests/assure-not-foreground.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo "Testing that the task is not run in foreground"
3 | adb logcat -c
4 | adb shell am force-stop com.backtest
5 | adb shell am start -n com.backtest/com.backtest.MainActivity
6 | sleep 4
7 | adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME
8 | sleep 1
9 | #adb shell am force-stop com.backtest
10 | adb shell am kill com.backtest
11 | sleep 4
12 | adb shell am start -n com.backtest/com.backtest.MainActivity
13 | adb logcat -d | grep "backgroundjob|ReactNativeJS"
14 | echo "###########################################"
15 | if [[ -z $(adb logcat -d | grep "Starting task!") ]]; then
16 | echo "Success: Task not started"
17 | else
18 | echo "Error: Task started"
19 | exit 1
20 | fi
21 |
--------------------------------------------------------------------------------
/tests/bg-working.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo "Testing that a task is started when closing the app and waiting"
3 | adb logcat -c
4 | adb shell am force-stop com.backtest
5 | adb shell am start -n com.backtest/com.backtest.MainActivity
6 | sleep 30
7 | adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME
8 | sleep 1
9 | #adb shell am force-stop com.backtest
10 | adb shell am kill com.backtest
11 | sleep 35
12 | adb shell am start -n com.backtest/com.backtest.MainActivity
13 | if [[ -z $(adb logcat -d | grep "Exact Job fired") ]]; then
14 | adb logcat -d | grep "backgroundjob|ReactNativeJS"
15 | echo "######################################"
16 | echo "Error: Task not started"
17 | exit 1
18 | else
19 | adb logcat -d | grep "backgroundjob|ReactNativeJS"
20 | echo "######################################"
21 | echo "Success: Task started"
22 | fi
23 |
--------------------------------------------------------------------------------