Implement session-based account registration API.

This commit is contained in:
Nicholas
2023-02-21 16:04:23 -05:00
committed by Greyson Parrelli
parent 3de17fa2d0
commit a47e3900c1
40 changed files with 1215 additions and 418 deletions

View File

@@ -0,0 +1,28 @@
package org.thoughtcrime.securesms.util.dualsim
import android.content.Context
import android.content.pm.PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS
import android.telephony.TelephonyManager
import androidx.core.content.ContextCompat
/**
* The mobile country code consists of three decimal digits and the mobile network code consists of two or three decimal digits.
*/
class MccMncProducer(context: Context) {
var mcc: String? = null
private set
var mnc: String? = null
private set
init {
if (context.packageManager.hasSystemFeature(FEATURE_TELEPHONY_RADIO_ACCESS)) {
val tel = ContextCompat.getSystemService(context, TelephonyManager::class.java)
val networkOperator = tel?.networkOperator
if (networkOperator?.isNotBlank() == true && networkOperator.length >= 5) {
mcc = networkOperator.substring(0, 3)
mnc = networkOperator.substring(3)
}
}
}
}