Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkourlas committed Feb 28, 2021
1 parent 3d55a0a commit 2c35a37
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
## 0.6.17 ##

* Bug fixes

## 0.6.16 ##

* Bug fixes
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/137.txt
@@ -0,0 +1,2 @@
0.6.17
• Bug fixes
4 changes: 2 additions & 2 deletions voipms-sms/build.gradle
Expand Up @@ -9,8 +9,8 @@ android {
applicationId 'net.kourlas.voipms_sms'
minSdkVersion 21
targetSdkVersion 30
versionCode 136
versionName '0.6.16'
versionCode 137
versionName '0.6.17'
}
flavorDimensions 'version', 'demo'
productFlavors {
Expand Down
Expand Up @@ -30,11 +30,11 @@ class SyncBootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
try {
if (context == null || intent == null) {
return
throw Exception("No context or intent provided")
}
if (intent.action != "android.intent.action.BOOT_COMPLETED"
&& intent.action != "android.intent.action.ACTION_LOCKED_BOOT_COMPLETED") {
return
throw Exception("Unrecognized action " + intent.action)
}
SyncIntervalReceiver.setInterval(context)
} catch (e: Exception) {
Expand Down
Expand Up @@ -37,17 +37,13 @@ class SyncIntervalReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
try {
if (context == null || intent == null) {
return
throw Exception("No context or intent provided")
}
if (intent.action != context.getString(
R.string.sync_interval_action)) {
return
throw Exception("Unrecognized action " + intent.action)
}
val forceRecent = intent.extras?.get(
context.getString(
R.string.sync_interval_force_recent)) as Boolean?
?: throw Exception("Force recent missing")
SyncWorker.performSynchronization(context, forceRecent)
SyncWorker.performSynchronization(context)
} catch (e: Exception) {
logException(e)
}
Expand Down
Expand Up @@ -25,7 +25,6 @@ import androidx.work.*
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.squareup.moshi.JsonDataException
import kotlinx.coroutines.CancellationException
import net.kourlas.voipms_sms.R
import net.kourlas.voipms_sms.notifications.Notifications
import net.kourlas.voipms_sms.preferences.getDids
Expand Down Expand Up @@ -114,8 +113,6 @@ class RetrieveDidsWorker(context: Context, params: WorkerParameters) :
enablePushNotifications(applicationContext)
replaceIndex(applicationContext)
}
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
logException(e)
}
Expand Down Expand Up @@ -145,8 +142,6 @@ class RetrieveDidsWorker(context: Context, params: WorkerParameters) :
mapOf("api_username" to getEmail(applicationContext),
"api_password" to getPassword(applicationContext),
"method" to "getDIDsInfo"))
} catch (e: CancellationException) {
throw e
} catch (e: IOException) {
error = applicationContext.getString(
R.string.preferences_dids_error_api_request)
Expand Down
Expand Up @@ -24,7 +24,6 @@ import android.os.Build
import androidx.work.*
import com.squareup.moshi.JsonClass
import com.squareup.moshi.JsonDataException
import kotlinx.coroutines.CancellationException
import net.kourlas.voipms_sms.R
import net.kourlas.voipms_sms.network.NetworkManager
import net.kourlas.voipms_sms.notifications.Notifications
Expand Down Expand Up @@ -175,8 +174,6 @@ class SendMessageWorker(context: Context, params: WorkerParameters) :
setOf(ConversationId(inlineReplyDid, inlineReplyContact)),
inlineReplyMessages = listOf(message))
}
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
logException(e)
error = applicationContext.getString(
Expand Down
Expand Up @@ -143,6 +143,7 @@ class SyncWorker(context: Context, params: WorkerParameters) :
SyncIntervalReceiver.setInterval(applicationContext)
}
} catch (e: CancellationException) {
// We need to propagate the exception from processRequests
throw e
} catch (e: Exception) {
logException(e)
Expand Down
Expand Up @@ -24,7 +24,6 @@ import android.os.Build
import androidx.work.*
import com.squareup.moshi.JsonClass
import com.squareup.moshi.JsonDataException
import kotlinx.coroutines.CancellationException
import net.kourlas.voipms_sms.R
import net.kourlas.voipms_sms.notifications.Notifications
import net.kourlas.voipms_sms.utils.httpPostWithMultipartFormData
Expand Down Expand Up @@ -101,8 +100,6 @@ class VerifyCredentialsWorker(context: Context, params: WorkerParameters) :
if (response != null) {
return verifyResponse(response)
}
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
logException(e)
}
Expand All @@ -126,8 +123,6 @@ class VerifyCredentialsWorker(context: Context, params: WorkerParameters) :
mapOf("api_username" to email,
"api_password" to password,
"method" to "getDIDsInfo"))
} catch (e: CancellationException) {
throw e
} catch (e: IOException) {
error = applicationContext.getString(
R.string.verify_credentials_error_api_request)
Expand Down
1 change: 0 additions & 1 deletion voipms-sms/src/main/res/values/strings.xml
Expand Up @@ -313,7 +313,6 @@

<!-- SyncIntervalReceiver -->
<string name="sync_interval_action" translatable="false">net.kourlas.voipms_sms.SYNC_INTERVAL_ACTION</string>
<string name="sync_interval_force_recent" translatable="false">net.kourlas.voipms_sms.SYNC_INTERVAL_FORCE_RECENT</string>

<!-- Sent message receiver -->
<string name="sent_message_action" translatable="false">net.kourlas.voipms_sms.SENT_MESSAGE_ACTION_%1$s_%2$s</string>
Expand Down
Expand Up @@ -24,7 +24,6 @@ import android.os.Build
import androidx.work.*
import com.squareup.moshi.JsonClass
import com.squareup.moshi.JsonDataException
import kotlinx.coroutines.CancellationException
import net.kourlas.voipms_sms.R
import net.kourlas.voipms_sms.notifications.Notifications
import net.kourlas.voipms_sms.preferences.*
Expand Down Expand Up @@ -63,8 +62,6 @@ class NotificationsRegistrationWorker(context: Context,
val responses = getVoipMsApiCallbackResponses(dids)
callbackFailedDids = parseVoipMsApiCallbackResponses(dids,
responses)
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
logException(e)
}
Expand Down Expand Up @@ -137,8 +134,6 @@ class NotificationsRegistrationWorker(context: Context,
+ "voipmssms-notify?did={TO}"),
"url_callback_retry" to "0")))
responses[did] = didResponses
} catch (e: CancellationException) {
throw e
} catch (e: IOException) {
// Do nothing.
} catch (e: JsonDataException) {
Expand Down
Expand Up @@ -30,7 +30,8 @@ import net.kourlas.voipms_sms.utils.logException
class AppIndexingReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
try {
AppIndexingWorker.performIndexing(context ?: return)
AppIndexingWorker.performIndexing(
context ?: throw Exception("No context provided"))
} catch (e: Exception) {
logException(e)
}
Expand Down

0 comments on commit 2c35a37

Please sign in to comment.