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

Remove email and password auth since no longer supported

parent 6d00dbb9
No related branches found
No related tags found
No related merge requests found
Showing
with 110 additions and 199 deletions
Loading
Loading
@@ -10,6 +10,7 @@ import android.support.annotation.DrawableRes
import android.support.v4.app.ActivityOptionsCompat
import android.view.View
import android.widget.ImageView
import com.commit451.addendum.themeAttrColor
import com.commit451.easel.Easel
import com.commit451.gitlab.R
import com.commit451.gitlab.activity.*
Loading
Loading
@@ -87,11 +88,6 @@ object Navigator {
activity.startActivity(LoginActivity.newIntent(activity, showClose))
}
 
fun navigateToWebSignin(activity: Activity, url: String, extractingPrivateToken: Boolean, requestCode: Int) {
val intent = WebLoginActivity.newIntent(activity, url, extractingPrivateToken)
activity.startActivityForResult(intent, requestCode)
}
fun navigateToSearch(activity: Activity) {
activity.startActivity(SearchActivity.newIntent(activity))
}
Loading
Loading
@@ -206,7 +202,7 @@ object Navigator {
 
private fun startMorphActivity(activity: Activity, fab: View?, @DrawableRes drawableRes: Int, intent: Intent) {
if (Build.VERSION.SDK_INT >= 21 && fab != null) {
FabTransform.addExtras(intent, Easel.getThemeAttrColor(activity, R.attr.colorAccent),
FabTransform.addExtras(intent, activity.themeAttrColor(R.attr.colorAccent),
drawableRes)
val options = ActivityOptions.makeSceneTransitionAnimation(activity, fab, activity.getString(R.string.transition_morph))
activity.startActivity(intent, options.toBundle())
Loading
Loading
Loading
Loading
@@ -17,33 +17,16 @@ class CustomTrustManager : X509TrustManager {
private var sslSocketFactory: SSLSocketFactory? = null
private var hostnameVerifier: HostnameVerifier? = null
 
fun setTrustedCertificate(trustedCertificate: String?) {
if (this.trustedCertificate == null && trustedCertificate == null || this.trustedCertificate != null && this.trustedCertificate == trustedCertificate) {
return
}
fun setTrustedCertificate(trustedCertificate: String) {
this.trustedCertificate = trustedCertificate
sslSocketFactory = null
}
 
fun setTrustedHostname(trustedHostname: String?) {
if (this.trustedHostname == null && trustedHostname == null || this.trustedHostname != null && this.trustedHostname == trustedHostname) {
return
}
fun setTrustedHostname(trustedHostname: String) {
this.trustedHostname = trustedHostname
hostnameVerifier = null
}
 
fun setPrivateKeyAlias(privateKeyAlias: String?) {
if (this.privateKeyAlias == null && privateKeyAlias == null || this.privateKeyAlias != null && this.privateKeyAlias == privateKeyAlias) {
return
}
this.privateKeyAlias = privateKeyAlias
sslSocketFactory = null
}
@Throws(CertificateException::class)
override fun checkClientTrusted(chain: Array<X509Certificate>, authType: String) {
X509TrustManagerProvider.x509TrustManager.checkClientTrusted(chain, authType)
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@ import android.content.Intent
import android.net.Uri
import android.support.design.widget.Snackbar
import android.view.View
import com.commit451.addendum.themeAttrColor
import com.commit451.easel.Easel
import com.commit451.gitlab.R
import com.commit451.gitlab.activity.BaseActivity
Loading
Loading
@@ -24,7 +25,7 @@ object IntentUtil {
}
val resolvedUrl = if (account == null) url else url.resolveUrl(account)
 
val primaryColor = Easel.getThemeAttrColor(activity, R.attr.colorPrimary)
val primaryColor = activity.themeAttrColor(R.attr.colorPrimary)
SimpleChromeCustomTabs.getInstance()
.withFallback(BrowserFallback(activity))
.withIntentCustomizer(LabCoatIntentCustomizer(activity, primaryColor))
Loading
Loading
Loading
Loading
@@ -14,6 +14,7 @@ import android.widget.TextView
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.commit451.addendum.themeAttrColor
import com.commit451.alakazam.HideRunnable
import com.commit451.easel.Easel
import com.commit451.gitlab.App
Loading
Loading
@@ -50,6 +51,7 @@ class LabCoatNavigationView : NavigationView {
 
lateinit var listAccounts: RecyclerView
lateinit var adapterAccounts: AccountAdapter
var user: User? = null
 
val mOnNavigationItemSelectedListener = OnNavigationItemSelectedListener { menuItem ->
when (menuItem.itemId) {
Loading
Loading
@@ -131,7 +133,9 @@ class LabCoatNavigationView : NavigationView {
 
@OnClick(R.id.profile_image)
fun onUserImageClick(imageView: ImageView) {
Navigator.navigateToUser(context as Activity, imageView, App.get().getAccount().user!!)
user?.let {
Navigator.navigateToUser(context as Activity, imageView, it)
}
}
 
@OnClick(R.id.button_debug)
Loading
Loading
@@ -158,7 +162,7 @@ class LabCoatNavigationView : NavigationView {
 
fun init() {
App.bus().register(this)
val colorPrimary = Easel.getThemeAttrColor(context, R.attr.colorPrimary)
val colorPrimary = context.themeAttrColor(R.attr.colorPrimary)
 
setNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
inflateMenu(R.menu.navigation)
Loading
Loading
@@ -222,18 +226,13 @@ class LabCoatNavigationView : NavigationView {
override fun responseNonNullSuccess(userFull: User) {
//Store the newly retrieved user to the account so that it stays up to date
// in local storage
val account = App.get().getAccount()
account.user = userFull
Prefs.updateAccount(account)
this@LabCoatNavigationView.user = user
bindUser(userFull)
}
})
}
 
fun bindUser(user: User) {
if (context == null) {
return
}
if (user.username != null) {
textUserName.text = user.username
}
Loading
Loading
@@ -267,7 +266,6 @@ class LabCoatNavigationView : NavigationView {
account.lastUsed = Date()
App.get().setAccount(account)
Prefs.updateAccount(account)
bindUser(account.user!!)
toggleAccounts()
App.bus().post(ReloadDataEvent())
App.bus().post(CloseDrawerEvent())
Loading
Loading
Loading
Loading
@@ -3,6 +3,7 @@ package com.commit451.gitlab.view
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import com.commit451.addendum.themeAttrColor
 
import com.commit451.easel.Easel
import com.commit451.gitlab.R
Loading
Loading
@@ -24,7 +25,7 @@ class LabCoatProgressView : MaterialProgressBar {
}
 
private fun init() {
val color = Easel.getThemeAttrColor(context, R.attr.colorAccent)
val color = context.themeAttrColor(R.attr.colorAccent)
progressTintList = ColorStateList.valueOf(color)
}
}
Loading
Loading
@@ -10,6 +10,7 @@ import android.widget.LinearLayout
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.commit451.addendum.themeAttrColor
import com.commit451.easel.Easel
import com.commit451.gitlab.R
 
Loading
Loading
@@ -58,7 +59,7 @@ class SendMessageView : LinearLayout {
View.inflate(context, R.layout.view_send_message, this)
orientation = LinearLayout.HORIZONTAL
ButterKnife.bind(this)
setBackgroundColor(Easel.getThemeAttrColor(context, R.attr.colorPrimary))
setBackgroundColor(context.themeAttrColor(R.attr.colorPrimary))
if (Build.VERSION.SDK_INT >= 21) {
elevation = resources.getDimensionPixelSize(R.dimen.toolbar_elevation).toFloat()
}
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ class AccountViewHolder(view: View) : RecyclerView.ViewHolder(view) {
 
fun bind(account: Account, isActive: Boolean, colorSelected: Int) {
textServer.text = account.serverUrl.toString()
textUsername.text = account.user!!.username
textUsername.text = account.email
 
if (isActive) {
itemView.setBackgroundColor(colorSelected)
Loading
Loading
@@ -56,7 +56,7 @@ class AccountViewHolder(view: View) : RecyclerView.ViewHolder(view) {
}
 
App.get().picasso
.load(ImageUtil.getAvatarUrl(account.user, itemView.resources.getDimensionPixelSize(R.dimen.user_list_image_size)))
.load(ImageUtil.getAvatarUrl(account.email, itemView.resources.getDimensionPixelSize(R.dimen.user_list_image_size)))
.transform(CircleTransformation())
.into(image)
}
Loading
Loading
Loading
Loading
@@ -7,6 +7,8 @@ import android.view.ViewGroup
import android.widget.TextView
import butterknife.BindView
import butterknife.ButterKnife
import com.commit451.addendum.recyclerview.context
import com.commit451.addendum.themeAttrColor
import com.commit451.easel.Easel
import com.commit451.gitlab.R
import com.commit451.gitlab.model.api.Branch
Loading
Loading
@@ -31,7 +33,7 @@ class BranchViewHolder(view: View) : RecyclerView.ViewHolder(view) {
 
init {
ButterKnife.bind(this, view)
colorHighlighted = Easel.getThemeAttrColor(itemView.context, R.attr.colorControlHighlight)
colorHighlighted = context.themeAttrColor(R.attr.colorControlHighlight)
}
 
fun bind(branch: Branch, selected: Boolean) {
Loading
Loading
Loading
Loading
@@ -7,6 +7,8 @@ import android.view.ViewGroup
import android.widget.TextView
import butterknife.BindView
import butterknife.ButterKnife
import com.commit451.addendum.recyclerview.context
import com.commit451.addendum.themeAttrColor
import com.commit451.easel.Easel
import com.commit451.gitlab.R
import com.commit451.gitlab.model.api.Tag
Loading
Loading
@@ -31,7 +33,7 @@ class TagViewHolder(view: View) : RecyclerView.ViewHolder(view) {
 
init {
ButterKnife.bind(this, view)
colorHighlighted = Easel.getThemeAttrColor(itemView.context, R.attr.colorControlHighlight)
colorHighlighted = context.themeAttrColor(R.attr.colorControlHighlight)
}
 
fun bind(tag: Tag, selected: Boolean) {
Loading
Loading
Loading
Loading
@@ -38,10 +38,10 @@ class AccountViewHolder(view: View) : TypedViewHolder<Account>(view) {
 
override fun bind(position: Int, item: Account) {
textServer.text = item.serverUrl.toString()
textUsername.text = item.user!!.username
textUsername.text = item.email
 
Picasso.with(context)
.load(ImageUtil.getAvatarUrl(item.user, itemView.resources.getDimensionPixelSize(R.dimen.user_list_image_size)))
.load(ImageUtil.getAvatarUrl(item.email, itemView.resources.getDimensionPixelSize(R.dimen.user_list_image_size)))
.transform(CircleTransformation())
.into(image)
}
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ import timber.log.Timber
/**
* Service that basically just defers everything to a Factory. Yay!
*/
class ProjectFeedWidgetService : RemoteViewsService() {
class FeedWidgetService : RemoteViewsService() {
 
companion object {
 
Loading
Loading
@@ -42,7 +42,7 @@ class ProjectFeedWidgetService : RemoteViewsService() {
fun newIntent(context: Context, widgetId: Int, account: Account, feedUrl: String): Intent {
val adapter = MoshiProvider.moshi.adapter<Account>(Account::class.java)
val accountJson = adapter.toJson(account)
val intent = Intent(context, ProjectFeedWidgetService::class.java)
val intent = Intent(context, FeedWidgetService::class.java)
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId)
intent.putExtra(EXTRA_ACCOUNT_JSON, accountJson)
intent.putExtra(EXTRA_FEED_URL, feedUrl)
Loading
Loading
Loading
Loading
@@ -49,7 +49,7 @@ class ProjectFeedWidgetProvider : AppWidgetProvider() {
val account = ProjectFeedWidgetPrefs.getAccount(context, widgetId)
val feedUrl = ProjectFeedWidgetPrefs.getFeedUrl(context, widgetId)
if (account != null && feedUrl!= null) {
val intent = ProjectFeedWidgetService.newIntent(context, widgetId, account, feedUrl)
val intent = FeedWidgetService.newIntent(context, widgetId, account, feedUrl)
 
 
intent.data = Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))
Loading
Loading
Loading
Loading
@@ -55,7 +55,9 @@ class UserFeedWidgetConfigureActivity : BaseActivity() {
toolbar.setTitle(R.string.widget_choose_account)
 
adapterAccounts = AccountsAdapter()
adapterAccounts.setOnItemClickListener { adapter, _, position -> saveWidgetConfig(adapter.get(position)) }
adapterAccounts.setOnItemClickListener { adapter, _, position ->
saveWidgetConfig(adapter.get(position))
}
list.layoutManager = LinearLayoutManager(this)
list.adapter = adapterAccounts
 
Loading
Loading
Loading
Loading
@@ -47,5 +47,4 @@ object UserFeedWidgetPrefs {
}
 
}
}
Loading
Loading
@@ -24,7 +24,6 @@ import android.content.Intent
import android.net.Uri
import android.widget.RemoteViews
import com.commit451.gitlab.R
import com.commit451.gitlab.extension.feedUrl
import com.commit451.gitlab.navigation.DeepLinker
import timber.log.Timber
 
Loading
Loading
@@ -53,13 +52,13 @@ class UserFeedWidgetProvider : AppWidgetProvider() {
// Here we setup the intent which points to the StackViewService which will
// provide the views for this collection.
val account = UserFeedWidgetPrefs.getAccount(context, widgetId)
val feedUrl = account?.user?.feedUrl
if (account == null || feedUrl == null) {
if (account == null) {
//TODO alert the user to this misfortune?
Timber.e("Error getting account or feed url")
} else {
Timber.d("Updating widget with url $feedUrl")
val intent = ProjectFeedWidgetService.newIntent(context, widgetId, account, feedUrl)
val feedUrl = account.serverUrl + "/${account.username}.atom"
val intent = FeedWidgetService.newIntent(context, widgetId, account, feedUrl)
// When intents are compared, the extras are ignored, so we need to embed the extras
// into the data so that the extras will not be ignored.
intent.data = Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))
Loading
Loading
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>
File added
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:id="@+id/root"
android:layout_width="match_parent"
Loading
Loading
@@ -10,17 +9,9 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="0dp"/>
android:elevation="0dp" />
 
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="32dp"
android:contentDescription="@string/app_name"
app:srcCompat="@drawable/ic_logo"/>
<LinearLayout
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
Loading
Loading
@@ -28,110 +19,88 @@
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:orientation="vertical">
 
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input_layout_server"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/text_server"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/url_hint"
android:importantForAutofill="no"
android:inputType="textUri" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="@+id/normal_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
 
<android.support.design.widget.TextInputLayout
android:id="@+id/user_input_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:contentDescription="@string/app_name"
app:srcCompat="@drawable/ic_logo" />
 
<android.support.design.widget.TextInputEditText
android:id="@+id/user_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="@string/user_hint"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"/>
<TextView
style="@style/Text.MonoRegular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:text="@string/welcome"
android:textSize="32sp" />
 
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="@string/welcome_message" />
 
<android.support.design.widget.TextInputLayout
android:id="@+id/password_hint"
android:id="@+id/text_input_layout_server"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
 
<android.support.design.widget.TextInputEditText
android:id="@+id/password_input"
android:id="@+id/text_server"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/user_input"
android:layout_centerHorizontal="true"
android:hint="@string/password_hint"
android:inputType="textPassword"/>
android:hint="@string/url_hint"
android:importantForAutofill="no"
android:inputType="textUri" />
 
</android.support.design.widget.TextInputLayout>
</LinearLayout>
 
<LinearLayout
android:id="@+id/token_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<android.support.design.widget.TextInputLayout
android:id="@+id/token_hint"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/token_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:hint="@string/token_hint"
android:inputType="textVisiblePassword"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/or"/>
android:layout_marginTop="8dp"
android:orientation="horizontal">
 
<Button
android:id="@+id/button_open_login_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/open_login_page"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/or"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/token_hint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText
android:id="@+id/token_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:hint="@string/token_hint"
android:inputType="textVisiblePassword" />
</android.support.design.widget.TextInputLayout>
<ImageView
android:id="@+id/button_info"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:padding="8dp"
app:srcCompat="@drawable/ic_info_outline_white_24dp" />
</LinearLayout>
 
<Button
android:id="@+id/button_open_login_page_for_personal_access"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/open_login_page_for_personal_access_token"/>
</LinearLayout>
 
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
 
<Button
android:id="@+id/login_button"
Loading
Loading
@@ -139,8 +108,8 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="16dp"
android:text="@string/login_button"/>
android:text="@string/login_button" />
 
<include layout="@layout/progress_fullscreen"/>
<include layout="@layout/progress_fullscreen" />
 
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<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.support.design.widget.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progress"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="false"
app:mpb_progressStyle="horizontal"/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_advanced_login"
app:showAsAction="never"
android:title="@string/advanced_login"/>
</menu>
\ No newline at end of file
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