Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:theme="@style/CustomMaterialTheme">

<provider
android:name=".FileSystem.OurFileProvider"
android:name=".FileSystem.SecrecyDecrpytFileProvider"
android:authorities="com.doplgangr.secrecy.FileSystem.DecryptFileProvider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;

public class OurFileProvider extends ContentProvider {
public class SecrecyDecrpytFileProvider extends ContentProvider {
public static final String
FILE_PROVIDER_AUTHORITY = "com.doplgangr.secrecy.FileSystem.DecryptFileProvider";

Expand Down Expand Up @@ -78,50 +78,6 @@ public static Uri getUriForFile(Context context, String authority, File file) {
return strategy.getUriForFile(file);
}

/**
* @Override public ParcelFileDescriptor openFile(Uri uri, String mode)
* throws FileNotFoundException {
* ParcelFileDescriptor[] pipe=null;
* <p/>
* try {
* pipe=ParcelFileDescriptor.createPipe();
* new TransferThread(CustomApp.context.getContentResolver().openInputStream(uri),
* new ParcelFileDescriptor.AutoCloseOutputStream(pipe[1])).start();
* }
* catch (IOException e) {
* Log.e(getClass().getSimpleName(), "Exception opening pipe", e);
* throw new FileNotFoundException("Could not open pipe for: "
* + uri.toString());
* }
* return(pipe[0]);
* }
* static class TransferThread extends Thread {
* InputStream in;
* OutputStream out;
* <p/>
* TransferThread(InputStream in, OutputStream out) {
* this.in = in;
* this.out = out;
* }
* @Override public void run() {
* byte[] buf = new byte[8192];
* int len;
* <p/>
* try {
* while ((len = in.read(buf)) > 0) {
* out.write(buf, 0, len);
* }
* <p/>
* in.close();
* out.flush();
* out.close();
* } catch (IOException e) {
* Log.e(getClass().getSimpleName(),
* "Exception transferring file", e);
* }
* }
* }
*/
private static PathStrategy getPathStrategy(Context context, String authority) {
PathStrategy strat;
synchronized (sCache) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/doplgangr/secrecy/Views/FileViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import com.doplgangr.secrecy.FileSystem.Encryption.Vault;
import com.doplgangr.secrecy.FileSystem.Files.EncryptedFile;
import com.doplgangr.secrecy.FileSystem.Files.SecrecyFile;
import com.doplgangr.secrecy.FileSystem.OurFileProvider;
import com.doplgangr.secrecy.FileSystem.SecrecyDecrpytFileProvider;
import com.doplgangr.secrecy.FileSystem.Storage;
import com.doplgangr.secrecy.Jobs.AddFileJob;
import com.doplgangr.secrecy.Listeners;
Expand Down Expand Up @@ -75,7 +75,7 @@ void decrypt(EncryptedFile encryptedFile, final Listeners.EmptyListener onFinish
if (tempFile.getParentFile().equals(Storage.getTempFolder())) {
tempFile = new File(Storage.getTempFolder(), tempFile.getName());
}
Uri uri = OurFileProvider.getUriForFile(context, OurFileProvider.FILE_PROVIDER_AUTHORITY, tempFile);
Uri uri = SecrecyDecrpytFileProvider.getUriForFile(context, SecrecyDecrpytFileProvider.FILE_PROVIDER_AUTHORITY, tempFile);
MimeTypeMap myMime = MimeTypeMap.getSingleton();
Intent newIntent = new Intent(android.content.Intent.ACTION_VIEW);
String mimeType = myMime.getMimeTypeFromExtension(encryptedFile.getType());
Expand All @@ -101,7 +101,7 @@ void sendMultiple(ArrayList<FilesListFragment.DecryptArgHolder> args) {
if (tempFile != null) {
if (tempFile.getParentFile().equals(Storage.getTempFolder()))
tempFile = new java.io.File(Storage.getTempFolder(), tempFile.getName());
uris.add(OurFileProvider.getUriForFile(context, OurFileProvider.FILE_PROVIDER_AUTHORITY, tempFile));
uris.add(SecrecyDecrpytFileProvider.getUriForFile(context, SecrecyDecrpytFileProvider.FILE_PROVIDER_AUTHORITY, tempFile));
mimes.add(myMime.getMimeTypeFromExtension(arg.encryptedFile.getType()));

}
Expand Down