├── .gitignore ├── .npmignore ├── Assets.ios.js ├── README.md ├── iOS ├── Podfile ├── RCTAssetsManager.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── jgabrielgutierrez.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── RCTAssetsManager.xcscheme │ └── xcuserdata │ │ └── jgabrielgutierrez.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── RCTAssetsManager │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── minus.imageset │ │ │ ├── Contents.json │ │ │ └── minus.png │ │ └── no_image_available.imageset │ │ │ ├── Contents.json │ │ │ ├── no_image_available-1.png │ │ │ └── no_image_available.png │ ├── Info.plist │ ├── RCTAssetManager.h │ ├── RCTAssetManager.m │ ├── RCTStoreManager.h │ ├── RCTStoreManager.m │ ├── main.jsbundle │ └── main.m └── RCTAssetsManagerTests │ ├── Info.plist │ └── RCTAssetsManagerTests.m ├── index.ios.js ├── logo.png ├── no_image_available.png └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | Podfile.lock 2 | iOS/Pods 3 | node_modules 4 | iOS/RCTAssetsManager.xcworkspace 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | iOS/RCTAssetsManager.xcworkspace/ 9 | iOS/Pods/ 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | *.xccheckout 20 | *.moved-aside 21 | DerivedData 22 | *.hmap 23 | *.ipa 24 | *.xcuserstate 25 | 26 | # node.js 27 | # 28 | node_modules/ 29 | npm-debug.log 30 | -------------------------------------------------------------------------------- /Assets.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 4 | * @providesModule ResourceDowloader 5 | * @flow 6 | */ 7 | 'use strict'; 8 | 9 | 10 | var RCTAssetManager = require('NativeModules').AssetManager; 11 | var invariant = require('invariant'); 12 | 13 | 14 | class Assets { 15 | 16 | 17 | /** 18 | * Saves the resource file dowloaded from url into cache directory 19 | * @param {string} url 20 | * @param {string} cacheDir cache directory where we're going to store the resource file 21 | * @param {function} sucessfull callback -Invoked with arg of filename given to dowloaded resource in cache 22 | * directory. 23 | * @param {function} error callback - Invoked with error message on error. 24 | * 25 | */ 26 | static downloadResourceFromUrl( url: string, cacheDir: string, successCallback: Function, errorCallback: Function) { 27 | 28 | invariant( 29 | typeof url === 'string', 30 | 'RCTAssetManager.downloadResourceFromUrl url must be a valid string.' 31 | ); 32 | 33 | invariant( 34 | typeof cacheDir === 'string', 35 | 'RCTAssetManager.downloadResourceFromUrl cacheDir must be a valid string.' 36 | ); 37 | 38 | RCTAssetManager.downloadResourceFromUrl( 39 | url,cacheDir, 40 | 41 | (localFileName) => { 42 | successCallback && successCallback(localFileName); 43 | }, 44 | (errorMessage) => { 45 | errorCallback && errorCallback(errorMessage); 46 | }); 47 | } 48 | 49 | /** 50 | * Lists resource file names in cache directory 51 | * @param {string} cacheDir cache directory where is stored the resource file. 52 | * @param {function} sucessfull callback -Invoked with arg of list of resource filenames stored 53 | * in cache directory. 54 | * @param {function} error callback - Invoked with error message on error. 55 | */ 56 | static listResourcesInCache(cacheDir: string, successCallback: Function, errorCallback:Function) { 57 | 58 | invariant( 59 | typeof cacheDir === 'string', 60 | 'RCTAssetManager.downloadResourceFromUrl cacheDir must be a valid string.' 61 | ); 62 | 63 | 64 | RCTAssetManager.listResourcesInCache(cacheDir, 65 | 66 | (arrayFilenames) => { 67 | successCallback && successCallback(arrayFilenames); 68 | }, 69 | (errorMessage) => { 70 | errorCallback && errorCallback(errorMessage); 71 | }); 72 | } 73 | 74 | 75 | /** 76 | * Delete resource file in cache directory 77 | * @param {string} cacheDir cache directory where is stored the resource file. 78 | * @param {function} sucessfull callback -Invoked with arg of list of resource filenames stored 79 | * in cache directory. 80 | * @param {function} error callback - Invoked with error message on error. 81 | */ 82 | static deleteResourceInCache(filename:string, cacheDir: string, successCallback:Function) { 83 | 84 | invariant( 85 | typeof cacheDir === 'string', 86 | 'RCTAssetManager.deleteResourceInCache cacheDir must be a valid string.' 87 | ); 88 | 89 | invariant( 90 | typeof filename === 'string', 91 | 'RCTAssetManager.deleteResourceInCache filename must be a valid string.' 92 | ); 93 | 94 | 95 | RCTAssetManager.deleteResourceInCache(filename,cacheDir, 96 | 97 | (deleted) => { 98 | successCallback && successCallback(deleted); 99 | } 100 | ); 101 | } 102 | 103 | } 104 | 105 | 106 | module.exports = Assets; 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-assets 2 | React native module that allows download assets in background from an url and persist them into a specific directory in Documents folder on iOS. In addition, you can delete and list assets from that directory. 3 | 4 | # How to run the example 5 | 6 | 1. npm install 7 | 2. Install CocoaPods https://guides.cocoapods.org/using/getting-started.html#toc_3 8 | 3. cd iOS/ 9 | 4. pod install 10 | 5. Then open RCTAssetsManager.cworkspace and run the app 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /iOS/Podfile: -------------------------------------------------------------------------------- 1 | pod "AFNetworking", "~> 2.0" 2 | platform :ios, ‘7.0’ 3 | 4 | target 'RCTAssetsManager' do 5 | 6 | end 7 | 8 | target 'RCTAssetsManagerTests' do 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; }; 11 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 12 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 13 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 14 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 15 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 16 | 00E356F31AD99517003FC87E /* RCTAssetsManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* RCTAssetsManagerTests.m */; }; 17 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 18 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 19 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 20 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 21 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 22 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 23 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 25 | 53126D23B2196DEF77F7EA4F /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A8D9733DF62BC25BC477B72 /* libPods.a */; }; 26 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 27 | C238A5A31B90C9C00080C0B4 /* RCTAssetManager.h in Sources */ = {isa = PBXBuildFile; fileRef = C238A59F1B90C9C00080C0B4 /* RCTAssetManager.h */; }; 28 | C238A5A41B90C9C00080C0B4 /* RCTAssetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C238A5A01B90C9C00080C0B4 /* RCTAssetManager.m */; }; 29 | C238A5A51B90C9C00080C0B4 /* RCTStoreManager.h in Sources */ = {isa = PBXBuildFile; fileRef = C238A5A11B90C9C00080C0B4 /* RCTStoreManager.h */; }; 30 | C238A5A61B90C9C00080C0B4 /* RCTStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C238A5A21B90C9C00080C0B4 /* RCTStoreManager.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 37 | proxyType = 2; 38 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 39 | remoteInfo = RCTActionSheet; 40 | }; 41 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 44 | proxyType = 2; 45 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 46 | remoteInfo = RCTGeolocation; 47 | }; 48 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 49 | isa = PBXContainerItemProxy; 50 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 51 | proxyType = 2; 52 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 53 | remoteInfo = RCTImage; 54 | }; 55 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 56 | isa = PBXContainerItemProxy; 57 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 58 | proxyType = 2; 59 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 60 | remoteInfo = RCTNetwork; 61 | }; 62 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 63 | isa = PBXContainerItemProxy; 64 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 65 | proxyType = 2; 66 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 67 | remoteInfo = RCTVibration; 68 | }; 69 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 70 | isa = PBXContainerItemProxy; 71 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 72 | proxyType = 1; 73 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 74 | remoteInfo = RCTAssetsManager; 75 | }; 76 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 77 | isa = PBXContainerItemProxy; 78 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 79 | proxyType = 2; 80 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 81 | remoteInfo = RCTSettings; 82 | }; 83 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 84 | isa = PBXContainerItemProxy; 85 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 86 | proxyType = 2; 87 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 88 | remoteInfo = RCTWebSocket; 89 | }; 90 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 91 | isa = PBXContainerItemProxy; 92 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 93 | proxyType = 2; 94 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 95 | remoteInfo = React; 96 | }; 97 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 98 | isa = PBXContainerItemProxy; 99 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 100 | proxyType = 2; 101 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 102 | remoteInfo = RCTLinking; 103 | }; 104 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 105 | isa = PBXContainerItemProxy; 106 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 107 | proxyType = 2; 108 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 109 | remoteInfo = RCTText; 110 | }; 111 | /* End PBXContainerItemProxy section */ 112 | 113 | /* Begin PBXFileReference section */ 114 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 115 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 116 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 117 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 118 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 119 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 120 | 00E356EE1AD99517003FC87E /* RCTAssetsManagerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RCTAssetsManagerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 121 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 122 | 00E356F21AD99517003FC87E /* RCTAssetsManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTAssetsManagerTests.m; sourceTree = ""; }; 123 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 124 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 125 | 13B07F961A680F5B00A75B9A /* RCTAssetsManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RCTAssetsManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; 126 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 127 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 128 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 129 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 130 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 131 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 132 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 133 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 134 | 7A8D9733DF62BC25BC477B72 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 135 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 136 | A2C368ADE7B6CD81BE17432B /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 137 | C238A59F1B90C9C00080C0B4 /* RCTAssetManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTAssetManager.h; sourceTree = ""; }; 138 | C238A5A01B90C9C00080C0B4 /* RCTAssetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTAssetManager.m; sourceTree = ""; }; 139 | C238A5A11B90C9C00080C0B4 /* RCTStoreManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTStoreManager.h; sourceTree = ""; }; 140 | C238A5A21B90C9C00080C0B4 /* RCTStoreManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTStoreManager.m; sourceTree = ""; }; 141 | D79D68A36165EACA8D824611 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 142 | /* End PBXFileReference section */ 143 | 144 | /* Begin PBXFrameworksBuildPhase section */ 145 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 146 | isa = PBXFrameworksBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 153 | isa = PBXFrameworksBuildPhase; 154 | buildActionMask = 2147483647; 155 | files = ( 156 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 157 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 158 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 159 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 160 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 161 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 162 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 163 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 164 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 165 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 166 | 53126D23B2196DEF77F7EA4F /* libPods.a in Frameworks */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXFrameworksBuildPhase section */ 171 | 172 | /* Begin PBXGroup section */ 173 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 177 | ); 178 | name = Products; 179 | sourceTree = ""; 180 | }; 181 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 185 | ); 186 | name = Products; 187 | sourceTree = ""; 188 | }; 189 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 190 | isa = PBXGroup; 191 | children = ( 192 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 193 | ); 194 | name = Products; 195 | sourceTree = ""; 196 | }; 197 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 198 | isa = PBXGroup; 199 | children = ( 200 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 201 | ); 202 | name = Products; 203 | sourceTree = ""; 204 | }; 205 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 206 | isa = PBXGroup; 207 | children = ( 208 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 209 | ); 210 | name = Products; 211 | sourceTree = ""; 212 | }; 213 | 00E356EF1AD99517003FC87E /* RCTAssetsManagerTests */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | 00E356F21AD99517003FC87E /* RCTAssetsManagerTests.m */, 217 | 00E356F01AD99517003FC87E /* Supporting Files */, 218 | ); 219 | path = RCTAssetsManagerTests; 220 | sourceTree = ""; 221 | }; 222 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 223 | isa = PBXGroup; 224 | children = ( 225 | 00E356F11AD99517003FC87E /* Info.plist */, 226 | ); 227 | name = "Supporting Files"; 228 | sourceTree = ""; 229 | }; 230 | 139105B71AF99BAD00B5F7CC /* Products */ = { 231 | isa = PBXGroup; 232 | children = ( 233 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 234 | ); 235 | name = Products; 236 | sourceTree = ""; 237 | }; 238 | 139FDEE71B06529A00C62182 /* Products */ = { 239 | isa = PBXGroup; 240 | children = ( 241 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 242 | ); 243 | name = Products; 244 | sourceTree = ""; 245 | }; 246 | 13B07FAE1A68108700A75B9A /* RCTAssetsManager */ = { 247 | isa = PBXGroup; 248 | children = ( 249 | C238A59F1B90C9C00080C0B4 /* RCTAssetManager.h */, 250 | C238A5A01B90C9C00080C0B4 /* RCTAssetManager.m */, 251 | C238A5A11B90C9C00080C0B4 /* RCTStoreManager.h */, 252 | C238A5A21B90C9C00080C0B4 /* RCTStoreManager.m */, 253 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 254 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 255 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 256 | 13B07FB61A68108700A75B9A /* Info.plist */, 257 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 258 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 259 | 13B07FB71A68108700A75B9A /* main.m */, 260 | ); 261 | path = RCTAssetsManager; 262 | sourceTree = ""; 263 | }; 264 | 146834001AC3E56700842450 /* Products */ = { 265 | isa = PBXGroup; 266 | children = ( 267 | 146834041AC3E56700842450 /* libReact.a */, 268 | ); 269 | name = Products; 270 | sourceTree = ""; 271 | }; 272 | 36D2BB789D406B970F495CE9 /* Pods */ = { 273 | isa = PBXGroup; 274 | children = ( 275 | D79D68A36165EACA8D824611 /* Pods.debug.xcconfig */, 276 | A2C368ADE7B6CD81BE17432B /* Pods.release.xcconfig */, 277 | ); 278 | name = Pods; 279 | sourceTree = ""; 280 | }; 281 | 78C398B11ACF4ADC00677621 /* Products */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 285 | ); 286 | name = Products; 287 | sourceTree = ""; 288 | }; 289 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 290 | isa = PBXGroup; 291 | children = ( 292 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 293 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 294 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 295 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 296 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 297 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 298 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 299 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 300 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 301 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 302 | ); 303 | name = Libraries; 304 | sourceTree = ""; 305 | }; 306 | 832341B11AAA6A8300B99B32 /* Products */ = { 307 | isa = PBXGroup; 308 | children = ( 309 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 310 | ); 311 | name = Products; 312 | sourceTree = ""; 313 | }; 314 | 83CBB9F61A601CBA00E9B192 = { 315 | isa = PBXGroup; 316 | children = ( 317 | 13B07FAE1A68108700A75B9A /* RCTAssetsManager */, 318 | 00E356EF1AD99517003FC87E /* RCTAssetsManagerTests */, 319 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 320 | 83CBBA001A601CBA00E9B192 /* Products */, 321 | DD2B953D6F0ABE10CF3D7197 /* Frameworks */, 322 | 36D2BB789D406B970F495CE9 /* Pods */, 323 | ); 324 | indentWidth = 2; 325 | sourceTree = ""; 326 | tabWidth = 2; 327 | }; 328 | 83CBBA001A601CBA00E9B192 /* Products */ = { 329 | isa = PBXGroup; 330 | children = ( 331 | 13B07F961A680F5B00A75B9A /* RCTAssetsManager.app */, 332 | 00E356EE1AD99517003FC87E /* RCTAssetsManagerTests.xctest */, 333 | ); 334 | name = Products; 335 | sourceTree = ""; 336 | }; 337 | DD2B953D6F0ABE10CF3D7197 /* Frameworks */ = { 338 | isa = PBXGroup; 339 | children = ( 340 | 7A8D9733DF62BC25BC477B72 /* libPods.a */, 341 | ); 342 | name = Frameworks; 343 | sourceTree = ""; 344 | }; 345 | /* End PBXGroup section */ 346 | 347 | /* Begin PBXNativeTarget section */ 348 | 00E356ED1AD99517003FC87E /* RCTAssetsManagerTests */ = { 349 | isa = PBXNativeTarget; 350 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RCTAssetsManagerTests" */; 351 | buildPhases = ( 352 | 00E356EA1AD99517003FC87E /* Sources */, 353 | 00E356EB1AD99517003FC87E /* Frameworks */, 354 | 00E356EC1AD99517003FC87E /* Resources */, 355 | ); 356 | buildRules = ( 357 | ); 358 | dependencies = ( 359 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 360 | ); 361 | name = RCTAssetsManagerTests; 362 | productName = RCTAssetsManagerTests; 363 | productReference = 00E356EE1AD99517003FC87E /* RCTAssetsManagerTests.xctest */; 364 | productType = "com.apple.product-type.bundle.unit-test"; 365 | }; 366 | 13B07F861A680F5B00A75B9A /* RCTAssetsManager */ = { 367 | isa = PBXNativeTarget; 368 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RCTAssetsManager" */; 369 | buildPhases = ( 370 | B525D9D9AEE036ADF3F1DAF9 /* Check Pods Manifest.lock */, 371 | 13B07F871A680F5B00A75B9A /* Sources */, 372 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 373 | 13B07F8E1A680F5B00A75B9A /* Resources */, 374 | C1257DCB452A2462F64260BE /* Copy Pods Resources */, 375 | ); 376 | buildRules = ( 377 | ); 378 | dependencies = ( 379 | ); 380 | name = RCTAssetsManager; 381 | productName = "Hello World"; 382 | productReference = 13B07F961A680F5B00A75B9A /* RCTAssetsManager.app */; 383 | productType = "com.apple.product-type.application"; 384 | }; 385 | /* End PBXNativeTarget section */ 386 | 387 | /* Begin PBXProject section */ 388 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 389 | isa = PBXProject; 390 | attributes = { 391 | LastUpgradeCheck = 0610; 392 | ORGANIZATIONNAME = Facebook; 393 | TargetAttributes = { 394 | 00E356ED1AD99517003FC87E = { 395 | CreatedOnToolsVersion = 6.2; 396 | TestTargetID = 13B07F861A680F5B00A75B9A; 397 | }; 398 | }; 399 | }; 400 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RCTAssetsManager" */; 401 | compatibilityVersion = "Xcode 3.2"; 402 | developmentRegion = English; 403 | hasScannedForEncodings = 0; 404 | knownRegions = ( 405 | en, 406 | Base, 407 | ); 408 | mainGroup = 83CBB9F61A601CBA00E9B192; 409 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 410 | projectDirPath = ""; 411 | projectReferences = ( 412 | { 413 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 414 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 415 | }, 416 | { 417 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 418 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 419 | }, 420 | { 421 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 422 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 423 | }, 424 | { 425 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 426 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 427 | }, 428 | { 429 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 430 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 431 | }, 432 | { 433 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 434 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 435 | }, 436 | { 437 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 438 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 439 | }, 440 | { 441 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 442 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 443 | }, 444 | { 445 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 446 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 447 | }, 448 | { 449 | ProductGroup = 146834001AC3E56700842450 /* Products */; 450 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 451 | }, 452 | ); 453 | projectRoot = ""; 454 | targets = ( 455 | 13B07F861A680F5B00A75B9A /* RCTAssetsManager */, 456 | 00E356ED1AD99517003FC87E /* RCTAssetsManagerTests */, 457 | ); 458 | }; 459 | /* End PBXProject section */ 460 | 461 | /* Begin PBXReferenceProxy section */ 462 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 463 | isa = PBXReferenceProxy; 464 | fileType = archive.ar; 465 | path = libRCTActionSheet.a; 466 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 467 | sourceTree = BUILT_PRODUCTS_DIR; 468 | }; 469 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 470 | isa = PBXReferenceProxy; 471 | fileType = archive.ar; 472 | path = libRCTGeolocation.a; 473 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 474 | sourceTree = BUILT_PRODUCTS_DIR; 475 | }; 476 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 477 | isa = PBXReferenceProxy; 478 | fileType = archive.ar; 479 | path = libRCTImage.a; 480 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 481 | sourceTree = BUILT_PRODUCTS_DIR; 482 | }; 483 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 484 | isa = PBXReferenceProxy; 485 | fileType = archive.ar; 486 | path = libRCTNetwork.a; 487 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 488 | sourceTree = BUILT_PRODUCTS_DIR; 489 | }; 490 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 491 | isa = PBXReferenceProxy; 492 | fileType = archive.ar; 493 | path = libRCTVibration.a; 494 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 495 | sourceTree = BUILT_PRODUCTS_DIR; 496 | }; 497 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 498 | isa = PBXReferenceProxy; 499 | fileType = archive.ar; 500 | path = libRCTSettings.a; 501 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 502 | sourceTree = BUILT_PRODUCTS_DIR; 503 | }; 504 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 505 | isa = PBXReferenceProxy; 506 | fileType = archive.ar; 507 | path = libRCTWebSocket.a; 508 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 509 | sourceTree = BUILT_PRODUCTS_DIR; 510 | }; 511 | 146834041AC3E56700842450 /* libReact.a */ = { 512 | isa = PBXReferenceProxy; 513 | fileType = archive.ar; 514 | path = libReact.a; 515 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 516 | sourceTree = BUILT_PRODUCTS_DIR; 517 | }; 518 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 519 | isa = PBXReferenceProxy; 520 | fileType = archive.ar; 521 | path = libRCTLinking.a; 522 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 523 | sourceTree = BUILT_PRODUCTS_DIR; 524 | }; 525 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 526 | isa = PBXReferenceProxy; 527 | fileType = archive.ar; 528 | path = libRCTText.a; 529 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 530 | sourceTree = BUILT_PRODUCTS_DIR; 531 | }; 532 | /* End PBXReferenceProxy section */ 533 | 534 | /* Begin PBXResourcesBuildPhase section */ 535 | 00E356EC1AD99517003FC87E /* Resources */ = { 536 | isa = PBXResourcesBuildPhase; 537 | buildActionMask = 2147483647; 538 | files = ( 539 | ); 540 | runOnlyForDeploymentPostprocessing = 0; 541 | }; 542 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 543 | isa = PBXResourcesBuildPhase; 544 | buildActionMask = 2147483647; 545 | files = ( 546 | 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */, 547 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 548 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 549 | ); 550 | runOnlyForDeploymentPostprocessing = 0; 551 | }; 552 | /* End PBXResourcesBuildPhase section */ 553 | 554 | /* Begin PBXShellScriptBuildPhase section */ 555 | B525D9D9AEE036ADF3F1DAF9 /* Check Pods Manifest.lock */ = { 556 | isa = PBXShellScriptBuildPhase; 557 | buildActionMask = 2147483647; 558 | files = ( 559 | ); 560 | inputPaths = ( 561 | ); 562 | name = "Check Pods Manifest.lock"; 563 | outputPaths = ( 564 | ); 565 | runOnlyForDeploymentPostprocessing = 0; 566 | shellPath = /bin/sh; 567 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 568 | showEnvVarsInLog = 0; 569 | }; 570 | C1257DCB452A2462F64260BE /* Copy Pods Resources */ = { 571 | isa = PBXShellScriptBuildPhase; 572 | buildActionMask = 2147483647; 573 | files = ( 574 | ); 575 | inputPaths = ( 576 | ); 577 | name = "Copy Pods Resources"; 578 | outputPaths = ( 579 | ); 580 | runOnlyForDeploymentPostprocessing = 0; 581 | shellPath = /bin/sh; 582 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 583 | showEnvVarsInLog = 0; 584 | }; 585 | /* End PBXShellScriptBuildPhase section */ 586 | 587 | /* Begin PBXSourcesBuildPhase section */ 588 | 00E356EA1AD99517003FC87E /* Sources */ = { 589 | isa = PBXSourcesBuildPhase; 590 | buildActionMask = 2147483647; 591 | files = ( 592 | 00E356F31AD99517003FC87E /* RCTAssetsManagerTests.m in Sources */, 593 | ); 594 | runOnlyForDeploymentPostprocessing = 0; 595 | }; 596 | 13B07F871A680F5B00A75B9A /* Sources */ = { 597 | isa = PBXSourcesBuildPhase; 598 | buildActionMask = 2147483647; 599 | files = ( 600 | C238A5A31B90C9C00080C0B4 /* RCTAssetManager.h in Sources */, 601 | C238A5A41B90C9C00080C0B4 /* RCTAssetManager.m in Sources */, 602 | C238A5A51B90C9C00080C0B4 /* RCTStoreManager.h in Sources */, 603 | C238A5A61B90C9C00080C0B4 /* RCTStoreManager.m in Sources */, 604 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 605 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 606 | ); 607 | runOnlyForDeploymentPostprocessing = 0; 608 | }; 609 | /* End PBXSourcesBuildPhase section */ 610 | 611 | /* Begin PBXTargetDependency section */ 612 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 613 | isa = PBXTargetDependency; 614 | target = 13B07F861A680F5B00A75B9A /* RCTAssetsManager */; 615 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 616 | }; 617 | /* End PBXTargetDependency section */ 618 | 619 | /* Begin PBXVariantGroup section */ 620 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 621 | isa = PBXVariantGroup; 622 | children = ( 623 | 13B07FB21A68108700A75B9A /* Base */, 624 | ); 625 | name = LaunchScreen.xib; 626 | sourceTree = ""; 627 | }; 628 | /* End PBXVariantGroup section */ 629 | 630 | /* Begin XCBuildConfiguration section */ 631 | 00E356F61AD99517003FC87E /* Debug */ = { 632 | isa = XCBuildConfiguration; 633 | buildSettings = { 634 | BUNDLE_LOADER = "$(TEST_HOST)"; 635 | FRAMEWORK_SEARCH_PATHS = ( 636 | "$(SDKROOT)/Developer/Library/Frameworks", 637 | "$(inherited)", 638 | ); 639 | GCC_PREPROCESSOR_DEFINITIONS = ( 640 | "DEBUG=1", 641 | "$(inherited)", 642 | ); 643 | INFOPLIST_FILE = RCTAssetsManagerTests/Info.plist; 644 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 645 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 646 | PRODUCT_NAME = "$(TARGET_NAME)"; 647 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCTAssetsManager.app/RCTAssetsManager"; 648 | }; 649 | name = Debug; 650 | }; 651 | 00E356F71AD99517003FC87E /* Release */ = { 652 | isa = XCBuildConfiguration; 653 | buildSettings = { 654 | BUNDLE_LOADER = "$(TEST_HOST)"; 655 | COPY_PHASE_STRIP = NO; 656 | FRAMEWORK_SEARCH_PATHS = ( 657 | "$(SDKROOT)/Developer/Library/Frameworks", 658 | "$(inherited)", 659 | ); 660 | INFOPLIST_FILE = RCTAssetsManagerTests/Info.plist; 661 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 662 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 663 | PRODUCT_NAME = "$(TARGET_NAME)"; 664 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCTAssetsManager.app/RCTAssetsManager"; 665 | }; 666 | name = Release; 667 | }; 668 | 13B07F941A680F5B00A75B9A /* Debug */ = { 669 | isa = XCBuildConfiguration; 670 | baseConfigurationReference = D79D68A36165EACA8D824611 /* Pods.debug.xcconfig */; 671 | buildSettings = { 672 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 673 | HEADER_SEARCH_PATHS = ( 674 | "$(inherited)", 675 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 676 | "$(SRCROOT)/../node_modules/react-native/React/**", 677 | ); 678 | INFOPLIST_FILE = "$(SRCROOT)/RCTAssetsManager/Info.plist"; 679 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 680 | OTHER_LDFLAGS = "$(inherited)"; 681 | PRODUCT_NAME = RCTAssetsManager; 682 | }; 683 | name = Debug; 684 | }; 685 | 13B07F951A680F5B00A75B9A /* Release */ = { 686 | isa = XCBuildConfiguration; 687 | baseConfigurationReference = A2C368ADE7B6CD81BE17432B /* Pods.release.xcconfig */; 688 | buildSettings = { 689 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 690 | HEADER_SEARCH_PATHS = ( 691 | "$(inherited)", 692 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 693 | "$(SRCROOT)/../node_modules/react-native/React/**", 694 | ); 695 | INFOPLIST_FILE = "$(SRCROOT)/RCTAssetsManager/Info.plist"; 696 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 697 | OTHER_LDFLAGS = "$(inherited)"; 698 | PRODUCT_NAME = RCTAssetsManager; 699 | }; 700 | name = Release; 701 | }; 702 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 703 | isa = XCBuildConfiguration; 704 | buildSettings = { 705 | ALWAYS_SEARCH_USER_PATHS = NO; 706 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 707 | CLANG_CXX_LIBRARY = "libc++"; 708 | CLANG_ENABLE_MODULES = YES; 709 | CLANG_ENABLE_OBJC_ARC = YES; 710 | CLANG_WARN_BOOL_CONVERSION = YES; 711 | CLANG_WARN_CONSTANT_CONVERSION = YES; 712 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 713 | CLANG_WARN_EMPTY_BODY = YES; 714 | CLANG_WARN_ENUM_CONVERSION = YES; 715 | CLANG_WARN_INT_CONVERSION = YES; 716 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 717 | CLANG_WARN_UNREACHABLE_CODE = YES; 718 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 719 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 720 | COPY_PHASE_STRIP = NO; 721 | ENABLE_STRICT_OBJC_MSGSEND = YES; 722 | GCC_C_LANGUAGE_STANDARD = gnu99; 723 | GCC_DYNAMIC_NO_PIC = NO; 724 | GCC_OPTIMIZATION_LEVEL = 0; 725 | GCC_PREPROCESSOR_DEFINITIONS = ( 726 | "DEBUG=1", 727 | "$(inherited)", 728 | ); 729 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 730 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 731 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 732 | GCC_WARN_UNDECLARED_SELECTOR = YES; 733 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 734 | GCC_WARN_UNUSED_FUNCTION = YES; 735 | GCC_WARN_UNUSED_VARIABLE = YES; 736 | HEADER_SEARCH_PATHS = ( 737 | "$(inherited)", 738 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 739 | "$(SRCROOT)/../node_modules/react-native/React/**", 740 | ); 741 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 742 | MTL_ENABLE_DEBUG_INFO = YES; 743 | ONLY_ACTIVE_ARCH = YES; 744 | SDKROOT = iphoneos; 745 | }; 746 | name = Debug; 747 | }; 748 | 83CBBA211A601CBA00E9B192 /* Release */ = { 749 | isa = XCBuildConfiguration; 750 | buildSettings = { 751 | ALWAYS_SEARCH_USER_PATHS = NO; 752 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 753 | CLANG_CXX_LIBRARY = "libc++"; 754 | CLANG_ENABLE_MODULES = YES; 755 | CLANG_ENABLE_OBJC_ARC = YES; 756 | CLANG_WARN_BOOL_CONVERSION = YES; 757 | CLANG_WARN_CONSTANT_CONVERSION = YES; 758 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 759 | CLANG_WARN_EMPTY_BODY = YES; 760 | CLANG_WARN_ENUM_CONVERSION = YES; 761 | CLANG_WARN_INT_CONVERSION = YES; 762 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 763 | CLANG_WARN_UNREACHABLE_CODE = YES; 764 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 765 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 766 | COPY_PHASE_STRIP = YES; 767 | ENABLE_NS_ASSERTIONS = NO; 768 | ENABLE_STRICT_OBJC_MSGSEND = YES; 769 | GCC_C_LANGUAGE_STANDARD = gnu99; 770 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 771 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 772 | GCC_WARN_UNDECLARED_SELECTOR = YES; 773 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 774 | GCC_WARN_UNUSED_FUNCTION = YES; 775 | GCC_WARN_UNUSED_VARIABLE = YES; 776 | HEADER_SEARCH_PATHS = ( 777 | "$(inherited)", 778 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 779 | "$(SRCROOT)/../node_modules/react-native/React/**", 780 | ); 781 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 782 | MTL_ENABLE_DEBUG_INFO = NO; 783 | SDKROOT = iphoneos; 784 | VALIDATE_PRODUCT = YES; 785 | }; 786 | name = Release; 787 | }; 788 | /* End XCBuildConfiguration section */ 789 | 790 | /* Begin XCConfigurationList section */ 791 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RCTAssetsManagerTests" */ = { 792 | isa = XCConfigurationList; 793 | buildConfigurations = ( 794 | 00E356F61AD99517003FC87E /* Debug */, 795 | 00E356F71AD99517003FC87E /* Release */, 796 | ); 797 | defaultConfigurationIsVisible = 0; 798 | defaultConfigurationName = Release; 799 | }; 800 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RCTAssetsManager" */ = { 801 | isa = XCConfigurationList; 802 | buildConfigurations = ( 803 | 13B07F941A680F5B00A75B9A /* Debug */, 804 | 13B07F951A680F5B00A75B9A /* Release */, 805 | ); 806 | defaultConfigurationIsVisible = 0; 807 | defaultConfigurationName = Release; 808 | }; 809 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RCTAssetsManager" */ = { 810 | isa = XCConfigurationList; 811 | buildConfigurations = ( 812 | 83CBBA201A601CBA00E9B192 /* Debug */, 813 | 83CBBA211A601CBA00E9B192 /* Release */, 814 | ); 815 | defaultConfigurationIsVisible = 0; 816 | defaultConfigurationName = Release; 817 | }; 818 | /* End XCConfigurationList section */ 819 | }; 820 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 821 | } 822 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager.xcodeproj/project.xcworkspace/xcuserdata/jgabrielgutierrez.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/iOS/RCTAssetsManager.xcodeproj/project.xcworkspace/xcuserdata/jgabrielgutierrez.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iOS/RCTAssetsManager.xcodeproj/xcshareddata/xcschemes/RCTAssetsManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager.xcodeproj/xcuserdata/jgabrielgutierrez.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RCTAssetsManager.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 00E356ED1AD99517003FC87E 16 | 17 | primary 18 | 19 | 20 | 13B07F861A680F5B00A75B9A 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"RCTAssetsManager" 50 | launchOptions:launchOptions]; 51 | 52 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 53 | UIViewController *rootViewController = [[UIViewController alloc] init]; 54 | rootViewController.view = rootView; 55 | self.window.rootViewController = rootViewController; 56 | [self.window makeKeyAndVisible]; 57 | return YES; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/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 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/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 | } -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/Images.xcassets/minus.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "minus.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/Images.xcassets/minus.imageset/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/iOS/RCTAssetsManager/Images.xcassets/minus.imageset/minus.png -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/Images.xcassets/no_image_available.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "no_image_available-1.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "no_image_available.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/Images.xcassets/no_image_available.imageset/no_image_available-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/iOS/RCTAssetsManager/Images.xcassets/no_image_available.imageset/no_image_available-1.png -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/Images.xcassets/no_image_available.imageset/no_image_available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/iOS/RCTAssetsManager/Images.xcassets/no_image_available.imageset/no_image_available.png -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/RCTAssetManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTResourceDownloadManager.h 3 | // GoldfingrNative 4 | // 5 | // Created by Juan Gabriel Gutierrez on 2015-06-11. 6 | // Copyright (c) 2015 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RCTBridge.h" 11 | @interface RCTAssetManager : NSObject 12 | { 13 | 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/RCTAssetManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTResourceDownloadManager.m 3 | // GoldfingrNative 4 | // 5 | // Created by Juan Gabriel Gutierrez on 2015-06-11. 6 | // Copyright (c) 2015 Facebook. All rights reserved. 7 | // 8 | 9 | 10 | #import "RCTAssetManager.h" 11 | #import "AFURLSessionManager.h" 12 | #import "AFHTTPRequestOperation.h" 13 | #import "RCTStoreManager.h" 14 | 15 | 16 | 17 | @implementation RCTAssetManager 18 | 19 | RCT_EXPORT_MODULE(); 20 | 21 | 22 | 23 | 24 | RCT_EXPORT_METHOD(downloadResourceFromUrl:(NSURL *)url andStoreInto:(NSString *) cacheDirectory 25 | onSuccesfull:(RCTResponseSenderBlock)successCallback onFailure:(RCTResponseSenderBlock)errorCallback) 26 | { 27 | 28 | NSURLRequest *request = [NSURLRequest requestWithURL:url]; 29 | 30 | AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; 31 | op.responseSerializer = [AFHTTPResponseSerializer serializer]; 32 | 33 | //On Succesfull 34 | [ op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 35 | 36 | 37 | RCTStoreManager* storeManager = [ [RCTStoreManager alloc] init]; 38 | NSString *stringURL = [ url absoluteString]; 39 | NSString *fileName = [ stringURL lastPathComponent ]; 40 | 41 | BOOL isStored = [ storeManager storeDataIntoLocalFilesystem:responseObject intoFile:fileName inDirectory:cacheDirectory ]; 42 | 43 | 44 | NSString *fullPath = [ storeManager getFullPath:cacheDirectory storedFilename:fileName ]; 45 | 46 | successCallback(@[@{@"filename":fullPath }]); 47 | 48 | 49 | 50 | // On Failure 51 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 52 | errorCallback(@[[error localizedDescription]]); 53 | }]; 54 | 55 | [[NSOperationQueue mainQueue] addOperation:op]; 56 | 57 | } 58 | 59 | 60 | RCT_EXPORT_METHOD(listResourcesInCache:(NSString *) cacheDirectory 61 | onSuccesfull:(RCTResponseSenderBlock)successCallback onFailure:(RCTResponseSenderBlock)errorCallback) 62 | { 63 | 64 | RCTStoreManager* manager = [ [RCTStoreManager alloc] init]; 65 | NSMutableArray* filenames = [ manager retrieveFilesFromDir:cacheDirectory ]; 66 | 67 | successCallback(@[filenames]); 68 | 69 | 70 | 71 | } 72 | 73 | 74 | RCT_EXPORT_METHOD(deleteResourceInCache:(NSString *) resourceFilename cacheDirectory: (NSString *) directory 75 | onSuccesfull:(RCTResponseSenderBlock)successCallback ) 76 | { 77 | 78 | RCTStoreManager* manager = [ [RCTStoreManager alloc] init]; 79 | BOOL deleted =[ manager removeFile:resourceFilename inDirectory:directory]; 80 | 81 | successCallback(@[@(deleted)]); 82 | 83 | 84 | } 85 | 86 | 87 | 88 | 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/RCTStoreManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTStoreManager.h 3 | // GoldfingrNative 4 | // 5 | // Created by Juan Gabriel Gutierrez on 2015-06-10. 6 | // Copyright (c) 2015 Facebook. All rights reserved. 7 | // 8 | 9 | 10 | #import "RCTBridge.h" 11 | 12 | @interface RCTStoreManager : NSObject 13 | 14 | 15 | - (BOOL)storeDataIntoLocalFilesystem:(id)content intoFile:(NSString *)filename inDirectory:(NSString *)directory; 16 | 17 | - (NSMutableArray*) retrieveFilesFromDir:(NSString *)directory; 18 | 19 | - (NSString*) getFullPath:(NSString *)directory storedFilename:(NSString *)filename; 20 | 21 | - (BOOL)removeFile:(NSString *)filename inDirectory:(NSString *)directory; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/RCTStoreManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTStoreManager.m 3 | // GoldfingrNative 4 | // 5 | // Created by Juan Gabriel Gutierrez on 2015-06-10. 6 | // Copyright (c) 2015 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RCTStoreManager.h" 10 | 11 | @interface RCTStoreManager () { 12 | NSString * _rootPath; 13 | 14 | } 15 | @end 16 | 17 | @implementation RCTStoreManager 18 | 19 | RCT_EXPORT_MODULE(); 20 | 21 | - (id)init { 22 | self = [super init]; 23 | if (self) { 24 | // get the root path of the Document Directory 25 | // NSCacheDirectory is also good to use 26 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 27 | _rootPath = [paths objectAtIndex:0]; 28 | 29 | } 30 | return self; 31 | } 32 | 33 | 34 | 35 | #pragma mark - storing management methods 36 | 37 | // store a data into a file in a specific sub directory 38 | RCT_EXPORT_METHOD(storeData:(id)content intoFile:(NSString *)filename inDirectory:(NSString *)directory callback:(RCTResponseSenderBlock)callback) { 39 | 40 | BOOL result = [self storeDataIntoLocalFilesystem:content intoFile:filename inDirectory:directory]; 41 | callback(@[@(result)]); 42 | } 43 | 44 | 45 | 46 | 47 | // store a data into a file in a specific sub directory 48 | - (BOOL)storeDataIntoLocalFilesystem:(id)content intoFile:(NSString *)filename inDirectory:(NSString *)directory { 49 | 50 | 51 | NSString *fullPath = [_rootPath stringByAppendingPathComponent:directory]; 52 | 53 | if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) 54 | [[NSFileManager defaultManager] createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil]; 55 | 56 | fullPath = [fullPath stringByAppendingPathComponent:filename]; 57 | 58 | //BOOL result = [NSKeyedArchiver archiveRootObject:content toFile:fullPath]; 59 | 60 | NSData *imageData = (NSData *)content; 61 | 62 | BOOL result = [ imageData writeToFile:fullPath atomically:YES]; 63 | 64 | if (result) 65 | NSLog(@"Successfully saved %@", fullPath); 66 | else 67 | NSLog(@"ERROR: can't save %@", fullPath); 68 | 69 | 70 | return result; 71 | 72 | } 73 | 74 | 75 | 76 | - (NSMutableArray*) retrieveFilesFromDir:(NSString *)directory { 77 | 78 | 79 | 80 | NSString *fullPath = [_rootPath stringByAppendingPathComponent:directory]; 81 | NSURL *url = [NSURL URLWithString:fullPath]; 82 | 83 | NSFileManager *fm = [[NSFileManager alloc] init]; 84 | NSDirectoryEnumerator *dirEnumerator = [fm enumeratorAtURL:url 85 | includingPropertiesForKeys:@[ NSURLNameKey, NSURLIsDirectoryKey ] 86 | options:NSDirectoryEnumerationSkipsHiddenFiles | NSDirectoryEnumerationSkipsSubdirectoryDescendants 87 | errorHandler:nil]; 88 | 89 | NSMutableArray *fileList = [NSMutableArray array]; 90 | 91 | for (NSURL *theURL in dirEnumerator) { 92 | NSNumber *isDirectory; 93 | [theURL getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:NULL]; 94 | if (![isDirectory boolValue]) { 95 | [fileList addObject: [ theURL absoluteString ]]; 96 | } 97 | } 98 | 99 | 100 | return fileList; 101 | } 102 | 103 | 104 | - (NSString*) getFullPath:(NSString *)directory storedFilename:(NSString *)filename { 105 | 106 | NSString *fullPath = [ [_rootPath stringByAppendingPathComponent:directory] stringByAppendingString: filename ]; 107 | return fullPath; 108 | 109 | } 110 | 111 | 112 | 113 | 114 | 115 | 116 | // remove a file in a specific sub directory 117 | - (BOOL)removeFile:(NSString *)filename inDirectory:(NSString *)directory { 118 | 119 | 120 | NSString *fullPath = [_rootPath stringByAppendingPathComponent:directory]; 121 | 122 | if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { 123 | return NO; 124 | } 125 | 126 | fullPath = [fullPath stringByAppendingPathComponent:filename]; 127 | 128 | NSError *error = [NSError new]; 129 | 130 | if ([[NSFileManager defaultManager] removeItemAtPath:fullPath error:&error]){ 131 | NSLog(@"Successfully removed %@", fullPath); 132 | return YES; 133 | 134 | }else{ 135 | NSLog(@"ERROR: can't remove %@ : %@",fullPath, [error localizedDescription]); 136 | return NO; 137 | } 138 | 139 | return NO; 140 | } 141 | 142 | // get the data stored into a file 143 | - (id)loadObjectFromFile:(NSString *)filename inDirectory:(NSString *)directory { 144 | 145 | NSString *fullPath = [_rootPath stringByAppendingPathComponent:directory]; 146 | if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) 147 | return nil; 148 | 149 | fullPath = [fullPath stringByAppendingPathComponent:filename]; 150 | return [NSKeyedUnarchiver unarchiveObjectWithFile:fullPath]; 151 | } 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | @end 169 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from the root of your project: 3 | // 4 | // $ react-native bundle --minify 5 | // 6 | // See http://facebook.github.io/react-native/docs/runningondevice.html for more details. 7 | 8 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 9 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManager/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManagerTests/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 | -------------------------------------------------------------------------------- /iOS/RCTAssetsManagerTests/RCTAssetsManagerTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTAssert.h" 14 | #import "RCTRedBox.h" 15 | #import "RCTRootView.h" 16 | 17 | #define TIMEOUT_SECONDS 240 18 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 19 | 20 | @interface RCTAssetsManagerTests : XCTestCase 21 | 22 | @end 23 | 24 | @implementation RCTAssetsManagerTests 25 | 26 | 27 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 28 | { 29 | if (test(view)) { 30 | return YES; 31 | } 32 | for (UIView *subview in [view subviews]) { 33 | if ([self findSubviewInView:subview matching:test]) { 34 | return YES; 35 | } 36 | } 37 | return NO; 38 | } 39 | 40 | - (void)testRendersWelcomeScreen { 41 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 42 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 43 | BOOL foundElement = NO; 44 | NSString *redboxError = nil; 45 | 46 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 47 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 49 | 50 | redboxError = [[RCTRedBox sharedInstance] currentErrorMessage]; 51 | 52 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 53 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 54 | return YES; 55 | } 56 | return NO; 57 | }]; 58 | } 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var Assets = require('./Assets.ios'); 9 | var Button = require('react-native-button'); 10 | 11 | 12 | var { 13 | AppRegistry, 14 | StyleSheet, 15 | Text, 16 | View, 17 | Image, 18 | TextInput, 19 | View, 20 | ListView, 21 | TouchableHighlight 22 | } = React; 23 | 24 | var component = React.createClass({ 25 | 26 | 27 | getInitialState: function() { 28 | 29 | return { 30 | dataSource: new ListView.DataSource({ 31 | rowHasChanged: (r1, r2) => r1 !== r2 32 | }), 33 | imageNumber: DEFAULT_IMAGE_NUMBER, 34 | localImage : DEFAULT_LOCAL_IMAGE 35 | }; 36 | 37 | }, 38 | _onSucessAssetDownload: function(response) { 39 | 40 | this.setState({localImage: response.filename}); 41 | this._listAssets(); 42 | }, 43 | _error : function(error){ 44 | console.log('error callback ',error); 45 | alert('Error!!',error); 46 | }, 47 | 48 | _onSucessListAssets: function(arrayFilenames){ 49 | 50 | this.setState({ 51 | dataSource: this.state.dataSource.cloneWithRows(arrayFilenames) 52 | }); 53 | }, 54 | 55 | _onSucessDeleteAsset: function (){ 56 | 57 | this._listAssets(); 58 | 59 | }, 60 | _dowloadAssest: function(){ 61 | 62 | var imageUrl = BASE_URL + this.state.imageNumber + '.jpg' 63 | 64 | Assets.downloadResourceFromUrl(imageUrl, CACHE_DIR, this._onSucessAssetDownload, this._error); 65 | 66 | }, 67 | _listAssets: function(){ 68 | 69 | Assets.listResourcesInCache(CACHE_DIR, this._onSucessListAssets, this._error); 70 | 71 | }, 72 | _extractFileName: function(filePath){ 73 | 74 | return filePath.substring(filePath.lastIndexOf("/")+1,filePath.length); 75 | 76 | }, 77 | 78 | _deleteAsset: function (data){ 79 | 80 | console.log('delete asset',data) 81 | Assets.deleteResourceInCache(data,CACHE_DIR,this._onSucessDeleteAsset) 82 | 83 | }, 84 | 85 | _renderRow: function(rowData: string, sectionID: number, rowID: number) { 86 | 87 | var fileName = this._extractFileName(rowData); 88 | var localPath = rowData.replace('file://',''); 89 | 90 | return ( 91 | 92 | 93 | 95 | 96 | 98 | {fileName} 99 | 100 | ); 101 | }, 102 | 103 | render: function() { 104 | 105 | 106 | return ( 107 | 108 | 109 | 110 | 111 | BASE URL: 112 | 113 | 114 | {BASE_URL} 115 | 116 | 117 | 118 | this.setState({imageNumber})} 121 | defaultValue={DEFAULT_IMAGE_NUMBER} 122 | value={this.state.imageNumber} 123 | /> 124 | 125 | 126 | .jpg 127 | 128 | 129 | 130 | 133 | 134 | 139 | 140 | 141 | 142 | ); 143 | } 144 | }); 145 | 146 | var DEFAULT_LOCAL_IMAGE = require('image!no_image_available') 147 | var MINUS_IMAGE = require('image!minus') 148 | 149 | var BASE_URL = 'https://s3.amazonaws.com/99Covers-Facebook-Covers/watermark/'; 150 | var DEFAULT_IMAGE_NUMBER = 10; 151 | 152 | var CACHE_DIR = 'images'; 153 | 154 | 155 | var styles = StyleSheet.create({ 156 | container: { 157 | flex: 1, 158 | backgroundColor: '#F5FCFF', 159 | margin:10 160 | }, 161 | welcome: { 162 | fontSize: 20, 163 | textAlign: 'center', 164 | margin: 10, 165 | }, 166 | instructions: { 167 | textAlign: 'center', 168 | color: '#333333', 169 | marginBottom: 5, 170 | }, 171 | }); 172 | 173 | AppRegistry.registerComponent('RCTAssetsManager', () => component); 174 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/logo.png -------------------------------------------------------------------------------- /no_image_available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llanox/react-native-assets/c6f6500d760c48dc93367ae715adc48e849449af/no_image_available.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-assets", 3 | "version": "0.0.2", 4 | "license": "MIT", 5 | "keywords": [ 6 | "react-native", 7 | "react-utilities", 8 | "ios", 9 | "assets", 10 | "downloader", 11 | "assets manager" 12 | ], 13 | "description": "Module to manage assets. It allows you download assests from a network and store into a specific local folder on iOS", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/llanox/react-native-assests.git" 17 | }, 18 | "dependencies": { 19 | "react-native": "^0.10.0", 20 | "react-native-button": "^1.2.1" 21 | }, 22 | "author": "Gabriel Gutierrez ", 23 | "contributors": [ 24 | { 25 | "name": "Georg Göttlich", 26 | "email": "mail@dvine.de", 27 | "url": "https://github.com/dvine-multimedia" 28 | } 29 | ], 30 | "bugs": { 31 | "url": "https://github.com/llanox/react-native-assests/issues" 32 | }, 33 | "homepage": "github.com/llanox/react-native-assests#readme", 34 | 35 | "main": "Assets.ios.js" 36 | } 37 | --------------------------------------------------------------------------------