diff --git a/App.js b/App.js index 2a72f76..3835cea 100644 --- a/App.js +++ b/App.js @@ -17,9 +17,9 @@ import Package from './package.json' import HttpUtils from './HttpUtils.js'; import CodePush from "react-native-code-push"; import DeviceInfo from "react-native-device-info"; - +import RNFetchBlob from 'react-native-fetch-blob'; import * as Animatable from 'react-native-animatable'; - +import {CachedImage,ImageCache} from "react-native-img-cache"; var testMac = 'FF:FF:FF:FF:FF:FF' var contentItemDefault = { @@ -248,6 +248,7 @@ codePushStatusDidChange(syncStatus) { if (result.code != 200) { this.showErrMsg(result.message+'\n'+this.state.macAddress); } else if (result.data.list) { + ImageCache.get().clear(); adDataList = result.data.list; if (this.updateContent()) { this.setState({contentDisplayStatus: true}) @@ -407,7 +408,7 @@ getContentViewItem(contentItem, annomation) { {/* 列表 */} - + {/* 券的title */} {contentItem.target.title} @@ -424,7 +425,7 @@ getContentViewItem(contentItem, annomation) { {/* */} - + {/* 优惠券底部商户名称 */} diff --git a/android/app/build.gradle b/android/app/build.gradle index afcacdd..c68f647 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -181,6 +181,7 @@ android { } dependencies { + implementation project(':react-native-fetch-blob') implementation project(':react-native-camera') implementation project(':react-native-device-info') implementation project(':react-native-code-push') diff --git a/android/app/src/main/java/com/screenad/MainApplication.java b/android/app/src/main/java/com/screenad/MainApplication.java index 2664dc1..6ab9b0c 100644 --- a/android/app/src/main/java/com/screenad/MainApplication.java +++ b/android/app/src/main/java/com/screenad/MainApplication.java @@ -3,6 +3,7 @@ package com.screenad; import android.app.Application; import com.facebook.react.ReactApplication; +import com.RNFetchBlob.RNFetchBlobPackage; import org.reactnative.camera.RNCameraPackage; import com.facebook.react.bridge.ReactApplicationContext; @@ -37,6 +38,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new RNFetchBlobPackage(), new RNCameraPackage(), new RNBuildConfigPackage(), new RNDeviceInfo(), diff --git a/android/settings.gradle b/android/settings.gradle index 399f0dc..c7cbd7f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'screenAd' +include ':react-native-fetch-blob' +project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android') include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android') include ':react-native-device-info' diff --git a/ios/screenAd.xcodeproj/project.pbxproj b/ios/screenAd.xcodeproj/project.pbxproj index a67b30b..6fad2e7 100644 --- a/ios/screenAd.xcodeproj/project.pbxproj +++ b/ios/screenAd.xcodeproj/project.pbxproj @@ -44,6 +44,7 @@ FEBB7F68D5534228A6A832AD /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C488E5D3FD5417DAAAA5C79 /* libRNDeviceInfo.a */; }; 59D20E8E9CD64A01B87A3AC0 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22D705AD40EF415A95C31652 /* libRNDeviceInfo-tvOS.a */; }; D240C4819F1E4B80BB6D7BEE /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F8C0E0ED2BA401B9075C9F3 /* libRNCamera.a */; }; + BA9EAC9D8E144D058AC73DD2 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 99C586CF88164E08936AF0C0 /* libRNFetchBlob.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -359,6 +360,8 @@ 22D705AD40EF415A95C31652 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; 0F57B32024664223A7D6E682 /* RNCamera.xcodeproj */ = {isa = PBXFileReference; name = "RNCamera.xcodeproj"; path = "../node_modules/react-native-camera/ios/RNCamera.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; 4F8C0E0ED2BA401B9075C9F3 /* libRNCamera.a */ = {isa = PBXFileReference; name = "libRNCamera.a"; path = "libRNCamera.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + BE5C3F5DA65B4EFC83BEC512 /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; name = "RNFetchBlob.xcodeproj"; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 99C586CF88164E08936AF0C0 /* libRNFetchBlob.a */ = {isa = PBXFileReference; name = "libRNFetchBlob.a"; path = "libRNFetchBlob.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -391,6 +394,7 @@ C7220E8B42ED4C16A6C2AE14 /* libz.tbd in Frameworks */, FEBB7F68D5534228A6A832AD /* libRNDeviceInfo.a in Frameworks */, D240C4819F1E4B80BB6D7BEE /* libRNCamera.a in Frameworks */, + BA9EAC9D8E144D058AC73DD2 /* libRNFetchBlob.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -585,6 +589,7 @@ D256D2ADE9FF4E9782EBCA6D /* CodePush.xcodeproj */, C6058A0BC9054E0394045AC4 /* RNDeviceInfo.xcodeproj */, 0F57B32024664223A7D6E682 /* RNCamera.xcodeproj */, + BE5C3F5DA65B4EFC83BEC512 /* RNFetchBlob.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1213,12 +1218,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Debug; @@ -1241,12 +1248,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Release; @@ -1272,6 +1281,7 @@ "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Debug; @@ -1296,6 +1306,7 @@ "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Release; @@ -1326,12 +1337,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Debug; @@ -1362,12 +1375,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Release; @@ -1397,12 +1412,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Debug; @@ -1432,12 +1449,14 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", + "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", ); }; name = Release; diff --git a/package.json b/package.json index 7866644..39871b6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,10 @@ "react-native-camera": "^1.12.0", "react-native-code-push": "^5.6.0", "react-native-device-info": "^2.1.2", - "react-native-swiper": "^1.5.14" + "react-native-fetch-blob": "^0.10.8", + "react-native-img-cache": "^1.6.0", + "react-native-swiper": "^1.5.14", + "rn-fetch-blob": "^0.10.15" }, "devDependencies": { "@babel/core": "^7.4.5",