cronapp-cordova-plugin-contentsync 4.4.0-RC.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +11 -0
- package/README.md +372 -0
- package/package-lock.json +1545 -0
- package/package.json +58 -0
- package/plugin.xml +93 -0
- package/sample/css/index.css +128 -0
- package/sample/img/logo.png +0 -0
- package/sample/index.html +47 -0
- package/sample/js/index.js +152 -0
- package/spec/helper/cordova.js +83 -0
- package/spec/index.spec.js +334 -0
- package/src/android/Sync.java +1102 -0
- package/src/browser/Sync.js +20 -0
- package/src/ios/ContentSync.h +74 -0
- package/src/ios/ContentSync.m +1002 -0
- package/src/ios/SSZipArchive.h +52 -0
- package/src/ios/SSZipArchive.m +540 -0
- package/src/ios/minizip/crypt.h +131 -0
- package/src/ios/minizip/ioapi.c +239 -0
- package/src/ios/minizip/ioapi.h +201 -0
- package/src/ios/minizip/mztools.c +284 -0
- package/src/ios/minizip/mztools.h +31 -0
- package/src/ios/minizip/unzip.c +2153 -0
- package/src/ios/minizip/unzip.h +437 -0
- package/src/ios/minizip/zip.c +2022 -0
- package/src/ios/minizip/zip.h +362 -0
- package/src/windows/SyncProxy.js +279 -0
- package/src/windows/ZipWinProj/PGZipInflate.cs +94 -0
- package/src/windows/ZipWinProj/Properties/AssemblyInfo.cs +30 -0
- package/src/windows/ZipWinProj/ZipWinProj.csproj +57 -0
- package/src/wp8/Sync.cs +746 -0
- package/src/wp8/Unzip.cs +481 -0
- package/tests/anyfile.txt +1 -0
- package/tests/archives/www1.zip +0 -0
- package/tests/archives/www2.zip +0 -0
- package/tests/package.json +11 -0
- package/tests/plugin.xml +22 -0
- package/tests/scripts/start-server.sh +2 -0
- package/tests/scripts/stop-server.sh +1 -0
- package/tests/tests.js +255 -0
- package/www/index.js +285 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function notSupported() {
|
|
2
|
+
console.log('ContentSync is not supported on browser platform');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
var ContentSync = function() {};
|
|
6
|
+
ContentSync.prototype.on = function() { notSupported(); };
|
|
7
|
+
ContentSync.prototype.emit = function() { notSupported(); };
|
|
8
|
+
ContentSync.prototype.cancel = function() { notSupported(); };
|
|
9
|
+
|
|
10
|
+
function sync() {
|
|
11
|
+
notSupported();
|
|
12
|
+
return new ContentSync();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
sync: sync,
|
|
17
|
+
unzip: notSupported,
|
|
18
|
+
download: notSupported,
|
|
19
|
+
ContentSync: ContentSync
|
|
20
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
#import <Foundation/Foundation.h>
|
|
20
|
+
#import <Cordova/CDVPlugin.h>
|
|
21
|
+
#import <Cordova/CDVAvailability.h>
|
|
22
|
+
|
|
23
|
+
enum ProgressState {
|
|
24
|
+
Stopped = 0,
|
|
25
|
+
Downloading,
|
|
26
|
+
Extracting,
|
|
27
|
+
Complete
|
|
28
|
+
};
|
|
29
|
+
typedef NSUInteger ProgressState;
|
|
30
|
+
|
|
31
|
+
enum ErrorCodes {
|
|
32
|
+
INVALID_URL_ERR = 1,
|
|
33
|
+
CONNECTION_ERR,
|
|
34
|
+
UNZIP_ERR,
|
|
35
|
+
LOCAL_ERR,
|
|
36
|
+
#if !TARGET_OS_IOS // this is currently not added to ios. see issue-96
|
|
37
|
+
IN_PROGRESS_ERR,
|
|
38
|
+
#endif
|
|
39
|
+
};
|
|
40
|
+
typedef NSUInteger ErrorCodes;
|
|
41
|
+
|
|
42
|
+
@interface ContentSyncTask: NSObject
|
|
43
|
+
|
|
44
|
+
@property (nonatomic) CDVInvokedUrlCommand* command;
|
|
45
|
+
@property (nonatomic) NSURLSessionDownloadTask* downloadTask;
|
|
46
|
+
@property (nonatomic) NSString* appId;
|
|
47
|
+
@property (nonatomic) NSString* archivePath;
|
|
48
|
+
@property (nonatomic) NSInteger progress;
|
|
49
|
+
@property (nonatomic) BOOL extractArchive;
|
|
50
|
+
|
|
51
|
+
@end
|
|
52
|
+
|
|
53
|
+
@interface ContentSync : CDVPlugin <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate>
|
|
54
|
+
|
|
55
|
+
@property (nonatomic) NSString* currentPath;
|
|
56
|
+
@property (nonatomic) NSMutableArray *syncTasks;
|
|
57
|
+
@property (nonatomic) NSURLSession* session;
|
|
58
|
+
@property (nonatomic) NSMutableArray* trustedHosts;
|
|
59
|
+
|
|
60
|
+
- (void) sync:(CDVInvokedUrlCommand*)command;
|
|
61
|
+
- (void) cancel:(CDVInvokedUrlCommand*)command;
|
|
62
|
+
- (void) download:(CDVInvokedUrlCommand*)command;
|
|
63
|
+
- (void) unzip:(CDVInvokedUrlCommand*)command;
|
|
64
|
+
|
|
65
|
+
@end
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* NSURLProtocolNoCache
|
|
69
|
+
*
|
|
70
|
+
* Custom URL Protocol handler to prevent caching of local assets.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
@interface NSURLProtocolNoCache : NSURLProtocol
|
|
74
|
+
@end
|