app head: channel creator page
This commit is contained in:
parent
d76cf4457e
commit
5f30cca79b
5 changed files with 71 additions and 5 deletions
2
app
2
app
|
@ -1 +1 @@
|
||||||
Subproject commit e74a419ffd5b0a078a9f30da2dd8442556188392
|
Subproject commit 44856e1ba16dd621e521c30263176692f73b8453
|
|
@ -106,7 +106,6 @@ subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':@react-native-community_async-storage')
|
compile project(':@react-native-community_async-storage')
|
||||||
compile project(':react-native-camera')
|
compile project(':react-native-camera')
|
||||||
compile project(':react-native-document-picker')
|
|
||||||
compile project(':react-native-exception-handler')
|
compile project(':react-native-exception-handler')
|
||||||
compile project(':react-native-fast-image')
|
compile project(':react-native-fast-image')
|
||||||
compile project(':react-native-fs')
|
compile project(':react-native-fs')
|
||||||
|
|
|
@ -106,7 +106,6 @@ subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':@react-native-community_async-storage')
|
compile project(':@react-native-community_async-storage')
|
||||||
compile project(':react-native-camera')
|
compile project(':react-native-camera')
|
||||||
compile project(':react-native-document-picker')
|
|
||||||
compile project(':react-native-exception-handler')
|
compile project(':react-native-exception-handler')
|
||||||
compile project(':react-native-fast-image')
|
compile project(':react-native-fast-image')
|
||||||
compile project(':react-native-fs')
|
compile project(':react-native-fs')
|
||||||
|
|
|
@ -11,8 +11,10 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.Cursor;
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.app.NotificationManagerCompat;
|
import android.support.v4.app.NotificationManagerCompat;
|
||||||
|
@ -37,7 +39,6 @@ import com.facebook.react.modules.core.PermissionListener;
|
||||||
import com.facebook.react.shell.MainReactPackage;
|
import com.facebook.react.shell.MainReactPackage;
|
||||||
import com.facebook.react.ReactRootView;
|
import com.facebook.react.ReactRootView;
|
||||||
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
|
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
|
||||||
import io.github.elyx0.reactnativedocumentpicker.DocumentPickerPackage;
|
|
||||||
import com.rnfs.RNFSPackage;
|
import com.rnfs.RNFSPackage;
|
||||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
||||||
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
|
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
|
||||||
|
@ -47,8 +48,10 @@ import com.RNFetchBlob.RNFetchBlobPackage;
|
||||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||||
import io.lbry.browser.reactmodules.BackgroundMediaModule;
|
import io.lbry.browser.reactmodules.BackgroundMediaModule;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -74,6 +77,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
|
|
||||||
private static final int RECEIVE_SMS_PERMISSION_REQ_CODE = 203;
|
private static final int RECEIVE_SMS_PERMISSION_REQ_CODE = 203;
|
||||||
|
|
||||||
|
public static final int DOCUMENT_PICKER_RESULT_CODE = 301;
|
||||||
|
|
||||||
private BroadcastReceiver notificationsReceiver;
|
private BroadcastReceiver notificationsReceiver;
|
||||||
|
|
||||||
private BroadcastReceiver smsReceiver;
|
private BroadcastReceiver smsReceiver;
|
||||||
|
@ -148,7 +153,6 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
.addPackage(new MainReactPackage())
|
.addPackage(new MainReactPackage())
|
||||||
.addPackage(new AsyncStoragePackage())
|
.addPackage(new AsyncStoragePackage())
|
||||||
.addPackage(new FastImageViewPackage())
|
.addPackage(new FastImageViewPackage())
|
||||||
.addPackage(new DocumentPickerPackage())
|
|
||||||
.addPackage(new ReactVideoPackage())
|
.addPackage(new ReactVideoPackage())
|
||||||
.addPackage(new ReanimatedPackage())
|
.addPackage(new ReanimatedPackage())
|
||||||
.addPackage(new RNCameraPackage())
|
.addPackage(new RNCameraPackage())
|
||||||
|
@ -290,6 +294,33 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
registerReceiver(smsReceiver, smsFilter);
|
registerReceiver(smsReceiver, smsFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUriPath(Context context, Uri uri) throws URISyntaxException {
|
||||||
|
if ("content".equalsIgnoreCase(uri.getScheme())) {
|
||||||
|
String[] projection = { MediaStore.MediaColumns.DATA };
|
||||||
|
Cursor cursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||||
|
int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
|
||||||
|
if (cursor.moveToFirst()) {
|
||||||
|
return cursor.getString(index);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// pass
|
||||||
|
android.util.Log.e("ReactNativeJS", e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ("file".equalsIgnoreCase(uri.getScheme())) {
|
||||||
|
return uri.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
|
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
|
||||||
|
@ -299,6 +330,32 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestCode == DOCUMENT_PICKER_RESULT_CODE) {
|
||||||
|
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||||
|
if (reactContext != null) {
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
Uri fileUri = data.getData();
|
||||||
|
try {
|
||||||
|
String filePath = getUriPath(this, fileUri);
|
||||||
|
android.util.Log.d("ReactNativeJS", "fileUri=" + filePath);
|
||||||
|
|
||||||
|
WritableMap params = Arguments.createMap();
|
||||||
|
params.putString("path", filePath);
|
||||||
|
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||||
|
.emit("onDocumentPickerFilePicked", params);
|
||||||
|
} catch (URISyntaxException ex) {
|
||||||
|
// failed to get a file path
|
||||||
|
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||||
|
.emit("onDocumentPickerCanceled", null);
|
||||||
|
}
|
||||||
|
} else if (resultCode == RESULT_CANCELED) {
|
||||||
|
// user canceled or request failed
|
||||||
|
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||||
|
.emit("onDocumentPickerCanceled", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Activity getActivity() {
|
public static Activity getActivity() {
|
||||||
|
|
|
@ -354,4 +354,15 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void openDocumentPicker(String type) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
|
intent.setType(type);
|
||||||
|
Activity activity = MainActivity.getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.startActivityForResult(
|
||||||
|
Intent.createChooser(intent, "Select a file"), MainActivity.DOCUMENT_PICKER_RESULT_CODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue