├── .gitattributes ├── .gitignore ├── .npmignore ├── README.md ├── android ├── README.md ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── reactlibrary │ ├── ClearCacheAsyncTask.java │ ├── ClearCacheModule.java │ └── ClearCachePackage.java ├── index.js ├── ios ├── ClearCache.h ├── ClearCache.m ├── ClearCache.xcodeproj │ └── project.pbxproj └── ClearCache.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── package.json └── react-native-clear-cache.podspec /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # node.js 6 | # 7 | node_modules/ 8 | npm-debug.log 9 | yarn-error.log 10 | 11 | # Xcode 12 | # 13 | build/ 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | *.xccheckout 24 | *.moved-aside 25 | DerivedData 26 | *.hmap 27 | *.ipa 28 | *.xcuserstate 29 | project.xcworkspace 30 | 31 | # Android/IntelliJ 32 | # 33 | build/ 34 | .idea 35 | .gradle 36 | local.properties 37 | *.iml 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sowlutions/react-native-clear-cache/2a0fba4cc2425f4d7c9aaf794cdd4aa3b81fe50d/.npmignore -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-clear-cache 2 | 3 | This app is a clone of [react-native-clear-app-cache](https://github.com/midas-gufei/react-native-clear-app-cache/) but transformed to work with RN 0.60+ 4 | 5 | ## Getting started 6 | 7 | Add to your package.json: 8 | 9 | `"react-native-clear-cache": "sowlutions/react-native-clear-cache"` 10 | 11 | ### Mostly automatic installation 12 | 13 | No need to link as of RN 0.60. 14 | 15 | ## Usage 16 | ```javascript 17 | import ClearCache from 'react-native-clear-cache'; 18 | 19 | // get the storage usage 20 | ClearCache.getAppCacheSize(data => { 21 | alert(data) // will show the App's storage usage in the app's cache. 22 | }); 23 | 24 | 25 | // clear the storage 26 | ClearCache.clearAppCache(data => { 27 | alert(data) // will alert the new size 28 | }); 29 | ``` 30 | -------------------------------------------------------------------------------- /android/README.md: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: 5 | 6 | 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed 7 | 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK 8 | ``` 9 | ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle 10 | sdk.dir=/Users/{username}/Library/Android/sdk 11 | ``` 12 | 3. Delete the `maven` folder 13 | 4. Run `./gradlew installArchives` 14 | 5. Verify that latest set of generated files is in the maven folder with the correct version number 15 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // android/build.gradle 2 | 3 | def safeExtGet(prop, fallback) { 4 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 5 | } 6 | 7 | buildscript { 8 | // The Android Gradle plugin is only required when opening the android folder stand-alone. 9 | // This avoids unnecessary downloads and potential conflicts when the library is included as a 10 | // module dependency in an application project. 11 | if (project == rootProject) { 12 | repositories { 13 | google() 14 | jcenter() 15 | } 16 | dependencies { 17 | classpath 'com.android.tools.build:gradle:3.4.1' 18 | } 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | apply plugin: 'maven' 24 | 25 | // Matches values in recent template from React Native 0.59 / 0.60 26 | // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9 27 | // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L5-L9 28 | def DEFAULT_COMPILE_SDK_VERSION = 28 29 | def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3" 30 | def DEFAULT_MIN_SDK_VERSION = 16 31 | def DEFAULT_TARGET_SDK_VERSION = 28 32 | 33 | android { 34 | compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) 35 | buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) 36 | defaultConfig { 37 | minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) 38 | targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) 39 | versionCode 1 40 | versionName "1.0" 41 | } 42 | lintOptions { 43 | abortOnError false 44 | } 45 | } 46 | 47 | repositories { 48 | mavenLocal() 49 | maven { 50 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 51 | url "$rootDir/../node_modules/react-native/android" 52 | } 53 | maven { 54 | // Android JSC is installed from npm 55 | url "$rootDir/../node_modules/jsc-android/dist" 56 | } 57 | google() 58 | jcenter() 59 | } 60 | 61 | dependencies { 62 | // ref: 63 | // https://github.com/facebook/react-native/blob/0.61-stable/template/android/app/build.gradle#L192 64 | //noinspection GradleDynamicVersion 65 | implementation 'com.facebook.react:react-native:+' // From node_modules 66 | } 67 | 68 | def configureReactNativePom(def pom) { 69 | def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) 70 | 71 | pom.project { 72 | name packageJson.title 73 | artifactId packageJson.name 74 | version = packageJson.version 75 | group = "com.reactlibrary" 76 | description packageJson.description 77 | url packageJson.repository.baseUrl 78 | 79 | licenses { 80 | license { 81 | name packageJson.license 82 | url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename 83 | distribution 'repo' 84 | } 85 | } 86 | 87 | developers { 88 | developer { 89 | id packageJson.author.username 90 | name packageJson.author.name 91 | } 92 | } 93 | } 94 | } 95 | 96 | afterEvaluate { project -> 97 | // some Gradle build hooks ref: 98 | // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html 99 | task androidJavadoc(type: Javadoc) { 100 | source = android.sourceSets.main.java.srcDirs 101 | classpath += files(android.bootClasspath) 102 | classpath += files(project.getConfigurations().getByName('compile').asList()) 103 | include '**/*.java' 104 | } 105 | 106 | task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { 107 | classifier = 'javadoc' 108 | from androidJavadoc.destinationDir 109 | } 110 | 111 | task androidSourcesJar(type: Jar) { 112 | classifier = 'sources' 113 | from android.sourceSets.main.java.srcDirs 114 | include '**/*.java' 115 | } 116 | 117 | android.libraryVariants.all { variant -> 118 | def name = variant.name.capitalize() 119 | task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) { 120 | from variant.javaCompile.destinationDir 121 | } 122 | } 123 | 124 | artifacts { 125 | archives androidSourcesJar 126 | archives androidJavadocJar 127 | } 128 | 129 | task installArchives(type: Upload) { 130 | configuration = configurations.archives 131 | repositories.mavenDeployer { 132 | // Deploy to react-native-event-bridge/maven, ready to publish to npm 133 | repository url: "file://${projectDir}/../android/maven" 134 | configureReactNativePom pom 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactlibrary/ClearCacheAsyncTask.java: -------------------------------------------------------------------------------- 1 | package com.reactlibrary; 2 | 3 | import android.os.AsyncTask; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.bridge.Callback; 7 | 8 | import java.io.File; 9 | 10 | public class ClearCacheAsyncTask extends AsyncTask { 11 | public ClearCacheModule myclearCacheModule = null; 12 | public Callback callback; 13 | public ClearCacheAsyncTask(ClearCacheModule clearCacheModule, Callback callback) { 14 | super(); 15 | this.myclearCacheModule = clearCacheModule; 16 | this.callback = callback; 17 | } 18 | 19 | @Override 20 | protected void onPreExecute() { 21 | super.onPreExecute(); 22 | } 23 | 24 | @Override 25 | protected void onPostExecute(String s) { 26 | super.onPostExecute(s); 27 | callback.invoke(); 28 | 29 | } 30 | 31 | @Override 32 | protected String doInBackground(Integer... params) { 33 | myclearCacheModule.clearCache(); 34 | return null; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactlibrary/ClearCacheModule.java: -------------------------------------------------------------------------------- 1 | package com.reactlibrary; 2 | 3 | import com.facebook.react.bridge.Arguments; 4 | import com.facebook.react.bridge.Callback; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.bridge.ReactContext; 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 8 | import com.facebook.react.bridge.ReactMethod; 9 | import com.facebook.react.bridge.WritableMap; 10 | import com.facebook.react.modules.core.DeviceEventManagerModule; 11 | 12 | import android.content.Context; 13 | import android.support.annotation.Nullable; 14 | import android.util.Log; 15 | 16 | import java.io.File; 17 | 18 | public class ClearCacheModule extends ReactContextBaseJavaModule { 19 | 20 | private final ReactApplicationContext reactContext; 21 | static public ClearCacheModule myclearCacheModule; 22 | 23 | public ClearCacheModule(ReactApplicationContext reactContext) { 24 | super(reactContext); 25 | 26 | this.reactContext = reactContext; 27 | myclearCacheModule = this; 28 | } 29 | 30 | @Override 31 | public String getName() { 32 | return "ClearCache"; 33 | } 34 | 35 | //获取缓存大小 36 | @ReactMethod 37 | public void getAppCacheSize(Callback callback) { 38 | // 计算缓存大小 39 | long fileSize = 0; 40 | File filesDir = getReactApplicationContext().getFilesDir();// /data/data/package_name/files 41 | File cacheDir = getReactApplicationContext().getCacheDir();// /data/data/package_name/cache 42 | fileSize += getDirSize(filesDir); 43 | fileSize += getDirSize(cacheDir); 44 | // 2.2版本才有将应用缓存转移到sd卡的功能 45 | if (isMethodsCompat(android.os.Build.VERSION_CODES.FROYO)) { 46 | File externalCacheDir = getExternalCacheDir(getReactApplicationContext());//"/Android/data//cache/" 47 | fileSize += getDirSize(externalCacheDir); 48 | } 49 | if (fileSize > 0) { 50 | String strFileSize = formatFileSize(fileSize); 51 | String unit = formatFileSizeName(fileSize); 52 | callback.invoke(strFileSize, unit); 53 | } else { 54 | WritableMap params = Arguments.createMap(); 55 | callback.invoke("0", "B"); 56 | } 57 | } 58 | 59 | @ReactMethod 60 | public void clearAppCache(Callback callback) { 61 | ClearCacheAsyncTask asyncTask = new ClearCacheAsyncTask(myclearCacheModule, callback); 62 | asyncTask.execute(10); 63 | } 64 | 65 | private long getDirSize(File dir) { 66 | if (dir == null) { 67 | return 0; 68 | } 69 | if (!dir.isDirectory()) { 70 | return 0; 71 | } 72 | long dirSize = 0; 73 | File[] files = dir.listFiles(); 74 | for (File file : files) { 75 | if (file.isFile()) { 76 | dirSize += file.length(); 77 | } else if (file.isDirectory()) { 78 | dirSize += file.length(); 79 | dirSize += getDirSize(file); 80 | } 81 | } 82 | return dirSize; 83 | } 84 | 85 | private boolean isMethodsCompat(int VersionCode) { 86 | int currentVersion = android.os.Build.VERSION.SDK_INT; 87 | return currentVersion >= VersionCode; 88 | } 89 | 90 | private File getExternalCacheDir(Context context) { 91 | return context.getExternalCacheDir(); 92 | } 93 | 94 | private String formatFileSizeName(long fileS) { 95 | java.text.DecimalFormat df = new java.text.DecimalFormat("#.00"); 96 | String fileSizeString = ""; 97 | if (fileS < 1024) { 98 | fileSizeString = "B"; 99 | } else if (fileS < 1048576) { 100 | fileSizeString = "KB"; 101 | } else if (fileS < 1073741824) { 102 | fileSizeString = "MB"; 103 | } else { 104 | fileSizeString = "G"; 105 | } 106 | return fileSizeString; 107 | } 108 | 109 | private String formatFileSize(long fileS) { 110 | java.text.DecimalFormat df = new java.text.DecimalFormat("#.00"); 111 | String fileSizeString = ""; 112 | if (fileS < 1024) { 113 | fileSizeString = df.format((double) fileS); 114 | } else if (fileS < 1048576) { 115 | fileSizeString = df.format((double) fileS / 1024); 116 | } else if (fileS < 1073741824) { 117 | fileSizeString = df.format((double) fileS / 1048576); 118 | } else { 119 | fileSizeString = df.format((double) fileS / 1073741824); 120 | } 121 | return fileSizeString; 122 | } 123 | 124 | public void clearCache() { 125 | 126 | getReactApplicationContext().deleteDatabase("webview.db"); 127 | getReactApplicationContext().deleteDatabase("webview.db-shm"); 128 | getReactApplicationContext().deleteDatabase("webview.db-wal"); 129 | getReactApplicationContext().deleteDatabase("webviewCache.db"); 130 | getReactApplicationContext().deleteDatabase("webviewCache.db-shm"); 131 | getReactApplicationContext().deleteDatabase("webviewCache.db-wal"); 132 | clearCacheFolder(getReactApplicationContext().getFilesDir(), System.currentTimeMillis()); 133 | clearCacheFolder(getReactApplicationContext().getCacheDir(), System.currentTimeMillis()); 134 | if (isMethodsCompat(android.os.Build.VERSION_CODES.FROYO)) { 135 | clearCacheFolder(getExternalCacheDir(getReactApplicationContext()), System.currentTimeMillis()); 136 | } 137 | 138 | } 139 | 140 | private int clearCacheFolder(File dir, long curTime) { 141 | int deletedFiles = 0; 142 | if (dir != null && dir.isDirectory()) { 143 | try { 144 | for (File child : dir.listFiles()) { 145 | if (child.isDirectory()) { 146 | deletedFiles += clearCacheFolder(child, curTime); 147 | } 148 | if (child.lastModified() < curTime) { 149 | if (child.delete()) { 150 | deletedFiles++; 151 | } 152 | } 153 | } 154 | } catch (Exception e) { 155 | e.printStackTrace(); 156 | } 157 | } 158 | return deletedFiles; 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactlibrary/ClearCachePackage.java: -------------------------------------------------------------------------------- 1 | package com.reactlibrary; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.bridge.NativeModule; 9 | import com.facebook.react.bridge.ReactApplicationContext; 10 | import com.facebook.react.uimanager.ViewManager; 11 | import com.facebook.react.bridge.JavaScriptModule; 12 | 13 | public class ClearCachePackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new ClearCacheModule(reactContext)); 17 | } 18 | 19 | @Override 20 | public List createViewManagers(ReactApplicationContext reactContext) { 21 | return Collections.emptyList(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { NativeModules } from 'react-native'; 2 | 3 | const { ClearCache } = NativeModules; 4 | 5 | export default ClearCache; 6 | -------------------------------------------------------------------------------- /ios/ClearCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ClearCache : NSObject 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /ios/ClearCache.m: -------------------------------------------------------------------------------- 1 | #import "ClearCache.h" 2 | 3 | 4 | @implementation ClearCache 5 | 6 | RCT_EXPORT_MODULE() 7 | 8 | RCT_EXPORT_METHOD(getAppCacheSize:(RCTResponseSenderBlock)callback) 9 | { 10 | NSString* fileSize = [self filePath:@"2"]; 11 | NSString* fileSizeName = [self filePath:@"1"]; 12 | callback(@[fileSize, fileSizeName]); 13 | } 14 | 15 | RCT_EXPORT_METHOD(clearAppCache:(RCTResponseSenderBlock)callback) 16 | { 17 | [self clearFile:callback]; 18 | } 19 | 20 | - (NSString*)filePath:(NSString*)type 21 | { 22 | NSString * cachPath = [ NSSearchPathForDirectoriesInDomains ( NSCachesDirectory , NSUserDomainMask , YES ) firstObject ]; 23 | return [self folderSizeAtPath :cachPath type:type]; 24 | } 25 | 26 | - (long long)fileSizeAtPath:( NSString *) filePath { 27 | NSFileManager * manager = [ NSFileManager defaultManager]; 28 | if ([manager fileExistsAtPath :filePath]) { 29 | return [[manager attributesOfItemAtPath :filePath error : nil ] fileSize ]; 30 | } 31 | return 0; 32 | } 33 | 34 | - (NSString*)folderSizeAtPath:(NSString *) folderPath type:(NSString*)type { 35 | 36 | NSFileManager *manager = [NSFileManager defaultManager]; 37 | 38 | if (![manager fileExistsAtPath :folderPath]) return 0 ; 39 | 40 | NSEnumerator *childFilesEnumerator = [[manager subpathsAtPath :folderPath] objectEnumerator ]; 41 | 42 | NSString *fileName; 43 | 44 | long long folderSize = 0 ; 45 | 46 | while ((fileName = [childFilesEnumerator nextObject ]) != nil ) { 47 | NSString * fileAbsolutePath = [folderPath stringByAppendingPathComponent :fileName]; 48 | folderSize += [ self fileSizeAtPath :fileAbsolutePath]; 49 | } 50 | 51 | NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; 52 | formatter.roundingMode = NSNumberFormatterRoundFloor; 53 | formatter.maximumFractionDigits = 2; 54 | 55 | NSString* strFileSize = [[NSString alloc]init]; 56 | NSMutableString* strFileName = [[NSMutableString alloc]init]; 57 | if (folderSize < 1024) { 58 | NSNumber* fileSize = [NSNumber numberWithFloat: folderSize]; 59 | strFileSize = [formatter stringFromNumber:fileSize]; 60 | [strFileName setString:@"B"]; 61 | } else if (folderSize < 1048576) { 62 | NSNumber* fileSize = [NSNumber numberWithFloat: (folderSize / 1024.0)]; 63 | strFileSize = [formatter stringFromNumber:fileSize]; 64 | [strFileName setString:@"KB"]; 65 | } else if(folderSize < 1073741824) { 66 | NSNumber* fileSize = [NSNumber numberWithFloat: (folderSize / 1048576.0)]; 67 | strFileSize = [formatter stringFromNumber:fileSize]; 68 | [strFileName setString:@"MB"]; 69 | } else { 70 | NSNumber* fileSize = [NSNumber numberWithFloat: (folderSize / 1073741824.0)]; 71 | strFileSize = [formatter stringFromNumber:fileSize]; 72 | [strFileName setString:@"G"]; 73 | } 74 | 75 | if ([type isEqualToString:@"1"]) { 76 | return strFileName; 77 | } else { 78 | return strFileSize; 79 | } 80 | } 81 | 82 | - (void)clearFile:(RCTResponseSenderBlock)callback 83 | { 84 | NSString * cachPath = [NSSearchPathForDirectoriesInDomains (NSCachesDirectory, NSUserDomainMask, YES ) firstObject]; 85 | 86 | NSArray * files = [[NSFileManager defaultManager]subpathsAtPath:cachPath]; 87 | 88 | NSLog ( @"cachpath = %@" , cachPath); 89 | 90 | for ( NSString * p in files) { 91 | NSError * error = nil ; 92 | NSString * path = [cachPath stringByAppendingPathComponent :p]; 93 | if ([[ NSFileManager defaultManager ] fileExistsAtPath :path]) { 94 | [[ NSFileManager defaultManager ] removeItemAtPath :path error :&error]; 95 | } 96 | } 97 | 98 | callback(@[[NSNull null]]); 99 | 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /ios/ClearCache.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* ClearCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ClearCache.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libClearCache.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libClearCache.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | B3E7B5881CC2AC0600A0062D /* ClearCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClearCache.h; sourceTree = ""; }; 28 | B3E7B5891CC2AC0600A0062D /* ClearCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClearCache.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libClearCache.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | B3E7B5881CC2AC0600A0062D /* ClearCache.h */, 54 | B3E7B5891CC2AC0600A0062D /* ClearCache.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* ClearCache */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ClearCache" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = ClearCache; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libClearCache.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0920; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ClearCache" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 58B511D21A9E6C8500147676; 101 | productRefGroup = 58B511D21A9E6C8500147676; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 58B511DA1A9E6C8500147676 /* ClearCache */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 58B511D71A9E6C8500147676 /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | B3E7B58A1CC2AC0600A0062D /* ClearCache.m in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 58B511ED1A9E6C8500147676 /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 131 | CLANG_WARN_BOOL_CONVERSION = YES; 132 | CLANG_WARN_COMMA = YES; 133 | CLANG_WARN_CONSTANT_CONVERSION = YES; 134 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 135 | CLANG_WARN_EMPTY_BODY = YES; 136 | CLANG_WARN_ENUM_CONVERSION = YES; 137 | CLANG_WARN_INFINITE_RECURSION = YES; 138 | CLANG_WARN_INT_CONVERSION = YES; 139 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 140 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 141 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 142 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 143 | CLANG_WARN_STRICT_PROTOTYPES = YES; 144 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 145 | CLANG_WARN_UNREACHABLE_CODE = YES; 146 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 147 | COPY_PHASE_STRIP = NO; 148 | ENABLE_STRICT_OBJC_MSGSEND = YES; 149 | ENABLE_TESTABILITY = YES; 150 | GCC_C_LANGUAGE_STANDARD = gnu99; 151 | GCC_DYNAMIC_NO_PIC = NO; 152 | GCC_NO_COMMON_BLOCKS = YES; 153 | GCC_OPTIMIZATION_LEVEL = 0; 154 | GCC_PREPROCESSOR_DEFINITIONS = ( 155 | "DEBUG=1", 156 | "$(inherited)", 157 | ); 158 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 159 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 160 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 161 | GCC_WARN_UNDECLARED_SELECTOR = YES; 162 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 163 | GCC_WARN_UNUSED_FUNCTION = YES; 164 | GCC_WARN_UNUSED_VARIABLE = YES; 165 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 166 | MTL_ENABLE_DEBUG_INFO = YES; 167 | ONLY_ACTIVE_ARCH = YES; 168 | SDKROOT = iphoneos; 169 | }; 170 | name = Debug; 171 | }; 172 | 58B511EE1A9E6C8500147676 /* Release */ = { 173 | isa = XCBuildConfiguration; 174 | buildSettings = { 175 | ALWAYS_SEARCH_USER_PATHS = NO; 176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 177 | CLANG_CXX_LIBRARY = "libc++"; 178 | CLANG_ENABLE_MODULES = YES; 179 | CLANG_ENABLE_OBJC_ARC = YES; 180 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_COMMA = YES; 183 | CLANG_WARN_CONSTANT_CONVERSION = YES; 184 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 185 | CLANG_WARN_EMPTY_BODY = YES; 186 | CLANG_WARN_ENUM_CONVERSION = YES; 187 | CLANG_WARN_INFINITE_RECURSION = YES; 188 | CLANG_WARN_INT_CONVERSION = YES; 189 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 190 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 191 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 192 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 193 | CLANG_WARN_STRICT_PROTOTYPES = YES; 194 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 195 | CLANG_WARN_UNREACHABLE_CODE = YES; 196 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 197 | COPY_PHASE_STRIP = YES; 198 | ENABLE_NS_ASSERTIONS = NO; 199 | ENABLE_STRICT_OBJC_MSGSEND = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu99; 201 | GCC_NO_COMMON_BLOCKS = YES; 202 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 203 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 204 | GCC_WARN_UNDECLARED_SELECTOR = YES; 205 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 206 | GCC_WARN_UNUSED_FUNCTION = YES; 207 | GCC_WARN_UNUSED_VARIABLE = YES; 208 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 209 | MTL_ENABLE_DEBUG_INFO = NO; 210 | SDKROOT = iphoneos; 211 | VALIDATE_PRODUCT = YES; 212 | }; 213 | name = Release; 214 | }; 215 | 58B511F01A9E6C8500147676 /* Debug */ = { 216 | isa = XCBuildConfiguration; 217 | buildSettings = { 218 | HEADER_SEARCH_PATHS = ( 219 | "$(inherited)", 220 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 221 | "$(SRCROOT)/../../../React/**", 222 | "$(SRCROOT)/../../react-native/React/**", 223 | ); 224 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 225 | OTHER_LDFLAGS = "-ObjC"; 226 | PRODUCT_NAME = ClearCache; 227 | SKIP_INSTALL = YES; 228 | }; 229 | name = Debug; 230 | }; 231 | 58B511F11A9E6C8500147676 /* Release */ = { 232 | isa = XCBuildConfiguration; 233 | buildSettings = { 234 | HEADER_SEARCH_PATHS = ( 235 | "$(inherited)", 236 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 237 | "$(SRCROOT)/../../../React/**", 238 | "$(SRCROOT)/../../react-native/React/**", 239 | ); 240 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 241 | OTHER_LDFLAGS = "-ObjC"; 242 | PRODUCT_NAME = ClearCache; 243 | SKIP_INSTALL = YES; 244 | }; 245 | name = Release; 246 | }; 247 | /* End XCBuildConfiguration section */ 248 | 249 | /* Begin XCConfigurationList section */ 250 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ClearCache" */ = { 251 | isa = XCConfigurationList; 252 | buildConfigurations = ( 253 | 58B511ED1A9E6C8500147676 /* Debug */, 254 | 58B511EE1A9E6C8500147676 /* Release */, 255 | ); 256 | defaultConfigurationIsVisible = 0; 257 | defaultConfigurationName = Release; 258 | }; 259 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ClearCache" */ = { 260 | isa = XCConfigurationList; 261 | buildConfigurations = ( 262 | 58B511F01A9E6C8500147676 /* Debug */, 263 | 58B511F11A9E6C8500147676 /* Release */, 264 | ); 265 | defaultConfigurationIsVisible = 0; 266 | defaultConfigurationName = Release; 267 | }; 268 | /* End XCConfigurationList section */ 269 | }; 270 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 271 | } 272 | -------------------------------------------------------------------------------- /ios/ClearCache.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/ClearCache.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-clear-cache", 3 | "title": "React Native Clear Cache", 4 | "version": "1.0.0", 5 | "description": "TODO", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/sowlutions/react-native-clear-cache.git", 13 | "baseUrl": "https://github.com/sowlutions/react-native-clear-cache" 14 | }, 15 | "keywords": [ 16 | "react-native" 17 | ], 18 | "author": { 19 | "name": "Sowlutions Inc.", 20 | "email": "tech@sowlutions.com" 21 | }, 22 | "license": "MIT", 23 | "licenseFilename": "LICENSE", 24 | "readmeFilename": "README.md", 25 | "peerDependencies": { 26 | "react": "^16.8.1", 27 | "react-native": ">=0.59.0-rc.0 <1.0.x" 28 | }, 29 | "devDependencies": { 30 | "react": "^16.8.3", 31 | "react-native": "^0.59.10" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /react-native-clear-cache.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = "react-native-clear-cache" 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.description = <<-DESC 10 | react-native-clear-cache 11 | DESC 12 | s.homepage = "https://github.com/github_account/react-native-clear-cache" 13 | s.license = "MIT" 14 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 15 | s.authors = { "Your Name" => "yourname@email.com" } 16 | s.platforms = { :ios => "9.0", :tvos => "10.0" } 17 | s.source = { :git => "https://github.com/github_account/react-native-clear-cache.git", :tag => "#{s.version}" } 18 | 19 | s.source_files = "ios/**/*.{h,m,swift}" 20 | s.requires_arc = true 21 | 22 | s.dependency "React" 23 | 24 | # s.dependency "..." 25 | end 26 | 27 | --------------------------------------------------------------------------------