Skip to content

Commit

Permalink
Merge pull request #2032 from hippware/1921
Browse files Browse the repository at this point in the history
1921
  • Loading branch information
southerneer authored Mar 23, 2018
2 parents 51e654a + c428b48 commit d130501
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 65 deletions.
Binary file added images/geoShareDefault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/geoShareOverlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ PODS:
- React/RCTBlob
- ReactNativePermissions (1.1.1):
- React
- RNBackgroundFetch (2.3.0):
- RNBackgroundFetch (2.4.1):
- React
- RNBackgroundGeolocation (2.11.0):
- RNBackgroundGeolocation (2.12.0-beta.2):
- CocoaLumberjack (~> 3.0)
- React
- RNFirebase (3.3.1):
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ios/Pods/Local Podspecs/RNBackgroundFetch.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ios/Pods/Local Podspecs/RNBackgroundGeolocation.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions ios/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"react-native": "0.53.0",
"react-native-actionsheet": "^2.2.2",
"react-native-background-fetch": "^2.4.1",
"react-native-background-geolocation": "^2.11.0",
"react-native-background-geolocation": "^2.12.0-beta.2",
"react-native-blur": "^3.2.2",
"react-native-camera-kit": "github:aksonov/react-native-camera-kit#6fb593bed81547a68e039a77c5042f070e3a9fa1",
"react-native-carrier-info": "github:hippware/react-native-carrier-info",
Expand Down Expand Up @@ -98,7 +98,7 @@
"remotedev": "^0.2.7",
"stream-to-array": "^2.3.0",
"validate.js": "github:hippware/validate.js#969b4fb274b0bb5234b8fe4199cc07dc1acb536e",
"wocky-client": "github:hippware/wocky-client#332dfe88b8fa45bb6f3b03ece5493cd06e90d278",
"wocky-client": "github:hippware/wocky-client#f2f544426a13a781c75723f56295cd786b7c73d7",
"xregexp": "^4.1.1"
},
"devDependencies": {
Expand Down
24 changes: 18 additions & 6 deletions src/components/event-cards/BotImage.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
// @flow

import React from 'react';
import {Image, View, StyleSheet} from 'react-native';
import {Image, StyleSheet, View} from 'react-native';
import {observer} from 'mobx-react/native';
import {defaultCover, width} from '../Global';
import {colors} from '../../constants';

type Props = {
bot: any,
image?: any,
isGeo?: boolean,
};

const BotImage = observer((props: Props) => {
const {bot, image} = props;
const geoDefault = require('../../../images/geoShareDefault.png');
const geoOverlay = require('../../../images/geoShareOverlay.png');

const BotImage = observer(({bot, image, isGeo}: Props) => {
const img = (image && image.source) || (bot.image && bot.image.thumbnail);
const source = img || defaultCover[bot.coverColor % 4];
return <Image style={styles.image} source={source} resizeMode='contain' />;
const source = img || (isGeo ? geoDefault : defaultCover[bot.coverColor % 4]);
const inner = <Image style={styles.image} source={source} resizeMode='contain' />;
return isGeo && img ? (
<View style={styles.image}>
{inner}
<View style={[styles.image, {backgroundColor: 'rgba(0,0,0,0.3)', position: 'absolute', alignItems: 'center'}]}>
<Image source={geoOverlay} style={{flex: 1}} resizeMode='contain' />
</View>
</View>
) : (
inner
);
});

export default BotImage;
Expand Down
25 changes: 10 additions & 15 deletions src/components/event-cards/EventBotShareCard.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// @flow

import React from 'react';
import {Text, View} from 'react-native';
import {View} from 'react-native';
import {observer} from 'mobx-react/native';
import {Actions} from 'react-native-router-flux';
import BotImage from './BotImage';
import EventBotTitle from './EventBotTitle';
import EventBotMetabar from './EventBotMetabar';
import {colors} from '../../constants';
import {k} from '../Global';
import {RText} from '../common';

type Props = {
item: EventBotShare,
Expand All @@ -21,36 +22,30 @@ class EventBotShareCard extends React.Component<Props> {
}

render() {
let eventBot, bot, msg;
let eventBot, bot, msg, isGeo;

try {
eventBot = this.props.item;
bot = eventBot.bot || {};
msg = eventBot.message || {};
isGeo = eventBot.action === 'geofence share';
} catch (err) {
return null;
}
console.log('render share', eventBot.toJSON());

return (
<View>
<EventBotTitle profile={eventBot.target} bot={bot} action='shared' timestamp={eventBot.relativeDateAsString} />
<EventBotTitle profile={eventBot.target} bot={bot} action={isGeo ? 'wants to share presence for' : 'shared'} timestamp={eventBot.relativeDateAsString} />
{!!msg.body && (
<View>
<View style={{height: 1, backgroundColor: colors.addAlpha(colors.DARK_GREY, 0.18), flex: 1}} />
<View style={{padding: 15 * k}}>
<Text
style={{
fontFamily: 'Roboto-Light',
color: colors.DARK_PURPLE,
fontSize: 15 * k,
}}
>
{msg.body}
</Text>
</View>
<RText weight='Light' color={colors.DARK_PURPLE} size={15} style={{padding: 15 * k}}>
{msg.body}
</RText>
</View>
)}
<BotImage bot={bot} filter />
<BotImage bot={bot} isGeo={isGeo} filter />
<EventBotMetabar bot={bot} />
</View>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/event-cards/EventCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const eventCardMap = {
};
@inject('log')
@observer
export default class EventCard extends React.Component<Props> {
class EventCard extends React.Component<Props> {
card: any;

render() {
Expand Down Expand Up @@ -60,3 +60,5 @@ export default class EventCard extends React.Component<Props> {
);
}
}

export default EventCard;
2 changes: 1 addition & 1 deletion src/components/map/BotMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const BotMarker = observer(({id, bot, scale, ...props}: Props) => {
if (!bot || !isAlive(bot) || !bot.location) {
return null;
}
const image = bot.image ? bot.image.thumbnail : bot.guest ? require('../../../images/footPrintCover.png') : defaultCover[bot.coverColor % 4];
const image = bot.image ? bot.image.thumbnail : bot.geofence ? require('../../../images/footPrintCover.png') : defaultCover[bot.coverColor % 4];
const showLoader = bot.image && !bot.image.loaded;
const text = bot.addressData ? bot.addressData.locationShort : bot.address;
return (
Expand Down
8 changes: 6 additions & 2 deletions src/store/LocationStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ const LocationStore = types

// This event fires when the user toggles location-services
backgroundGeolocation.on('providerchange', (provider) => {
logger.log('- Location provider changed: ', provider.enabled);
logger.log('- Location provider changed: ', provider);

self.setAlwaysOn(provider.status === backgroundGeolocation.AUTHORIZATION_STATUS_ALWAYS);
});
const url = `https://${settings.getDomain()}/api/v1/users/${model.username}/locations`;
logger.log(`LOCATION UPDATE URL: ${url} ${model.username} ${model.password}`);
Expand Down Expand Up @@ -175,10 +177,12 @@ const LocationStore = types
(state) => {
logger.log('- BackgroundGeolocation is configured and ready: ', state);

if (!state.enabled) {
if (!state.enabled && self.alwaysOn) {
backgroundGeolocation.start(() => {
logger.log('- Start success');
});
} else if (state.enabled && !self.alwaysOn) {
backgroundGeolocation.stop();
}
},
);
Expand Down
Loading

0 comments on commit d130501

Please sign in to comment.