Skip to content

Commit

Permalink
app2.0(updated some issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
alphakongx committed Apr 1, 2021
1 parent aedb96d commit 5262968
Show file tree
Hide file tree
Showing 72 changed files with 661 additions and 181 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions ios/Pluzo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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",
Expand All @@ -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)",
Expand All @@ -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",
Expand Down Expand Up @@ -1459,15 +1459,15 @@
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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;
Expand All @@ -1493,15 +1493,15 @@
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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)";
Expand Down
1 change: 0 additions & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ module.exports = {
},
}),
},
assets: ["./assets/fonts/"],
};
30 changes: 27 additions & 3 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class App extends React.Component {
firstLoading: true,
appState: AppState.currentState,
};
this.openedTime = 0;
}

async componentDidMount() {
Expand All @@ -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) {
Expand All @@ -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) => {
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -286,10 +309,10 @@ class App extends React.Component {
</View>}
{this.isLogin() && (
<WS
url={"ws://3.134.208.235:27800?user=" + this.props.user.id}
url={"ws://3.18.139.193:27801?user=" + this.props.user.id}
onMessage={this.onMessage}
onOpen={() => console.log("Opened socket")}
onError={() => console.log("Error socket")}
onError={(error) => console.log(error)}
onClose={() => console.log("Closed socket")}
reconnect
isActive={this.state.appState}
Expand Down Expand Up @@ -322,6 +345,7 @@ const mapDispatchToProps = {
updateUser: UserCreators.requestUpdateUser,
updateFriends: InboxCreators.requestFriendsSuccess,
loadPendingRequests: InboxCreators.requestPendingFriends,
showPluzo: AppCreators.showPluzo,
};

export default connect(mapStateToProps, mapDispatchToProps)(App);
3 changes: 2 additions & 1 deletion src/components/alerts/app-alert.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/components/alerts/boost-confirm-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/components/alerts/confirm-modal.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/components/alerts/notification-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
12 changes: 7 additions & 5 deletions src/components/dialog-input/dialog-input.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -86,10 +86,12 @@ class DialogInput extends PureComponent {

return (
<Modal
animationType={animationType}
transparent={true}
visible={this.props.isDialogVisible}
onRequestClose={this.handleOnRequestClose}
animationIn={"fadeIn"}
animationOut={"fadeOut"}
backdropOpacity={0}
style={{margin: 0}}
isVisible={this.props.isDialogVisible}
onModalHide={this.handleOnRequestClose}
>
<KeyboardAvoidingView style={[styles.container, { ...modalStyleProps }]}>
<TouchableOpacity
Expand Down
3 changes: 2 additions & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ export * from "./keyboard-listener";
export * from "./gesture-recognizer";
export * from "./animated-dots";
export * from "./image-zoom-viewer";
export * from "./pluzo-ar-view";
export * from "./pluzo-ar-view";
export * from "./modal-base";
3 changes: 3 additions & 0 deletions src/components/modal-base/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ModalBase from "./modal-base";

export { ModalBase };
31 changes: 31 additions & 0 deletions src/components/modal-base/modal-base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import Modal from "react-native-modal";
import { connect } from "react-redux";
import { AppCreators } from "@redux/actions";

const ModalBase: () => 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 <Modal {...rest} onModalShow={modalShow} onModalHide={modalHide} />;
};

const mapDispatchToProps = {
updateModalShowed: AppCreators.updateModalShowed,
};

export default connect(null, mapDispatchToProps)(ModalBase);
4 changes: 2 additions & 2 deletions src/components/screen/screen.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
1 change: 1 addition & 0 deletions src/components/wheel-scroll/wheel-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/redux/actions/app.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
31 changes: 30 additions & 1 deletion src/redux/reducers/app.reducer.js
Original file line number Diff line number Diff line change
@@ -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);
1 change: 0 additions & 1 deletion src/redux/sagas/user.sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions src/redux/store/initial-state.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export default {
app: {
isConnected: true,
visiblePurchase: false,
visiblePluzo: false,
pluzoType: "",
modalShowed: false,
},
user: {
token: "",
Expand Down
Loading

0 comments on commit 5262968

Please sign in to comment.