Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ subprojects {
if (file.exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}
testInstrumentationRunnerArgument "test.stitch.baseURL", properties.getProperty("test.stitch.baseURL", "http://10.0.2.2:9090")
testInstrumentationRunnerArgument "test.stitch.baseURL",
properties.getProperty("test.stitch.baseURL", "http://10.0.2.2:9090")
}
lintOptions {
disable 'InvalidPackage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
* </p><p>
* User login is possible with the {@link StitchAuth} from {@link getAuth}.
* </p><p>
* Use {@link callFunction} to call <a href="https://docs.mongodb.com/stitch/functions/" target=".">Stitch Functions</a>.
* Use {@link callFunction} to call
* <a href="https://docs.mongodb.com/stitch/functions/" target=".">Stitch Functions</a>.
* </p><p>
* This class can also access different <a href="https://docs.mongodb.com/stitch/services/" target=".">services</a>
* like local and remote MongoDB, AWS, and HTTP. Use the {@link com.mongodb.stitch.android.services.mongodb.remote.RemoteMongoClient}
* This class can also access different
* <a href="https://docs.mongodb.com/stitch/services/" target=".">services</a>
* like local and remote MongoDB, AWS, and HTTP.
* Use the {@link com.mongodb.stitch.android.services.mongodb.remote.RemoteMongoClient}
* service via {@link getServiceClient} for reading and writing on a remote database.
* </p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
/**
* StitchAuth manages authentication for any Stitch based client.
* <p>
* You can access the StitchAuth instance of the {@link com.mongodb.stitch.android.core.StitchAppClient} with
* You can access the StitchAuth instance of the
* {@link com.mongodb.stitch.android.core.StitchAppClient} with
* {@link com.mongodb.stitch.android.core.StitchAppClient#getAuth()}.
* </p><p>
* This class handles login with various <a href="https://docs.mongodb.com/stitch/authentication/providers/" target=".">
* authentication providers</a> using {@link StitchCredential}s with {@link loginWithCredential}.
* This class handles login with various
* <a href="https://docs.mongodb.com/stitch/authentication/providers/" target=".">
* authentication providers</a> using {@link StitchCredential}s with {@link #loginWithCredential}.
* </p><p>
* Once logged in, you can retrieve the active {@link StitchUser} with {@link getUser},
* switch the active user with {@link switchToUserWithId}, {@link logout}, and remove users
* with {@link removeUserWithId}.
* Once logged in, you can retrieve the active {@link StitchUser} with {@link #getUser},
* switch the active user with {@link #switchToUserWithId}, {@link #logout}, and remove users
* with {@link #removeUserWithId}.
* </p>
* <h3>Working with Multiple User Accounts</h3>
* <p>
Expand All @@ -44,13 +46,17 @@
* switch the active user to be any other logged in user at any time. This allows users to
* quickly switch between logged in accounts on a device.
* </p><p>
* When a user is logged out, they remain on the device and are returned in the {@link listUsers} list.
* To log in again, another {@link loginWithCredential} call needs to be made. To remove a user from
* the device, use {@link removeUserWithId}.
* When a user is logged out, they remain on the device and are returned in the
* {@link #listUsers} list.
* To log in again, another {@link #loginWithCredential} call needs to be made.
* To remove a user from
* the device, use {@link #removeUserWithId}.
* </p><p>
* The following diagram explains the state of user accounts in your app when different events occur:
* The following diagram explains the state of user accounts in your app when different
* events occur:
* </p>
* <img src="https://docs.mongodb.com/stitch/_images/multi-user.png" alt="Stitch User state diagram" >
* <img src="https://docs.mongodb.com/stitch/_images/multi-user.png"
* alt="Stitch User state diagram" >
*
* @see com.mongodb.stitch.android.core.StitchAppClient
* @see StitchUser
Expand Down Expand Up @@ -86,10 +92,10 @@ <T> T getProviderClient(
* of the active user. If there was already an active user, that user becomes inactive but
* still logged in.
* </p>
* @see logout
* @see logoutUserWithId
* @see switchToUserWithId
* @see removeUserWithId
* @see #logout
* @see #logoutUserWithId
* @see #switchToUserWithId
* @see #removeUserWithId
*
* @param credential the credentials of the user to log in.
* @return a {@link Task} containing user associated with the credentials if log in is successful.
Expand All @@ -99,12 +105,12 @@ <T> T getProviderClient(
/**
* Logs out the active user.
* <p>
* To log out an inactive user, use {@link logoutUserWithId}.
* To log out an inactive user, use {@link #logoutUserWithId}.
* </p><p>
* Except for anonymous users, logged out users remain on
* the device and will be listed in the result of {@link listUsers}.
* To log in again, {@link loginWithCredential} must be used.
* To log out and remove the active user, use {@link removeUser}.
* the device and will be listed in the result of {@link #listUsers}.
* To log in again, {@link #loginWithCredential} must be used.
* To log out and remove the active user, use {@link #removeUser}.
* </p><p>
* Anonymous users are deleted immediately after logging out.
* </p>
Expand All @@ -117,9 +123,9 @@ <T> T getProviderClient(
* Throws an exception if the user was not found.
* <p>
* Except for anonymous users, logged out users remain on
* the device and will be listed in the result of {@link listUsers}.
* To log in again, {@link loginWithCredential} must be used.
* To remove a user from the list, use {@link removeUserWithId}.
* the device and will be listed in the result of {@link #listUsers}.
* To log in again, {@link #loginWithCredential} must be used.
* To remove a user from the list, use {@link #removeUserWithId}.
* </p><p>
* Anonymous users are deleted immediately after logging out.
* </p>
Expand All @@ -131,11 +137,11 @@ <T> T getProviderClient(
/**
* Logs out and removes the active user.
* <p>
* To remove an inactive user, see {@link removeUserWithId}.
* To remove an inactive user, see {@link #removeUserWithId}.
* </p><p>
* Removing a user means removing it from this device,
* i.e. removing it from the list of users returned by
* {@link listUsers}.
* {@link #listUsers}.
* </p>
* @return a {@link Task} completing when logged out.
*/
Expand All @@ -154,8 +160,8 @@ <T> T getProviderClient(
* <p>
* Note: even if there are other users who are logged in,
* this will return false if there is no <i>active</i> user.
* A user becomes the active user upon {@link loginWithCredential}.
* See {@link listUsers}.
* A user becomes the active user upon {@link #loginWithCredential}.
* See {@link #listUsers}.
* </p>
*
* @return whether there's a currently active user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ public interface StitchAuthListener {
* <ul>
* <li>When a user logs in.</li>
* <li>When a user logs out.</li>
* <li>When a user is linked to another identity, i.e. with {@link StitchUser#linkWithCredential}.</li>
* <li>When a listener is registered. This is to handle the case where during registration an event happens
* <li>When a user is linked to another identity, i.e. with
* {@link StitchUser#linkWithCredential}.</li>
* <li>When a listener is registered.
* This is to handle the case where during registration an event happens
* that the registerer would otherwise miss out on.</li>
* <li>When switching active users, e.g. with {@link StitchAuth#switchToUserWithId} or when another user logs in.</li>
* <li>When switching active users, e.g. with {@link StitchAuth#switchToUserWithId}
* or when another user logs in.</li>
* </ul>
*
* @param auth the instance of {@link StitchAuth} where the event happened. It should be used to
Expand Down Expand Up @@ -84,7 +87,8 @@ default void onUserLoggedIn(final StitchAuth auth,
}

/**
* Called whenever a user is linked to a new identity, as in {@link StitchUser#linkWithCredential}.
* Called whenever a user is linked to a new identity, as in
* {@link StitchUser#linkWithCredential}.
*
* @param auth The instance of {@link StitchAuth} where the user was linked.
* It can be used to infer the current state of authentication.
Expand Down Expand Up @@ -114,8 +118,8 @@ default void onUserLoggedOut(final StitchAuth auth, final StitchUser loggedOutUs

/**
* Called whenever the active user changes.
* <p>
* This may be due to a call to:
*
* <p>This may be due to a call to:
* <ul>
* <li>{@link StitchAuth#loginWithCredential}</li>
* <li>{@link StitchAuth#switchToUserWithId}</li>
Expand Down
13 changes: 13 additions & 0 deletions android/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
14 changes: 14 additions & 0 deletions android/examples/stress-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
apply plugin: 'com.android.application'
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'jacoco-android'
apply plugin: 'kotlin-android'

buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'digital.wup:android-maven-publish:3.3.0'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
}
}

android {
compileSdkVersion target_api
defaultConfig {
multiDexEnabled true
minSdkVersion min_api
targetSdkVersion target_api
}

buildTypes {
debug {
minifyEnabled false
}
}

}

dependencies {
Expand All @@ -25,4 +35,8 @@ dependencies {
implementation "com.android.support:appcompat-v7:${support_library_version}"
implementation "com.android.support:recyclerview-v7:${support_library_version}"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1"


}
5 changes: 3 additions & 2 deletions android/examples/stress-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mongodb.stitch.android.examples.stresstests">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Loading