-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update README.md for
autofill
usage.
- Remove `autofill-no-op` component. Update Autofill component: - Create `AutofillInitializer` to automatically initialize the library. - Remove AutofillService.Builder and split AutofillProcessor. - Add logs to json read config. - Add `matchAnyField` flag. - Update `autofill` to `0.2.0`.
- Loading branch information
1 parent
91fb7d3
commit cd6ebe7
Showing
17 changed files
with
286 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,44 +38,72 @@ Autofill data that suitable with inflated form inputs are shown in the selection | |
</table> | ||
|
||
### Usage | ||
```kotlin | ||
AutofillService.Builder(this) | ||
.withFilePath("autofill.json") | ||
.build() | ||
Autofill will automatically started if added as dependency. It checks `autofill.json` file on assets directory of the | ||
project. If you want to disable Autofill to be initialized, you can modify `AndroidManifest.xml` like below on `main` or | ||
desired flavor/variant. | ||
|
||
```xml | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application> | ||
|
||
<provider | ||
android:name="androidx.startup.InitializationProvider" | ||
android:authorities="${applicationId}.androidx-startup" | ||
tools:node="remove"> | ||
|
||
<meta-data | ||
android:name="com.trendyol.android.devtools.autofillservice.AutofillInitializer" | ||
android:value="androidx.startup" /> | ||
</provider> | ||
</application> | ||
</manifest> | ||
``` | ||
|
||
### Configuration | ||
Configuration Json file can be located in `/debug/assets` folder. You can define autofill data by following this structure. | ||
You should also note that the order of the defined form field resource id's and order of input values must match. | ||
Configuration Json file can be located in `/[variant/flavor or main]/assets` folder. You can define autofill data by | ||
following this structure. You should also note that the order of the defined form field resource id's and order of | ||
input values must match. | ||
|
||
```json | ||
{ | ||
"forms": [ | ||
{ | ||
"fields": ["inputEmail", "inputPassword"], // Form input resource id's | ||
"fields": ["inputEmail", "inputPassword"], | ||
"matchAnyField": true, | ||
"categories": { | ||
"Temporary Users": [ | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] } | ||
{ "description": "Temporary test user.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Temporary tool user.", "values": ["[email protected]", "123456"] } | ||
], | ||
"Test Users": [ | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Has more then one order history.", "values": ["[email protected]", "123456"] } | ||
{ "description": "Test regular user.", "values": ["[email protected]", "123456"] }, | ||
{ "description": "Test tool user.", "values": ["[email protected]", "123456"] } | ||
] | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
- `forms` object declares the forms that will be cheched on activity/fragment screen. | ||
- `fields` are input view ids. | ||
- `matchAnyField` is optional flag to enable the feature whether if all `fields` should be exist or not. Default is `false`. | ||
- `categories` declares inputs, you can provide multiple category and multiple input values. | ||
|
||
### Setup | ||
```gradle | ||
"com.trendyol.android.devtools:autofill-service:$version" | ||
"com.trendyol.android.devtools:autofill-service-no-op:$version" | ||
Since Autofill not requires any initialization code, all you need to add the dependency on desired variant/flavor like | ||
below. | ||
|
||
```kotlin | ||
dependencies { | ||
|
||
debugImplementation("com.trendyol.android.devtools:autofill-service:$version") | ||
} | ||
``` | ||
|
||
![Maven Central](https://img.shields.io/maven-central/v/com.trendyol.android.devtools/autofill-service?color=%2373c248) | ||
|
||
## Analytics Logger | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...vice-no-op/src/main/java/com/trendyol/android/devtools/autofillservice/AutofillService.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application> | ||
|
||
<provider | ||
android:name="androidx.startup.InitializationProvider" | ||
android:authorities="${applicationId}.androidx-startup" | ||
tools:node="merge"> | ||
|
||
<meta-data | ||
android:name="com.trendyol.android.devtools.autofillservice.AutofillInitializer" | ||
android:value="androidx.startup" /> | ||
</provider> | ||
</application> | ||
</manifest> |
18 changes: 18 additions & 0 deletions
18
...ervice/src/main/java/com/trendyol/android/devtools/autofillservice/AutofillInitializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.trendyol.android.devtools.autofillservice | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.startup.Initializer | ||
import com.trendyol.android.devtools.autofillservice.internal.AutofillProcessor | ||
|
||
class AutofillInitializer : Initializer<Unit> { | ||
|
||
override fun create(context: Context) { | ||
AutofillProcessor( | ||
application = context.applicationContext as Application, | ||
filePath = "autofill.json" | ||
) | ||
} | ||
|
||
override fun dependencies(): MutableList<Class<out Initializer<*>>> = mutableListOf() | ||
} |
Oops, something went wrong.