@ammarahmed/react-native-background-fetch 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarnignore +7 -0
- package/LICENSE +21 -0
- package/README.md +502 -0
- package/RNBackgroundFetch.podspec +25 -0
- package/android/build.gradle +40 -0
- package/android/proguard-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/java/com/transistorsoft/rnbackgroundfetch/HeadlessTask.java +119 -0
- package/android/src/main/java/com/transistorsoft/rnbackgroundfetch/RNBackgroundFetchModule.java +185 -0
- package/android/src/main/java/com/transistorsoft/rnbackgroundfetch/RNBackgroundFetchPackage.java +29 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/BGTask.java +305 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/BackgroundFetch.java +297 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/BackgroundFetchConfig.java +362 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/BootReceiver.java +24 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/FetchAlarmReceiver.java +40 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/FetchJobService.java +106 -0
- package/android/src/main/java/com/transistorsoft/tsbackgroundfetch/LifecycleManager.java +225 -0
- package/app.plugin.js +1 -0
- package/index.d.ts +185 -0
- package/index.js +119 -0
- package/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m +22 -0
- package/ios/RNBackgroundFetch/RNBackgroundFetch.h +18 -0
- package/ios/RNBackgroundFetch/RNBackgroundFetch.m +167 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/Info.plist +57 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_armv7/TSBackgroundFetch.framework/Headers/TSBackgroundFetch.h +47 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_armv7/TSBackgroundFetch.framework/Info.plist +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_armv7/TSBackgroundFetch.framework/Modules/module.modulemap +6 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_armv7/TSBackgroundFetch.framework/TSBackgroundFetch +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/Headers/TSBackgroundFetch.h +47 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/Info.plist +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/Modules/module.modulemap +6 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/TSBackgroundFetch +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeResources +132 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_i386_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_x86_64-maccatalyst/TSBackgroundFetch.framework/Headers/TSBackgroundFetch.h +47 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_x86_64-maccatalyst/TSBackgroundFetch.framework/Modules/module.modulemap +6 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_x86_64-maccatalyst/TSBackgroundFetch.framework/Resources/Info.plist +52 -0
- package/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_x86_64-maccatalyst/TSBackgroundFetch.framework/TSBackgroundFetch +0 -0
- package/ios/RNBackgroundFetch.xcodeproj/project.pbxproj +310 -0
- package/ios/RNBackgroundFetch.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNBackgroundFetch.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNBackgroundFetch.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/package.json +32 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNBackgroundFetch.h
|
|
3
|
+
// RNBackgroundFetch
|
|
4
|
+
//
|
|
5
|
+
// Created by Christopher Scott on 2016-08-01.
|
|
6
|
+
// Copyright © 2016 Christopher Scott. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
#import <Foundation/Foundation.h>
|
|
11
|
+
#import <UIKit/UIKit.h>
|
|
12
|
+
|
|
13
|
+
#import <React/RCTLog.h>
|
|
14
|
+
#import <React/RCTEventEmitter.h>
|
|
15
|
+
|
|
16
|
+
@interface RNBackgroundFetch : RCTEventEmitter <UIApplicationDelegate>
|
|
17
|
+
|
|
18
|
+
@end
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNBackgroundFetch.m
|
|
3
|
+
// RNBackgroundFetch
|
|
4
|
+
//
|
|
5
|
+
// Created by Christopher Scott on 2016-08-01.
|
|
6
|
+
// Copyright © 2016 Christopher Scott. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RNBackgroundFetch.h"
|
|
10
|
+
@import TSBackgroundFetch;
|
|
11
|
+
#import <UIKit/UIKit.h>
|
|
12
|
+
|
|
13
|
+
#import <React/RCTEventDispatcher.h>
|
|
14
|
+
|
|
15
|
+
static NSString *const RN_BACKGROUND_FETCH_TAG = @"RNBackgroundFetch";
|
|
16
|
+
static NSString *const EVENT_FETCH = @"fetch";
|
|
17
|
+
static NSString *const PLUGIN_ID = @"react-native-background-fetch";
|
|
18
|
+
|
|
19
|
+
@implementation RNBackgroundFetch {
|
|
20
|
+
BOOL configured;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
RCT_EXPORT_MODULE();
|
|
24
|
+
|
|
25
|
+
-(instancetype)init
|
|
26
|
+
{
|
|
27
|
+
self = [super init];
|
|
28
|
+
|
|
29
|
+
configured = NO;
|
|
30
|
+
|
|
31
|
+
return self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (BOOL)requiresMainQueueSetup
|
|
35
|
+
{
|
|
36
|
+
return NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
40
|
+
return @[EVENT_FETCH];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
RCT_EXPORT_METHOD(configure:(NSDictionary*)config success:(RCTResponseSenderBlock)success failure:(RCTResponseSenderBlock)failure)
|
|
44
|
+
{
|
|
45
|
+
TSBackgroundFetch *fetchManager = [TSBackgroundFetch sharedInstance];
|
|
46
|
+
|
|
47
|
+
[fetchManager addListener:PLUGIN_ID callback:[self createFetchCallback] timeout:[self createFetchTimeoutCallback]];
|
|
48
|
+
|
|
49
|
+
NSTimeInterval delay = [[config objectForKey:@"minimumFetchInterval"] doubleValue] * 60;
|
|
50
|
+
|
|
51
|
+
[fetchManager configure:delay callback:^(UIBackgroundRefreshStatus status) {
|
|
52
|
+
self->configured = YES;
|
|
53
|
+
if (status != UIBackgroundRefreshStatusAvailable) {
|
|
54
|
+
NSLog(@"- %@ failed to start, status: %ld", RN_BACKGROUND_FETCH_TAG, (long)status);
|
|
55
|
+
failure(@[@(status)]);
|
|
56
|
+
} else {
|
|
57
|
+
success(@[@(status)]);
|
|
58
|
+
}
|
|
59
|
+
}];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
RCT_EXPORT_METHOD(start:(RCTResponseSenderBlock)success failure:(RCTResponseSenderBlock)failure)
|
|
63
|
+
{
|
|
64
|
+
TSBackgroundFetch *fetchManager = [TSBackgroundFetch sharedInstance];
|
|
65
|
+
|
|
66
|
+
[fetchManager status:^(UIBackgroundRefreshStatus status) {
|
|
67
|
+
if (status == UIBackgroundRefreshStatusAvailable) {
|
|
68
|
+
[fetchManager addListener:PLUGIN_ID callback:[self createFetchCallback] timeout:[self createFetchTimeoutCallback]];
|
|
69
|
+
NSError *error = [fetchManager start:nil];
|
|
70
|
+
if (!error) {
|
|
71
|
+
success(@[@(status)]);
|
|
72
|
+
} else {
|
|
73
|
+
failure(@[error.localizedDescription]);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
NSLog(@"- %@ failed to start, status: %lu", PLUGIN_ID, (long)status);
|
|
77
|
+
NSString *msg = [NSString stringWithFormat:@"%ld", (long) status];
|
|
78
|
+
failure(@[msg]);
|
|
79
|
+
}
|
|
80
|
+
}];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
RCT_EXPORT_METHOD(stop:(NSString*)taskId success:(RCTResponseSenderBlock)success failure:(RCTResponseSenderBlock)failure)
|
|
84
|
+
{
|
|
85
|
+
TSBackgroundFetch *fetchManager = [TSBackgroundFetch sharedInstance];
|
|
86
|
+
if (!taskId) {
|
|
87
|
+
[fetchManager removeListener:PLUGIN_ID];
|
|
88
|
+
}
|
|
89
|
+
[fetchManager stop:taskId];
|
|
90
|
+
success(@[@(YES)]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
RCT_EXPORT_METHOD(scheduleTask:(NSDictionary*)config success:(RCTResponseSenderBlock)success failure:(RCTResponseSenderBlock)failure) {
|
|
94
|
+
NSString *taskId = [config objectForKey:@"taskId"];
|
|
95
|
+
long delayMS = [[config objectForKey:@"delay"] longValue];
|
|
96
|
+
NSTimeInterval delay = delayMS / 1000;
|
|
97
|
+
BOOL periodic = [[config objectForKey:@"periodic"] boolValue];
|
|
98
|
+
BOOL requiresCharging = ([config objectForKey:@"requiresCharging"]) ? [[config objectForKey:@"requiresCharging"] boolValue] : NO;
|
|
99
|
+
BOOL requiresNetwork = ([config objectForKey:@"requiresNetworkConnectivity"]) ? [[config objectForKey:@"requiresNetworkConnectivity"] boolValue] : NO;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
NSError *error = [[TSBackgroundFetch sharedInstance] scheduleProcessingTaskWithIdentifier:taskId
|
|
103
|
+
delay:delay
|
|
104
|
+
periodic:periodic
|
|
105
|
+
requiresExternalPower: requiresCharging
|
|
106
|
+
requiresNetworkConnectivity:requiresNetwork
|
|
107
|
+
callback:[self createTaskCallback]];
|
|
108
|
+
if (!error) {
|
|
109
|
+
success(@[@(YES)]);
|
|
110
|
+
} else {
|
|
111
|
+
failure(@[error.localizedDescription]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
RCT_EXPORT_METHOD(finish:(NSString*)taskId)
|
|
116
|
+
{
|
|
117
|
+
TSBackgroundFetch *fetchManager = [TSBackgroundFetch sharedInstance];
|
|
118
|
+
[fetchManager finish:taskId];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
RCT_EXPORT_METHOD(status:(RCTResponseSenderBlock)callback)
|
|
122
|
+
{
|
|
123
|
+
[[TSBackgroundFetch sharedInstance] status:^(UIBackgroundRefreshStatus status) {
|
|
124
|
+
callback(@[@(status)]);
|
|
125
|
+
}];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
-(void (^)(NSString* taskId)) createFetchCallback {
|
|
129
|
+
return ^void(NSString* taskId){
|
|
130
|
+
RCTLogInfo(@"- %@ Received fetch event %@", RN_BACKGROUND_FETCH_TAG, taskId);
|
|
131
|
+
[self sendEventWithName:EVENT_FETCH body:@{
|
|
132
|
+
@"taskId": taskId,
|
|
133
|
+
@"timeout": @(NO)
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
-(void (^)(NSString* taskId)) createFetchTimeoutCallback {
|
|
139
|
+
return ^void(NSString* taskId){
|
|
140
|
+
[self sendEventWithName:EVENT_FETCH body:@{
|
|
141
|
+
@"taskId": taskId,
|
|
142
|
+
@"timeout": @(YES)
|
|
143
|
+
}];
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
-(void (^)(NSString* taskId, BOOL timeout)) createTaskCallback {
|
|
148
|
+
return ^void(NSString* taskId, BOOL timeout){
|
|
149
|
+
RCTLogInfo(@"- %@ Received event event %@", RN_BACKGROUND_FETCH_TAG, taskId);
|
|
150
|
+
[self sendEventWithName:EVENT_FETCH body:@{
|
|
151
|
+
@"taskId": taskId,
|
|
152
|
+
@"timeout": @(timeout)
|
|
153
|
+
}];
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
-(NSString*) eventName:(NSString*)name
|
|
158
|
+
{
|
|
159
|
+
return [NSString stringWithFormat:@"%@:%@", RN_BACKGROUND_FETCH_TAG, name];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (void)dealloc
|
|
163
|
+
{
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>LibraryIdentifier</key>
|
|
9
|
+
<string>ios-arm64_armv7</string>
|
|
10
|
+
<key>LibraryPath</key>
|
|
11
|
+
<string>TSBackgroundFetch.framework</string>
|
|
12
|
+
<key>SupportedArchitectures</key>
|
|
13
|
+
<array>
|
|
14
|
+
<string>arm64</string>
|
|
15
|
+
<string>armv7</string>
|
|
16
|
+
</array>
|
|
17
|
+
<key>SupportedPlatform</key>
|
|
18
|
+
<string>ios</string>
|
|
19
|
+
</dict>
|
|
20
|
+
<dict>
|
|
21
|
+
<key>LibraryIdentifier</key>
|
|
22
|
+
<string>ios-arm64_x86_64-maccatalyst</string>
|
|
23
|
+
<key>LibraryPath</key>
|
|
24
|
+
<string>TSBackgroundFetch.framework</string>
|
|
25
|
+
<key>SupportedArchitectures</key>
|
|
26
|
+
<array>
|
|
27
|
+
<string>arm64</string>
|
|
28
|
+
<string>x86_64</string>
|
|
29
|
+
</array>
|
|
30
|
+
<key>SupportedPlatform</key>
|
|
31
|
+
<string>ios</string>
|
|
32
|
+
<key>SupportedPlatformVariant</key>
|
|
33
|
+
<string>maccatalyst</string>
|
|
34
|
+
</dict>
|
|
35
|
+
<dict>
|
|
36
|
+
<key>LibraryIdentifier</key>
|
|
37
|
+
<string>ios-arm64_i386_x86_64-simulator</string>
|
|
38
|
+
<key>LibraryPath</key>
|
|
39
|
+
<string>TSBackgroundFetch.framework</string>
|
|
40
|
+
<key>SupportedArchitectures</key>
|
|
41
|
+
<array>
|
|
42
|
+
<string>arm64</string>
|
|
43
|
+
<string>i386</string>
|
|
44
|
+
<string>x86_64</string>
|
|
45
|
+
</array>
|
|
46
|
+
<key>SupportedPlatform</key>
|
|
47
|
+
<string>ios</string>
|
|
48
|
+
<key>SupportedPlatformVariant</key>
|
|
49
|
+
<string>simulator</string>
|
|
50
|
+
</dict>
|
|
51
|
+
</array>
|
|
52
|
+
<key>CFBundlePackageType</key>
|
|
53
|
+
<string>XFWK</string>
|
|
54
|
+
<key>XCFrameworkFormatVersion</key>
|
|
55
|
+
<string>1.0</string>
|
|
56
|
+
</dict>
|
|
57
|
+
</plist>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNBackgroundFetchManager.h
|
|
3
|
+
// RNBackgroundFetch
|
|
4
|
+
//
|
|
5
|
+
// Created by Christopher Scott on 2016-08-02.
|
|
6
|
+
// Copyright © 2016 Christopher Scott. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
#import <BackgroundTasks/BackgroundTasks.h>
|
|
12
|
+
|
|
13
|
+
@interface TSBackgroundFetch : NSObject
|
|
14
|
+
|
|
15
|
+
@property (nonatomic) BOOL stopOnTerminate;
|
|
16
|
+
@property (readonly) BOOL configured;
|
|
17
|
+
@property (readonly) BOOL active;
|
|
18
|
+
@property (readonly) NSString *fetchTaskId;
|
|
19
|
+
@property (copy) void (^completionHandler)(UIBackgroundFetchResult);
|
|
20
|
+
@property (nonatomic) UIBackgroundTaskIdentifier backgroundTask;
|
|
21
|
+
|
|
22
|
+
+ (TSBackgroundFetch *)sharedInstance;
|
|
23
|
+
|
|
24
|
+
-(void) didFinishLaunching;
|
|
25
|
+
-(void) registerAppRefreshTask;
|
|
26
|
+
-(void) registerBGProcessingTask:(NSString*)identifier;
|
|
27
|
+
|
|
28
|
+
-(void) configure:(NSTimeInterval)delay callback:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
29
|
+
|
|
30
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
31
|
+
|
|
32
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic requiresExternalPower:(BOOL)requiresExternalPower requiresNetworkConnectivity:(BOOL)requiresNetworkConnectivity callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
33
|
+
|
|
34
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback;
|
|
35
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback timeout:(void (^)(NSString* componentName))timeout;
|
|
36
|
+
-(void) removeListener:(NSString*)componentName;
|
|
37
|
+
-(BOOL) hasListener:(NSString*)componentName;
|
|
38
|
+
|
|
39
|
+
-(NSError*) start:(NSString*)identifier;
|
|
40
|
+
-(void) stop:(NSString*)identifier;
|
|
41
|
+
-(void) finish:(NSString*)tag;
|
|
42
|
+
-(void) status:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
43
|
+
|
|
44
|
+
// @deprecated API
|
|
45
|
+
-(void) performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))handler applicationState:(UIApplicationState)state;
|
|
46
|
+
@end
|
|
47
|
+
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNBackgroundFetchManager.h
|
|
3
|
+
// RNBackgroundFetch
|
|
4
|
+
//
|
|
5
|
+
// Created by Christopher Scott on 2016-08-02.
|
|
6
|
+
// Copyright © 2016 Christopher Scott. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
#import <BackgroundTasks/BackgroundTasks.h>
|
|
12
|
+
|
|
13
|
+
@interface TSBackgroundFetch : NSObject
|
|
14
|
+
|
|
15
|
+
@property (nonatomic) BOOL stopOnTerminate;
|
|
16
|
+
@property (readonly) BOOL configured;
|
|
17
|
+
@property (readonly) BOOL active;
|
|
18
|
+
@property (readonly) NSString *fetchTaskId;
|
|
19
|
+
@property (copy) void (^completionHandler)(UIBackgroundFetchResult);
|
|
20
|
+
@property (nonatomic) UIBackgroundTaskIdentifier backgroundTask;
|
|
21
|
+
|
|
22
|
+
+ (TSBackgroundFetch *)sharedInstance;
|
|
23
|
+
|
|
24
|
+
-(void) didFinishLaunching;
|
|
25
|
+
-(void) registerAppRefreshTask;
|
|
26
|
+
-(void) registerBGProcessingTask:(NSString*)identifier;
|
|
27
|
+
|
|
28
|
+
-(void) configure:(NSTimeInterval)delay callback:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
29
|
+
|
|
30
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
31
|
+
|
|
32
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic requiresExternalPower:(BOOL)requiresExternalPower requiresNetworkConnectivity:(BOOL)requiresNetworkConnectivity callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
33
|
+
|
|
34
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback;
|
|
35
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback timeout:(void (^)(NSString* componentName))timeout;
|
|
36
|
+
-(void) removeListener:(NSString*)componentName;
|
|
37
|
+
-(BOOL) hasListener:(NSString*)componentName;
|
|
38
|
+
|
|
39
|
+
-(NSError*) start:(NSString*)identifier;
|
|
40
|
+
-(void) stop:(NSString*)identifier;
|
|
41
|
+
-(void) finish:(NSString*)tag;
|
|
42
|
+
-(void) status:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
43
|
+
|
|
44
|
+
// @deprecated API
|
|
45
|
+
-(void) performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))handler applicationState:(UIApplicationState)state;
|
|
46
|
+
@end
|
|
47
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Headers/TSBackgroundFetch.h</key>
|
|
8
|
+
<data>
|
|
9
|
+
+Ut705/FLadKVGWj5kKwjLrWsY4=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Info.plist</key>
|
|
12
|
+
<data>
|
|
13
|
+
Wg9tqduNsAZuWWrRxjYDH67H7oo=
|
|
14
|
+
</data>
|
|
15
|
+
<key>Modules/module.modulemap</key>
|
|
16
|
+
<data>
|
|
17
|
+
4NbofBeHHFHeUWRZ1ZcIkl3/T3w=
|
|
18
|
+
</data>
|
|
19
|
+
</dict>
|
|
20
|
+
<key>files2</key>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>Headers/TSBackgroundFetch.h</key>
|
|
23
|
+
<dict>
|
|
24
|
+
<key>hash</key>
|
|
25
|
+
<data>
|
|
26
|
+
+Ut705/FLadKVGWj5kKwjLrWsY4=
|
|
27
|
+
</data>
|
|
28
|
+
<key>hash2</key>
|
|
29
|
+
<data>
|
|
30
|
+
F6a1xu0gmhZTrz9rIBLzkR4Z81adJbimwFAvGIcBSBQ=
|
|
31
|
+
</data>
|
|
32
|
+
</dict>
|
|
33
|
+
<key>Modules/module.modulemap</key>
|
|
34
|
+
<dict>
|
|
35
|
+
<key>hash</key>
|
|
36
|
+
<data>
|
|
37
|
+
4NbofBeHHFHeUWRZ1ZcIkl3/T3w=
|
|
38
|
+
</data>
|
|
39
|
+
<key>hash2</key>
|
|
40
|
+
<data>
|
|
41
|
+
ZZoRDGe9SOWekYXO71UHMmkagz+I18vRneUTVMd0WnY=
|
|
42
|
+
</data>
|
|
43
|
+
</dict>
|
|
44
|
+
</dict>
|
|
45
|
+
<key>rules</key>
|
|
46
|
+
<dict>
|
|
47
|
+
<key>^.*</key>
|
|
48
|
+
<true/>
|
|
49
|
+
<key>^.*\.lproj/</key>
|
|
50
|
+
<dict>
|
|
51
|
+
<key>optional</key>
|
|
52
|
+
<true/>
|
|
53
|
+
<key>weight</key>
|
|
54
|
+
<real>1000</real>
|
|
55
|
+
</dict>
|
|
56
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
57
|
+
<dict>
|
|
58
|
+
<key>omit</key>
|
|
59
|
+
<true/>
|
|
60
|
+
<key>weight</key>
|
|
61
|
+
<real>1100</real>
|
|
62
|
+
</dict>
|
|
63
|
+
<key>^Base\.lproj/</key>
|
|
64
|
+
<dict>
|
|
65
|
+
<key>weight</key>
|
|
66
|
+
<real>1010</real>
|
|
67
|
+
</dict>
|
|
68
|
+
<key>^version.plist$</key>
|
|
69
|
+
<true/>
|
|
70
|
+
</dict>
|
|
71
|
+
<key>rules2</key>
|
|
72
|
+
<dict>
|
|
73
|
+
<key>.*\.dSYM($|/)</key>
|
|
74
|
+
<dict>
|
|
75
|
+
<key>weight</key>
|
|
76
|
+
<real>11</real>
|
|
77
|
+
</dict>
|
|
78
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
79
|
+
<dict>
|
|
80
|
+
<key>omit</key>
|
|
81
|
+
<true/>
|
|
82
|
+
<key>weight</key>
|
|
83
|
+
<real>2000</real>
|
|
84
|
+
</dict>
|
|
85
|
+
<key>^.*</key>
|
|
86
|
+
<true/>
|
|
87
|
+
<key>^.*\.lproj/</key>
|
|
88
|
+
<dict>
|
|
89
|
+
<key>optional</key>
|
|
90
|
+
<true/>
|
|
91
|
+
<key>weight</key>
|
|
92
|
+
<real>1000</real>
|
|
93
|
+
</dict>
|
|
94
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
95
|
+
<dict>
|
|
96
|
+
<key>omit</key>
|
|
97
|
+
<true/>
|
|
98
|
+
<key>weight</key>
|
|
99
|
+
<real>1100</real>
|
|
100
|
+
</dict>
|
|
101
|
+
<key>^Base\.lproj/</key>
|
|
102
|
+
<dict>
|
|
103
|
+
<key>weight</key>
|
|
104
|
+
<real>1010</real>
|
|
105
|
+
</dict>
|
|
106
|
+
<key>^Info\.plist$</key>
|
|
107
|
+
<dict>
|
|
108
|
+
<key>omit</key>
|
|
109
|
+
<true/>
|
|
110
|
+
<key>weight</key>
|
|
111
|
+
<real>20</real>
|
|
112
|
+
</dict>
|
|
113
|
+
<key>^PkgInfo$</key>
|
|
114
|
+
<dict>
|
|
115
|
+
<key>omit</key>
|
|
116
|
+
<true/>
|
|
117
|
+
<key>weight</key>
|
|
118
|
+
<real>20</real>
|
|
119
|
+
</dict>
|
|
120
|
+
<key>^embedded\.provisionprofile$</key>
|
|
121
|
+
<dict>
|
|
122
|
+
<key>weight</key>
|
|
123
|
+
<real>20</real>
|
|
124
|
+
</dict>
|
|
125
|
+
<key>^version\.plist$</key>
|
|
126
|
+
<dict>
|
|
127
|
+
<key>weight</key>
|
|
128
|
+
<real>20</real>
|
|
129
|
+
</dict>
|
|
130
|
+
</dict>
|
|
131
|
+
</dict>
|
|
132
|
+
</plist>
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNBackgroundFetchManager.h
|
|
3
|
+
// RNBackgroundFetch
|
|
4
|
+
//
|
|
5
|
+
// Created by Christopher Scott on 2016-08-02.
|
|
6
|
+
// Copyright © 2016 Christopher Scott. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
#import <BackgroundTasks/BackgroundTasks.h>
|
|
12
|
+
|
|
13
|
+
@interface TSBackgroundFetch : NSObject
|
|
14
|
+
|
|
15
|
+
@property (nonatomic) BOOL stopOnTerminate;
|
|
16
|
+
@property (readonly) BOOL configured;
|
|
17
|
+
@property (readonly) BOOL active;
|
|
18
|
+
@property (readonly) NSString *fetchTaskId;
|
|
19
|
+
@property (copy) void (^completionHandler)(UIBackgroundFetchResult);
|
|
20
|
+
@property (nonatomic) UIBackgroundTaskIdentifier backgroundTask;
|
|
21
|
+
|
|
22
|
+
+ (TSBackgroundFetch *)sharedInstance;
|
|
23
|
+
|
|
24
|
+
-(void) didFinishLaunching;
|
|
25
|
+
-(void) registerAppRefreshTask;
|
|
26
|
+
-(void) registerBGProcessingTask:(NSString*)identifier;
|
|
27
|
+
|
|
28
|
+
-(void) configure:(NSTimeInterval)delay callback:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
29
|
+
|
|
30
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
31
|
+
|
|
32
|
+
-(NSError*) scheduleProcessingTaskWithIdentifier:(NSString*)identifier delay:(NSTimeInterval)delay periodic:(BOOL)periodic requiresExternalPower:(BOOL)requiresExternalPower requiresNetworkConnectivity:(BOOL)requiresNetworkConnectivity callback:(void (^)(NSString* taskId, BOOL timeout))callback;
|
|
33
|
+
|
|
34
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback;
|
|
35
|
+
-(void) addListener:(NSString*)componentName callback:(void (^)(NSString* componentName))callback timeout:(void (^)(NSString* componentName))timeout;
|
|
36
|
+
-(void) removeListener:(NSString*)componentName;
|
|
37
|
+
-(BOOL) hasListener:(NSString*)componentName;
|
|
38
|
+
|
|
39
|
+
-(NSError*) start:(NSString*)identifier;
|
|
40
|
+
-(void) stop:(NSString*)identifier;
|
|
41
|
+
-(void) finish:(NSString*)tag;
|
|
42
|
+
-(void) status:(void(^)(UIBackgroundRefreshStatus status))callback;
|
|
43
|
+
|
|
44
|
+
// @deprecated API
|
|
45
|
+
-(void) performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))handler applicationState:(UIApplicationState)state;
|
|
46
|
+
@end
|
|
47
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>BuildMachineOSBuild</key>
|
|
6
|
+
<string>20G95</string>
|
|
7
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
8
|
+
<string>en</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>TSBackgroundFetch</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>com.transistorsoft.TSBackgroundFetch</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>TSBackgroundFetch</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>FMWK</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>1.0</string>
|
|
21
|
+
<key>CFBundleSignature</key>
|
|
22
|
+
<string>????</string>
|
|
23
|
+
<key>CFBundleSupportedPlatforms</key>
|
|
24
|
+
<array>
|
|
25
|
+
<string>MacOSX</string>
|
|
26
|
+
</array>
|
|
27
|
+
<key>CFBundleVersion</key>
|
|
28
|
+
<string>1</string>
|
|
29
|
+
<key>DTCompiler</key>
|
|
30
|
+
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
|
+
<key>DTPlatformBuild</key>
|
|
32
|
+
<string>12D4e</string>
|
|
33
|
+
<key>DTPlatformName</key>
|
|
34
|
+
<string>macosx</string>
|
|
35
|
+
<key>DTPlatformVersion</key>
|
|
36
|
+
<string>11.1</string>
|
|
37
|
+
<key>DTSDKBuild</key>
|
|
38
|
+
<string>20C63</string>
|
|
39
|
+
<key>DTSDKName</key>
|
|
40
|
+
<string>macosx11.1</string>
|
|
41
|
+
<key>DTXcode</key>
|
|
42
|
+
<string>1240</string>
|
|
43
|
+
<key>DTXcodeBuild</key>
|
|
44
|
+
<string>12D4e</string>
|
|
45
|
+
<key>LSMinimumSystemVersion</key>
|
|
46
|
+
<string>10.15</string>
|
|
47
|
+
<key>UIDeviceFamily</key>
|
|
48
|
+
<array>
|
|
49
|
+
<integer>2</integer>
|
|
50
|
+
</array>
|
|
51
|
+
</dict>
|
|
52
|
+
</plist>
|