diff --git a/android/app/build.gradle b/android/app/build.gradle index 832ccf6..44b5eb4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -135,7 +135,7 @@ android { applicationId "com.pluzo" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 5 + versionCode 8 versionName "1.7" multiDexEnabled true } diff --git a/android/gradle.properties b/android/gradle.properties index c3acecb..e66b4f6 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -10,8 +10,8 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -#Fri Feb 26 23:02:11 PST 2021 -FLIPPER_VERSION=0.46.0 +#Wed Mar 03 22:06:29 PST 2021 +org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" android.enableJetifier=true android.useAndroidX=true -org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx1024M" +FLIPPER_VERSION=0.46.0 diff --git a/ios/Pluzo.xcodeproj/project.pbxproj b/ios/Pluzo.xcodeproj/project.pbxproj index 5aa66ec..30d26fa 100644 --- a/ios/Pluzo.xcodeproj/project.pbxproj +++ b/ios/Pluzo.xcodeproj/project.pbxproj @@ -1155,7 +1155,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Pluzo/Pluzo.entitlements; COREML_CODEGEN_LANGUAGE = Swift; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = ST99247FHV; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1170,7 +1170,7 @@ INFOPLIST_FILE = Pluzo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 2.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1193,7 +1193,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Pluzo/Pluzo.entitlements; COREML_CODEGEN_LANGUAGE = Swift; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = ST99247FHV; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1203,7 +1203,7 @@ INFOPLIST_FILE = Pluzo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 2.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1459,7 +1459,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 2; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = NO; DEVELOPMENT_TEAM = ST99247FHV; @@ -1467,7 +1467,7 @@ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 2.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.pluzo.app.OneSignalNotificationServiceExtension; @@ -1493,7 +1493,7 @@ CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 2; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = NO; DEVELOPMENT_TEAM = ST99247FHV; @@ -1501,7 +1501,7 @@ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 2.0; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.pluzo.app.OneSignalNotificationServiceExtension; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/metro.config.js b/metro.config.js index 0003bca..13a9642 100644 --- a/metro.config.js +++ b/metro.config.js @@ -14,5 +14,4 @@ module.exports = { }, }), }, - assets: ["./assets/fonts/"], }; diff --git a/src/app/app.js b/src/app/app.js index a5d07b6..b2ec1a3 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -36,6 +36,7 @@ class App extends React.Component { firstLoading: true, appState: AppState.currentState, }; + this.openedTime = 0; } async componentDidMount() { @@ -57,11 +58,19 @@ class App extends React.Component { this._netUnsubscribe = NetInfo.addEventListener(state => { this.props.updateConnectionState(state.isConnected); }); + this._openedUnsubscribe = EventBus.on("AppState_Active", () => { + this._countAppTime(); + }); + this._countAppTime(); } componentWillUnmount() { AppState.removeEventListener("change", this._handleAppStateChange); this._netUnsubscribe(); + this._openedUnsubscribe(); + if (this._opendInterval) { + clearInterval(this._opendInterval); + } } componentDidUpdate(prevProps) { @@ -74,6 +83,21 @@ class App extends React.Component { } } + _countAppTime = () => { + this.openedTime = 0; + if (this._opendInterval) { + clearInterval(this._opendInterval); + this._opendInterval = null; + } + this._opendInterval = setInterval(() => { + this.openedTime += 1; + if (this.openedTime === 420 && this.props.user && this.props.user.premium === 0) { + this.props.showPluzo(true, ""); + this.openedTime = 0; + } + }, 1000); + } + _handleAppStateChange = nextAppState => { if (this.state.appState.match(/inactive|background|unknown/) && nextAppState === "active") { OneSignal.getPermissionSubscriptionState((status) => { @@ -158,7 +182,6 @@ class App extends React.Component { let newProfile = objData.user; newProfile.id = parseInt(newProfile._id, 10); this.props.updateProfile(newProfile); - // console.log("user>>>", newProfile); } EventBus.publish("player_actions", "User_update", objData); } else if (data.action === "Friends") { @@ -286,10 +309,10 @@ class App extends React.Component { } {this.isLogin() && ( console.log("Opened socket")} - onError={() => console.log("Error socket")} + onError={(error) => console.log(error)} onClose={() => console.log("Closed socket")} reconnect isActive={this.state.appState} @@ -322,6 +345,7 @@ const mapDispatchToProps = { updateUser: UserCreators.requestUpdateUser, updateFriends: InboxCreators.requestFriendsSuccess, loadPendingRequests: InboxCreators.requestPendingFriends, + showPluzo: AppCreators.showPluzo, }; export default connect(mapStateToProps, mapDispatchToProps)(App); diff --git a/src/components/alerts/app-alert.js b/src/components/alerts/app-alert.js index f444efd..e9f2313 100644 --- a/src/components/alerts/app-alert.js +++ b/src/components/alerts/app-alert.js @@ -1,6 +1,7 @@ import React, { useState } from "react"; import { View } from "react-native"; -import Modal from "react-native-modal"; +// import Modal from "react-native-modal"; +import { ModalBase as Modal } from "../modal-base"; import { BoxShadow } from "../shadow"; import { Text } from "../text"; import { GradientButton } from "../button"; diff --git a/src/components/alerts/boost-confirm-modal.js b/src/components/alerts/boost-confirm-modal.js index cc58df1..7e85147 100644 --- a/src/components/alerts/boost-confirm-modal.js +++ b/src/components/alerts/boost-confirm-modal.js @@ -5,7 +5,7 @@ import { Text } from "../text"; import { Image } from "../image"; import { BoxShadow } from "../shadow"; import { GradientButton, AnimatedButton } from "../button"; -import Modal from "react-native-modal"; +import { ModalBase as Modal } from "../modal-base"; import Images from "@assets/Images"; import styles from "./boost-confirm-modal.style"; diff --git a/src/components/alerts/confirm-modal.js b/src/components/alerts/confirm-modal.js index abd2c83..7d51a83 100644 --- a/src/components/alerts/confirm-modal.js +++ b/src/components/alerts/confirm-modal.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import { View, SafeAreaView } from "react-native"; import { BlurView } from "@react-native-community/blur"; -import Modal from "react-native-modal"; +import { ModalBase as Modal } from "../modal-base"; import { Screen } from "../screen"; import { Touchable } from "../touchable"; import { SolidButton } from "../button"; diff --git a/src/components/alerts/notification-modal.js b/src/components/alerts/notification-modal.js index 9092824..f4d573b 100644 --- a/src/components/alerts/notification-modal.js +++ b/src/components/alerts/notification-modal.js @@ -5,7 +5,7 @@ import { Text } from "../text"; import { Image } from "../image"; import { BoxShadow } from "../shadow"; import { GradientButton } from "../button"; -import Modal from "react-native-modal"; +import { ModalBase as Modal } from "../modal-base"; import Images from "@assets/Images"; import styles from "./notification-modal.style"; diff --git a/src/components/dialog-input/dialog-input.js b/src/components/dialog-input/dialog-input.js index d042daf..df3efdd 100644 --- a/src/components/dialog-input/dialog-input.js +++ b/src/components/dialog-input/dialog-input.js @@ -1,12 +1,12 @@ import React, { PureComponent } from "react"; import { - Modal, Platform, TouchableOpacity, View, Image, KeyboardAvoidingView, } from "react-native"; +import { ModalBase as Modal } from "../modal-base"; import { BlurView } from "../blur-view"; import { Screen } from "../screen"; import { Text } from "../text"; @@ -86,10 +86,12 @@ class DialogInput extends PureComponent { return ( React$Node = props => { + + const { onModalShow, onModalHide, needUpdate=true, ...rest } = props; + + const modalShow = () => { + if (needUpdate === true) { + props.updateModalShowed(true); + } + onModalShow && onModalShow(); + } + + const modalHide = () => { + if (needUpdate === true) { + props.updateModalShowed(false); + } + onModalHide && onModalHide(); + } + + return ; +}; + +const mapDispatchToProps = { + updateModalShowed: AppCreators.updateModalShowed, +}; + +export default connect(null, mapDispatchToProps)(ModalBase); diff --git a/src/components/screen/screen.js b/src/components/screen/screen.js index 23d8312..6fcabee 100644 --- a/src/components/screen/screen.js +++ b/src/components/screen/screen.js @@ -1,6 +1,6 @@ import React from "react"; -import { ImageBackground, View } from "react-native"; -import { SafeAreaView } from "react-navigation"; +import { ImageBackground, View, SafeAreaView } from "react-native"; +// import { SafeAreaView } from "react-navigation"; import LinearGradient from "react-native-linear-gradient"; import { GRADIENT } from "@config"; import styles from "./screen.style"; diff --git a/src/components/wheel-scroll/wheel-scroll.js b/src/components/wheel-scroll/wheel-scroll.js index ec61fba..3514b22 100644 --- a/src/components/wheel-scroll/wheel-scroll.js +++ b/src/components/wheel-scroll/wheel-scroll.js @@ -97,6 +97,7 @@ export default class ScrollPicker extends React.Component { onScrollEndDrag={this.onScrollEndDrag} onScroll={this.onScroll} style={styles.scrollContainer} + scrollEventThrottle={16} > {header} {this.props.dataSource.map(this.renderItem.bind(this))} diff --git a/src/helpers/location.js b/src/helpers/location.js index 2e41bb2..6df33a5 100644 --- a/src/helpers/location.js +++ b/src/helpers/location.js @@ -15,7 +15,7 @@ const hasLocationPermissionIOS = async (noalert) => { } if (status === "denied" && !noalert) { - Notification.alert("Location permission denied"); + // Notification.alert("Location permission denied"); } if (status === "disabled" && !noalert) { diff --git a/src/redux/actions/app.actions.js b/src/redux/actions/app.actions.js index a08c0b1..4a3386a 100644 --- a/src/redux/actions/app.actions.js +++ b/src/redux/actions/app.actions.js @@ -2,6 +2,9 @@ import { createActions } from "reduxsauce"; const { Types, Creators } = createActions({ updateConnectionState: ["connected"], + showPurchase: ["visible"], + showPluzo: ["visible", "pluzoType"], + updateModalShowed: ["show"], }); export const AppTypes = Types; diff --git a/src/redux/reducers/app.reducer.js b/src/redux/reducers/app.reducer.js index b1bba25..97fd64c 100644 --- a/src/redux/reducers/app.reducer.js +++ b/src/redux/reducers/app.reducer.js @@ -1,15 +1,44 @@ import { createReducer } from "reduxsauce"; -import { AppTypes } from "../actions"; +import { AppTypes, UserTypes } from "../actions"; import storeInitialState from "../store/initial-state"; export const INITIAL_STATE = storeInitialState.app; +const logout = (state, action) => ({ + ...state, + visiblePurchase: false, + visiblePluzo: false, + pluzoType: "", + modalShowed: false, +}); + const updateConnectionState = (state, action) => ({ ...state, isConnected: action.connected, }); +const showPurchase = (state, action) => ({ + ...state, + visiblePurchase: action.visible, +}); + +const showPluzo = (state, action) => ({ + ...state, + visiblePluzo: action.visible, + pluzoType: action.pluzoType, +}); + +const updateModalShowed = (state, action) => ({ + ...state, + modalShowed: action.show, +}); + export const HANDLERS = { [AppTypes.UPDATE_CONNECTION_STATE]: updateConnectionState, + [AppTypes.SHOW_PURCHASE]: showPurchase, + [AppTypes.SHOW_PLUZO]: showPluzo, + [AppTypes.UPDATE_MODAL_SHOWED]: updateModalShowed, + + [UserTypes.LOGOUT]: logout, }; export default createReducer(INITIAL_STATE, HANDLERS); diff --git a/src/redux/sagas/user.sagas.js b/src/redux/sagas/user.sagas.js index ac68457..9069e0d 100644 --- a/src/redux/sagas/user.sagas.js +++ b/src/redux/sagas/user.sagas.js @@ -120,7 +120,6 @@ function* requestRegistration(action) { } const response = yield call(register, params); - yield put(UserCreators.registrationSuccess(response.data.data)); } catch (error) { yield put(UserCreators.registrationFailure()); diff --git a/src/redux/store/initial-state.js b/src/redux/store/initial-state.js index 1e38eda..def9803 100644 --- a/src/redux/store/initial-state.js +++ b/src/redux/store/initial-state.js @@ -1,6 +1,10 @@ export default { app: { isConnected: true, + visiblePurchase: false, + visiblePluzo: false, + pluzoType: "", + modalShowed: false, }, user: { token: "", diff --git a/src/screens/chat/user-setting-modal/user-setting-modal.js b/src/screens/chat/user-setting-modal/user-setting-modal.js index 8e6c3a1..7717f28 100644 --- a/src/screens/chat/user-setting-modal/user-setting-modal.js +++ b/src/screens/chat/user-setting-modal/user-setting-modal.js @@ -1,8 +1,7 @@ import React, { Component } from "react"; import { View, SafeAreaView } from "react-native"; import { BlurView } from "@react-native-community/blur"; -import Modal from "react-native-modal"; -import { Screen, Touchable, SolidButton, Text } from "@components"; +import { Screen, Touchable, SolidButton, Text, ModalBase as Modal } from "@components"; import styles from "./user-setting-modal.style"; diff --git a/src/screens/chat/zoom-image-modal/zoom-image-modal.js b/src/screens/chat/zoom-image-modal/zoom-image-modal.js index c64e9a6..58fb6dd 100644 --- a/src/screens/chat/zoom-image-modal/zoom-image-modal.js +++ b/src/screens/chat/zoom-image-modal/zoom-image-modal.js @@ -1,7 +1,6 @@ import React from "react"; import { View, ActivityIndicator } from "react-native"; -import { Touchable, Image, ImageZoomViewer } from "@components"; -import Modal from "react-native-modal"; +import { Touchable, Image, ImageZoomViewer, ModalBase as Modal } from "@components"; import Images from "@assets/Images"; import styles from "./zoom-image-modal.style"; diff --git a/src/screens/country-selection/country-selection.js b/src/screens/country-selection/country-selection.js index 264a49c..1aba4d0 100644 --- a/src/screens/country-selection/country-selection.js +++ b/src/screens/country-selection/country-selection.js @@ -1,7 +1,6 @@ import React, { useState, useEffect } from "react"; import { View, SafeAreaView } from "react-native"; -import { BackButton, Screen, Text, StatesPicker, CountryCodePicker } from "@components"; -import Modal from "react-native-modal"; +import { BackButton, Screen, Text, StatesPicker, CountryCodePicker, ModalBase as Modal } from "@components"; import styles from "./country-selection.style"; diff --git a/src/screens/forgot-password/forgot-password.screen.js b/src/screens/forgot-password/forgot-password.screen.js index af0467f..dccd81d 100644 --- a/src/screens/forgot-password/forgot-password.screen.js +++ b/src/screens/forgot-password/forgot-password.screen.js @@ -63,7 +63,7 @@ const SignupPhoneNumber: () => React$Node = props => { setPhoneNumber(txt.replace(/[^0-9]/g, ''))} placeholder={"Your phone number"} keyboardType={"phone-pad"} /> diff --git a/src/screens/home/home.js b/src/screens/home/home.js index c0ee726..c5e0a0c 100644 --- a/src/screens/home/home.js +++ b/src/screens/home/home.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { View, Animated, PanResponder } from "react-native"; import { HomeStack } from "../../navigation/home-navigator"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -15,6 +15,8 @@ import styles, { width, height } from "./home.style"; import PushNotification from "./push-notification"; import AsyncStorage from "@react-native-community/async-storage"; import PendingRequestModal from "../inbox/pending-request-modal"; +import PluzoLearnModel from "./pluzo-learn-modal"; +import PurchaseModal from "../profile-settings/purchase-modal"; const shadowOptions = { width: 130, @@ -30,6 +32,7 @@ const shadowOptions = { const Home = props => { const insets = useSafeAreaInsets(); + const appOpened = useRef(0); const { setStreamStatus, updateMessages, initLiveUsers, updateChannelName } = props; const [visiblePendingRequest, setVisiblePendingRequest] = useState(false); const [visibleStream, setVisibleStream] = useState(false); @@ -339,6 +342,18 @@ const Home = props => { }); }, []); + useEffect(() => { + const unsubscribe = EventBus.on("AppState_Active", () => { + appOpened.current = appOpened.current + 1; + if (appOpened.current === 1 && props.user && props.user.premium === 0) { + props.showPluzo(true, "opened"); + } + }); + return () => { + unsubscribe(); + } + }, [props.user, props.showPluzo]); + return ( @@ -485,6 +500,21 @@ const Home = props => { isVisible={visiblePendingRequest} startLoading={true} dismissModal={() => setVisiblePendingRequest(false)}/> + props.showPluzo(false, "")} + needUpdate={false} + onShowPurchase={() => { + props.showPluzo(false, ""); + setTimeout(() => { + props.showPurchase(true); + }, 500); + }} + /> + props.showPurchase(false)} + /> ); }; diff --git a/src/screens/home/index.js b/src/screens/home/index.js index ac2be91..77aa77c 100644 --- a/src/screens/home/index.js +++ b/src/screens/home/index.js @@ -1,13 +1,17 @@ import Home from "./home"; import { connect } from "react-redux"; -import { LiveCreators, InboxCreators, UserCreators } from "@redux/actions"; +import { LiveCreators, InboxCreators, UserCreators, AppCreators } from "@redux/actions"; function mapStateToProps(state) { return { token: state.user.token, + user: state.user.user, streamStatus: state.live.streamStatus, isScrolling: state.live.isScrolling, notification: state.user.notification, + visiblePurchase: state.app.visiblePurchase, + visiblePluzo: state.app.visiblePluzo, + modalShowed: state.app.modalShowed, }; } @@ -20,6 +24,8 @@ const mapDispatchToProps = { updateNotification: UserCreators.updateNotification, initLiveUsers: LiveCreators.streamUserListSuccess, updateChannelName: LiveCreators.updateChannelName, + showPurchase: AppCreators.showPurchase, + showPluzo: AppCreators.showPluzo, }; export default connect(mapStateToProps, mapDispatchToProps)(Home); diff --git a/src/screens/home/pluzo-learn-modal/index.js b/src/screens/home/pluzo-learn-modal/index.js new file mode 100644 index 0000000..7b08c2a --- /dev/null +++ b/src/screens/home/pluzo-learn-modal/index.js @@ -0,0 +1,17 @@ +import PluzoLearnModel from "./pluzo-learn-modal"; +import { connect } from "react-redux"; + +function mapStateToProps(state) { + return { + user: state.user.user, + pluzoType: state.app.pluzoType, + }; +} + +const mapDispatchToProps = { +}; + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(PluzoLearnModel); diff --git a/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.js b/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.js new file mode 100644 index 0000000..59787c9 --- /dev/null +++ b/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.js @@ -0,0 +1,128 @@ +import React from "react"; +import { View } from "react-native"; +import FastImage from "react-native-fast-image"; +import { GradientButton, Text, BoxShadow, Touchable, Image, ModalBase as Modal } from "@components"; +import { BlurView } from "@react-native-community/blur"; +import * as Animatable from "react-native-animatable"; +import RNIap from "react-native-iap"; +import { GRADIENT } from "@config"; +import Images from "@assets/Images"; + +import styles, { screenWidth } from "./pluzo-learn-modal.style"; + +const { createAnimatableComponent } = Animatable; +const AnimatableView = createAnimatableComponent(View); + +const plusAnimation = { + from: { + ["translateY"]: -20, + }, + to: { + ["translateY"]: 0, + }, +}; + +class PurchaseModal extends React.Component { + constructor(props) { + super(props); + this.state = { + products: [], + visibleSelect: false, + visibleAdvantage: false, + }; + } + + onPurchase = async sku => { + try { + await RNIap.requestSubscription(sku); + } catch (err) { + console.log(err.code, err.message); + } + }; + + render() { + let totalMonth = 0; + if (this.props.user.premium === 1) { + totalMonth = this.props.user.premium_info.total_month; + } + + return ( + + + + } + backdropOpacity={1} + swipeDirection={"down"} + swipeThreshold={100} + useNativeDriver={false} + propagateSwipe={true} + onModalWillShow={() => this.setState({visibleAdvantage: false})} + > + + {this.props.pluzoType === "swipe" && + {"Want to see who likes your profile?"}} + {this.props.pluzoType === "opened" && + {"Unlock exclusive badges and more!"}} + + + + + + + + {this.props.user.premium === 0 && + {"Exclusive features to enhance\nyour experience."} + } + + + + + + + this.props.onShowPurchase()} + /> + + + + ); + } +} + +export default PurchaseModal; diff --git a/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.style.js b/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.style.js new file mode 100644 index 0000000..e0b6873 --- /dev/null +++ b/src/screens/home/pluzo-learn-modal/pluzo-learn-modal.style.js @@ -0,0 +1,75 @@ +import { StyleSheet, Dimensions } from "react-native"; +import { widthPercentageToDP as wp } from "@helpers"; + +export const screenWidth = Dimensions.get("window").width; + +export default StyleSheet.create({ + flexFill: { + flex: 1, + }, + container: { + alignItems: "center", + }, + + questionText: { + fontWeight: "600", + fontSize: wp(16), + color: "white", + marginBottom: wp(20), + }, + + premiumView: { + width: screenWidth - wp(40), + height: ((screenWidth - wp(40)) * 169) / 336, + backgroundColor: "#110029", + borderRadius: wp(22), + borderWidth: wp(2), + borderColor: "rgba(255, 255, 255, 0.15)", + overflow: "hidden", + alignItems: "center", + }, + premiumMask1: { + position: "absolute", + left: -wp(162), + right: -wp(140), + top: -wp(156), + bottom: -wp(144), + }, + premiumMask2: { + position: "absolute", + left: 0, + top: 0, + bottom: 0, + width: wp(200), + }, + premiumLogo: { + width: wp(151), + height: wp(50), + marginTop: wp(27.4), + }, + premiumLogoCenter: { + width: wp(151), + height: wp(50), + marginTop: wp(45), + }, + premiumText: { + color: "white", + fontSize: wp(14), + fontWeight: "bold", + textAlign: "center", + marginTop: wp(15), + }, + premiumPlusView: { + position: "absolute", + // left: wp(23.4), + bottom: wp(30), + }, + premiumPlusImage: { + + }, + buttonContainer: { + width: screenWidth - wp(100), + marginTop: -wp(25), + alignSelf: "center", + }, +}); diff --git a/src/screens/home/push-notification.js b/src/screens/home/push-notification.js index b368c24..a7206c3 100644 --- a/src/screens/home/push-notification.js +++ b/src/screens/home/push-notification.js @@ -106,16 +106,22 @@ class PushNotification extends React.Component { setTimeout(() => { EventBus.publish("APP_END_STREAM_ACTION", params); }, 1000); + } else if (data.action === "likes") { + setTimeout(() => { + NavigationService.navigate(SCREENS.LIKE_USERS); + }, 500); } } } onIds(device) { - AsyncStorage.setItem("PUSH_TOKEN", device.userId, err => { - if (err === null) { - EventBus.publish("UPDATE_PUSH_TOKEN"); - } - }); + if (device && device.userId !== null && device.userId !== undefined) { + AsyncStorage.setItem("PUSH_TOKEN", device.userId, err => { + if (err === null) { + EventBus.publish("UPDATE_PUSH_TOKEN"); + } + }); + } } render() { diff --git a/src/screens/home/stream-stop-modal/stream-stop-modal.js b/src/screens/home/stream-stop-modal/stream-stop-modal.js index dae4fe6..7863593 100644 --- a/src/screens/home/stream-stop-modal/stream-stop-modal.js +++ b/src/screens/home/stream-stop-modal/stream-stop-modal.js @@ -7,8 +7,8 @@ import { BoxShadow, GradientButton, SolidButton, + ModalBase as Modal } from "@components"; -import Modal from "react-native-modal"; import styles from "./stream-stop-modal.style"; diff --git a/src/screens/inbox/add-friend-modal/add-friend-modal.js b/src/screens/inbox/add-friend-modal/add-friend-modal.js index 3c9aeb0..a5457e2 100644 --- a/src/screens/inbox/add-friend-modal/add-friend-modal.js +++ b/src/screens/inbox/add-friend-modal/add-friend-modal.js @@ -8,6 +8,7 @@ import { GradientButton, TextInput, DiscoverPeopleItem, + ModalBase } from "@components"; import KeyboardManager from "react-native-keyboard-manager"; import { BlurView } from "@react-native-community/blur"; @@ -116,7 +117,7 @@ class AddFriendModal extends Component { const { isAddingFriend } = this.props; return ( - @@ -192,7 +193,7 @@ class AddFriendModal extends Component { return ( this.onAddFriend(item)} disabled={addingNewFriend || delayAdding} onShowProfile={() => this.setState({selectedUser: item, visibleProfile: true})} @@ -213,7 +214,7 @@ class AddFriendModal extends Component { - + ); } } diff --git a/src/screens/inbox/pending-request-modal/pending-request-modal.js b/src/screens/inbox/pending-request-modal/pending-request-modal.js index 17e572c..fe19957 100644 --- a/src/screens/inbox/pending-request-modal/pending-request-modal.js +++ b/src/screens/inbox/pending-request-modal/pending-request-modal.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import { View, FlatList, ActivityIndicator } from "react-native"; -import { Screen, Text, BackButton, Touchable, Image } from "@components"; +import { Screen, Text, BackButton, Touchable, Image, ModalBase } from "@components"; import FastImage from "react-native-fast-image"; import { BlurView } from "@react-native-community/blur"; import Modal from "react-native-modal"; @@ -52,7 +52,7 @@ class PendingRequestModal extends Component { render() { const { isLoadingPendingFriends, pendingFriends } = this.props; return ( - @@ -94,7 +94,7 @@ class PendingRequestModal extends Component { keyExtractor={item => `pending-requests-${item._id}`} ItemSeparatorComponent={() => } renderItem={({ item: item, index }) => ( - { this.setState({selectedUser: item, visibleProfile: true}); }}> @@ -142,7 +142,7 @@ class PendingRequestModal extends Component { - + ); } } diff --git a/src/screens/like-users/index.js b/src/screens/like-users/index.js index 3b41c52..6fcc19a 100644 --- a/src/screens/like-users/index.js +++ b/src/screens/like-users/index.js @@ -1,6 +1,6 @@ import LikeUsersScreen from "./like-users.screen"; import { connect } from "react-redux"; -import { SwipeCreators } from "@redux/actions"; +import { SwipeCreators, AppCreators } from "@redux/actions"; function mapStateToProps(state) { return { @@ -14,6 +14,7 @@ const mapDispatchToProps = { addLike: SwipeCreators.addLike, addDisLike: SwipeCreators.addDisLike, runBoost: SwipeCreators.requestRunBoost, + showPurchase: AppCreators.showPurchase, }; export default connect(mapStateToProps, mapDispatchToProps)(LikeUsersScreen); diff --git a/src/screens/like-users/like-users.screen.js b/src/screens/like-users/like-users.screen.js index d3e1d80..3655196 100644 --- a/src/screens/like-users/like-users.screen.js +++ b/src/screens/like-users/like-users.screen.js @@ -7,7 +7,6 @@ import { getLikedUsers } from "@redux/api"; import Images from "@assets/Images"; import LikedUserItem from "./liked-user-item"; import PluzoLikeSwiper from "./pluzo-like-swiper"; -import PurchaseModal from "../profile-settings/purchase-modal"; import SwipePurchaseModal from "../swipe/swipe-purchase-modal"; import BoostTimeModal from "../swipe/boost-time-modal"; @@ -18,7 +17,6 @@ class LikeUsersScreen extends Component { super(...arguments); this.state = { likedUsers: [], - visiblePurchase: false, scrollEnabled: true, visibleBoost: false, visibleRemainingBoost: false, @@ -139,7 +137,7 @@ class LikeUsersScreen extends Component { return ( this.setState({visiblePurchase: true})}> + onPress={() => this.props.showPurchase(true)}> ) @@ -173,7 +171,7 @@ class LikeUsersScreen extends Component { shadowColor={"#FF6F00"} text={"Get Pluzo Plus"} animImage={Images.swipe.pluzoPlusMark} - onPress={() => this.setState({visiblePurchase: true})} + onPress={() => this.props.showPurchase(true)} /> } {this.props.user.premium === 1 && @@ -191,11 +189,6 @@ class LikeUsersScreen extends Component { } - this.setState({visiblePurchase: false})} - /> - React$Node = props => { /> ) : ( - {(messageBoxHeight === 300 || showFilters) && ( + {(messageBoxHeight === 300 || showPlayerSetting) && ( { - if (showFilters) { - setShowFilters(false); + if (showPlayerSetting) { + setShowPlayerSetting(false); } else { Keyboard.dismiss() } @@ -153,8 +153,8 @@ const StreamOverlayView: () => React$Node = props => { {props.streamerCount > 0 && ( { - if (showFilters) { - setShowFilters(false); + if (showPlayerSetting) { + setShowPlayerSetting(false); } else { Keyboard.dismiss() } @@ -178,7 +178,7 @@ const StreamOverlayView: () => React$Node = props => { )} - {!showFilters && + {!showPlayerSetting && { + this.setState({ clickedNew: true }, () => { + setTimeout(() => { + this.setState({ clickedNew: false }); + }, 500); + }) const { user } = this.props; let channelName = `${new Date().getTime()}-${user.id}`; let params = { @@ -226,7 +232,7 @@ class Live extends Component { return ( - {this.props.streamStatus === StreamStatus.STARTED ? ( + {(this.props.streamStatus === StreamStatus.STARTED || this.state.clickedNew) ? ( diff --git a/src/screens/login-phone-number/login-phone-number.screen.js b/src/screens/login-phone-number/login-phone-number.screen.js index e5ecfc7..34bceee 100644 --- a/src/screens/login-phone-number/login-phone-number.screen.js +++ b/src/screens/login-phone-number/login-phone-number.screen.js @@ -62,7 +62,7 @@ const LoginPhoneNumber: () => React$Node = props => { setPhoneNumber(txt.replace(/[^0-9]/g, ''))} placeholder={"Your phone number"} keyboardType={"phone-pad"} /> diff --git a/src/screens/profile-settings/choose-badge-modal/choose-badge-modal.js b/src/screens/profile-settings/choose-badge-modal/choose-badge-modal.js index 69cddf3..14ca6a9 100644 --- a/src/screens/profile-settings/choose-badge-modal/choose-badge-modal.js +++ b/src/screens/profile-settings/choose-badge-modal/choose-badge-modal.js @@ -8,9 +8,9 @@ import { Touchable, AutoDragSortableView, AnimatedButton, + ModalBase as Modal } from "@components"; import { BlurView } from "@react-native-community/blur"; -import Modal from "react-native-modal"; import { GRADIENT } from "@config"; import Images from "@assets/Images"; diff --git a/src/screens/profile-settings/friends-modal/friends-modal.js b/src/screens/profile-settings/friends-modal/friends-modal.js index 0b2fe26..0b11b30 100644 --- a/src/screens/profile-settings/friends-modal/friends-modal.js +++ b/src/screens/profile-settings/friends-modal/friends-modal.js @@ -1,7 +1,6 @@ import React, { useState } from "react"; import { View, FlatList } from "react-native"; -import { Text, Screen, BlurView, Touchable, NotificationModal } from "@components"; -import Modal from "react-native-modal"; +import { Text, Screen, BlurView, Touchable, NotificationModal, ModalBase as Modal } from "@components"; import SearchPeopleItem from "../../search/search-people-item"; import { API } from "@helpers"; import { API_ENDPOINTS } from "@config"; diff --git a/src/screens/profile-settings/index.js b/src/screens/profile-settings/index.js index 5af4c4e..ea3094d 100644 --- a/src/screens/profile-settings/index.js +++ b/src/screens/profile-settings/index.js @@ -1,7 +1,7 @@ import ProfileSettings from "./profile-settings.screen"; import { withSafeAreaInsets } from "react-native-safe-area-context"; import { connect } from "react-redux"; -import { UserCreators } from "@redux/actions"; +import { UserCreators, AppCreators } from "@redux/actions"; function mapStateToProps(state) { return { @@ -18,6 +18,7 @@ const mapDispatchToProps = { updateUserImage: UserCreators.updateUserSuccess, reorderImages: UserCreators.requestReorderImages, requestPageTime: UserCreators.requestPageTime, + showPurchase: AppCreators.showPurchase, }; export default connect( diff --git a/src/screens/profile-settings/locked-badge-modal/locked-badge-modal.js b/src/screens/profile-settings/locked-badge-modal/locked-badge-modal.js index 95b052d..1f090ea 100644 --- a/src/screens/profile-settings/locked-badge-modal/locked-badge-modal.js +++ b/src/screens/profile-settings/locked-badge-modal/locked-badge-modal.js @@ -1,10 +1,9 @@ import React, { useState } from "react"; import { View } from "react-native"; -import { Screen, Text, BoxShadow, GradientButton, Touchable } from "@components"; +import { Screen, Text, BoxShadow, GradientButton, Touchable, ModalBase as Modal } from "@components"; import * as Animatable from "react-native-animatable"; import { BlurView } from "@react-native-community/blur"; import FastImage from "react-native-fast-image"; -import Modal from "react-native-modal"; import { GRADIENT } from "@config"; import { AppBadges } from "@config"; import Images from "@assets/Images"; diff --git a/src/screens/profile-settings/profile-settings.screen.js b/src/screens/profile-settings/profile-settings.screen.js index 3d52d03..d903a8c 100644 --- a/src/screens/profile-settings/profile-settings.screen.js +++ b/src/screens/profile-settings/profile-settings.screen.js @@ -29,7 +29,6 @@ import { GRADIENT } from "@config"; import Header from "./header"; import UserProfile from "./user-profile"; import ProfileAmounts from "./profile-amounts"; -import PurchaseModal from "./purchase-modal"; import ChooseBadgeModal from "./choose-badge-modal"; import FriendsModal from "./friends-modal"; import SwipePurchaseModal from "../swipe/swipe-purchase-modal"; @@ -50,7 +49,6 @@ class ProfileSettings extends React.Component { constructor(props) { super(props); this.state = { - visiblePurchase: false, visibleChooseBadge: false, visibleBoost: false, visibleSuperlike: false, @@ -436,7 +434,7 @@ class ProfileSettings extends React.Component { text={this.props.user.premium === 1 ? "My Pluzo Plus" : "Get Pluzo Plus"} colors={GRADIENT.PURCHASE_BUTTON} shadowColor={"#FF6F00"} - onPress={() => this.setState({ visiblePurchase: true })} + onPress={() => this.props.showPurchase(true)} // noButton={this.props.user.premium === 1} /> @@ -484,18 +482,13 @@ class ProfileSettings extends React.Component { - this.setState({ visiblePurchase: false })} - /> - this.setState({ visibleChooseBadge: false })} onPurchase={() => { this.setState({ visibleChooseBadge: false }); setTimeout(() => { - this.setState({ visiblePurchase: true }) + this.props.showPurchase(true); }, 400); }} /> diff --git a/src/screens/profile-settings/purchase-modal/puchase-select-modal.js b/src/screens/profile-settings/purchase-modal/puchase-select-modal.js index 9dd0a58..74ca093 100644 --- a/src/screens/profile-settings/purchase-modal/puchase-select-modal.js +++ b/src/screens/profile-settings/purchase-modal/puchase-select-modal.js @@ -1,9 +1,8 @@ import React from "react"; import { View } from "react-native"; -import Modal from "react-native-modal"; import FastImage from "react-native-fast-image"; import LinearGradient from "react-native-linear-gradient"; -import { GradientButton, Text, BackButton, BoxShadow, Touchable, Screen } from "@components"; +import { GradientButton, Text, BackButton, BoxShadow, Touchable, Screen, ModalBase as Modal } from "@components"; import { BlurView } from "@react-native-community/blur"; import * as Animatable from "react-native-animatable"; import Images from "@assets/Images"; diff --git a/src/screens/profile-settings/purchase-modal/purchase-modal.js b/src/screens/profile-settings/purchase-modal/purchase-modal.js index 833293f..aa48091 100644 --- a/src/screens/profile-settings/purchase-modal/purchase-modal.js +++ b/src/screens/profile-settings/purchase-modal/purchase-modal.js @@ -1,9 +1,8 @@ import React from "react"; import { View } from "react-native"; -import Modal from "react-native-modal"; import FastImage from "react-native-fast-image"; import LinearGradient from "react-native-linear-gradient"; -import { GradientButton, Text, BackButton, BoxShadow, Touchable, Image } from "@components"; +import { GradientButton, Text, BackButton, BoxShadow, Touchable, Image, ModalBase as Modal } from "@components"; import { BlurView } from "@react-native-community/blur"; import * as Animatable from "react-native-animatable"; import RNIap from "react-native-iap"; @@ -205,6 +204,7 @@ class PurchaseModal extends React.Component { this.setState({visibleSelect: false})} onConfirm={(index) => { diff --git a/src/screens/profile-view/profile-detail/profile-detail.js b/src/screens/profile-view/profile-detail/profile-detail.js index 1091604..3541b94 100644 --- a/src/screens/profile-view/profile-detail/profile-detail.js +++ b/src/screens/profile-view/profile-detail/profile-detail.js @@ -18,6 +18,8 @@ const ProfileDetail: () => React$Node = props => { longitude, badges, age, + hide_location, + hide_city, } = props.user; const { location, imageIndex } = props; @@ -36,16 +38,22 @@ const ProfileDetail: () => React$Node = props => { } let isOwner = true; //props.owner.id === (props.user.id || props.user._id); let strAddress = (address !== null && address !== "null") ? address : ""; - if (city !== null && state !== null) { - strAddress = `${city}, ${state}`; + if (hide_location === 1) { + strAddress = ""; } else { - if (city === null && state === null) { - strAddress = strAddress; - } else { - if (city === null) { - strAddress = `${state}, ${strAddress}`; + if (hide_city === 0) { + if (city !== null && state !== null) { + strAddress = `${city}, ${state}`; } else { - strAddress = `${city}, ${strAddress}`; + if (city === null && state === null) { + strAddress = strAddress; + } else { + if (city === null) { + strAddress = `${state}, ${strAddress}`; + } else { + strAddress = `${city}, ${strAddress}`; + } + } } } } diff --git a/src/screens/profile-view/profile-view.screen.js b/src/screens/profile-view/profile-view.screen.js index 8eb519d..d2ca65e 100644 --- a/src/screens/profile-view/profile-view.screen.js +++ b/src/screens/profile-view/profile-view.screen.js @@ -261,19 +261,26 @@ class ProfileView extends React.Component { data, }) .then(response => { - let res = response.data.data; - this.setState({ - friend: res.friend_info.friend, - updating: false, - rejecting: false, - }); + let res = response.data.data; console.log(res); if (type === "accept" || type === "reject") { + this.setState({ + friend: 4, + updating: false, + rejecting: false, + }); + const { pendingFriends } = this.props; let requests = pendingFriends.filter(value => value._id !== userId); this.props.updatePendings(requests); + } else { + this.setState({ + friend: res.friend_info.friend, + updating: false, + rejecting: false, + }); } }) - .catch(err => { + .catch(err => {console.log(err); this.setState({ updating: false, rejecting: false }); }); }; @@ -476,12 +483,14 @@ class ProfileView extends React.Component { this.setState({ visibleReport: false })} /> this.setState({ visibleConfirmBlock: false })} onConfirm={() => { @@ -496,6 +505,7 @@ class ProfileView extends React.Component { this.setState({visibleConfirmDelete: false})} onConfirm={(userId, userName) => { this.setState({visibleConfirmDelete: false}); diff --git a/src/screens/report-modal/report-modal.js b/src/screens/report-modal/report-modal.js index 87f0983..98c330f 100644 --- a/src/screens/report-modal/report-modal.js +++ b/src/screens/report-modal/report-modal.js @@ -2,8 +2,7 @@ import React, { Component } from "react"; import { View, TextInput, Platform, ActivityIndicator } from "react-native"; import { BlurView } from "@react-native-community/blur"; import KeyboardManager from "react-native-keyboard-manager"; -import Modal from "react-native-modal"; -import { Screen, Touchable, Image, Text, AppAlert } from "@components"; +import { Screen, Touchable, Image, Text, AppAlert, ModalBase as Modal } from "@components"; import { report } from "@redux/api"; import Images from "@assets/Images"; @@ -174,6 +173,7 @@ class ReportModal extends Component { { this.onInit(); this.props.onDismiss && this.props.onDismiss(); diff --git a/src/screens/settings/account-settings/update-name-modal/update-name-modal.js b/src/screens/settings/account-settings/update-name-modal/update-name-modal.js index 30b0b6e..239f154 100644 --- a/src/screens/settings/account-settings/update-name-modal/update-name-modal.js +++ b/src/screens/settings/account-settings/update-name-modal/update-name-modal.js @@ -7,8 +7,8 @@ import { Touchable, BackButton, TextInput, + ModalBase as Modal } from "@components"; -import Modal from "react-native-modal"; import styles from "./update-name-modal.style"; diff --git a/src/screens/settings/account-settings/update-password-modal/update-password-modal.js b/src/screens/settings/account-settings/update-password-modal/update-password-modal.js index 6065372..d70bc78 100644 --- a/src/screens/settings/account-settings/update-password-modal/update-password-modal.js +++ b/src/screens/settings/account-settings/update-password-modal/update-password-modal.js @@ -7,8 +7,8 @@ import { Touchable, BackButton, TextInput, + ModalBase as Modal } from "@components"; -import Modal from "react-native-modal"; import { changePassword } from "@redux/api"; import { Notification } from "@helpers"; diff --git a/src/screens/settings/account-settings/update-phone-modal/update-phone-modal.js b/src/screens/settings/account-settings/update-phone-modal/update-phone-modal.js index bc6e0e6..b0c80a9 100644 --- a/src/screens/settings/account-settings/update-phone-modal/update-phone-modal.js +++ b/src/screens/settings/account-settings/update-phone-modal/update-phone-modal.js @@ -9,8 +9,8 @@ import { TextInput, Text, CountryCodePicker, + ModalBase as Modal } from "@components"; -import Modal from "react-native-modal"; import LinearGradient from "react-native-linear-gradient"; import { GRADIENT } from "@config"; import { Validator } from "@helpers"; @@ -83,7 +83,7 @@ const UpdatePhoneModal: () => React$Node = props => { setPhoneNumber(txt.replace(/[^0-9]/g, ''))} placeholder={"New Phone Number"} keyboardType={"phone-pad"} /> diff --git a/src/screens/settings/logout-modal/logout-modal.js b/src/screens/settings/logout-modal/logout-modal.js index bfc2321..1b98cfb 100644 --- a/src/screens/settings/logout-modal/logout-modal.js +++ b/src/screens/settings/logout-modal/logout-modal.js @@ -1,7 +1,6 @@ import React, { useState } from "react"; import { View } from "react-native"; -import { Screen, Touchable, BlurView, Text, Image, BoxShadow } from "@components"; -import Modal from "react-native-modal"; +import { Screen, Touchable, BlurView, Text, Image, BoxShadow, ModalBase as Modal } from "@components"; import Images from "@assets/Images"; import styles from "./logout-modal.style"; diff --git a/src/screens/settings/push-notification-settings/push-notification-settings.screen.js b/src/screens/settings/push-notification-settings/push-notification-settings.screen.js index 4d27b3c..6c1287b 100644 --- a/src/screens/settings/push-notification-settings/push-notification-settings.screen.js +++ b/src/screens/settings/push-notification-settings/push-notification-settings.screen.js @@ -21,17 +21,19 @@ class PushNotificationSettings extends Component { requestFriend: user_setting.push_friend_request === 1 ? true : false, live: user_setting.push_live === 1 ? true : false, message: user_setting.push_message === 1 ? true : false, + likes: user_setting.push_likes === 1 ? true : false, } } componentWillUnmount() { - const { newFriends, requestFriend, live, message } = this.state; + const { newFriends, requestFriend, live, message, likes } = this.state; const params = new FormData(); params.append("push_new_friend", newFriends ? 1 : 0); params.append("push_friend_request", requestFriend ? 1 : 0); params.append("push_live", live ? 1 : 0); params.append("push_new_friend", message ? 1 : 0); + params.append("push_likes", likes ? 1 : 0); this.props.updateUser(params, this.props.token); } @@ -40,7 +42,7 @@ class PushNotificationSettings extends Component { }; render() { - const { newFriends, requestFriend, live, message } = this.state; + const { newFriends, requestFriend, live, message, likes } = this.state; return ( + + + Likes + { + this.setState({ likes: val }); + ReactNativeHapticFeedback.trigger("impactLight", options); + }} + circleSize={20} + barHeight={24} + circleBorderWidth={0} + backgroundActive={"#617FFF"} + backgroundInactive={"#ABA7D5"} + circleActiveColor={"white"} + circleInActiveColor={"white"} + renderActiveText={false} + renderInActiveText={false} + switchBorderRadius={12} + switchWidthMultiplier={2.2} + /> + + diff --git a/src/screens/settings/safety-privacy/location-permission/index.js b/src/screens/settings/safety-privacy/location-permission/index.js index 9b48c32..31c6c8d 100644 --- a/src/screens/settings/safety-privacy/location-permission/index.js +++ b/src/screens/settings/safety-privacy/location-permission/index.js @@ -1,3 +1,16 @@ import LocationPermissionScreen from "./location-permission"; +import { connect } from "react-redux"; +import { UserCreators } from "@redux/actions"; -export default LocationPermissionScreen; +function mapStateToProps(state) { + return { + user: state.user.user, + token: state.user.token, + }; +} + +const mapDispatchToProps = { + updateUser: UserCreators.requestUpdateUser, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(LocationPermissionScreen); diff --git a/src/screens/settings/safety-privacy/location-permission/location-permission.js b/src/screens/settings/safety-privacy/location-permission/location-permission.js index 69ba9d2..a1c2be2 100644 --- a/src/screens/settings/safety-privacy/location-permission/location-permission.js +++ b/src/screens/settings/safety-privacy/location-permission/location-permission.js @@ -1,14 +1,33 @@ import React, { useEffect, useState } from "react"; import { Platform, SafeAreaView, View } from "react-native"; import { Screen, Text, Image, Touchable } from "@components"; +import { Switch } from "react-native-switch"; +import ReactNativeHapticFeedback from "react-native-haptic-feedback"; import { request, checkMultiple, PERMISSIONS, RESULTS, openSettings} from 'react-native-permissions'; import Images from "@assets/Images"; import Header from "../../header"; import styles from "./location-permission.style"; +const options = { + enableVibrateFallback: true, + ignoreAndroidSystemSettings: true, +}; + const LocationPermissionScreen: () => React$Node = props => { const [locationEnabled, setLocationEnabled] = useState(null); + const [hideLocation, setHideLocation] = useState(props.user.hide_location === 0 ? false : true); + const [hideCity, setHideCity] = useState(props.user.hide_city === 0 ? false : true); + const { updateUser, token } = props; + + useEffect(() => { + return () => { + const params = new FormData(); + params.append("hide_location", hideLocation ? 1 : 0); + params.append("hide_city", hideCity ? 1 : 0); + updateUser(params, token); + } + }, [updateUser, token, hideLocation, hideCity]); useEffect(() => { let arrPermissions = [PERMISSIONS.IOS.LOCATION_WHEN_IN_USE]; @@ -71,6 +90,52 @@ const LocationPermissionScreen: () => React$Node = props => { {renderItem("Manage location access", locationEnabled, null)} + + + Hide Location + { + setHideLocation(val); + ReactNativeHapticFeedback.trigger("impactLight", options); + }} + circleSize={20} + barHeight={24} + circleBorderWidth={0} + backgroundActive={"#617FFF"} + backgroundInactive={"#ABA7D5"} + circleActiveColor={"white"} + circleInActiveColor={"white"} + renderActiveText={false} + renderInActiveText={false} + switchBorderRadius={12} + switchWidthMultiplier={2.2} + /> + + + + + Hide City + { + setHideCity(val); + ReactNativeHapticFeedback.trigger("impactLight", options); + }} + circleSize={20} + barHeight={24} + circleBorderWidth={0} + backgroundActive={"#617FFF"} + backgroundInactive={"#ABA7D5"} + circleActiveColor={"white"} + circleInActiveColor={"white"} + renderActiveText={false} + renderInActiveText={false} + switchBorderRadius={12} + switchWidthMultiplier={2.2} + /> + + diff --git a/src/screens/settings/safety-privacy/safety-privacy.js b/src/screens/settings/safety-privacy/safety-privacy.js index 351358f..cc18ed1 100644 --- a/src/screens/settings/safety-privacy/safety-privacy.js +++ b/src/screens/settings/safety-privacy/safety-privacy.js @@ -33,7 +33,7 @@ const SafetyPrivacy: () => React$Node = props => { -
+
props.navigation.navigate(SCREENS.BLOCKED_USERS)}> {renderItem("Blocked Users", props.blockedUsers.length, null)} diff --git a/src/screens/settings/swipe-settings/swipe-settings.screen.js b/src/screens/settings/swipe-settings/swipe-settings.screen.js index 968fe56..24fb434 100644 --- a/src/screens/settings/swipe-settings/swipe-settings.screen.js +++ b/src/screens/settings/swipe-settings/swipe-settings.screen.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import { View, Dimensions, ActivityIndicator, SafeAreaView } from "react-native"; import { Screen, Image, Text, Touchable } from "@components"; -import moment from "moment"; import { Switch } from "react-native-switch"; import MultiSlider from "@ptomasroos/react-native-multi-slider"; import Images from "@assets/Images"; diff --git a/src/screens/signup-code-verification/signup-code-verification.screen.js b/src/screens/signup-code-verification/signup-code-verification.screen.js index 040ee77..7319a38 100644 --- a/src/screens/signup-code-verification/signup-code-verification.screen.js +++ b/src/screens/signup-code-verification/signup-code-verification.screen.js @@ -41,22 +41,22 @@ class SignupCodeVerification extends Component { .catch(p => console.log(p)); } - // let lastTime = 0; - // try { - // lastTime = await AsyncStorage.getItem(TUTORIAL.SMS_LAST_TIME); - // } catch (error) { - // lastTime = 0; - // } - // if (lastTime === 0 || lastTime === null) { - // this.resendCode(); - // } else { - // let passTime = moment().diff(moment.unix(lastTime), "seconds"); - // if (passTime < 60) { - // this.startCountDown(60 - passTime); - // } else { - // this.resendCode(); - // } - // } + let lastTime = 0; + try { + lastTime = await AsyncStorage.getItem(TUTORIAL.SMS_LAST_TIME); + } catch (error) { + lastTime = 0; + } + if (lastTime === 0 || lastTime === null) { + this.resendCode(); + } else { + let passTime = moment().diff(moment.unix(lastTime), "seconds"); + if (passTime < 60) { + this.startCountDown(60 - passTime); + } else { + this.resendCode(); + } + } } componentWillUnmount() { diff --git a/src/screens/signup-phone-number/signup-phone-number.screen.js b/src/screens/signup-phone-number/signup-phone-number.screen.js index 3f945ab..b713fed 100644 --- a/src/screens/signup-phone-number/signup-phone-number.screen.js +++ b/src/screens/signup-phone-number/signup-phone-number.screen.js @@ -77,7 +77,7 @@ const SignupPhoneNumber: () => React$Node = props => { setPhoneNumber(txt.replace(/[^0-9]/g, ''))} placeholder={"Your phone number"} keyboardType={"phone-pad"} /> diff --git a/src/screens/swipe/boost-time-modal/boost-time-modal.js b/src/screens/swipe/boost-time-modal/boost-time-modal.js index 684b794..809caa6 100644 --- a/src/screens/swipe/boost-time-modal/boost-time-modal.js +++ b/src/screens/swipe/boost-time-modal/boost-time-modal.js @@ -1,7 +1,6 @@ import React, { useEffect, useState, useRef } from "react"; import { View } from "react-native"; -import { Screen, Text, Image, BoxShadow, GradientButton, AnimatedButton } from "@components"; -import Modal from "react-native-modal"; +import { Screen, Text, Image, BoxShadow, GradientButton, AnimatedButton, ModalBase as Modal } from "@components"; import moment from "moment"; import Images from "@assets/Images"; diff --git a/src/screens/swipe/header/header.js b/src/screens/swipe/header/header.js index 1e9af41..0edbbef 100644 --- a/src/screens/swipe/header/header.js +++ b/src/screens/swipe/header/header.js @@ -8,23 +8,29 @@ import Images from "@assets/Images"; import styles from "./header.style"; const Header: () => React$Node = props => { - var { first_name, birthday, age, address, state, city, badges, bio } = props.item; + var { first_name, birthday, age, address, state, city, badges, bio, hide_location, hide_city } = props.item; if (first_name === null || first_name === "") { first_name = "No Name"; } birthday = age; //moment().diff(moment.unix(birthday), "years"); let strAddress = (address !== null && address !== "null") ? address : ""; - if (city !== null && state !== null) { - strAddress = `${city}, ${state}`; + if (hide_location === 1) { + strAddress = ""; } else { - if (city === null && state === null) { - strAddress = strAddress; - } else { - if (city === null) { - strAddress = `${state}, ${strAddress}`; + if (hide_city === 0) { + if (city !== null && state !== null) { + strAddress = `${city}, ${state}`; } else { - strAddress = `${city}, ${strAddress}`; + if (city === null && state === null) { + strAddress = strAddress; + } else { + if (city === null) { + strAddress = `${state}, ${strAddress}`; + } else { + strAddress = `${city}, ${strAddress}`; + } + } } } } diff --git a/src/screens/swipe/index.js b/src/screens/swipe/index.js index e8184ec..0ec0236 100644 --- a/src/screens/swipe/index.js +++ b/src/screens/swipe/index.js @@ -1,6 +1,6 @@ import Swipe from "./swipe.screen"; import { connect } from "react-redux"; -import { SwipeCreators, UserCreators } from "@redux/actions"; +import { SwipeCreators, UserCreators, AppCreators } from "@redux/actions"; function mapStateToProps(state) { return { @@ -26,6 +26,7 @@ const mapDispatchToProps = { updateSettings: SwipeCreators.requestSetSettings, updateCards: SwipeCreators.requestCardsUpdate, loadSettings: SwipeCreators.requestGetSettings, + showPluzo: AppCreators.showPluzo, }; export default connect(mapStateToProps, mapDispatchToProps)(Swipe); diff --git a/src/screens/swipe/no-users/gender-modal/gender-modal.js b/src/screens/swipe/no-users/gender-modal/gender-modal.js index d055324..479ffb8 100644 --- a/src/screens/swipe/no-users/gender-modal/gender-modal.js +++ b/src/screens/swipe/no-users/gender-modal/gender-modal.js @@ -1,8 +1,7 @@ import React from "react"; import { View } from "react-native"; -import { ModalHeader, GradientButton, SolidButton, Screen, Touchable, Text } from "@components"; +import { ModalHeader, GradientButton, SolidButton, Screen, Touchable, Text, ModalBase as Modal } from "@components"; import { BlurView } from "@react-native-community/blur"; -import Modal from "react-native-modal"; import styles from "./gender-modal.style"; diff --git a/src/screens/swipe/no-users/no-users.js b/src/screens/swipe/no-users/no-users.js index 60c15ee..6e7f2ae 100644 --- a/src/screens/swipe/no-users/no-users.js +++ b/src/screens/swipe/no-users/no-users.js @@ -1,9 +1,8 @@ import React from "react"; import { View, Animated, Easing, SafeAreaView, Linking } from "react-native"; import FastImage from "react-native-fast-image"; -import { Text, GradientButton, Touchable } from "@components"; +import { Text, GradientButton, Touchable, ModalBase as Modal } from "@components"; import { BlurView } from "@react-native-community/blur"; -import Modal from "react-native-modal"; import styles from "./no-users.style"; import SwipeSettings from "../../settings/swipe-settings"; @@ -66,10 +65,10 @@ class NoUsers extends React.Component { )} {permission && <> - Oops! - + {/*Oops!*/} + {/* {"In order to use Pluzo you\nneed to enable your location."} - + */} } diff --git a/src/screens/swipe/swipe-purchase-modal/swipe-purchase-modal.js b/src/screens/swipe/swipe-purchase-modal/swipe-purchase-modal.js index 4484934..3263514 100644 --- a/src/screens/swipe/swipe-purchase-modal/swipe-purchase-modal.js +++ b/src/screens/swipe/swipe-purchase-modal/swipe-purchase-modal.js @@ -8,8 +8,8 @@ import { Touchable, SolidButton, GradientButton, + ModalBase as Modal } from "@components"; -import Modal from "react-native-modal"; import moment from "moment"; import RNIap from "react-native-iap"; import * as Animatable from "react-native-animatable"; @@ -235,6 +235,7 @@ const SwipePurchaseModal: () => React$Node = props => { setVisiblePurchase(false)} /> diff --git a/src/screens/swipe/swipe.screen.js b/src/screens/swipe/swipe.screen.js index ae4fba3..b7caffa 100644 --- a/src/screens/swipe/swipe.screen.js +++ b/src/screens/swipe/swipe.screen.js @@ -167,12 +167,17 @@ class Swipe extends React.Component { params.append("latitude", position.coords.latitude); params.append("longitude", position.coords.longitude); this.props.updateUser(params, this.props.token); - if (this.props.cards.length === 0) { - this.cardIndex = -1; - this.props.loadCards(this.props.token, 1); - } + } + if (this.props.cards.length === 0) { + this.cardIndex = -1; + this.props.loadCards(this.props.token, 1); } }); + } else { + if (this.props.cards.length === 0) { + this.cardIndex = -1; + this.props.loadCards(this.props.token, 1); + } } } @@ -308,6 +313,14 @@ class Swipe extends React.Component { this.setState({swipedCount: 4}); } } + + if (this.props.user.premium === 0 && this.state.swipedCount === 9) { + if (this.props.cards.length >= (index + 1)) { + this.props.showPluzo(true, "swipe"); + } else { + this.setState({swipedCount: 8}); + } + } if (type === "left") { // dislike @@ -376,16 +389,16 @@ class Swipe extends React.Component { const { isLoadingCards, cards } = this.props; const { labelType, tutorialPointer, swipedCount, hasPermission } = this.state; - if (hasPermission === false) { - return ( - - - this.onWillFocus(payload)} - onWillBlur={(payload) => this.onWillBlur(payload)} /> - - ) - } + // if (hasPermission === false) { + // return ( + // + // + // this.onWillFocus(payload)} + // onWillBlur={(payload) => this.onWillBlur(payload)} /> + // + // ) + // } if (isLoadingCards || cards === null || cards === undefined || cards.length === 0) { return (