Skip to content

Commit

Permalink
Merge pull request #128 from arcao/dev
Browse files Browse the repository at this point in the history
Release version 3.0.7
  • Loading branch information
arcao authored Nov 18, 2020
2 parents 4efb7a2 + df27319 commit b7585d2
Show file tree
Hide file tree
Showing 33 changed files with 167 additions and 198 deletions.
11 changes: 10 additions & 1 deletion .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.

12 changes: 9 additions & 3 deletions .idea/misc.xml

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

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ dependencies {
implementation "androidx.cardview:cardview:$card_view_version"
implementation "com.google.android.material:material:$material_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.preference:preference:$preference_version"
implementation "androidx.preference:preference-ktx:$preference_version"

implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
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.core:core-ktx:$core_version"
Expand All @@ -23,7 +23,7 @@ dependencies {
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:$paging_version"
implementation "androidx.paging:paging-runtime-ktx:$paging_version"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs_version"

Expand Down
24 changes: 21 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
android:exported="true"
android:icon="@drawable/ic_action_search"
android:label="@string/launcher_nearest_geocaches"
android:launchMode="singleTask"
android:theme="@style/AppTheme.DialogWhenLarge">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINT_TOOLS" />
Expand All @@ -95,6 +96,7 @@
android:name=".settings.SettingsActivity"
android:exported="false"
android:label="@string/action_settings"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Settings">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
Expand All @@ -112,6 +114,7 @@
android:exported="true"
android:icon="@drawable/ic_action_update"
android:label="@string/launcher_update_geocache"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINT_TOOLS" />
Expand All @@ -128,6 +131,7 @@
android:exported="true"
android:icon="@drawable/ic_action_download_logs"
android:label="@string/launcher_download_logs"
android:launchMode="singleTask"
android:targetActivity=".update.UpdateActivity">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINT_TOOLS" />
Expand All @@ -144,6 +148,7 @@
android:exported="true"
android:icon="@drawable/ic_action_update"
android:label="@string/launcher_update_geocaches"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINTS_SCREEN_TOOLS" />
Expand All @@ -154,6 +159,7 @@
android:name=".importgc.ImportUrlActivity"
android:exported="true"
android:label="@string/launcher_import_geocache"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -217,6 +223,7 @@
android:name=".dashboard.DashboardActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Dashboard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -225,10 +232,12 @@
</activity>
<activity
android:name=".authentication.LoginActivity"
android:exported="true"
android:label="@string/title_login"
android:launchMode="singleTop"
android:theme="@style/AppTheme">
android:launchMode="singleTask"
android:theme="@style/AppTheme" />
<activity
android:name=".authentication.RedirectUriReceiverActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -245,6 +254,7 @@
android:exported="true"
android:icon="@drawable/ic_action_gc_input"
android:label="@string/launcher_import_from_gc"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_MAIN_FUNCTION_GC" />
Expand All @@ -260,6 +270,7 @@
android:exported="true"
android:icon="@drawable/ic_action_import_bookmark"
android:label="@string/launcher_import_bookmarks"
android:launchMode="singleTask"
android:theme="@style/AppTheme.DialogWhenLarge">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_MAIN_FUNCTION_GC" />
Expand All @@ -271,6 +282,7 @@
android:exported="true"
android:icon="@drawable/ic_action_watch_geocache"
android:label="@string/launcher_watch_geocache"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINT_TOOLS" />
Expand All @@ -286,6 +298,7 @@
android:exported="true"
android:icon="@drawable/ic_action_bookmark_geocache"
android:label="@string/launcher_bookmark_geocache"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_POINT_TOOLS" />
Expand All @@ -301,6 +314,7 @@
android:exported="true"
android:icon="@drawable/ic_action_live_map_download_caches"
android:label="@string/launcher_download_rectangle"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Invisible">
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_MAIN_FUNCTION_GC" />
Expand All @@ -312,18 +326,22 @@
<activity-alias
android:name=".DashboardActivity"
android:exported="true"
android:launchMode="singleTask"
android:targetActivity=".dashboard.DashboardActivity" />
<activity-alias
android:name=".SearchNearestActivity"
android:exported="true"
android:launchMode="singleTask"
android:targetActivity=".search_nearest.SearchNearestActivity" />
<activity-alias
android:name=".ImportFromGCActivity"
android:exported="true"
android:launchMode="singleTask"
android:targetActivity=".importgc.ImportGeocacheCodeActivity" />
<activity-alias
android:name=".ImportBookmarkActivity"
android:exported="true"
android:launchMode="singleTask"
android:targetActivity=".import_bookmarks.ImportBookmarkActivity" />
</application>
</manifest>
4 changes: 3 additions & 1 deletion app/src/main/java/com/arcao/feedback/FeedbackHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ class FeedbackHelper(
}
}

@Suppress("BlockingMethodInNonBlockingContext")
@Throws(IOException::class)
private suspend fun createReport(reportFile: File) {
reportFile.parentFile.mkdirs()
reportFile.parentFile?.mkdirs()

if (reportFile.exists()) {
Timber.d("Report file $reportFile already exist.")
Expand All @@ -78,6 +79,7 @@ class FeedbackHelper(
Timber.d("Report created.")
}

@Suppress("BlockingMethodInNonBlockingContext")
@Throws(IOException::class)
private suspend fun writeCollectors(zos: ZipOutputStream) {
for (collector in collectors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 @@ -122,7 +123,7 @@ class ConfigurationCollector(private val context: Context) : Collector() {
if (f.type == Int::class.javaPrimitiveType) {
result.append(getFieldValueName(conf, f))
} else if (f.get(conf) != null) {
result.append(f.get(conf).toString())
result.append(f.get(conf)?.toString())
}
result.append('\n')
}
Expand Down Expand Up @@ -156,7 +157,7 @@ class ConfigurationCollector(private val context: Context) : Collector() {
FIELD_SCREENLAYOUT -> return activeFlags(VALUE_ARRAYS[PREFIX_SCREENLAYOUT]!!, f.getInt(conf))
else -> {
val values =
VALUE_ARRAYS[fieldName.toUpperCase() + '_'] // Unknown field, return the raw int as String
VALUE_ARRAYS[fieldName.toUpperCase(Locale.ROOT) + '_'] // 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 @@ -16,7 +16,7 @@ class ConstantsCollector(private val source: Class<*>, private val prefix: Strin
result.append(
when (val value = field.get(null)) {
is Array<*> -> Arrays.toString(value)
else -> value.toString()
else -> value?.toString()
}
)
} catch (e: IllegalArgumentException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.arcao.feedback.collector

import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
import androidx.preference.PreferenceManager

class SharedPreferencesCollector @JvmOverloads constructor(
private val context: Context,
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/com/arcao/geocaching4locus/App.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@file:Suppress("DEPRECATION")

package com.arcao.geocaching4locus

import android.app.Application
import android.content.Context
import android.os.Build
import android.preference.PreferenceManager
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
import com.arcao.geocaching4locus.base.constants.CrashlyticsConstants
Expand All @@ -29,8 +31,8 @@ import timber.log.Timber
import java.util.UUID

class App : Application() {
val accountManager by inject<AccountManager>()
val analyticsManager by inject<AnalyticsManager>()
private val accountManager by inject<AccountManager>()
private val analyticsManager by inject<AnalyticsManager>()

private val deviceId: String by lazy {
val pref = PreferenceManager.getDefaultSharedPreferences(this)
Expand All @@ -44,7 +46,7 @@ class App : Application() {
putString(PrefConstants.DEVICE_ID, value)
}
}
value
value.orEmpty()
}

val version: String by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -44,8 +45,8 @@ class LoginActivity : AbstractActionBarActivity() {

Timber.i("source: login")

if (savedInstanceState == null) {
if (!viewModel.handleIntent(intent)) {
if (!viewModel.handleIntent(intent)) {
if (savedInstanceState == null) {
viewModel.startLogin()
}
}
Expand Down Expand Up @@ -128,5 +129,12 @@ class LoginActivity : AbstractActionBarActivity() {
fun createIntent(context: Context): Intent {
return Intent(context, LoginActivity::class.java)
}

fun createResponseHandlingIntent(context: Context, responseUri: Uri?): Intent {
val intent = createIntent(context)
intent.data = responseUri
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
return intent
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ class LoginViewModel(

fun handleIntent(intent: Intent): Boolean {
val data = intent.data
val action = intent.action

if (Intent.ACTION_VIEW == action && data != null && data.getQueryParameter(OAuthConstants.CODE) != null) {
if (data?.getQueryParameter(OAuthConstants.CODE) != null) {
val code = requireNotNull(data.getQueryParameter(OAuthConstants.CODE))
fromIntent = true
finishLogin(code)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.arcao.geocaching4locus.authentication

import android.app.Activity
import android.os.Bundle

class RedirectUriReceiverActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// redirect to LoginActivity with FLAG_SINGLE_TOP and FLAG_CLEAR_TOP to close Chrome Custom
// Tab
startActivity(LoginActivity.createResponseHandlingIntent(this, this.intent.data))
finish()
}
}
Loading

0 comments on commit b7585d2

Please sign in to comment.