Merge pull request 'Fix Android File Sharing' (#600) from newjson into trunk
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #600
This commit is contained in:
commit
abec0f3ad5
|
@ -1 +1 @@
|
|||
2022-12-11-12-38-v1.10.1-2-g1e4221c
|
||||
2022-12-12-22-59-v1.10.1-3-g3d0a3a5
|
|
@ -1 +1 @@
|
|||
2022-12-11-17-40-v1.10.1-2-g1e4221c
|
||||
2022-12-12-22-59-v1.10.1-3-g3d0a3a5
|
|
@ -68,7 +68,7 @@ class MainActivity: FlutterActivity() {
|
|||
private val PROFILE_EXPORT_REQUEST_CODE = 236
|
||||
private val REQUEST_DOZE_WHITELISTING_CODE:Int = 9
|
||||
private var dlToProfile = ""
|
||||
private var dlToHandle = ""
|
||||
private var dlToHandle = 0
|
||||
private var dlToFileKey = ""
|
||||
private var exportFromPath = ""
|
||||
|
||||
|
@ -128,9 +128,10 @@ class MainActivity: FlutterActivity() {
|
|||
if (requestCode == FILEPICKER_REQUEST_CODE) {
|
||||
val filePath = intent!!.getData().toString();
|
||||
val manifestPath = StringBuilder().append(this.applicationContext.cacheDir).append("/").append(this.dlToFileKey).toString();
|
||||
Log.d("MainActivity:FILEPICKER_REQUEST_CODE", "DownloadableFileCreated");
|
||||
handleCwtch(MethodCall("DownloadFile", mapOf(
|
||||
"ProfileOnion" to this.dlToProfile,
|
||||
"handle" to this.dlToHandle,
|
||||
"conversation" to this.dlToHandle.toInt(),
|
||||
"filepath" to filePath,
|
||||
"manifestpath" to manifestPath,
|
||||
"filekey" to this.dlToFileKey
|
||||
|
@ -255,7 +256,7 @@ class MainActivity: FlutterActivity() {
|
|||
}
|
||||
"CreateDownloadableFile" -> {
|
||||
this.dlToProfile = argmap["ProfileOnion"] ?: ""
|
||||
this.dlToHandle = argmap["handle"] ?: ""
|
||||
this.dlToHandle = call.argument("conversation")!!
|
||||
val suggestedName = argmap["filename"] ?: "filename.ext"
|
||||
this.dlToFileKey = argmap["filekey"] ?: ""
|
||||
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
||||
|
@ -427,6 +428,7 @@ class MainActivity: FlutterActivity() {
|
|||
}
|
||||
|
||||
"DownloadFile" -> {
|
||||
Log.d("MainActivity.kt", "Cwtch Download File Called...")
|
||||
val profile: String = call.argument("ProfileOnion") ?: ""
|
||||
val conversation: Int = call.argument("conversation") ?: 0
|
||||
val filepath: String = call.argument("filepath") ?: ""
|
||||
|
|
|
@ -251,7 +251,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
if (Platform.isAndroid) {
|
||||
Provider.of<ProfileInfoState>(context, listen: false).downloadInit(widget.fileKey(), (widget.fileSize / 4096).ceil());
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetMessageAttribute(profileOnion, conversation, 0, idx, "file-downloaded", "true");
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle);
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context, listen: false).contactList.findContact(Provider.of<MessageMetadata>(context, listen: false).senderHandle);
|
||||
if (contact != null) {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateDownloadableFile(profileOnion, contact.identifier, widget.nameSuggestion, widget.fileKey());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue