Skip to content

Commit

Permalink
Merge pull request #13 from COINiD/feature/add-backup-reminder
Browse files Browse the repository at this point in the history
Feature/add backup reminder
  • Loading branch information
rikardwissing committed Sep 11, 2019
2 parents 83a4a79 + 4e32a99 commit d84d3f2
Show file tree
Hide file tree
Showing 13 changed files with 319 additions and 99 deletions.
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def enableProguardInReleaseBuilds = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -116,8 +117,8 @@ android {
applicationId "org.coinid.wallet.tbtc"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 328
versionName "1.7.2"
versionCode 332
versionName "1.7.3"
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
}
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
google()
jcenter()
maven {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
4 changes: 2 additions & 2 deletions ios/COINiDWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@
buildSettings = {
APP_RETURN_SCHEME = "coinid-tbtc";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 328;
CURRENT_PROJECT_VERSION = 334;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = GC88SQF2BV;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -1749,7 +1749,7 @@
buildSettings = {
APP_RETURN_SCHEME = "coinid-tbtc";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 328;
CURRENT_PROJECT_VERSION = 334;
DEVELOPMENT_TEAM = GC88SQF2BV;
HEADER_SEARCH_PATHS = (
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions ios/COINiDWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.7.2</string>
<string>1.7.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>328</string>
<string>334</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false />
<key>LSApplicationQueriesSchemes</key>
Expand Down
6 changes: 4 additions & 2 deletions ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ platform :ios do
next
end

rootDir = '..'
shRootDir = '../..'; # sh cwd is android/fastlane

sh("#{shRootDir}/bin/changeCoin #{options[:ticker]}")

build_app(scheme: 'COINiDWallet')
build_app(
scheme: 'COINiDWallet',
xcargs: '-allowProvisioningUpdates'
)
upload_to_testflight(skip_waiting_for_build_processing: true)

message_slack(options)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "COINiDWallet",
"version": "1.7.2",
"version": "1.7.3",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand Down Expand Up @@ -33,7 +33,7 @@
"numbro": "^2.1.0",
"prop-types": "^15.7.2",
"react": "16.8.3",
"react-native": "0.59.1",
"react-native": "0.59.9",
"react-native-blur": "^3.2.2",
"react-native-camera": "^1.0.2",
"react-native-crypto": "^2.1.1",
Expand Down
232 changes: 232 additions & 0 deletions src/components/DismissableByDragView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import React, { PureComponent } from 'react';
import {
StyleSheet, Animated, Dimensions, PanResponder, Easing, Platform,
} from 'react-native';
import PropTypes from 'prop-types';

export const styles = StyleSheet.create({
container: {
position: 'absolute',
width: '100%',
},
slideTop: {
bottom: Dimensions.get('window').height,
},
slideBottom: {
top: Platform.OS === 'android' ? Dimensions.get('window').height : 0,
},
});

export default class DismissableByDragView extends PureComponent {
static propTypes = {
slide: PropTypes.oneOf(['slideTop', 'slideBottom']), // we can expand this to make the view come in from any direction
showTime: PropTypes.number,
initTime: PropTypes.number,
onHide: PropTypes.func,
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
};

static defaultProps = {
slide: 'slideTop',
showTime: 3500,
initTime: 100,
onHide: () => {},
children: null,
};

constructor(props) {
super(props);

this.pan = new Animated.ValueXY({ x: 0, y: 0 });

this.panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => false,
onStartShouldSetPanResponderCapture: () => false,
onMoveShouldSetPanResponder: (_, gestureState) => {
const { slide } = this.props;

if (slide === 'slideTop' || slide === 'slideBottom') {
return Math.abs(gestureState.dy) > 5;
}

return false;
},
onMoveShouldSetPanResponderCapture: () => false,
onPanResponderGrant: () => {
if (this.showTimer) {
clearTimeout(this.showTimer.timeout);
}
},
onPanResponderMove: Animated.event([null, { dx: this.pan.x, dy: this.pan.y }]),
onPanResponderTerminationRequest: () => true,
onPanResponderRelease: (_, gestureState) => {
const { slide } = this.props;

const shouldDismiss = () => {
if (slide === 'slideTop') {
return gestureState.dy < -5;
}

if (slide === 'slideBottom') {
return gestureState.dy > 5;
}

return false;
};

if (shouldDismiss()) {
this.dismiss();
} else {
Animated.timing(this.pan.x, {
duration: 200,
toValue: 0,
easing: Easing.out(Easing.poly(4)),
useNativeDriver: true,
}).start();

Animated.timing(this.pan.y, {
duration: 200,
toValue: 0,
easing: Easing.out(Easing.poly(4)),
useNativeDriver: true,
}).start();

this.refreshShowTimer();
}
},
onPanResponderTerminate: () => {
this.pan.x.setValue(0);
this.pan.y.setValue(0);
},
});

this.state = {
anim: new Animated.Value(0),
animStyle: {},
};
}

componentDidMount() {
this.init();
}

refreshShowTimer = () => {
const { showTime } = this.props;

if (this.showTimer && showTime) {
this.showTimer.timeout = setTimeout(() => {
if (this.showTimer) {
this.showTimer.callback();
}
}, showTime);
}
};

init = async () => {
const { initTime, showTime } = this.props;

await new Promise(r => setTimeout(r, initTime));
await this.show();

await new Promise((r) => {
const timeout = showTime ? setTimeout(r, showTime) : null;
this.showTimer = { timeout, callback: r };
});
this.showTimer = null;
await this.hide();
};

animate = (toValue, callback) => {
const { anim } = this.state;

Animated.timing(anim, {
duration: 160,
toValue,
useNativeDriver: true,
}).start(callback);
};

show = () => new Promise((resolve) => {
const { anim } = this.state;
anim.setValue(0);
this.animate(1);
resolve();
});

hide = () => new Promise((resolve) => {
const { onHide } = this.props;

const onAnimDone = () => {
resolve();
onHide();
};

this.animate(0, onAnimDone);
});

dismiss = () => new Promise((resolve) => {
if (this.showTimer) {
clearTimeout(this.showTimer.timeout);
this.showTimer.callback();
setTimeout(resolve, 300);
} else {
resolve();
}
});

onLayout = ({ nativeEvent: { layout } }) => {
const { slide } = this.props;
const { height } = layout;
const { anim } = this.state;

let slideY = 0;
let upPan = 0;
let downPan = 0;

if (slide === 'slideTop') {
slideY = height;
upPan = -1;
downPan = 0.4;
}

if (slide === 'slideBottom') {
slideY = -height;
upPan = -0.4;
downPan = 1;
}

const animStyle = {
transform: [
{
translateY: anim.interpolate({
inputRange: [0, 1],
outputRange: [0, slideY],
}),
},
{
translateY: this.pan.y.interpolate({
inputRange: [-1, 0, 1],
outputRange: [upPan, 0, downPan], // makes it more sluggish to drag down
}),
},
],
};

this.setState({ animStyle });
};

render() {
const { children, slide } = this.props;
const { animStyle } = this.state;

return (
<Animated.View
style={[styles.container, styles[slide], animStyle]}
onLayout={this.onLayout}
{...this.panResponder.panHandlers}
>
{children}
</Animated.View>
);
}
}
6 changes: 5 additions & 1 deletion src/components/InactiveOverlay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

import {
Linking,
Expand All @@ -20,6 +21,7 @@ import { addressFunctionP2PKH } from 'coinid-address-functions';
import SplashScreen from 'react-native-splash-screen';

import { ifIphoneX } from 'react-native-iphone-x-helper';

import { colors, fontSize, fontWeight } from '../config/styling';
import Settings from '../config/settings';
import settingHelper from '../utils/settingHelper';
Expand Down Expand Up @@ -116,7 +118,7 @@ const AnimatedBlurView = Platform.OS === 'ios'
? Animated.createAnimatedComponent(BlurView)
: Animated.createAnimatedComponent(View);

export default class InactiveOverlay extends PureComponent {
class InactiveOverlay extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -633,3 +635,5 @@ export default class InactiveOverlay extends PureComponent {
InactiveOverlay.propTypes = {};

InactiveOverlay.defaultProps = {};

export default InactiveOverlay;
Loading

0 comments on commit d84d3f2

Please sign in to comment.