implement direct URI navigation #134
6 changed files with 30 additions and 59 deletions
|
@ -1,7 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import FeaturedCategory from './view';
|
|
||||||
|
|
||||||
const select = state => ({});
|
|
||||||
const perform = dispatch => ({});
|
|
||||||
|
|
||||||
export default connect(select, perform)(FeaturedCategory);
|
|
|
@ -1,27 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { Text, View } from 'react-native';
|
|
||||||
import { normalizeURI } from 'lbry-redux';
|
|
||||||
import FileItem from '../fileItem';
|
|
||||||
import discoverStyle from '../../styles/discover';
|
|
||||||
|
|
||||||
class FeaturedCategory extends React.PureComponent {
|
|
||||||
render() {
|
|
||||||
const { category, names, categoryLink, navigation } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<Text style={discoverStyle.categoryName}>{category}</Text>
|
|
||||||
{names &&
|
|
||||||
names.map(name => (
|
|
||||||
<FileItem
|
|
||||||
style={discoverStyle.fileItem}
|
|
||||||
key={name}
|
|
||||||
uri={normalizeURI(name)}
|
|
||||||
navigation={navigation} />
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default FeaturedCategory;
|
|
|
@ -1,15 +1,16 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FeaturedCategory from '../../component/featuredCategory';
|
|
||||||
import NavigationActions from 'react-navigation';
|
import NavigationActions from 'react-navigation';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
AsyncStorage,
|
AsyncStorage,
|
||||||
NativeModules,
|
NativeModules,
|
||||||
ScrollView,
|
SectionList,
|
||||||
Text,
|
Text,
|
||||||
View
|
View
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
import { normalizeURI } from 'lbry-redux';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import FileItem from '../../component/fileItem';
|
||||||
import discoverStyle from '../../styles/discover';
|
import discoverStyle from '../../styles/discover';
|
||||||
import Colors from '../../styles/colors';
|
import Colors from '../../styles/colors';
|
||||||
import UriBar from '../../component/uriBar';
|
import UriBar from '../../component/uriBar';
|
||||||
|
@ -56,22 +57,21 @@ class DiscoverPage extends React.PureComponent {
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{hasContent &&
|
{hasContent &&
|
||||||
<ScrollView style={discoverStyle.scrollContainer}>
|
<SectionList style={discoverStyle.scrollContainer}
|
||||||
{hasContent &&
|
renderItem={ ({item, index, section}) => (
|
||||||
Object.keys(featuredUris).map(
|
<FileItem
|
||||||
category =>
|
style={discoverStyle.fileItem}
|
||||||
featuredUris[category].length ? (
|
key={item}
|
||||||
<FeaturedCategory
|
uri={normalizeURI(item)}
|
||||||
key={category}
|
navigation={navigation} />
|
||||||
category={category}
|
)
|
||||||
names={featuredUris[category]}
|
}
|
||||||
navigation={navigation}
|
renderSectionHeader={
|
||||||
/>
|
({section: {title}}) => (<Text style={discoverStyle.categoryName}>{title}</Text>)
|
||||||
) : (
|
}
|
||||||
''
|
sections={Object.keys(featuredUris).map(category => ({ title: category, data: featuredUris[category] }))}
|
||||||
)
|
keyExtractor={(item, index) => item}
|
||||||
)}
|
/>
|
||||||
</ScrollView>
|
|
||||||
}
|
}
|
||||||
<UriBar navigation={navigation} />
|
<UriBar navigation={navigation} />
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -16,7 +16,10 @@ class SettingsPage extends React.PureComponent {
|
||||||
showNsfw,
|
showNsfw,
|
||||||
setClientSetting
|
setClientSetting
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
// If no true / false value set, default to true
|
||||||
|
const actualKeepDaemonRunning = (keepDaemonRunning === undefined || keepDaemonRunning === null) ? true : keepDaemonRunning;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<PageHeader title={"Settings"}
|
<PageHeader title={"Settings"}
|
||||||
|
@ -47,7 +50,7 @@ class SettingsPage extends React.PureComponent {
|
||||||
<Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text>
|
<Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={settingsStyle.switchContainer}>
|
<View style={settingsStyle.switchContainer}>
|
||||||
<Switch value={keepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
<Switch value={actualKeepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
// Should we show an explanation?
|
// Should we show an explanation?
|
||||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
"LBRY requires access to your device storage to be able to download files and media.", Toast.LENGTH_SHORT).show();
|
"LBRY requires access to your device storage to be able to download files and media.", Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(this,
|
ActivityCompat.requestPermissions(this,
|
||||||
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, STORAGE_PERMISSION_REQ_CODE);
|
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, STORAGE_PERMISSION_REQ_CODE);
|
||||||
|
@ -100,7 +100,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case STORAGE_PERMISSION_REQ_CODE:
|
case STORAGE_PERMISSION_REQ_CODE:
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
if (!Settings.canDrawOverlays(this)) {
|
if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) {
|
||||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||||
Uri.parse("package:" + getPackageName()));
|
Uri.parse("package:" + getPackageName()));
|
||||||
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
||||||
|
|
|
@ -9,6 +9,8 @@ import com.facebook.react.bridge.ReadableMap;
|
||||||
|
|
||||||
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
||||||
|
|
||||||
|
import io.lbry.browser.BuildConfig;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -16,9 +18,9 @@ import org.json.JSONException;
|
||||||
|
|
||||||
public class MixpanelModule extends ReactContextBaseJavaModule {
|
public class MixpanelModule extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
// TODO: Detect dev / debug and release mode and update value accordingly
|
private static final String MIXPANEL_TOKEN = BuildConfig.DEBUG ?
|
||||||
private static final String MIXPANEL_TOKEN = "93b81fb957cb0ddcd3198c10853a6a95"; // Production
|
"bc1630b8be64c5dfaa4700b3a62969f3" /* Dev Testing */ :
|
||||||
//private static final String MIXPANEL_TOKEN = "bc1630b8be64c5dfaa4700b3a62969f3"; // Dev Testing
|
"93b81fb957cb0ddcd3198c10853a6a95"; /* Production */
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue