Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Qksms existing send functionality #10

Merged
merged 4 commits into from
Dec 16, 2021

Conversation

timbze
Copy link
Contributor

@timbze timbze commented Dec 15, 2021

Fixes #7
Fixes #9

This changes Traccar sms sending so that it uses Qksms functionality. That way sent message is saved and message is split if needed

This would also make #5 and #8 irrelevant. I believe this is a better approach

@tananaev

@timbze timbze changed the title Use Qksms send funtionality Use Qksms send functionality Dec 15, 2021
@timbze timbze changed the title Use Qksms send functionality Use Qksms existing send functionality Dec 15, 2021
@tananaev
Copy link
Member

Is it possible to make saving messages configurable?

@timbze
Copy link
Contributor Author

timbze commented Dec 16, 2021

Is it possible to make saving messages configurable?

Yes, I have pushed another commit to do that now. It will not save by default, but you can (optionally) send "saveMessage":true in API in addition to to and message and the message will save

@timbze
Copy link
Contributor Author

timbze commented Dec 16, 2021

It would of course also be possible through a app setting, but would be a bit more work than how I did it now

Comment on lines 59 to 61
"to" -> phone = reader.nextString()
"message" -> message = reader.nextString()
"saveMessage" -> saveMessage = reader.nextBoolean()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align formatting here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -299,8 +299,10 @@ class MessageRepositoryImpl @Inject constructor(
addresses: List<String>,
body: String,
attachments: List<Attachment>,
delay: Int
delay: Int,
saveSentMessage: Boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to avoid so many API changes? This might cause merge conflicts in the future as we merge upstream QKSMS. Maybe we can pass information in some other way? Like maybe pass a special value in addresses or attachments to indicate if message should or should not be saved? It's a bit hacky, but would save time later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible, probably. Feasible, not in my opinion. This place in code is only used a few times. I think if I make changes in multiple methods with the addresses or attachments variable there would be just as much chance for conflicts as it is now, and would be more prone to have other negative side effects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, how about moving the new parameter to the top of the methods. That way chance of conflict is lower. And also cleaner diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did one now, but the one for SendMessage.kt Params has more usages where I have to go change them all, so I'm not sure changing that one is a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. OK, I think we are good to merge. Thank you for the pull request and fixing my comments.

@@ -40,7 +40,8 @@ class SendMessage @Inject constructor(
val addresses: List<String>,
val body: String,
val attachments: List<Attachment> = listOf(),
val delay: Int = 0
val delay: Int = 0,
val saveSentMessage: Boolean = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to the top as well.

@tananaev tananaev merged commit 39a00e3 into traccar:master Dec 16, 2021
@timbze timbze deleted the use_app_sms_send branch December 16, 2021 19:34
@gaeldb
Copy link

gaeldb commented Jan 7, 2022

Thnak you for the PR and merge guys!
Could you please generate release and post APK?
Thanks!

@gaeldb gaeldb mentioned this pull request Jan 24, 2022
@gregjotau gregjotau mentioned this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sent messages are not saved [BUG] Long Messages Are Not Being Sent
3 participants