From 83d913e30d83bda9dd45711a3966c4d2a34fe584 Mon Sep 17 00:00:00 2001 From: kf <7kfpun@gmail.com> Date: Sat, 28 Jan 2017 16:11:15 +0800 Subject: [PATCH] Code clean up --- .gitignore | 3 +++ Photos.js | 8 ++++++++ README.md | 1 + app/main.js | 15 ++++++--------- ios/Photos.xcodeproj/project.pbxproj | 8 ++++++++ ios/Photos/Base.lproj/LaunchScreen.xib | 26 ++++++++------------------ ios/Photos/Info.plist | 10 ++++++---- package.json | 4 ++-- 8 files changed, 42 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 74904c6..777c9b6 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ buck-out/ android/app/libs android/keystores/debug.keystore *.keystore + +# App +app/config.js diff --git a/Photos.js b/Photos.js index 3ea946e..2948566 100644 --- a/Photos.js +++ b/Photos.js @@ -6,6 +6,7 @@ import { // 3rd party libraries import { Actions, Router, Scene } from 'react-native-router-flux'; +import { AdMobInterstitial } from 'react-native-admob'; import DeviceInfo from 'react-native-device-info'; import GoogleAnalytics from 'react-native-google-analytics-bridge'; import store from 'react-native-simple-store'; @@ -18,6 +19,8 @@ import PasswordView from './app/password'; import { config } from './app/config'; +AdMobInterstitial.setAdUnitID(config.admob[Platform.OS].interstital); + GoogleAnalytics.setTrackerId(config.googleAnalytics[Platform.OS]); if (DeviceInfo.getDeviceName() === 'iPhone Simulator' || DeviceInfo.getDeviceName() === 'appleā€™s MacBook Pro' || DeviceInfo.getManufacturer() === 'Genymotion') { @@ -25,6 +28,11 @@ if (DeviceInfo.getDeviceName() === 'iPhone Simulator' || DeviceInfo.getDeviceNam GoogleAnalytics.setDryRun(true); } +console.ignoredYellowBox = [ + 'Possible Unhandled Promise Rejection', + 'Warning: setState(...): Can only update a mounted or mounting component.', +]; + const scenes = Actions.create( diff --git a/README.md b/README.md index 51eec0f..ddde3eb 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Pick the photos you want to share with your friends on Look Lock before giving a [![App Store Button](assets/app-store.png "App Store Button")](https://itunes.apple.com/us/app/look-lock-show-photos-without/id1151863742) [![Play Store Button](assets/google-play.png "Google Play Button")](https://play.google.com/store/apps/details?id=com.kfpun.photos) +[![Apk Download Button](assets/apk-download.png "Apk Download Button")](https://github.com/7kfpun/PhotosReactNative/releases/download/v1.0.7/app-release.apk) ## Screenshots diff --git a/app/main.js b/app/main.js index f496fa5..ef0b2ea 100644 --- a/app/main.js +++ b/app/main.js @@ -131,8 +131,7 @@ export default class MainView extends Component { if (images) { that.setState({ images, - key0: Math.random(), - key1: Math.random(), + key: Math.random(), }); } }); @@ -166,7 +165,6 @@ export default class MainView extends Component { clearImages() { this.setState({ images: [], - key0: Math.random(), }); store.save('images', []); GoogleAnalytics.trackEvent('user-action', 'clear-images'); @@ -190,7 +188,7 @@ export default class MainView extends Component { /> } rightButton={{ - title: this.state.images.length > 0 ? 'Clear all' : '', + title: this.state.images && this.state.images.length > 0 ? 'Clear all' : '', tintColor: '#69BBFF', handler: () => this.clearImages(), }} @@ -223,7 +221,6 @@ export default class MainView extends Component { return ( {this.renderToolbar()} - - {this.state.images.length > 0 && this.state.images.map((item, i) => + {this.state.images && this.state.images.length > 0 && this.state.images.map((item, i) => { this.setModalVisible(true); @@ -259,7 +256,8 @@ export default class MainView extends Component { )} - {this.state.images.length === 0 && + {(!this.state.images || (this.state.images && this.state.images.length === 0)) + && Pick your photos } @@ -267,7 +265,6 @@ export default class MainView extends Component { this.getSelectedImages(images, current)} imagesPerRow={Device.isTablet ? IMAGE_PER_ROW_TABLET : IMAGE_PER_ROW_PHONE} backgroundColor="#212121" @@ -295,7 +292,7 @@ export default class MainView extends Component { - + { diff --git a/ios/Photos.xcodeproj/project.pbxproj b/ios/Photos.xcodeproj/project.pbxproj index 2fd1a80..8c4068f 100644 --- a/ios/Photos.xcodeproj/project.pbxproj +++ b/ios/Photos.xcodeproj/project.pbxproj @@ -587,6 +587,9 @@ CreatedOnToolsVersion = 6.2; TestTargetID = 13B07F861A680F5B00A75B9A; }; + 13B07F861A680F5B00A75B9A = { + DevelopmentTeam = CC4C8V8BXN; + }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Photos" */; @@ -941,6 +944,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEAD_CODE_STRIPPING = NO; + DEVELOPMENT_TEAM = CC4C8V8BXN; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", @@ -964,6 +968,7 @@ "-ObjC", "-lc++", ); + PRODUCT_BUNDLE_IDENTIFIER = com.kfpun.photos; PRODUCT_NAME = Photos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -973,6 +978,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = CC4C8V8BXN; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", @@ -996,7 +1002,9 @@ "-ObjC", "-lc++", ); + PRODUCT_BUNDLE_IDENTIFIER = com.kfpun.photos; PRODUCT_NAME = Photos; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; diff --git a/ios/Photos/Base.lproj/LaunchScreen.xib b/ios/Photos/Base.lproj/LaunchScreen.xib index 60a5143..9240a5d 100644 --- a/ios/Photos/Base.lproj/LaunchScreen.xib +++ b/ios/Photos/Base.lproj/LaunchScreen.xib @@ -1,9 +1,9 @@ - - + + - - + + @@ -12,29 +12,19 @@ - - + - - - - + diff --git a/ios/Photos/Info.plist b/ios/Photos/Info.plist index fc3f51c..6b4f28f 100644 --- a/ios/Photos/Info.plist +++ b/ios/Photos/Info.plist @@ -4,22 +4,24 @@ CFBundleDevelopmentRegion en + CFBundleDisplayName + Look Lock CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - $(PRODUCT_NAME) + Look Lock CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.0.4 CFBundleSignature ???? CFBundleVersion - 1 + 22 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/package.json b/package.json index e94136a..d459543 100644 --- a/package.json +++ b/package.json @@ -28,14 +28,14 @@ "react": "15.3.1", "react-native": "^0.33.0", "react-native-admob": "^1.1.5", - "react-native-camera-roll-picker": "^1.1.8", + "react-native-camera-roll-picker": "github:7kfpun/react-native-camera-roll-picker", "react-native-collapsible": "^0.7.0", "react-native-device-detection": "^0.1.3", "react-native-device-info": "^0.9.5", "react-native-gesture-password": "^0.2.0", "react-native-google-analytics-bridge": "^3.1.0", "react-native-navbar": "^1.5.4", - "react-native-passcode-auth": "git+https://github.com/domoconnell/react-native-passcode-auth.git", + "react-native-passcode-auth": "github:pkwak-sf/react-native-passcode-auth", "react-native-photo-browser": "github:ksti/react-native-photo-browser", "react-native-router-flux": "^3.35.0", "react-native-share": "^1.0.14",