[client] Add receive_sharing_intent, upgrade gradle and ndk

This commit is contained in:
Abhishek Shroff
2025-05-01 10:42:42 +05:30
parent bc40ec1186
commit 702c8ec73d
7 changed files with 70 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ plugins {
android {
namespace = "cloud.phylum.drive"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -40,6 +40,18 @@ android {
}
}
project(':receive_sharing_intent').afterEvaluate {
project(':receive_sharing_intent').android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
}
flutter {
source = "../.."
}

View File

@@ -30,6 +30,18 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip

View File

@@ -18,7 +18,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.0" apply false
id "com.android.application" version "8.9.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
}

View File

@@ -1,8 +1,11 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:phylum/ui/explorer/explorer_actions.dart';
import 'package:phylum/ui/explorer/explorer_gesture_handler.dart';
import 'package:phylum/ui/explorer/path_view.dart';
import 'package:provider/provider.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'explorer_controller.dart';
import 'folder_empty_view.dart';
@@ -19,6 +22,37 @@ class ExplorerView extends StatefulWidget {
class _ExplorerViewState extends State<ExplorerView> {
final _refreshKey = GlobalKey<RefreshIndicatorState>();
late StreamSubscription _intentSub;
@override
void initState() {
super.initState();
// Listen to media sharing coming from outside the app while the app is in the memory.
_intentSub = ReceiveSharingIntent.instance.getMediaStream().listen((value) {
final files = value.map((f) => f.path).toList(growable: false);
print('Received files when in memory');
print(files);
ReceiveSharingIntent.instance.reset();
}, onError: (err) {
print("getIntentDataStream error: $err");
});
// Get the media sharing coming from outside the app while the app is closed.
ReceiveSharingIntent.instance.getInitialMedia().then((value) {
final files = value.map((f) => f.path).toList(growable: false);
print('Received files when closed');
print(files);
ReceiveSharingIntent.instance.reset();
});
}
@override
void dispose() {
_intentSub.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ExplorerActions(

View File

@@ -905,6 +905,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.0"
receive_sharing_intent:
dependency: "direct main"
description:
name: receive_sharing_intent
sha256: ec76056e4d258ad708e76d85591d933678625318e411564dcb9059048ca3a593
url: "https://pub.dev"
source: hosted
version: "1.8.1"
share_plus:
dependency: "direct main"
description:

View File

@@ -31,6 +31,7 @@ dependencies:
permission_handler:
printing:
provider:
receive_sharing_intent:
share_plus:
sqlite3:
state_notifier: