Skip to content

Commit d923389

Browse files
puneet-pdxSoren Rothsorenoidhud10837eri9000
authored
200.3.0 Release - merge v.next into main (#224)
* enable the publication of artifacts which include the build number in the version. * bump version * add lambda to authenticator * add util methods * add lambda to DialogAuthenticator * cherry pick to v.next (#103) * use launchCustomTabs in OAuthUserSignInActivity * fix issue with pressing cancel button * Merge pull request #104 from Esri/sorenoid/update-auth-readme use updated name of the auth dependency in README * reinstate onWindowFocusChanged in OAuthUserSignInActivity * use didLaunch logic in OAuthAuthenticator for lambda scenario as well * rm context receivers * remove ontopresumedactivitychanged * Trigger onFacilityChanged along with the levelChanged when selectedLevelId is programmatically updated (#111) * reorganize OAuthAuthenticator * update readme * Don't suggest singleInstance * add doc to method * eof newline * move composable to activity scope * mv viewmodel definition to class level * mv Authenticator definition to setContent block * pass vm as argument to auth app * fix readme numbering * add note about redirect uri * update doc for new param * simplify side effect * Address pr comments * rename Extensions file * rework OAuthAuthenticator to move launcher * update readme * Deletes WebView's session if `preferPrivateWebBrowserSession` is enabled (#119) * added geo composable map * Update gradle * Delete SceneComposable.kt * Revert "Delete SceneComposable.kt" This reverts commit 5f9b41e. * upgrades to match the API's gradle versions so we can easily include the API as a composite build. Also clears some false warnings in gradle files * renamed to module geo-compose * fixes for displaying FloorFilter facilitySelector when Sites are not present in the map (#153) * Create t9nmanifest.txt (#167) * removed module and microapp (#208) * Update gradle.properties (#211) * Update build.gradle.kts (#212) * updates client id and redirect Uri (#216) * Take out build numbers for publishing (#219) * update dependency section of readme for 200.3.0 (#220) --------- Co-authored-by: Soren Roth <sor10874@esri.com> Co-authored-by: Soren Roth <sroth@esri.com> Co-authored-by: Hudson Miears <hud10837@esri.com> Co-authored-by: hud10837 <hmiears@esri.com> Co-authored-by: Erick Lopez Solis <erick_solis@esri.com> Co-authored-by: Shubham Sharma <shubhamsharma@esri.com> Co-authored-by: Rama Chintapalli <rchintapalli@esri.com> Co-authored-by: Gunther Heppner <gheppner@esri.com>
1 parent 980dfa3 commit d923389

File tree

21 files changed

+286
-158
lines changed

21 files changed

+286
-158
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ The *ArcGIS Maps SDK for Kotlin Toolkit* has a *Minimum SDK* version of *26*, me
2525
The *ArcGIS Maps SDK for Kotlin Toolkit* is released with a "bill of materials" (`BOM`). The releasable BOM is versioned and represents a set of versions of the toolkit components which are compatible with one another. You may specify dependencies as follows
2626

2727
```
28-
implementation(platform('com.esri:arcgis-maps-kotlin-toolkit-bom:200.2.0'))
28+
implementation(platform('com.esri:arcgis-maps-kotlin-toolkit-bom:200.3.0'))
2929
implementation('com.esri:arcgis-maps-kotlin-toolkit-authentication')
3030
implementation('com.esri:arcgis-maps-kotlin-toolkit-compass')
31+
implementation('com.esri:arcgis-maps-kotlin-toolkit-indoors')
3132
```
3233

3334
The template and TemplateApp modules are for bootstrapping new modules.

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@
1818

1919
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2020
plugins {
21-
@Suppress("DSL_SCOPE_VIOLATION") // fixed in gradle 8.1
2221
alias(libs.plugins.android.application) apply false
23-
@Suppress("DSL_SCOPE_VIOLATION")
2422
alias(libs.plugins.android.library) apply false
25-
@Suppress("DSL_SCOPE_VIOLATION")
2623
alias(libs.plugins.kotlin.android) apply false
27-
@Suppress("DSL_SCOPE_VIOLATION")
2824
alias(libs.plugins.gradle.secrets) apply false
29-
@Suppress("DSL_SCOPE_VIOLATION")
3025
alias(libs.plugins.kotlin.serialization) apply false
3126
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ artifactoryUsername=""
4646
artifactoryPassword=""
4747
# these numbers will define the artifact version on artifactory
4848
# and are overridden by the jenkins command line in the daily build
49-
versionNumber=200.2.0
49+
versionNumber=200.3.0
5050
buildNumber=0000-snapshot
5151
#set this flag to `true` to ignore the build number when publishing. This
5252
# will publish an artifact with a build number like "..:200.2.0" as opposed to "...:200.2.0-3963
5353
ignoreBuildNumber=true
5454
# these versions define the dependency of the ArcGIS Maps SDK for Kotlin dependency
5555
# and are generally not overridden at the command line unless a special build is requested.
56-
sdkVersionNumber=200.2.0
56+
sdkVersionNumber=200.3.0
5757
sdkBuildNumber=
5858

5959

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
androidGradlePlugin = "8.0.0"
2+
androidGradlePlugin = "8.1.1"
33
androidxActivity = "1.5.1"
44
androidXBrowser = "1.5.0"
55
androidxCompose = "1.3.0"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
#Thu May 04 21:42:41 PDT 2023
2020
distributionBase=GRADLE_USER_HOME
2121
distributionPath=wrapper/dists
22-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
22+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
2323
zipStoreBase=GRADLE_USER_HOME
2424
zipStorePath=wrapper/dists

microapps/AuthenticationApp/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<data
5858
android:host="auth"
59-
android:scheme="my-ags-app" />
59+
android:scheme="kotlin-toolkit-authenticator-microapp" />
6060
</intent-filter>
6161
</activity>
6262
</application>

microapps/AuthenticationApp/app/src/main/java/com/arcgismaps/toolkit/authenticationapp/AuthenticationAppViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class AuthenticationAppViewModel(application: Application) : AndroidViewModel(ap
4343
arcGISUrl,
4444
// This client ID is for demo purposes only. For use of the Authenticator in your own app,
4545
// create your own client ID. For more info see: https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/register-your-application/
46-
"lgAdHkYZYlwwfAhC",
47-
"my-ags-app://auth"
46+
"aink3YEhnDNBBcJq",
47+
"kotlin-toolkit-authenticator-microapp://auth"
4848
)
4949

5050
private val _infoText: MutableStateFlow<String> = MutableStateFlow(startInfoText)

microapps/AuthenticationApp/app/src/main/java/com/arcgismaps/toolkit/authenticationapp/MainActivity.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
package com.arcgismaps.toolkit.authenticationapp
2020

21-
import android.app.Application
2221
import android.os.Bundle
2322
import androidx.activity.ComponentActivity
2423
import androidx.activity.compose.setContent
24+
import androidx.activity.viewModels
2525
import androidx.compose.foundation.layout.Arrangement
2626
import androidx.compose.foundation.layout.Box
2727
import androidx.compose.foundation.layout.Column
@@ -44,36 +44,32 @@ import androidx.compose.runtime.collectAsState
4444
import androidx.compose.ui.Alignment
4545
import androidx.compose.ui.ExperimentalComposeUiApi
4646
import androidx.compose.ui.Modifier
47-
import androidx.compose.ui.platform.LocalContext
4847
import androidx.compose.ui.platform.LocalFocusManager
4948
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
5049
import androidx.compose.ui.text.input.ImeAction
5150
import androidx.compose.ui.text.input.KeyboardType
5251
import androidx.compose.ui.unit.dp
53-
import androidx.lifecycle.viewmodel.compose.viewModel
5452
import com.arcgismaps.ArcGISEnvironment
55-
import com.arcgismaps.toolkit.authentication.AuthenticatorState
5653
import com.arcgismaps.toolkit.authentication.DialogAuthenticator
5754
import com.arcgismaps.toolkit.authenticationapp.ui.theme.AuthenticationAppTheme
5855

5956
class MainActivity : ComponentActivity() {
57+
private val authenticationAppViewModel: AuthenticationAppViewModel by viewModels()
6058
override fun onCreate(savedInstanceState: Bundle?) {
6159
super.onCreate(savedInstanceState)
6260
// Application context must be set for client certificate authentication.
6361
ArcGISEnvironment.applicationContext = applicationContext
6462
setContent {
6563
AuthenticationAppTheme {
66-
AuthenticationApp()
64+
AuthenticationApp(authenticationAppViewModel)
65+
DialogAuthenticator(authenticatorState = authenticationAppViewModel.authenticatorState)
6766
}
6867
}
6968
}
7069
}
7170

7271
@Composable
73-
private fun AuthenticationApp() {
74-
val application = LocalContext.current.applicationContext as Application
75-
val authenticationAppViewModel = viewModel { AuthenticationAppViewModel(application) }
76-
val authenticatorState: AuthenticatorState = authenticationAppViewModel.authenticatorState
72+
private fun AuthenticationApp(authenticationAppViewModel: AuthenticationAppViewModel) {
7773
Column {
7874
val infoText = authenticationAppViewModel.infoText.collectAsState().value
7975
val isLoading = authenticationAppViewModel.isLoading.collectAsState().value
@@ -87,7 +83,6 @@ private fun AuthenticationApp() {
8783
)
8884
InfoScreen(text = infoText, isLoading = isLoading)
8985
}
90-
DialogAuthenticator(authenticatorState = authenticatorState)
9186
}
9287

9388
/**

t9nmanifest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
toolkit/authentication/src/main/res/values/strings.xml
2+
toolkit/indoors/src/main/res/values/strings.xml

toolkit/authentication/README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ class MyAppViewModel(application: Application) : AndroidViewModel(application),
8484
}
8585
```
8686

87-
### Intercepting OAuth Sign-in Redirects
87+
### Intercepting OAuth Sign-in
8888

8989
The `Authenticator` launches a Custom Tab when an OAuth challenge is issued. When the Custom Tab completes with a redirect url, it is received by the `OAuthUserSignInActivity` that is declared in your app's manifest via its intent filter.
9090

91-
If you want to intercept this redirect before allowing the sign-in to complete, you can do that with the following steps:
91+
If you want to launch a Custom Tab from your own app's activity, these steps will allow you to do that:
9292

93-
1. Remove the `intent-filter` from the `OAuthUserSignInActivity` in your app's manifest and put it on the activity that you wish to receive the redirect intent:
93+
1. Remove the `OAuthUserSignInActivity` in your app's manifest and put its intent filter on the activity that you wish to receive the redirect intent:
9494

9595
```xml
9696
<activity
@@ -114,35 +114,36 @@ If you want to intercept this redirect before allowing the sign-in to complete,
114114
android:scheme="my-ags-app" />
115115
</intent-filter>
116116
</activity>
117+
```
117118

118-
<activity
119-
android:name="com.arcgismaps.toolkit.authentication.OAuthUserSignInActivity"
120-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
121-
android:exported="true"
122-
android:launchMode="singleTop" >
123-
</activity>
119+
2. Call `launchCustomTabs` in the lambda `onPendingOAuthUserSignIn` of the `Authenticator`, passing in the pending `OAuthUserSignIn`:
120+
121+
```kotlin
122+
DialogAuthenticator(authenticatorState = authenticatorState) { pendingSignIn ->
123+
launchCustomTabs(pendingSignIn)
124+
}
124125
```
125126

126-
2. Handle the redirect in your app's activity:
127+
3. Handle the redirect in your app activity's `onNewIntent` and `onResume` overrides:
128+
129+
Note: You can check if the `intent` was caused by an OAuth redirect because the `intent.data.toString()` will start with your OAuth configuration's redirect URI.
127130

128131
```kotlin
129-
override fun onCreate(savedInstanceState: Bundle?) {
130-
super.onCreate(savedInstanceState)
131-
// Handle OAuth redirect intents by checking the intent.data
132-
intent?.data?.let { uri ->
133-
val uriString = uri.toString()
134-
if (uriString.startsWith("my-ags-app")) {
135-
// Do whatever business logic your app requires
136-
val newIntent = Intent(this, OAuthUserSignInActivity::class.java).apply {
137-
data = uri
138-
}
139-
startActivity(newIntent)
140-
}
141-
}
132+
override fun onNewIntent(intent: Intent?) {
133+
super.onNewIntent(intent)
134+
// This gets called first when OAuth redirects back to the app with a successful or cancelled
135+
// sign-in.
136+
authenticationAppViewModel.authenticatorState.completeOAuthSignIn(intent)
137+
}
138+
139+
override fun onResume() {
140+
super.onResume()
141+
// This gets called when the Custom Tab is closed using the close button or the phone's back button.
142+
authenticationAppViewModel.authenticatorState.completeOAuthSignIn(intent)
142143
}
143144
```
144145

145-
Please note that the `OAuthUserSignInActivity` must have a `launchMode` of either `singleTop` or `singleInstance` for OAuth authentication to work.
146+
Please note that your app's activity must have a `launchMode` of `singleTop` for OAuth authentication to work.
146147

147148
### Launch OAuth Prompts in Incognito Mode
148149

0 commit comments

Comments
 (0)