Skip to content

Commit

Permalink
Last minute bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkourlas committed Feb 27, 2021
1 parent 161e978 commit 3d55a0a
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.16 ##

* Bug fixes

## 0.6.15 ##

* Bug fixes
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/136.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.6.16
• Bug fixes
4 changes: 2 additions & 2 deletions voipms-sms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId 'net.kourlas.voipms_sms'
minSdkVersion 21
targetSdkVersion 30
versionCode 135
versionName '0.6.15'
versionCode 136
versionName '0.6.16'
}
flavorDimensions 'version', 'demo'
productFlavors {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ open class ConversationActivity(val bubble: Boolean = false) :
R.id.coordinator_layout,
resources.getQuantityString(
R.plurals.conversation_message_deleted,
messages.size,
messages.size),
getString(R.string.undo),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,13 @@ open class ConversationsActivity(val archived: Boolean = false) :

// Perform initial setup as well as account and DID check
performAccountDidCheck()
performInitialSetup()
val firstSyncRequired = performInitialSetup()

// Refresh and perform limited synchronization
adapter.refresh()
SyncWorker.performSynchronization(this, forceRecent = true)
// Refresh and perform limited synchronization\
if (!firstSyncRequired) {
adapter.refresh()
SyncWorker.performSynchronization(this, forceRecent = true)
}

// Refresh on resume just in case the contacts permission was newly
// granted and we need to add the contact names and photos
Expand Down Expand Up @@ -389,15 +391,20 @@ open class ConversationsActivity(val archived: Boolean = false) :
/**
* Performs initial setup following sign-in or upgrade.
*/
private fun performInitialSetup() {
private fun performInitialSetup(): Boolean {
// After the user configures an account, do an initial synchronization
// with the SwipeRefreshLayout refresh icon
val firstSyncRequired = getFirstSyncAfterSignIn(this)
if (getFirstSyncAfterSignIn(this)) {
val swipeRefreshLayout = findViewById<SwipeRefreshLayout>(
R.id.swipe_refresh_layout)
swipeRefreshLayout.isRefreshing = true
SyncWorker.performSynchronization(this, forceRecent = false)

val emptyTextView = findViewById<TextView>(
R.id.empty_text)
emptyTextView.text = getString(R.string.conversations_first_sync)

val format = SimpleDateFormat("MMM d, yyyy",
Locale.getDefault())
val date = format.format(getStartDate(this))
Expand All @@ -421,6 +428,8 @@ open class ConversationsActivity(val archived: Boolean = false) :
enablePushNotifications(this.applicationContext,
activityToShowError = this)
}

return firstSyncRequired
}

/**
Expand Down Expand Up @@ -835,6 +844,7 @@ open class ConversationsActivity(val archived: Boolean = false) :
R.id.coordinator_layout,
resources.getQuantityString(
R.plurals.conversations_archived,
messages.size,
messages.size),
getString(R.string.undo),
{
Expand Down Expand Up @@ -879,6 +889,7 @@ open class ConversationsActivity(val archived: Boolean = false) :
R.id.coordinator_layout,
resources.getQuantityString(
R.plurals.conversations_unarchived,
messages.size,
messages.size),
getString(R.string.undo),
{
Expand Down Expand Up @@ -941,6 +952,7 @@ open class ConversationsActivity(val archived: Boolean = false) :
this@ConversationsActivity,
R.id.coordinator_layout,
resources.getQuantityString(R.plurals.conversations_deleted,
messages.size,
messages.size),
getString(R.string.undo),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.squareup.moshi.JsonDataException
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import net.kourlas.voipms_sms.R
import net.kourlas.voipms_sms.notifications.Notifications
import net.kourlas.voipms_sms.preferences.getDids
Expand Down Expand Up @@ -115,9 +112,7 @@ class RetrieveDidsWorker(context: Context, params: WorkerParameters) :
setDids(applicationContext,
getDids(applicationContext).plus(dids))
enablePushNotifications(applicationContext)
GlobalScope.launch(Dispatchers.Default) {
replaceIndex(applicationContext)
}
replaceIndex(applicationContext)
}
} catch (e: CancellationException) {
throw e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class VerifyCredentialsWorker(context: Context, params: WorkerParameters) :
*/
fun verifyCredentials(context: Context, email: String,
password: String) {
val work = OneTimeWorkRequestBuilder<RetrieveDidsWorker>()
val work = OneTimeWorkRequestBuilder<VerifyCredentialsWorker>()
.setInputData(
workDataOf(
context.getString(
Expand Down
1 change: 1 addition & 0 deletions voipms-sms/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
<string name="conversations_message_you">You:</string>
<string name="conversations_no_account">No account configured</string>
<string name="conversations_no_dids">You have no configured phone numbers.</string>
<string name="conversations_first_sync">Please wait for the first synchronization to complete…</string>
<string name="conversations_no_messages">You have no messages associated with the selected phone number.</string>
<string name="conversations_no_results">No results found for \'%1$s\'</string>
<string name="conversations_perm_denied_contacts">Contacts permission required to view names and photos</string>
Expand Down

0 comments on commit 3d55a0a

Please sign in to comment.