diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version index 599bf812..05e99b26 100644 --- a/LIBCWTCH-GO-MACOS.version +++ b/LIBCWTCH-GO-MACOS.version @@ -1 +1 @@ -2022-12-11-12-38-v1.10.1-2-g1e4221c \ No newline at end of file +2022-12-12-22-59-v1.10.1-3-g3d0a3a5 \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index c5887495..05e99b26 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-12-11-17-40-v1.10.1-2-g1e4221c \ No newline at end of file +2022-12-12-22-59-v1.10.1-3-g3d0a3a5 \ No newline at end of file diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt index ae76d09e..39303751 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt @@ -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 @@ -228,7 +229,7 @@ class MainActivity: FlutterActivity() { var method = call.method // todo change usage patern to match that in FlwtchWorker // Unsafe for anything using int args, causes access time attempt to cast to string which will fail - val argmap: Map = call.arguments as Map + val argmap: Map = call.arguments as Map // the frontend calls Start every time it fires up, but we don't want to *actually* call Cwtch.Start() // in case the ForegroundService is still running. in both cases, however, we *do* want to re-register @@ -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") ?: "" diff --git a/lib/widgets/filebubble.dart b/lib/widgets/filebubble.dart index 323ada54..78781c8f 100644 --- a/lib/widgets/filebubble.dart +++ b/lib/widgets/filebubble.dart @@ -251,7 +251,7 @@ class FileBubbleState extends State { if (Platform.isAndroid) { Provider.of(context, listen: false).downloadInit(widget.fileKey(), (widget.fileSize / 4096).ceil()); Provider.of(context, listen: false).cwtch.SetMessageAttribute(profileOnion, conversation, 0, idx, "file-downloaded", "true"); - ContactInfoState? contact = Provider.of(context).contactList.findContact(Provider.of(context).senderHandle); + ContactInfoState? contact = Provider.of(context, listen: false).contactList.findContact(Provider.of(context, listen: false).senderHandle); if (contact != null) { Provider.of(context, listen: false).cwtch.CreateDownloadableFile(profileOnion, contact.identifier, widget.nameSuggestion, widget.fileKey()); }