mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-05 16:45:08 +00:00
[SMS App] Add support to extract attachments from network packet and send it MMS
## Summary Add support for handling message request packets which have a list of attachments ## Test Plan - Sent message with no attached file from desktop which was sent and received correctly - Sent message with attached file from desktop which was sent and received correctly - Sent message with two attached files which was sent and received correctly
This commit is contained in:
committed by
Simon Redman
parent
88ef4cbca1
commit
10925b9724
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
||||
* SPDX-FileCopyrightText: 2019 Simon Redman <simon@ergotech.com>
|
||||
* SPDX-FileCopyrightText: 2021 Simon Redman <simon@ergotech.com>
|
||||
* SPDX-FileCopyrightText: 2020 Aniket Kumar <anikketkumar786@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
@@ -118,10 +119,7 @@ public class SMSPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Packet sent to request a message be sent
|
||||
* <p>
|
||||
* This will almost certainly need to be replaced or augmented to support MMS,
|
||||
* but be sure the Android side remains compatible with old desktop apps!
|
||||
* <p>
|
||||
*
|
||||
* The body should look like so:
|
||||
* {
|
||||
* "version": 2, // The version of the packet being sent. Compare to SMS_REQUEST_PACKET_VERSION before attempting to handle.
|
||||
@@ -410,8 +408,9 @@ public class SMSPlugin extends Plugin {
|
||||
addressList = new ArrayList<>();
|
||||
addressList.add(new SMSHelper.Address(np.getString("phoneNumber")));
|
||||
}
|
||||
List<SMSHelper.Attachment> attachedFiles = SMSHelper.jsonArrayToAttachmentsList(np.getJSONArray("attachments"));
|
||||
|
||||
SmsMmsUtils.sendMessage(context, textMessage, addressList, (int) subID);
|
||||
SmsMmsUtils.sendMessage(context, textMessage, attachedFiles, addressList, (int) subID);
|
||||
break;
|
||||
|
||||
case TelephonyPlugin.PACKET_TYPE_TELEPHONY_REQUEST:
|
||||
|
Reference in New Issue
Block a user