Skip to content

Commit

Permalink
2.1.4 version
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdamiano committed Apr 20, 2018
1 parent db08088 commit 5c0760d
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 31 deletions.
13 changes: 7 additions & 6 deletions mainActivity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
applicationId 'com.sierrawireless.avphone'
minSdkVersion 22
targetSdkVersion 27
versionName '2.1.2'
versionName '2.1.4'
}

buildTypes {
Expand All @@ -44,22 +44,23 @@ android {
}

dependencies {
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
implementation 'com.baoyz.swipemenulistview:library:1.3.0'
implementation files('libs/okhttp-1.2.1-jar-with-dependencies.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.0.1@aar') {
transitive = true
}
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.anko:anko-common:$anko_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.2.21"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.2.31"

}

crashlytics {
Expand Down
2 changes: 1 addition & 1 deletion mainActivity/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sierrawireless.avphone"
android:versionCode="50">
android:versionCode="52">

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ open class RunFragment : AvPhoneFragment(), MonitorServiceListener, CustomLabels
val listObject = ArrayList<HashMap<String, String>>()

objectsManager = ObjectsManager.getInstance()
val obj = objectsManager.getObjectByName(objectName!!)
val obj = objectsManager.getObjectByName(objectName!!) ?: return
var temp: HashMap<String, String>
for (data in obj!!.datas) {
for (data in obj.datas) {
temp = HashMap()
temp[Tools.NAME] = data.name
if (data.mode != AvPhoneObjectData.Mode.None) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import kotlinx.android.synthetic.main.activity_main.*
import net.airvantage.model.User
import net.airvantage.utils.PreferenceUtils
import org.jetbrains.anko.alert
import org.jetbrains.anko.longToast
import java.util.*

/**
Expand All @@ -60,9 +59,6 @@ class MainActivity : FragmentActivity(), LoginListener, AuthenticationManager, O
private var alarmManager: AlarmManager? = null
private var taskFactory: IAsyncTaskFactory? = null
override var authentication: Authentication? = null
set(value) {
field = value
}
private var prefs: SharedPreferences? = null

internal var boundToMonitoringService = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ open class SyncWithAvTask internal constructor(private val applicationClient: IA

val systemType: String?
val syncParams = params[0]
val user = userClient.user
val imei = syncParams.imei
val iccid = syncParams.iccid
deviceName = syncParams.deviceName
val mqttPassword = syncParams.mqttPassword
val user = userClient.user!!
val imei = syncParams.imei!!
val iccid = syncParams.iccid!!
deviceName = syncParams.deviceName!!
val mqttPassword = syncParams.mqttPassword!!
val objectsManager = ObjectsManager.getInstance()

val missingRights = userClient.checkRights()
Expand All @@ -58,7 +58,7 @@ open class SyncWithAvTask internal constructor(private val applicationClient: IA
systemType = objectsManager.savedObjectName

// For emulator and iOs compatibility sake, using generated serial.
val serialNumber = DeviceInfo.generateSerial(user!!.uid!!)
val serialNumber = DeviceInfo.generateSerial(user.uid!!)

// Save Device serial in context
if (context is MainActivity) {
Expand All @@ -75,8 +75,15 @@ open class SyncWithAvTask internal constructor(private val applicationClient: IA
if (system == null) {

publishProgress(SyncProgress.CREATING_SYSTEM)
val uid = application.uid!!
var name = if (user.name == null){
"Nobody"
}else{
user.name!!
}


system = systemClient.createSystem(serialNumber, iccid!!, systemType, mqttPassword!!, application.uid!!, deviceName!!, user.name!!, imei!!)
system = systemClient.createSystem(serialNumber, iccid, systemType, mqttPassword, uid, deviceName!!, name, imei)
}
objectsManager.savecObject.systemUid = system.uid
objectsManager.saveOnPref()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ open class UpdateTask internal constructor(private val applicationClient: IAppli
val mqttPassword = syncParams.mqttPassword
val objectsManager = ObjectsManager.getInstance()

systemType = objectsManager.savedObjectName
systemType = objectsManager.savedObjectName!!

val missingRights = userClient.checkRights()
if (!missingRights.isEmpty()) {
Expand All @@ -73,11 +73,15 @@ open class UpdateTask internal constructor(private val applicationClient: IAppli

var system: net.airvantage.model.AvSystem? = this.systemClient.getSystem(serialNumber, systemType!!, deviceName!!)
publishProgress(UpdateProgress.UPDATING_SYSTEM)

var name = if (user.name == null){
"Nobody"
}else{
user.name!!
}
if (system != null) {
systemClient.updateSystem(system, serialNumber, iccid!!, systemType, mqttPassword!!, application.uid!!, deviceName!!, user.name!!, imei!!)
systemClient.updateSystem(system, serialNumber, iccid!!, systemType, mqttPassword!!, application.uid!!, deviceName!!, name, imei!!)
}else{
system = systemClient.createSystem(serialNumber, iccid!!, systemType, mqttPassword!!, application.uid!!, deviceName!!, user.name!!, imei!!)
system = systemClient.createSystem(serialNumber, iccid!!, systemType, mqttPassword!!, application.uid!!, deviceName!!, name, imei!!)
}

objectsManager.savecObject.systemUid = system.uid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ object DeviceInfo {


@SuppressLint("HardwareIds", "MissingPermission")
fun getIMEI(context: Context): String? {
fun getIMEI(context: Context): String {

val telManager: TelephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
var rc:String? = null
var rc = "DEAD"
try {
rc = if (telManager.phoneType == TelephonyManager.PHONE_TYPE_GSM) {
@Suppress("DEPRECATION")
telManager.deviceId
} else null
if (telManager.deviceId == null) {
"DEAD"
}else {
telManager.deviceId
}
} else "DEAD"
}catch(e:SecurityException) {
MainActivity.instance.runOnUiThread {
MainActivity.instance.toast("Read Phone Permission not given")
Expand All @@ -86,13 +90,17 @@ object DeviceInfo {
fun getICCID(context: Context): String {
val sm = SubscriptionManager.from(context)
val sis = sm.activeSubscriptionInfoList
var rc = ""
var rc = "DEAD"
try {
rc = if (sis != null) {
val si = sis[0]
si.iccId
if (si.iccId == null) {
"DEAD"
}else{
si.iccId
}
} else {
""
"DEAD"
}
}catch(e:SecurityException) {
MainActivity.instance.runOnUiThread {
Expand Down

0 comments on commit 5c0760d

Please sign in to comment.