|
@@ -16,8 +16,8 @@ import {
|
|
|
BackHandler,
|
|
BackHandler,
|
|
|
ActivityIndicator,
|
|
ActivityIndicator,
|
|
|
Dimensions,
|
|
Dimensions,
|
|
|
- StatusBar,
|
|
|
|
|
Alert,
|
|
Alert,
|
|
|
|
|
+ Appearance,
|
|
|
} from 'react-native';
|
|
} from 'react-native';
|
|
|
import {
|
|
import {
|
|
|
View,
|
|
View,
|
|
@@ -35,10 +35,10 @@ import RNIap, {
|
|
|
type PurchaseError
|
|
type PurchaseError
|
|
|
} from 'react-native-iap';
|
|
} from 'react-native-iap';
|
|
|
|
|
|
|
|
-import { initialMode, useDarkMode, DynamicStyleSheet, DynamicValue, useDynamicStyleSheet, eventEmitter } from 'react-native-dark-mode';
|
|
|
|
|
import JitsiMeet, { JitsiMeetView } from 'react-native-jitsi-meet';
|
|
import JitsiMeet, { JitsiMeetView } from 'react-native-jitsi-meet';
|
|
|
import VideoCall from './VideoCall';
|
|
import VideoCall from './VideoCall';
|
|
|
import ErrorPage from './ErrorPage';
|
|
import ErrorPage from './ErrorPage';
|
|
|
|
|
+import { themeDark, themeLight, useTheme } from './Theme';
|
|
|
|
|
|
|
|
import { version } from './package.json';
|
|
import { version } from './package.json';
|
|
|
|
|
|
|
@@ -56,7 +56,6 @@ export default class App extends Component<Props> {
|
|
|
|
|
|
|
|
loading = false;
|
|
loading = false;
|
|
|
videoCallAudio = false;
|
|
videoCallAudio = false;
|
|
|
- mode = initialMode;
|
|
|
|
|
purchaseUpdateSubscription = null;
|
|
purchaseUpdateSubscription = null;
|
|
|
purchaseErrorSubscription = null;
|
|
purchaseErrorSubscription = null;
|
|
|
products = {};
|
|
products = {};
|
|
@@ -64,8 +63,10 @@ export default class App extends Component<Props> {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
+ var colorScheme = Appearance.getColorScheme();
|
|
|
|
|
+
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`,
|
|
|
|
|
|
|
+ url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' === colorScheme ? MIX_DARK : MIX_LIGHT}`,
|
|
|
status: 'No Page Loaded',
|
|
status: 'No Page Loaded',
|
|
|
backButtonEnabled: false,
|
|
backButtonEnabled: false,
|
|
|
forwardButtonEnabled: false,
|
|
forwardButtonEnabled: false,
|
|
@@ -87,13 +88,6 @@ export default class App extends Component<Props> {
|
|
|
this.onVideoCallStart = this.onVideoCallStart.bind(this);
|
|
this.onVideoCallStart = this.onVideoCallStart.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- onModeChanged(newMode){
|
|
|
|
|
- this.mode = newMode;
|
|
|
|
|
- this.setState ({
|
|
|
|
|
- key: this.state.key + 1,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
async onRequestPurchase (sku: string) {
|
|
async onRequestPurchase (sku: string) {
|
|
|
if ('ios' === Platform.OS)
|
|
if ('ios' === Platform.OS)
|
|
|
RNIap.clearTransactionIOS();
|
|
RNIap.clearTransactionIOS();
|
|
@@ -217,8 +211,9 @@ export default class App extends Component<Props> {
|
|
|
if (`${BASE_URL}` == this.state.url || this.state.url.startsWith(`${BASE_URL}?skin=${TEMPLATE}`) || `${BASE_URL}index.php` == this.state.url) {
|
|
if (`${BASE_URL}` == this.state.url || this.state.url.startsWith(`${BASE_URL}?skin=${TEMPLATE}`) || `${BASE_URL}index.php` == this.state.url) {
|
|
|
this.injectJavaScript("bx_mobile_apps_close_sliding_menus()");
|
|
this.injectJavaScript("bx_mobile_apps_close_sliding_menus()");
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ var colorScheme = Appearance.getColorScheme();
|
|
|
this.setState ({
|
|
this.setState ({
|
|
|
- url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`,
|
|
|
|
|
|
|
+ url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == colorScheme ? MIX_DARK : MIX_LIGHT}`,
|
|
|
searchbar: false,
|
|
searchbar: false,
|
|
|
key: this.state.key + 1,
|
|
key: this.state.key + 1,
|
|
|
});
|
|
});
|
|
@@ -368,11 +363,14 @@ export default class App extends Component<Props> {
|
|
|
SplashScreen.hide();
|
|
SplashScreen.hide();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- UNSAFE_componentWillMount() {
|
|
|
|
|
- eventEmitter.on('currentModeChanged', this.onModeChanged.bind(this));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
async componentDidMount() {
|
|
async componentDidMount() {
|
|
|
|
|
+
|
|
|
|
|
+ Appearance.addChangeListener(({ colorScheme }) => {
|
|
|
|
|
+ this.setState ({
|
|
|
|
|
+ key: this.state.key + 1,
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
OneSignal.setLogLevel(6, 0);
|
|
OneSignal.setLogLevel(6, 0);
|
|
|
OneSignal.setAppId(ONESIGNALAPPID);
|
|
OneSignal.setAppId(ONESIGNALAPPID);
|
|
|
// OneSignal.inFocusDisplaying(0);
|
|
// OneSignal.inFocusDisplaying(0);
|
|
@@ -428,9 +426,7 @@ export default class App extends Component<Props> {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- SplashScreen.hide();
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (PAYMENTS_CALLBACK != '') {
|
|
if (PAYMENTS_CALLBACK != '') {
|
|
|
var _self = this;
|
|
var _self = this;
|
|
@@ -479,10 +475,11 @@ export default class App extends Component<Props> {
|
|
|
console.log('purchaseErrorListener', error);
|
|
console.log('purchaseErrorListener', error);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ SplashScreen.hide();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
componentWillUnmount() {
|
|
|
- eventEmitter.removeListener('currentModeChanged', this.onModeChanged);
|
|
|
|
|
|
|
|
|
|
if (this.purchaseUpdateSubscription) {
|
|
if (this.purchaseUpdateSubscription) {
|
|
|
this.purchaseUpdateSubscription.remove();
|
|
this.purchaseUpdateSubscription.remove();
|
|
@@ -565,6 +562,7 @@ export default class App extends Component<Props> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
+ var colorScheme = Appearance.getColorScheme();
|
|
|
var sWebview = (
|
|
var sWebview = (
|
|
|
<WebView
|
|
<WebView
|
|
|
useWebKit={true}
|
|
useWebKit={true}
|
|
@@ -581,7 +579,7 @@ export default class App extends Component<Props> {
|
|
|
onShouldStartLoadWithRequest={this.onWebViewShouldStartLoadWithRequest.bind(this)}
|
|
onShouldStartLoadWithRequest={this.onWebViewShouldStartLoadWithRequest.bind(this)}
|
|
|
onNavigationStateChange={this.onWebViewNavigationStateChange.bind(this)}
|
|
onNavigationStateChange={this.onWebViewNavigationStateChange.bind(this)}
|
|
|
style={{flex: 1}}
|
|
style={{flex: 1}}
|
|
|
- source={{uri: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`}}
|
|
|
|
|
|
|
+ source={{uri: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == colorScheme ? MIX_DARK : MIX_LIGHT}`}}
|
|
|
userAgent={"UNAMobileApp/Mobile (" + Platform.OS + ")"}
|
|
userAgent={"UNAMobileApp/Mobile (" + Platform.OS + ")"}
|
|
|
onMessage={this.onWebViewMessage.bind(this)}
|
|
onMessage={this.onWebViewMessage.bind(this)}
|
|
|
allowFileAccess={true}
|
|
allowFileAccess={true}
|
|
@@ -591,7 +589,7 @@ export default class App extends Component<Props> {
|
|
|
/>
|
|
/>
|
|
|
);
|
|
);
|
|
|
return (
|
|
return (
|
|
|
- <Container>
|
|
|
|
|
|
|
+ <Container>
|
|
|
<Drawer ref="drawer" content={<UnaDrawer onLogin={this.onDrawerLoginMenu.bind(this)} onJoin={this.onDrawerJoinMenu.bind(this)} onForotPassword={this.onDrawerForgotMenu.bind(this)} onClose={this.drawerClose.bind(this)} />} onClose={this.drawerClose.bind(this)}>
|
|
<Drawer ref="drawer" content={<UnaDrawer onLogin={this.onDrawerLoginMenu.bind(this)} onJoin={this.onDrawerJoinMenu.bind(this)} onForotPassword={this.onDrawerForgotMenu.bind(this)} onClose={this.drawerClose.bind(this)} />} onClose={this.drawerClose.bind(this)}>
|
|
|
<UnaApp
|
|
<UnaApp
|
|
|
webview={sWebview}
|
|
webview={sWebview}
|
|
@@ -620,16 +618,6 @@ export default class App extends Component<Props> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UnaApp(o) {
|
|
function UnaApp(o) {
|
|
|
- const styles = useDynamicStyleSheet(dynamicStyles);
|
|
|
|
|
-
|
|
|
|
|
- const isDarkMode = useDarkMode();
|
|
|
|
|
- var sBarStyle = 'dark-content';
|
|
|
|
|
- if (Platform.OS === 'android' || isDarkMode)
|
|
|
|
|
- sBarStyle = 'light-content';
|
|
|
|
|
- if (Platform.OS === 'android')
|
|
|
|
|
- StatusBar.setBackgroundColor('#076fd3');
|
|
|
|
|
- StatusBar.setBarStyle(sBarStyle, false);
|
|
|
|
|
-
|
|
|
|
|
return (<Container>
|
|
return (<Container>
|
|
|
|
|
|
|
|
{o.state.searchbar ? (
|
|
{o.state.searchbar ? (
|
|
@@ -655,7 +643,6 @@ function UnaApp(o) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UnaFooter(o) {
|
|
function UnaFooter(o) {
|
|
|
- const styles = useDynamicStyleSheet(dynamicStyles)
|
|
|
|
|
return (
|
|
return (
|
|
|
<Footer style={styles.footer}>
|
|
<Footer style={styles.footer}>
|
|
|
{!('decorous' == TEMPLATE && Platform.isPad) &&
|
|
{!('decorous' == TEMPLATE && Platform.isPad) &&
|
|
@@ -706,22 +693,22 @@ function UnaFooter(o) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UnaToolbar(o) {
|
|
function UnaToolbar(o) {
|
|
|
- const styles = useDynamicStyleSheet(dynamicStyles)
|
|
|
|
|
|
|
+ var colorScheme = Appearance.getColorScheme();
|
|
|
return (
|
|
return (
|
|
|
- <Header style={styles.header}>
|
|
|
|
|
|
|
+ <Header androidStatusBarColor={useTheme('colors.statusBar')} transparent={false} iosBarStyle={useTheme('iosBarStyle')} style={styles.header}>
|
|
|
<Left>
|
|
<Left>
|
|
|
{o.loading ? (
|
|
{o.loading ? (
|
|
|
- <ActivityIndicator size="small" color={Platform.OS === 'android' ? '#fff' : '#333'} style={styles.loadingIndicator} />
|
|
|
|
|
|
|
+ <ActivityIndicator size="small" color={useTheme('colors.activityIndicator')} style={styles.loadingIndicator} />
|
|
|
):(
|
|
):(
|
|
|
o.loggedin ? (
|
|
o.loggedin ? (
|
|
|
(o.backButtonEnabled || Platform.OS === 'android') &&
|
|
(o.backButtonEnabled || Platform.OS === 'android') &&
|
|
|
(<Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent disabled={!o.backButtonEnabled} onPress={o.onBackAndMainMenu}>
|
|
(<Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent disabled={!o.backButtonEnabled} onPress={o.onBackAndMainMenu}>
|
|
|
- <Icon name="ios-arrow-back" />
|
|
|
|
|
|
|
+ <Icon name="ios-arrow-back" style={styles.headerIcon} />
|
|
|
</Button>)
|
|
</Button>)
|
|
|
|
|
|
|
|
) : (
|
|
) : (
|
|
|
<Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent onPress={o.onMainMenu}>
|
|
<Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent onPress={o.onMainMenu}>
|
|
|
- <Icon name='menu' />
|
|
|
|
|
|
|
+ <Icon name='menu' style={styles.headerIcon} />
|
|
|
</Button>
|
|
</Button>
|
|
|
)
|
|
)
|
|
|
)}
|
|
)}
|
|
@@ -732,7 +719,7 @@ function UnaToolbar(o) {
|
|
|
<Right>
|
|
<Right>
|
|
|
{o.loggedin && (
|
|
{o.loggedin && (
|
|
|
<Button transparent>
|
|
<Button transparent>
|
|
|
- <Icon name='search' onPress={o.onSearchMenu} />
|
|
|
|
|
|
|
+ <Icon name='search' onPress={o.onSearchMenu} style={styles.headerIcon} />
|
|
|
</Button>
|
|
</Button>
|
|
|
)}
|
|
)}
|
|
|
</Right>
|
|
</Right>
|
|
@@ -741,24 +728,23 @@ function UnaToolbar(o) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UnaToolbarSearch(o) {
|
|
function UnaToolbarSearch(o) {
|
|
|
- const styles = useDynamicStyleSheet(dynamicStyles)
|
|
|
|
|
|
|
+ var colorScheme = Appearance.getColorScheme();
|
|
|
return (
|
|
return (
|
|
|
- <Header style={styles.header} searchBar rounded>
|
|
|
|
|
|
|
+ <Header androidStatusBarColor={useTheme('colors.statusBar')} transparent={false} iosBarStyle={useTheme('iosBarStyle')} style={styles.header} searchBar rounded>
|
|
|
<Item>
|
|
<Item>
|
|
|
<Icon name="search" />
|
|
<Icon name="search" />
|
|
|
<Input placeholder="Search" onEndEditing={o.onSearchCancel} onSubmitEditing={o.onSearch} />
|
|
<Input placeholder="Search" onEndEditing={o.onSearchCancel} onSubmitEditing={o.onSearch} />
|
|
|
</Item>
|
|
</Item>
|
|
|
<Button transparent onPress={o.onSearchCancel}>
|
|
<Button transparent onPress={o.onSearchCancel}>
|
|
|
- <Text>Cancel</Text>
|
|
|
|
|
|
|
+ <Text style={styles.headerIcon}>Cancel</Text>
|
|
|
</Button>
|
|
</Button>
|
|
|
</Header>
|
|
</Header>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UnaDrawer(o) {
|
|
function UnaDrawer(o) {
|
|
|
- const styles = useDynamicStyleSheet(dynamicStyles)
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Container>
|
|
|
|
|
|
|
+ <Container style={styles.drawerContainer}>
|
|
|
<Content>
|
|
<Content>
|
|
|
<View style={styles.drawerImageContainer}>
|
|
<View style={styles.drawerImageContainer}>
|
|
|
<Image style={styles.drawerImage} source={require('./img/logo-loading.png')} />
|
|
<Image style={styles.drawerImage} source={require('./img/logo-loading.png')} />
|
|
@@ -780,22 +766,29 @@ function UnaDrawer(o) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const dynamicStyles = new DynamicStyleSheet({
|
|
|
|
|
|
|
+const styles = new StyleSheet.create({
|
|
|
|
|
+ container: {
|
|
|
|
|
+ backgroundColor: useTheme('colors.background'),
|
|
|
|
|
+ flex: 1
|
|
|
|
|
+ },
|
|
|
header: {
|
|
header: {
|
|
|
- backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
|
|
|
|
|
|
|
+ backgroundColor: useTheme('colors.primary'),
|
|
|
height: 46, paddingTop:0, // tmp fix - https://github.com/GeekyAnts/NativeBase/issues/3095
|
|
height: 46, paddingTop:0, // tmp fix - https://github.com/GeekyAnts/NativeBase/issues/3095
|
|
|
},
|
|
},
|
|
|
headerTitle: {
|
|
headerTitle: {
|
|
|
- color: Platform.OS === 'android' ? '#fff' : new DynamicValue('#333', '#ccc'),
|
|
|
|
|
|
|
+ color: useTheme('colors.textOnPrimary'),
|
|
|
|
|
+ },
|
|
|
|
|
+ headerIcon: {
|
|
|
|
|
+ color: useTheme('colors.textOnPrimary'),
|
|
|
},
|
|
},
|
|
|
footer: {
|
|
footer: {
|
|
|
- backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
|
|
|
|
|
|
|
+ backgroundColor: useTheme('colors.primary'),
|
|
|
},
|
|
},
|
|
|
footerTab: {
|
|
footerTab: {
|
|
|
- backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
|
|
|
|
|
|
|
+ backgroundColor: useTheme('colors.primary'),
|
|
|
},
|
|
},
|
|
|
footerIcon: {
|
|
footerIcon: {
|
|
|
- color: Platform.OS === 'android' ? '#fff' : new DynamicValue('#555', '#ccc'),
|
|
|
|
|
|
|
+ color: useTheme('colors.textOnPrimary'),
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
containerVideoCall: {
|
|
containerVideoCall: {
|
|
@@ -812,11 +805,14 @@ const dynamicStyles = new DynamicStyleSheet({
|
|
|
buttonLeftTopIos: {
|
|
buttonLeftTopIos: {
|
|
|
marginLeft: 5,
|
|
marginLeft: 5,
|
|
|
},
|
|
},
|
|
|
|
|
+ drawerContainer: {
|
|
|
|
|
+ backgroundColor: useTheme('colors.drawerBackground'),
|
|
|
|
|
+ },
|
|
|
drawerImageContainer: {
|
|
drawerImageContainer: {
|
|
|
height:100,
|
|
height:100,
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
|
alignItems: 'center',
|
|
alignItems: 'center',
|
|
|
- backgroundColor: '#FFF',
|
|
|
|
|
|
|
+ backgroundColor: useTheme('colors.drawerBackground'),
|
|
|
},
|
|
},
|
|
|
drawerImage: {
|
|
drawerImage: {
|
|
|
height:33.5,
|
|
height:33.5,
|
|
@@ -830,10 +826,9 @@ const dynamicStyles = new DynamicStyleSheet({
|
|
|
fontSize: 20,
|
|
fontSize: 20,
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
|
textAlign: 'center',
|
|
textAlign: 'center',
|
|
|
- color: '#1890ff',
|
|
|
|
|
|
|
+ color: useTheme('colors.drawerText'),
|
|
|
},
|
|
},
|
|
|
drawerButtonText: {
|
|
drawerButtonText: {
|
|
|
- color: '#1890ff',
|
|
|
|
|
|
|
+ color: useTheme('colors.drawerText'),
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|