Skip to content
Snippets Groups Projects
Commit dc1215c2 authored by John's avatar John
Browse files

Add setting to view network activity

parent 35dc756a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,12 +13,16 @@ repositories {
}
 
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
 
android {
compileSdkVersion 27
 
project.ext {
LABCOAT_FABRIC_KEY = project.hasProperty("LABCOAT_FABRIC_KEY") ? project.LABCOAT_FABRIC_KEY : ""
Loading
Loading
@@ -27,6 +31,8 @@ android {
KEY_PASSWORD = project.hasProperty("KEY_PASSWORD") ? project.KEY_PASSWORD : " "
}
 
compileSdkVersion 27
defaultConfig {
applicationId "com.commit451.gitlab"
minSdkVersion 16
Loading
Loading
@@ -170,10 +176,6 @@ dependencies {
implementation "com.github.Commit451:Alakazam:2.0.0"
implementation 'com.github.Commit451:Lift:2.0.1'
implementation 'com.github.Commit451:okyo:3.0.2'
implementation 'com.github.Commit451:OkioProGuardRules:1.11.0.0'
implementation 'com.github.Commit451:RetrofitProguardRules:2.2.0.0'
implementation 'com.github.Commit451:LoganSquareProGuardRules:1.3.7.0'
implementation 'com.github.Commit451:EventBusProGuardRules:3.0.0.0'
implementation "com.github.Commit451.Addendum:addendum:$addendumVersion"
implementation "com.github.Commit451.Addendum:addendum-recyclerview:$addendumVersion"
implementation "com.github.Commit451.Addendum:addendum-design:$addendumVersion"
Loading
Loading
@@ -208,6 +210,8 @@ dependencies {
 
implementation 'com.atlassian.commonmark:commonmark:0.11.0'
 
implementation 'com.readystatesoftware.chuck:library:1.1.0'
normalImplementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
 
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
Loading
Loading
Loading
Loading
@@ -43,10 +43,26 @@
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }
 
# Retrofit
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
# EventBus
-keepattributes *Annotation*
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
# Moshi
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.**
-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}
Loading
Loading
Loading
Loading
@@ -13,6 +13,7 @@ import com.commit451.gitlab.util.FabricUtil
import com.commit451.lift.Lift
import com.jakewharton.threetenabp.AndroidThreeTen
import com.novoda.simplechromecustomtabs.SimpleChromeCustomTabs
import com.readystatesoftware.chuck.ChuckInterceptor
import com.squareup.leakcanary.LeakCanary
import com.squareup.picasso.Picasso
import io.reactivex.plugins.RxJavaPlugins
Loading
Loading
@@ -91,6 +92,7 @@ class App : Application() {
if (BuildConfig.DEBUG) {
clientBuilder.addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
}
clientBuilder.addInterceptor(ChuckInterceptor(this).showNotification(false))
val client = clientBuilder.build()
initGitLab(account, clientBuilder)
if (BuildConfig.DEBUG) {
Loading
Loading
Loading
Loading
@@ -39,6 +39,7 @@ import com.commit451.gitlab.ssl.X509CertificateException
import com.commit451.gitlab.ssl.X509Util
import com.commit451.gitlab.util.IntentUtil
import com.commit451.teleprinter.Teleprinter
import com.readystatesoftware.chuck.ChuckInterceptor
import okhttp3.Credentials
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
Loading
Loading
@@ -209,6 +210,7 @@ class LoginActivity : BaseActivity() {
if (BuildConfig.DEBUG) {
gitlabClientBuilder.addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
}
gitlabClientBuilder.addInterceptor(ChuckInterceptor(this.applicationContext).showNotification(false))
 
currentGitLab = GitLabFactory.createGitLab(currentAccount, gitlabClientBuilder)
 
Loading
Loading
Loading
Loading
@@ -4,15 +4,12 @@ import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.support.v7.widget.SwitchCompat
import android.support.v7.widget.Toolbar
import android.view.View
import android.view.ViewGroup
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.commit451.gitlab.R
import com.commit451.gitlab.data.Prefs
import com.readystatesoftware.chuck.Chuck
import kotlinx.android.synthetic.main.activity_settings.*
 
/**
* Settings
Loading
Loading
@@ -27,18 +24,6 @@ class SettingsActivity : BaseActivity() {
}
}
 
@BindView(R.id.toolbar)
lateinit var toolbar: Toolbar
@BindView(R.id.root_require_device_auth)
lateinit var rootRequireDeviceAuth: ViewGroup
@BindView(R.id.switch_require_auth)
lateinit var switchRequireAuth: SwitchCompat
@OnClick(R.id.root_require_device_auth)
fun onRequireDeviceAuthClicked() {
switchRequireAuth.toggle()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
Loading
Loading
@@ -55,6 +40,11 @@ class SettingsActivity : BaseActivity() {
switchRequireAuth.setOnCheckedChangeListener { _, b ->
Prefs.isRequiredDeviceAuth = b
}
rootRequireDeviceAuth.setOnClickListener { switchRequireAuth.toggle() }
rootNetwork.setOnClickListener {
val intent = Chuck.getLaunchIntent(this)
startActivity(intent)
}
}
 
fun bindPrefs() {
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
 
<ScrollView
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
 
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
 
<LinearLayout
android:id="@+id/root_require_device_auth"
android:id="@+id/rootRequireDeviceAuth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:orientation="horizontal"
android:paddingTop="@dimen/activity_vertical_margin">
 
<LinearLayout
Loading
Loading
@@ -42,29 +56,58 @@
style="?android:attr/textAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white_60"
android:text="@string/setting_require_device_auth_description" />
android:text="@string/setting_require_device_auth_description"
android:textColor="@color/white_60" />
</LinearLayout>
 
 
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_require_auth"
android:id="@+id/switchRequireAuth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:text="Debug"
android:textColor="?attr/colorAccent" />
<LinearLayout
android:id="@+id/rootNetwork"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<TextView
style="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_marginLeft="8dp"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:text="@string/setting_see_network_activity" />
 
<TextView
style="?android:attr/textAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setting_see_network_activity_description"
android:textColor="@color/white_60" />
</LinearLayout>
 
 
</LinearLayout>
 
</ScrollView>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.v4.widget.NestedScrollView>
 
</merge>
\ No newline at end of file
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
Loading
Loading
@@ -495,6 +495,8 @@
</string-array>
<string name="setting_require_device_auth">Require device authentication</string>
<string name="setting_require_device_auth_description">Force device authentication when starting the app for the first time</string>
<string name="setting_see_network_activity">See network activity</string>
<string name="setting_see_network_activity_description">View the recent network activity of the app, for debugging purposes</string>
<string name="device_auth_title">Authenticate</string>
<string name="device_auth_message">Please authenticate to access LabCoat</string>
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment