Skip to content

Commit bda2153

Browse files
authored
Merge pull request #105 from particle-iot/bug/ch60996/update-mobile-apps-to-use-reliable-sim-management
Update mobile apps to use Reliable SIM Management conventions like the console
2 parents 4e41912 + ea2b0b7 commit bda2153

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jdk:
77

88
env:
99
global:
10-
- ANDROID_COMPILE_API_LEVEL=28
11-
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
10+
- ANDROID_COMPILE_API_LEVEL=30
11+
- ANDROID_BUILD_TOOLS_VERSION=29.0.2
1212

1313
android:
1414
components:
@@ -33,6 +33,9 @@ android:
3333
- 'android-sdk-license-.+'
3434
- 'google-gdk-license-.+'
3535

36+
before_install:
37+
- yes | sdkmanager "platforms;android-30"
38+
- yes | sdkmanager "build-tools;29.0.2"
3639

3740
script:
3841
- ./gradlew :cloudsdk:assembleDebug :cloudsdk:testDebugUnitTest :cloudsdk:jacocoTestReport

mesh/src/main/java/io/particle/mesh/setup/flow/Errors.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ class StickerErrorException(cause: Throwable? = null) : MeshSetupFlowException(
194194

195195
class FailedToActivateSimException(severity: ExceptionType, cause: Throwable? = null) : MeshSetupFlowException(
196196
cause,
197-
userFacingMessage = "SIM activation is taking longer than expected. Please retry your SIM activation. If you have retried multiple times, please contact support.",
197+
userFacingMessage = "SIM activation is ongoing and taking a long time to finish. Wait for it to complete and try again.",
198198
severity = severity
199199
)
200200

201201

202202
class FailedToDeactivateSimException : MeshSetupFlowException(
203-
userFacingMessage = "SIM deactivation is taking longer than expected. Please retry your SIM deactivation. If you have retried multiple times, please contact support.",
203+
userFacingMessage = "SIM deactivation is ongoing and taking a long time to finish. Wait for it to complete and try again.",
204204
severity = ERROR_FATAL
205205
)
206206

mesh/src/main/java/io/particle/mesh/setup/flow/setupsteps/StepEnsureSimActivated.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import io.particle.mesh.setup.flow.FailedToActivateSimException
77
import io.particle.mesh.setup.flow.MeshSetupStep
88
import io.particle.mesh.setup.flow.Scopes
99
import io.particle.mesh.setup.flow.context.SetupContexts
10+
import io.particle.mesh.setup.flow.retrySimAction
1011

1112
class StepEnsureSimActivated(private val cloud: ParticleCloud) : MeshSetupStep() {
1213

@@ -15,27 +16,17 @@ class StepEnsureSimActivated(private val cloud: ParticleCloud) : MeshSetupStep()
1516
return
1617
}
1718

18-
for (i in 0..2) {
19-
20-
val statusCode = doActivateSim(ctxs)
21-
if (statusCode == 200) {
22-
ctxs.targetDevice.updateIsSimActivated(true)
23-
return
24-
25-
} else if (statusCode == 504) {
26-
continue
27-
28-
} else {
29-
throw FailedToActivateSimException(ERROR_RECOVERABLE)
30-
}
19+
retrySimAction {
20+
doActivateSim(ctxs)
3121
}
32-
33-
throw FailedToActivateSimException(ERROR_FATAL)
3422
}
3523

3624
private fun doActivateSim(ctxs: SetupContexts): Int {
3725
val response = cloud.activateSim(ctxs.targetDevice.iccid!!)
3826
return response.status
3927
}
4028

29+
override fun wrapException(cause: Exception): Exception {
30+
return FailedToActivateSimException(ERROR_FATAL, cause)
31+
}
4132
}

0 commit comments

Comments
 (0)