Skip to content

Commit

Permalink
Merge pull request #135 from arcao/dev
Browse files Browse the repository at this point in the history
Release 3.0.8
  • Loading branch information
arcao authored Oct 31, 2022
2 parents b7585d2 + 25eddcd commit da5f6b7
Show file tree
Hide file tree
Showing 153 changed files with 1,740 additions and 2,220 deletions.
9 changes: 0 additions & 9 deletions .idea/codeStyles/Project.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/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.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

55 changes: 26 additions & 29 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'de.mannodermaus.android-junit5'

dependencies {
// Android Support
Expand All @@ -15,14 +16,13 @@ dependencies {

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_extension_version"

implementation "androidx.core:core-ktx:$core_version"
implementation "androidx.collection:collection-ktx:$collection_version"
implementation "androidx.browser:browser:$browser_version"
implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.multidex:multidex:$multidex_version"
implementation "androidx.paging:paging-runtime-ktx:$paging_version"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs_version"
Expand All @@ -33,9 +33,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"

// koin
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
implementation "org.koin:koin-androidx-scope:$koin_version"
implementation "io.insert-koin:koin-android:$koin_version"

// Geocaching API
api project(":geocaching-api")
Expand All @@ -53,21 +51,17 @@ dependencies {

// Crashlytics & Firebase
implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version")
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'

// Networking
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
}

android {
compileSdkVersion rootProject.compile_sdk_version
namespace 'com.arcao.geocaching4locus'

dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries preDexEnabled && !isTravis
}
compileSdkVersion rootProject.compile_sdk_version

defaultConfig {
applicationId 'com.arcao.geocaching4locus'
Expand All @@ -93,8 +87,8 @@ android {

buildConfigField 'String', 'TEST_USER', 'null'
buildConfigField 'String', 'TEST_PASSWORD', 'null'

resConfigs 'en', 'cs', 'de', 'es', 'fr', 'nl', 'no', 'pl', 'sk'

}

compileOptions {
Expand All @@ -106,8 +100,8 @@ android {

kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn",
"-Xjvm-default=compatibility"
"-opt-in=kotlin.RequiresOptIn",
"-Xjvm-default=all-compatibility"
]
jvmTarget = JavaVersion.VERSION_1_8
}
Expand Down Expand Up @@ -139,28 +133,31 @@ android {
buildConfigField 'String', 'BUILD_TIME', '"' + gitTimestamp() + '"'

signingConfig signingConfigs.release
minifyEnabled false // App crash on VerifyError on Android 4.2, 4.3; https://issuetracker.google.com/issues/134304597
minifyEnabled false
// App crash on VerifyError on Android 4.2, 4.3; https://issuetracker.google.com/issues/134304597
shrinkResources false
crunchPngs false

proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
proguardFiles fileTree(dir: 'proguard-rules', include: '*.pro').getFiles().toArray()
}
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/atomicfu.kotlin_module'
exclude 'org/apache/http/version.properties'
exclude 'templates/release-notes.vm'
exclude 'log4j.xml'
resources {
excludes += [
'META-INF/DEPENDENCIES',
'META-INF/LICENSE',
'META-INF/atomicfu.kotlin_module',
'org/apache/http/version.properties',
'templates/release-notes.vm',
'log4j.xml'
]
}
}
lintOptions { abortOnError false }
}

androidExtensions {
experimental = true
lint {
abortOnError false
}
}

if (project.hasProperty('storeFile') &&
Expand Down
32 changes: 30 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.arcao.geocaching4locus"
android:installLocation="auto">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down Expand Up @@ -38,11 +37,13 @@
android:name=".App"
android:allowBackup="true"
android:backupAgent=".base.util.backup.PreferencesBackupAgent"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/full_backup_scheme"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true">
android:largeHeap="true"
tools:targetApi="s">
<meta-data
android:name="com.samsung.android.icon_container.has_icon_container"
android:value="true" />
Expand Down Expand Up @@ -183,6 +184,12 @@
android:host="*.coord.info"
android:pathPrefix="/GC"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="geocaching.com"
Expand Down Expand Up @@ -344,4 +351,25 @@
android:launchMode="singleTask"
android:targetActivity=".import_bookmarks.ImportBookmarkActivity" />
</application>

<queries>
<!-- All Locus Map packages -->
<package android:name="menion.android.locus" />
<package android:name="menion.android.locus.free.amazon" />
<package android:name="menion.android.locus.free.samsung" />
<package android:name="menion.android.locus.pro" />
<package android:name="menion.android.locus.pro.amazon" />
<package android:name="menion.android.locus.pro.asamm" />
<package android:name="menion.android.locus.pro.computerBild" />

<intent>
<action android:name="android.intent.action.SEND" />
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
</intent>
<intent>
<action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
</intent>
</queries>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.util.SparseArray
import timber.log.Timber
import java.lang.reflect.Field
import java.lang.reflect.Modifier
import java.util.Locale

class ConfigurationCollector(private val context: Context) : Collector() {
override val name: String
Expand Down Expand Up @@ -150,14 +149,17 @@ class ConfigurationCollector(private val context: Context) : Collector() {
* @throws IllegalAccessException if the supplied field is inaccessible.
*/
@Throws(IllegalAccessException::class)
private fun getFieldValueName(conf: Configuration, f: Field): String? {
private fun getFieldValueName(conf: Configuration, f: Field): String {
when (val fieldName = f.name) {
FIELD_MCC, FIELD_MNC -> return f.getInt(conf).toString()
FIELD_UIMODE -> return activeFlags(VALUE_ARRAYS[PREFIX_UI_MODE]!!, f.getInt(conf))
FIELD_SCREENLAYOUT -> return activeFlags(VALUE_ARRAYS[PREFIX_SCREENLAYOUT]!!, f.getInt(conf))
FIELD_SCREENLAYOUT -> return activeFlags(
VALUE_ARRAYS[PREFIX_SCREENLAYOUT]!!,
f.getInt(conf)
)
else -> {
val values =
VALUE_ARRAYS[fieldName.toUpperCase(Locale.ROOT) + '_'] // Unknown field, return the raw int as String
VALUE_ARRAYS[fieldName.uppercase() + '_'] // Unknown field, return the raw int as String
?: return f.getInt(conf).toString()

return values.get(f.getInt(conf)) // Unknown value, return the raw int as String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import android.content.Context
import android.graphics.Point
import android.graphics.Rect
import android.hardware.display.DisplayManager
import android.os.Build
import android.util.DisplayMetrics
import android.util.SparseArray
import android.view.Display
import android.view.Surface
import android.view.WindowManager
import timber.log.Timber

class DisplayManagerCollector(private val context: Context) : Collector() {
Expand All @@ -20,20 +18,13 @@ class DisplayManagerCollector(private val context: Context) : Collector() {
var displays: Array<Display>? = null
val result = StringBuilder()

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Before Android 4.2, there was a single display available from the
// window manager
val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
displays = arrayOf(windowManager.defaultDisplay)
} else {
// Since Android 4.2, we can fetch multiple displays with the
// DisplayManager.
try {
val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
displays = displayManager.displays
} catch (e: IllegalArgumentException) {
Timber.e(e, "Error while collecting DisplayManager data")
}
// Since Android 4.2, we can fetch multiple displays with the
// DisplayManager.
try {
val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
displays = displayManager.displays
} catch (e: IllegalArgumentException) {
Timber.e(e, "Error while collecting DisplayManager data")
}

displays?.forEach { display ->
Expand Down Expand Up @@ -102,6 +93,7 @@ class DisplayManagerCollector(private val context: Context) : Collector() {
try {
// since API v13
val size = Rect()
@Suppress("DEPRECATION")
display.getRectSize(size)
result.append(display.displayId).append(".rectSize=[").append(size.top).append(',').append(size.left)
.append(',').append(size.width()).append(',').append(size.height()).append(']').append('\n')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class LogCatCollector : Collector() {
override val name: String
get() = "LOGCAT"

@Suppress("BlockingMethodInNonBlockingContext", "ControlFlowWithEmptyBody")
override suspend fun collect(): String = coroutineScope {
try {
val process = Runtime.getRuntime().exec(COMMAND_LINE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class MemoryCollector : Collector() {
override val name: String
get() = "MEMORY"

@Suppress("BlockingMethodInNonBlockingContext")
override suspend fun collect(): String {
try {
val commandLine = arrayOf("dumpsys", "meminfo", Process.myPid().toString())
Expand Down
22 changes: 4 additions & 18 deletions app/src/main/java/com/arcao/geocaching4locus/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
package com.arcao.geocaching4locus

import android.app.Application
import android.content.Context
import android.os.Build
import android.webkit.CookieManager
import android.webkit.CookieSyncManager
import androidx.annotation.WorkerThread
import androidx.core.content.edit
import androidx.core.content.pm.PackageInfoCompat
import androidx.multidex.MultiDex
import androidx.preference.PreferenceManager
import com.arcao.feedback.feedbackModule
import com.arcao.geocaching4locus.authentication.util.isPremium
Expand Down Expand Up @@ -46,7 +42,7 @@ class App : Application() {
putString(PrefConstants.DEVICE_ID, value)
}
}
value.orEmpty()
value
}

val version: String by lazy {
Expand Down Expand Up @@ -89,11 +85,6 @@ class App : Application() {
analyticsManager.setPremiumMember(accountManager.isPremium)
}

override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}

private fun prepareCrashlytics() {
// Set up Crashlytics, disabled for debug builds
if (BuildConfig.DEBUG) {
Expand All @@ -114,8 +105,8 @@ class App : Application() {
null
}

crashlytics.setCustomKey(CrashlyticsConstants.LOCUS_VERSION, lv?.versionName ?: "")
crashlytics.setCustomKey(CrashlyticsConstants.LOCUS_PACKAGE, lv?.packageName ?: "")
crashlytics.setCustomKey(CrashlyticsConstants.LOCUS_VERSION, lv?.versionName.orEmpty())
crashlytics.setCustomKey(CrashlyticsConstants.LOCUS_PACKAGE, lv?.packageName.orEmpty())
}

@WorkerThread
Expand All @@ -134,12 +125,7 @@ class App : Application() {
}

private fun flushCookie() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
CookieManager.getInstance().flush()
} else {
@Suppress("DEPRECATION")
CookieSyncManager.createInstance(this).sync()
}
CookieManager.getInstance().flush()
}

companion object {
Expand Down
Loading

0 comments on commit da5f6b7

Please sign in to comment.