Skip to content

Commit

Permalink
Merge pull request #127 from ostdotcom/team/post-search-bug-fix
Browse files Browse the repository at this point in the history
Team/post search bug fix
  • Loading branch information
Ashutoshlodhi authored Nov 5, 2019
2 parents fb496cd + 925ab15 commit f16ca46
Show file tree
Hide file tree
Showing 25 changed files with 258 additions and 81 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ android {
applicationId "com.pepo.staging"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 17
versionName "0.9.4"
versionCode 18
versionName "0.9.5"
missingDimensionStrategy 'react-native-camera', 'general'
}
splits {
Expand Down
2 changes: 1 addition & 1 deletion ios/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ostdotcom/ost-wallet-sdk-ios" == 2.3.2
github "ostdotcom/ost-wallet-sdk-ios" == 2.3.3
5 changes: 5 additions & 0 deletions ios/Pepo2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00029B4323329B55009E6919 /* TrustKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B76D86A2318FAAC007316D4 /* TrustKit.framework */; };
00029B4423329B63009E6919 /* OstWalletSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0050FDA022A8226800C2634F /* OstWalletSdk.framework */; };
Expand Down Expand Up @@ -1468,6 +1469,9 @@
com.apple.BackgroundModes = {
enabled = 1;
};
com.apple.DataProtection = {
enabled = 1;
};
com.apple.InAppPurchase = {
enabled = 1;
};
Expand Down Expand Up @@ -2340,6 +2344,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.pepo.staging;
PRODUCT_NAME = Pepo2;
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions ios/Pepo2/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>0.9.4</string>
<string>0.9.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>18</string>
<string>19</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
2 changes: 2 additions & 0 deletions ios/Pepo2/Pepo2.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
<string>applinks:stagingpepo.com</string>
<string>applinks:app.stagingpepo.com</string>
</array>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
</dict>
</plist>
18 changes: 17 additions & 1 deletion src/components/CommonComponents/TagsInput/CustomTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,36 @@ const MAX_LENGTH = 500;
class CustomTextInput extends PureComponent {
constructor(props) {
super(props);
this.textInputRef = null;
}

setTextInputRef = (textInputRef) => {
this.textInputRef = textInputRef;
if ( this.props.value ) {
this.setInputText( this.props.value );
}
};

setInputText = ( text ) => {
if ( this.textInputRef ) {
this.textInputRef.setNativeProps({
"text": text
});
}
};

render() {
return (
<View style={{ backgroundColor: 'white' }}>
<TextInput
ref={this.setTextInputRef}
style={[Theme.TextInput.textInputStyle, this.props.textInputStyles]}
onSelectionChange={this.props.locationGetter}
onChangeText={(value) => {
this.props.onChangeText(value);
}}
multiline={true}
autoFocus={this.props.autoFocus}
value={this.props.value}
placeholder={this.props.placeholderText}
multiline={true}
numberOfLines={3}
Expand Down
25 changes: 16 additions & 9 deletions src/components/CommonComponents/TagsInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ class TagsInput extends PureComponent {
super(props);
this.state = {
data: [],
value: this.props.initialValue,
keyword: ''
};
this.value = this.props.initialValue;
this.reqTimer = 0;
this.wordIndex = -1;
this.indexWord = null;
this.isTrackingStarted = false;
this.customTextInputRef = null;
}

fetchHashTags = (keyword) => {
Expand Down Expand Up @@ -66,10 +67,15 @@ class TagsInput extends PureComponent {
this.changeValue(val);
};

setCustomInputRef = ( ref )=> {
this.customTextInputRef = ref;
}

changeValue = (val) => {
this.setState({
value: val
this.customTextInputRef.textInputRef.setNativeProps({
"text": val
});
this.value = val;
this.props.onChangeVal(val);
};

Expand Down Expand Up @@ -123,19 +129,19 @@ class TagsInput extends PureComponent {

onSuggestionTap(item) {
this.closeSuggestionsPanel();
const wordToReplace = this.getWordAtIndex(this.state.value, this.wordIndex),
const wordToReplace = this.getWordAtIndex(this.value, this.wordIndex),
isHashTag = this.isHashTag(wordToReplace);
if (isHashTag) {
const startIndex = this.getStartIndex(this.state.value, this.wordIndex),
endIndex = this.getEndIndex(this.state.value, this.wordIndex),
const startIndex = this.getStartIndex(this.value, this.wordIndex),
endIndex = this.getEndIndex(this.value, this.wordIndex),
replaceString = ` #${item.text} `,
newString = this.replaceBetween(startIndex, endIndex, replaceString);
this.changeValue(newString);
}
}

replaceBetween(start, end, replaceString) {
return this.state.value.substring(0, start) + replaceString + this.state.value.substring(end);
return this.value.substring(0, start) + replaceString + this.value.substring(end);
}

getStartIndex(text, index) {
Expand Down Expand Up @@ -175,10 +181,11 @@ class TagsInput extends PureComponent {
renderItem={this._renderItem}
ListHeaderComponent={
<CustomTextInput
ref={this.setCustomInputRef}
textInputStyles={this.props.textInputStyles}
value={this.state.value}
value={this.value}
submitEvent={() => {
this.props.submitEvent(this.state.value);
this.props.submitEvent(this.value);
}}
locationGetter={this.locationGetter}
onChangeText={this.onChangeText}
Expand Down
48 changes: 47 additions & 1 deletion src/components/CommonComponents/UserInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import InAppBrowser from '../../../services/InAppBrowser';
import profileLink from '../../../assets/profile_link.png';
import twitterLink from '../../../assets/twitter_link.png';
import Utilities from '../../../services/Utilities';
import inlineStyles from '../../Home/styles';

const mapStateToProps = (state, ownProps) => {
return {
Expand Down Expand Up @@ -82,6 +83,25 @@ class UserInfo extends React.PureComponent {
);
};

onTagPressed = (tag) => {
let entity = reduxGetter.getBioIncudes(this.props.userId, tag);
if (!entity) {
return;
}

if(entity.kind === 'tags'){
this.props.navigation.push('VideoTags', {
"tagId": entity.id
});
}
};

isValidBioTag(userId, tappedText) {
let entity = reduxGetter.getBioIncudes(userId, tappedText);
return !!entity;
}


render() {
return (
<View style={{ alignItems: 'center', paddingTop: 30}}>
Expand Down Expand Up @@ -129,7 +149,33 @@ class UserInfo extends React.PureComponent {
<Text style={inlineStyle.numericInfoText}>Received</Text>
</View>
</View>
{!!this.props.bio && <Text style={inlineStyle.bioSection}>{this.props.bio}</Text>}
{!!this.props.bio && <Text style={inlineStyle.bioSectionWrapper}>
{this.props.bio.split(' ').map((item) => {

let onPressFunc = () => {};
let style = [inlineStyle.bioSection];
if (item.startsWith('#') && this.isValidBioTag(this.props.userId, item)) {
onPressFunc = this.onTagPressed;
style.push({fontFamily:'AvenirNext-DemiBold'});
let tagText = item.replace("#", "");
return(
<Text
style={style}
onPress={()=> {onPressFunc(item)} }
>
<Text style={{fontStyle:'italic'}}>#</Text>{tagText + " "}
</Text>
);


}

// Default return
return(<Text style={style}>{item+ " "}</Text>);

})}
</Text>}

{!!this.props.link && (
<View style={{flexDirection:'row', alignItems:'center',justifyContent:'center', marginHorizontal: 20, marginTop: 10}}>
<Text ellipsizeMode={'tail'} numberOfLines={1}>
Expand Down
8 changes: 5 additions & 3 deletions src/components/CommonComponents/UserInfo/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ let stylesMap = {
fontFamily: 'AvenirNext-DemiBold'
},
bioSection: {
textAlign: 'center',
marginTop: 20,
paddingHorizontal: 30,
color: Colors.valhalla,
fontSize: 14
},
bioSectionWrapper: {
marginTop: 20,
marginHorizontal: 30,
textAlign: 'center'
},
numericInfoWrapper: {
marginTop: 20,
flexDirection: 'row',
Expand Down
19 changes: 2 additions & 17 deletions src/components/CustomTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const mapStateToProps = (state, ownProps) => {
};

let previousTabIndex = 0;
let tabBeforeCaptureVideo = null;

function onTabPressed(navigation, tab) {
if (CurrentUser.getOstUserId()) {
Expand All @@ -38,30 +37,16 @@ function onTabPressed(navigation, tab) {
}
}

function getStackbeforeVideoCapture(index) {
for (let config in appConfig.tabConfig){
if ( appConfig.tabConfig[config].navigationIndex == index ){
return appConfig.tabConfig[config];
}
}

}

let refreshTimeOut = 0;

function loginInFlow(navigation, tab) {
let currentTabIndex = tab.navigationIndex;
if (tab.rootStack === 'CaptureVideo') {
tabBeforeCaptureVideo = previousTabIndex;
if (tab.rootStack === 'CaptureVideo') {
utilities.handleVideoUploadModal(previousTabIndex, navigation);
return;
}
if (currentTabIndex == undefined || currentTabIndex == null) return;
if (tabBeforeCaptureVideo != null && currentTabIndex == tabBeforeCaptureVideo ){
navigation.dispatch(StackActions.popToTop());
navigation.dispatch(StackActions.popToTop());
tabBeforeCaptureVideo = null;
} else if (previousTabIndex !== currentTabIndex) {
if (previousTabIndex !== currentTabIndex) {
tab.rootStack == 'Notification' && refreshActivity(tab.childStack);
navigation.navigate(tab.rootStack);
} else if (utilities.getLastChildRoutename(navigation.state) !== tab.childStack) {
Expand Down
9 changes: 2 additions & 7 deletions src/components/FanVideoDetails/VideoDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ import TagsInput from '../CommonComponents/TagsInput';
class VideoDescription extends PureComponent {
constructor(props) {
super(props);
this.state = {
value: this.props.initialValue
};
this.value = this.props.initialValue;
}

onChangeValue = (value) => {
this.setState({
value
});
this.props.onChangeDesc(value);
};

Expand All @@ -26,7 +21,7 @@ class VideoDescription extends PureComponent {
<View style={{ flex: 1 }}>
<TagsInput
horizontal={false}
initialValue={this.props.initialValue}
initialValue={this.value}
onChangeVal={this.onChangeValue}
placeholderText="Add a description. You can include #tags."
submitEvent={this.submitEvent}
Expand Down
Loading

0 comments on commit f16ca46

Please sign in to comment.