Skip to content

Commit 556cc1c

Browse files
author
JulesG10
committed
improved app functionality
1 parent 069204d commit 556cc1c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@
3232
android:exported="true"
3333
android:label="Ajouter dans FlouFlix"
3434
android:icon="@drawable/flouflix_icon">
35+
36+
<intent-filter>
37+
<action android:name="android.intent.action.VIEW" />
38+
<category android:name="android.intent.category.DEFAULT" />
39+
<category android:name="android.intent.category.BROWSABLE" />
40+
41+
<data android:scheme="file" />
42+
<data android:scheme="content" />
43+
<data android:mimeType="*/*" />
44+
<data android:host="*" />
45+
</intent-filter>
46+
3547
<intent-filter>
3648
<action android:name="android.intent.action.PROCESS_TEXT" />
3749
<category android:name="android.intent.category.DEFAULT" />
@@ -76,5 +88,4 @@
7688
<!-- Permissions -->
7789
<uses-permission android:name="android.permission.INTERNET" />
7890
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
79-
<uses-permission android:name="android.permission.READ_HISTORY_BOOKMARKS" />
8091
</manifest>

android/app/src/main/java/com/fouflix/julesg10/FlouFlixActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ private String extractQuery(Intent intent)
4747

4848
private String extractFile(Intent intent) {
4949
Uri file = intent.getParcelableExtra(Intent.EXTRA_STREAM);
50+
if(file == null)
51+
{
52+
file = intent.getData();
53+
}
54+
5055
if (file == null) return null;
5156

5257
StringBuilder fileContent = new StringBuilder();

android/app/src/main/java/com/fouflix/julesg10/FlouFlixPlugin.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,16 @@ protected void handleOnNewIntent(Intent intent) {
6969
String text = intent.getStringExtra("text");
7070
String file = intent.getStringExtra("file");
7171

72-
if(text == null && file == null)
72+
JSObject ret = new JSObject();
73+
if(text != null)
7374
{
74-
return;
75+
ret.put("text", text);
7576
}
7677

77-
JSObject ret = new JSObject();
78-
ret.put("text", text);
79-
ret.put("file", file);
78+
if(file != null)
79+
{
80+
ret.put("file", file);
81+
}
8082

8183
this.notifyListeners(EVENT_SHARE_TEXT_DATA, ret, true);
8284
}

0 commit comments

Comments
 (0)