From f8af04ba4b20162d714501acdcf59dcb829f9f41 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 24 Jul 2018 14:37:31 +0100 Subject: [PATCH 1/3] prevent an error upon pressing the back button on the splash screen --- app/src/component/AppNavigator.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/component/AppNavigator.js b/app/src/component/AppNavigator.js index 91a4f0a1..18f3ef05 100644 --- a/app/src/component/AppNavigator.js +++ b/app/src/component/AppNavigator.js @@ -128,12 +128,14 @@ class AppWithNavigationState extends React.Component { const { dispatch, nav } = this.props; // There should be a better way to check this if (nav.routes.length > 0) { - const subRoutes = nav.routes[0].routes[0].routes; - const lastRoute = subRoutes[subRoutes.length - 1]; - if (nav.routes[0].routes[0].index > 0 && - ['About', 'Settings'].indexOf(lastRoute.key) > -1) { - dispatch(NavigationActions.back()); - return true; + if (nav.routes[0].routes && nav.routes[0].routes.length > 0) { + const subRoutes = nav.routes[0].routes[0].routes; + const lastRoute = subRoutes[subRoutes.length - 1]; + if (nav.routes[0].routes[0].index > 0 && + ['About', 'Settings'].indexOf(lastRoute.key) > -1) { + dispatch(NavigationActions.back()); + return true; + } } if (nav.routes[0].routeName === 'Main') { if (nav.routes[0].routes[0].routes[0].index > 0) { -- 2.45.3 From bfefc53040d53c56d2f3b7c9a0f30d788cbca58e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 29 Jul 2018 09:12:45 +0100 Subject: [PATCH 2/3] hide navigation bar in fullscreen playback mode --- app/src/page/file/view.js | 14 ++++- .../browser/reactmodules/UtilityModule.java | 59 +++++++++++++------ 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/app/src/page/file/view.js b/app/src/page/file/view.js index 55098e0b..126c8c79 100644 --- a/app/src/page/file/view.js +++ b/app/src/page/file/view.js @@ -99,9 +99,17 @@ class FilePage extends React.PureComponent { if (mode) { // fullscreen, so change orientation to landscape mode NativeModules.ScreenOrientation.lockOrientationLandscape(); + if (NativeModules.UtilityModule) { + // hide the navigation bar (on devices that use have soft navigation bar) + NativeModules.UtilityModule.hideNavigationBar(); + } } else { // Switch back to portrait mode when the media is not fullscreen NativeModules.ScreenOrientation.lockOrientationPortrait(); + if (NativeModules.UtilityModule) { + // hide the navigation bar (on devices that use have soft navigation bar) + NativeModules.UtilityModule.showNavigationBar(); + } } } } @@ -138,9 +146,11 @@ class FilePage extends React.PureComponent { StatusBar.setHidden(false); if (NativeModules.ScreenOrientation) { NativeModules.ScreenOrientation.unlockOrientation(); - } + } if (NativeModules.UtilityModule) { - NativeModules.UtilityModule.keepAwakeOff(); + const utility = NativeModules.UtilityModule; + utility.keepAwakeOff(); + utility.showNavigationBar(); } } diff --git a/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java b/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java index 083d8c87..e3804aa2 100644 --- a/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java +++ b/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java @@ -2,6 +2,7 @@ package io.lbry.browser.reactmodules; import android.app.Activity; import android.content.Context; +import android.view.View; import android.view.WindowManager; import com.facebook.react.bridge.ReactApplicationContext; @@ -23,29 +24,51 @@ public class UtilityModule extends ReactContextBaseJavaModule { @ReactMethod public void keepAwakeOn() { - final Activity activity = getCurrentActivity(); + final Activity activity = getCurrentActivity(); - if (activity != null) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } - }); - } + if (activity != null) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }); + } } @ReactMethod public void keepAwakeOff() { - final Activity activity = getCurrentActivity(); + final Activity activity = getCurrentActivity(); - if (activity != null) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } - }); - } + if (activity != null) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }); + } + } + + @ReactMethod + public void hideNavigationBar() { + if (context != null && context instanceof Activity) { + Activity activity = (Activity) context; + View decorView = activity.getWindow().getDecorView(); + decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_IMMERSIVE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + } + } + + @ReactMethod + public void showNavigationBar() { + if (context != null && context instanceof Activity) { + Activity activity = (Activity) context; + View decorView = activity.getWindow().getDecorView(); + decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_VISIBLE); + } } } -- 2.45.3 From ad38a090525603a5d0023b184158e02434acda42 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 31 Jul 2018 15:45:33 +0100 Subject: [PATCH 3/3] added Discord and social media links to the About page --- app/src/page/about/view.js | 27 +++++++++++++++++++-------- app/src/styles/about.js | 9 ++++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/src/page/about/view.js b/app/src/page/about/view.js index 0f33a9c0..29edd73c 100644 --- a/app/src/page/about/view.js +++ b/app/src/page/about/view.js @@ -11,11 +11,11 @@ class AboutPage extends React.PureComponent { lbryId: null, versionInfo: null }; - + componentDidMount() { if (NativeModules.VersionInfo) { NativeModules.VersionInfo.getAppVersion().then(version => { - this.setState({appVersion: version}); + this.setState({appVersion: version}); }); } Lbry.version().then(info => { @@ -29,11 +29,11 @@ class AboutPage extends React.PureComponent { }); }); } - + render() { const loading = 'Loading...'; const ver = this.state.versionInfo ? this.state.versionInfo : null; - + return ( + Get Social + + You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit. + + + + + + + + Release information App version {this.state.appVersion} - + Daemon (lbrynet) {ver ? ver.lbrynet_version : loading } - + Wallet (lbryum) {ver ? ver.lbryum_version : loading } - + Platform {ver ? ver.platform : loading } - + Installation ID diff --git a/app/src/styles/about.js b/app/src/styles/about.js index 58d7265f..d9697294 100644 --- a/app/src/styles/about.js +++ b/app/src/styles/about.js @@ -33,7 +33,7 @@ const aboutStyle = StyleSheet.create({ links: { marginLeft: 12, marginRight: 12, - marginBottom: 12 + marginBottom: 18 }, link: { color: Colors.LbryGreen, @@ -44,6 +44,13 @@ const aboutStyle = StyleSheet.create({ col: { alignSelf: 'stretch' }, + socialTitle: { + fontFamily: 'Metropolis-Regular', + marginLeft: 12, + marginRight: 12, + marginBottom: 8, + fontSize: 20 + }, releaseInfoTitle: { fontFamily: 'Metropolis-Regular', marginLeft: 12, -- 2.45.3