diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b00bb29ada..b449ef4169 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -55,7 +55,19 @@
+ android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
+
+
+
+
+
+
+
+
+
+
Unit?) {
+ launchUI(strategy) {
+ try {
+ withContext(DefaultDispatcher) {
+ setupConnectionInfo(serverUrl)
+ refreshServerAccounts()
+ checkForCustomOauthAccount(serverUrl)
+ }
+ retryIO { currentAccessToken = client.getAccessToken(customOauthServiceName.toString())}
+ onClickCallback("${widechatCustomOauthHost}${updatePath}${currentAccessToken}")
+ } catch (ex: Exception) {
+ view.showMessage(ex)
+ }
+ }
+ }
+
fun updateUserProfile(email: String, name: String, username: String) {
launchUI(strategy) {
view.showLoading()
diff --git a/app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt b/app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
index eef3702f90..f2e96d01d6 100644
--- a/app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+++ b/app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
@@ -44,6 +44,7 @@ import javax.inject.Inject
// WIDECHAT
import chat.rocket.android.helper.Constants
+import chat.rocket.android.util.extensions.openTabbedUrl
import kotlinx.android.synthetic.main.app_bar.* // need this for back button in setupToolbar
import kotlinx.android.synthetic.main.fragment_profile_widechat.*
@@ -269,7 +270,16 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
if (Constants.WIDECHAT) {
widechat_view_dim.setOnClickListener { hideUpdateAvatarOptions() }
- edit_profile_button.setOnClickListener { showToast("Edit Profile Button Clicked") }
+
+ var onClickCallback = {url: String? ->
+ edit_profile_button.setOnClickListener { view: View ->
+ view.openTabbedUrl(url)
+ }
+ edit_profile_button.setBackgroundResource(R.drawable.widechat_update_profile_button)
+ }
+
+ presenter.setUpdateUrl(getString(R.string.widechat_sso_profile_update_path), onClickCallback)
+
delete_account_button.setOnClickListener { showToast("Delete Account Button Clicked") }
} else {
view_dim.setOnClickListener { hideUpdateAvatarOptions() }
diff --git a/app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt b/app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
index a1c01b78ee..31bf1151c4 100644
--- a/app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
+++ b/app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
@@ -103,6 +103,9 @@ abstract class CheckServerPresenter constructor(
internal var isLoginFormEnabled = false
internal var isNewAccountCreationEnabled = false
+ // WIDECHAT
+ internal var widechatCustomOauthHost: String? = null
+
internal fun setupConnectionInfo(serverUrl: String) {
currentServer = serverUrl
client = factory.create(serverUrl)
@@ -200,6 +203,21 @@ abstract class CheckServerPresenter constructor(
}
}
+ // WIDECHAT
+ internal suspend fun checkForCustomOauthAccount(serverUrl: String) {
+ try {
+ val services = retryIO("settingsOauth()") {
+ client.settingsOauth().services
+ }
+
+ if (services.isNotEmpty()) {
+ checkEnabledCustomOauthAccounts(services, serverUrl)
+ }
+ } catch (exception: RocketChatException) {
+ Timber.e(exception)
+ }
+ }
+
/**
* Logout the user from the current server.
*
@@ -378,6 +396,7 @@ abstract class CheckServerPresenter constructor(
getServiceNameColor(serviceMap)
val serviceButtonColor = getServiceButtonColor(serviceMap)
+ widechatCustomOauthHost = host
if (customOauthServiceName != null &&
host != null &&
authorizePath != null &&
diff --git a/app/src/main/java/chat/rocket/android/util/extensions/View.kt b/app/src/main/java/chat/rocket/android/util/extensions/View.kt
index 55f68eb223..83e8d27e5e 100644
--- a/app/src/main/java/chat/rocket/android/util/extensions/View.kt
+++ b/app/src/main/java/chat/rocket/android/util/extensions/View.kt
@@ -15,6 +15,8 @@ fun View.openTabbedUrl(url: String?) {
val tabsbuilder = CustomTabsIntent.Builder()
tabsbuilder.setToolbarColor(ResourcesCompat.getColor(context.resources, R.color.colorPrimary, context.theme))
val customTabsIntent = tabsbuilder.build()
+ // WIDECHAT NOTE: - Use chrome if they have it.
+ customTabsIntent.intent.setPackage("com.android.chrome")
try {
customTabsIntent.launchUrl(context, uri)
} catch (ex: Exception) {
diff --git a/app/src/main/res/drawable/widechat_update_profile_button_grey.xml b/app/src/main/res/drawable/widechat_update_profile_button_grey.xml
new file mode 100644
index 0000000000..a9cd4cbbbd
--- /dev/null
+++ b/app/src/main/res/drawable/widechat_update_profile_button_grey.xml
@@ -0,0 +1,26 @@
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_profile_widechat.xml b/app/src/main/res/layout/fragment_profile_widechat.xml
index 874ad1d6c7..b9a5c3fae4 100644
--- a/app/src/main/res/layout/fragment_profile_widechat.xml
+++ b/app/src/main/res/layout/fragment_profile_widechat.xml
@@ -101,7 +101,7 @@
android:layout_marginTop="32dp"
android:layout_marginStart="@dimen/screen_edge_left_and_right_margins"
android:layout_marginEnd="@dimen/screen_edge_left_and_right_margins"
- android:background="@drawable/widechat_update_profile_button"
+ android:background="@drawable/widechat_update_profile_button_grey"
android:textColor="@color/colorWhite"
android:text="@string/edit_profile" />
diff --git a/app/src/main/res/values/defaults.xml b/app/src/main/res/values/defaults.xml
index 917829213f..c75a739c5f 100644
--- a/app/src/main/res/values/defaults.xml
+++ b/app/src/main/res/values/defaults.xml
@@ -3,9 +3,11 @@
https://
viasatconnect.com
viasatconnect.com
+ /federation/custom/ViasatConnectProfile.jsp?access_token=
viasatconnect.page.link
chat.veranda.android
-
+
+
open.rocket.chat
cloud.rocket.chat/trial
https://play.google.com/store/apps/details?id=chat.rocket.android