Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
7kfpun committed Jan 28, 2017
1 parent 0626dce commit 83d913e
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ buck-out/
android/app/libs
android/keystores/debug.keystore
*.keystore

# App
app/config.js
8 changes: 8 additions & 0 deletions Photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -18,13 +19,20 @@ 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') {
console.log('GoogleAnalytics setDryRun');
GoogleAnalytics.setDryRun(true);
}

console.ignoredYellowBox = [
'Possible Unhandled Promise Rejection',
'Warning: setState(...): Can only update a mounted or mounting component.',
];

const scenes = Actions.create(
<Scene key="root">
<Scene key="main" title={'Look Lock'} component={MainView} hideNavBar={true} initial={true} />
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 6 additions & 9 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ export default class MainView extends Component {
if (images) {
that.setState({
images,
key0: Math.random(),
key1: Math.random(),
key: Math.random(),
});
}
});
Expand Down Expand Up @@ -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');
Expand All @@ -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(),
}}
Expand Down Expand Up @@ -223,7 +221,6 @@ export default class MainView extends Component {
return (
<View style={styles.container}>
{this.renderToolbar()}

<Modal
animationType="fade"
transparent={true}
Expand All @@ -244,7 +241,7 @@ export default class MainView extends Component {

<Collapsible style={{ height: 160 }} collapsed={!this.state.isSelectedShow} duration={600}>
<ScrollView style={styles.preview} horizontal={true}>
{this.state.images.length > 0 && this.state.images.map((item, i) => <View key={i} style={styles.imageBlock}>
{this.state.images && this.state.images.length > 0 && this.state.images.map((item, i) => <View key={i} style={styles.imageBlock}>
<TouchableHighlight
onPress={() => {
this.setModalVisible(true);
Expand All @@ -259,15 +256,15 @@ export default class MainView extends Component {
</TouchableHighlight>
</View>)}

{this.state.images.length === 0 && <View style={{ width: Dimensions.get('window').width - 10, justifyContent: 'center', alignItems: 'center' }}>
{(!this.state.images || (this.state.images && this.state.images.length === 0))
&& <View style={{ width: Dimensions.get('window').width - 10, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ color: 'white' }}>Pick your photos</Text>
</View>}
</ScrollView>
</Collapsible>

<View style={styles.rollPicker}>
<CameraRollPicker
key={this.state.key0}
callback={(images, current) => this.getSelectedImages(images, current)}
imagesPerRow={Device.isTablet ? IMAGE_PER_ROW_TABLET : IMAGE_PER_ROW_PHONE}
backgroundColor="#212121"
Expand Down Expand Up @@ -295,7 +292,7 @@ export default class MainView extends Component {

<AdmobCell backgroundColor="#212121" />

<Collapsible key={this.state.key1} collapsed={this.state.images.length === 0}>
<Collapsible key={this.state.key} collapsed={!this.state.images || (this.state.images && this.state.images.length === 0)}>
<TouchableHighlight
style={styles.footer}
onPress={() => {
Expand Down
8 changes: 8 additions & 0 deletions ios/Photos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = CC4C8V8BXN;
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Photos" */;
Expand Down Expand Up @@ -941,6 +944,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = CC4C8V8BXN;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -964,6 +968,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.kfpun.photos;
PRODUCT_NAME = Photos;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -973,6 +978,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = CC4C8V8BXN;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -996,7 +1002,9 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.kfpun.photos;
PRODUCT_NAME = Photos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
26 changes: 8 additions & 18 deletions ios/Photos/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A304a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -12,29 +12,19 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="With &lt;3 by KF" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Photos" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="1" green="0.9882496905" blue="0.98740788089999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
Expand Down
10 changes: 6 additions & 4 deletions ios/Photos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Look Lock</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<string>Look Lock</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>22</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 83d913e

Please sign in to comment.