Skip to content

Commit

Permalink
Merge pull request #104 from particle-iot/jensck/fix-for-modern-andro…
Browse files Browse the repository at this point in the history
…id-sdks

Fix for modern android sdks
  • Loading branch information
jensck authored Oct 29, 2020
2 parents db8e0cb + 4c0eb7f commit 7774bf5
Show file tree
Hide file tree
Showing 45 changed files with 598 additions and 416 deletions.
18 changes: 18 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 8 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.31.2'
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}

Expand All @@ -19,16 +8,16 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "androidx.navigation.safeargs.kotlin"

apply plugin: 'io.fabric' /* uncomment for release builds */
apply plugin: 'com.google.firebase.crashlytics' /* uncomment for release builds */


android {
compileSdkVersion 28
compileSdkVersion 30

defaultConfig {
applicationId 'io.particle.android.app'
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 30
// scheme for these version numbers: EPOCH MAJOR MINOR PATCH BUILD
versionCode 1_03_01_01_01
versionName "3.1.1"
Expand Down Expand Up @@ -92,7 +81,6 @@ dependencies {
transitive = true
}

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1'
implementation "io.github.microutils:kotlin-logging:1.7.8"
Expand All @@ -102,10 +90,9 @@ dependencies {
// implemented by hand (and as such, might not be worth it.)
implementation 'com.getbase:floatingactionbutton:1.10.1'

releaseImplementation 'com.google.firebase:firebase-core:17.2.1'
releaseImplementation 'com.google.firebase:firebase-analytics:17.2.1'
releaseImplementation 'com.google.firebase:firebase-perf:19.0.2'
releaseImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
releaseImplementation 'com.google.firebase:firebase-analytics:17.6.0'
releaseImplementation 'com.google.firebase:firebase-perf:19.0.9'
releaseImplementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.2'

// Segment
//noinspection GradleDynamicVersion -- this is what the docs want (even if it's a bad idea)
Expand All @@ -121,7 +108,8 @@ dependencies {
// releaseImplementation 'io.intercom.android:intercom-sdk-fcm:5.+'

implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
api 'io.github.inflationx:calligraphy3:3.1.1'
api 'io.github.inflationx:viewpump:2.0.3'

implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class EventsFragment : Fragment() {
val context = holder.itemView.context
val clipboard = context.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Event data", buildEventClipboardCopy(event))
clipboard.primaryClip = clip
clipboard.setPrimaryClip(clip)
Toast.makeText(context, R.string.clipboard_copy_event_msg, Toast.LENGTH_SHORT)
.show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private class DataListAdapter(
val clipboard: ClipboardManager? = context.getSystemService()
val clip = ClipData.newPlainText(title, message)
if (clipboard != null) {
clipboard.primaryClip = clip
clipboard.setPrimaryClip(clip)
}
Toast.makeText(context, R.string.clipboard_copy_variable, Toast.LENGTH_SHORT).show()
dialog.dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class InspectorActivity : BaseActivity() {
return
}

device = intent.getParcelableExtra(EXTRA_DEVICE)
device = intent.getParcelableExtra(EXTRA_DEVICE)!!

setContentView(R.layout.activity_inspector)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ package io.particle.android.sdk
import android.app.Application
import android.util.Log

import com.crashlytics.android.Crashlytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.analytics.FirebaseAnalytics

import java.util.logging.Handler
import java.util.logging.Level

import io.fabric.sdk.android.Fabric
import io.particle.android.sdk.utils.*
import io.particle.mesh.common.QATool
import io.particle.mesh.common.QAToolImpl
import pl.brightinventions.slf4android.LogRecord
import pl.brightinventions.slf4android.LoggerConfiguration
import pl.brightinventions.slf4android.MessageValueSupplier
import com.google.firebase.FirebaseApp


fun onApplicationCreated(app: Application) {
val coveredByGDPR = isUserCoveredByGDPR()
FirebaseApp.initializeApp(app)

if (!coveredByGDPR) {
//"MVP" level GDPR support: only enable crash reporting + Analytics if the user is NOT in the EU.
FirebaseAnalytics.getInstance(app).setAnalyticsCollectionEnabled(true)
Fabric.with(app, Crashlytics())


// Add Crashlytics logger
LoggerConfiguration.configuration()
Expand All @@ -48,15 +49,15 @@ fun onApplicationCreated(app: Application) {
if (coveredByGDPR) {
return
}
Crashlytics.logException(exception)
FirebaseCrashlytics.getInstance().recordException(exception)
}

override fun doLog(msg: String) {
Log.e("Particle", msg)
if (coveredByGDPR) {
return
}
Crashlytics.log(msg)
FirebaseCrashlytics.getInstance().log(msg)
}
}

Expand All @@ -76,7 +77,7 @@ fun updateUsernameWithCrashlytics(username: String?) {
return
}

Crashlytics.setUserIdentifier(username)
username?.let { FirebaseCrashlytics.getInstance().setUserId(it) }
}


Expand All @@ -95,9 +96,7 @@ internal class CrashlyticsLoggerHandler : Handler() {
val logRecord = LogRecord.fromRecord(record)
val messageBuilder = StringBuilder()
messageValueSupplier.append(logRecord, messageBuilder)
val tag = record.loggerName
val androidLogLevel = logRecord.logLevel.androidLevel
Crashlytics.log(androidLogLevel, tag, messageBuilder.toString())
FirebaseCrashlytics.getInstance().log(messageBuilder.toString())
}

override fun close() {}
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

buildscript {

ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.10'

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
Expand Down
9 changes: 3 additions & 6 deletions cloudsdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ ext {


android {
compileSdkVersion 28
compileSdkVersion 30

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName project.version

Expand Down Expand Up @@ -81,7 +81,7 @@ android {
}

dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api "io.github.microutils:kotlin-logging:1.7.8"

api 'com.google.code.findbugs:jsr305:3.0.2'
Expand Down Expand Up @@ -157,11 +157,8 @@ task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
excludes: excludes)
def mainSrc = "${project.projectDir}/src/main/java"

// classDirectories = files([debugTree], [kotlinDebugTree])
getClassDirectories().setFrom(files([debugTree], [kotlinDebugTree]))
// executionData = files("$buildDir/jacoco/testDebugUnitTest.exec")
getExecutionData().setFrom(files("$buildDir/jacoco/testDebugUnitTest.exec"))
// sourceDirectories = files([mainSrc])
getSourceDirectories().setFrom(files([mainSrc]))
}

8 changes: 4 additions & 4 deletions commonui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 30

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -43,7 +43,6 @@ dependencies {
implementation project(':cloudsdk')
implementation project(':mesh')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1'
implementation "io.github.microutils:kotlin-logging:1.7.8"
Expand All @@ -56,7 +55,8 @@ dependencies {
implementation 'com.google.android.material:material:1.0.0'

implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
Expand Down
5 changes: 5 additions & 0 deletions devicesetup/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.7.0
=====
* Update to accommodate changes in API 29 and up


0.5.3
=====
* Particle CloudSdk update.
Expand Down
20 changes: 15 additions & 5 deletions devicesetup/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife'


// This is the library version used when deploying the artifact
version = '0.6.3'
version = '0.7.0'

ext {
bintrayRepo = 'android'
Expand Down Expand Up @@ -34,11 +37,11 @@ ext {


android {
compileSdkVersion 28
compileSdkVersion 30

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
Expand All @@ -48,6 +51,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -58,7 +65,6 @@ android {
lintOptions {
abortOnError true
}

}


Expand All @@ -67,9 +73,13 @@ dependencies {

implementation project(':cloudsdk')
// api 'io.particle:cloudsdk:1.0.0'
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

api "io.github.microutils:kotlin-logging:1.7.8"

api 'com.squareup.phrase:phrase:1.1.0'
api 'uk.co.chrisjenx:calligraphy:2.3.0'
api 'io.github.inflationx:calligraphy3:3.1.1'
api 'io.github.inflationx:viewpump:2.0.3'
api 'com.segment.analytics.android:analytics:4.3.1'
api 'com.madgag.spongycastle:core:1.58.0.0'

Expand Down
Loading

0 comments on commit 7774bf5

Please sign in to comment.