Skip to content

Commit 3028698

Browse files
authored
Fix checkbox type value formatting (#238)
We should be expecting an array of JSON objects, with `label` and `value` in each object.
1 parent 846dbd7 commit 3028698

34 files changed

Lines changed: 303 additions & 176 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push]
55
jobs:
66
test:
77
name: Run unit tests
8-
runs-on: ubuntu-18.04
8+
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v1
1111
- name: Setup JDK 11

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ This SDK uses the following libraries as dependencies:
4242
### Gradle
4343
```groovy
4444
// Required for Connect API integration.
45-
implementation "com.ifttt:connect-api:2.5.3"
45+
implementation "com.ifttt:connect-api:2.5.4"
4646
// Connect Button UI.
47-
implementation "com.ifttt:connect-button:2.5.3"
47+
implementation "com.ifttt:connect-button:2.5.4"
4848
```
4949

5050
## Usage

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ apply plugin: 'kotlin-android'
33

44
android {
55
compileSdkVersion rootProject.compileSdkVersion
6-
buildToolsVersion rootProject.buildToolsVersion
76

87
defaultConfig {
98
applicationId "com.ifttt.groceryexpress"
@@ -24,6 +23,7 @@ android {
2423
sourceCompatibility JavaVersion.VERSION_11
2524
targetCompatibility JavaVersion.VERSION_11
2625
}
26+
namespace 'com.ifttt.groceryexpress'
2727
}
2828

2929
dependencies {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.ifttt.groceryexpress">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<uses-permission android:name="android.permission.INTERNET"/>
54
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = '1.6.10'
3+
ext.kotlin_version = '1.6.21'
44
repositories {
55
google()
66
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.0.4'
9+
classpath 'com.android.tools.build:gradle:7.4.2'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
@@ -34,7 +34,7 @@ task clean(type: Delete) {
3434

3535
ext {
3636
libVersion = '2.5.3'
37-
okHttpVersion = '4.9.0'
37+
okHttpVersion = '4.10.0'
3838
retrofitVersion = '2.9.0'
3939
moshiVersion = '1.8.0'
4040
workManagerVersion = '2.7.1'

connect-api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion rootProject.compileSdkVersion
5-
buildToolsVersion rootProject.buildToolsVersion
65

76
defaultConfig {
87
minSdkVersion rootProject.minSdkVersion
@@ -22,6 +21,7 @@ android {
2221
sourceCompatibility JavaVersion.VERSION_1_8
2322
targetCompatibility JavaVersion.VERSION_1_8
2423
}
24+
namespace 'com.ifttt.connect.api'
2525
}
2626

2727
dependencies {

connect-api/publish.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ afterEvaluate {
7777
name = 'Zhe Lu'
7878
email = 'zhe@ifttt.com'
7979
}
80-
developer {
81-
id = 'priyaashah'
82-
name = 'Priya Shah'
83-
email = 'priya@ifttt.com'
84-
}
8580
}
8681
scm {
8782
connection = gitUrl
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.ifttt.connect.api" />
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.ifttt.connect.api;
2+
3+
import android.os.Parcel;
4+
import android.os.Parcelable;
5+
6+
import java.util.List;
7+
import java.util.Objects;
8+
9+
/**
10+
* Data structure representing the checkbox field values.
11+
*/
12+
public final class CheckBoxFieldValue implements Parcelable {
13+
14+
public final List<CheckBoxValue> value;
15+
16+
public CheckBoxFieldValue(List<CheckBoxValue> value) {
17+
this.value = value;
18+
}
19+
20+
protected CheckBoxFieldValue(Parcel in) {
21+
value = in.createTypedArrayList(CheckBoxValue.CREATOR);
22+
}
23+
24+
public static final Creator<CheckBoxFieldValue> CREATOR = new Creator<CheckBoxFieldValue>() {
25+
@Override
26+
public CheckBoxFieldValue createFromParcel(Parcel in) {
27+
return new CheckBoxFieldValue(in);
28+
}
29+
30+
@Override
31+
public CheckBoxFieldValue[] newArray(int size) {
32+
return new CheckBoxFieldValue[size];
33+
}
34+
};
35+
36+
@Override
37+
public boolean equals(Object o) {
38+
if (this == o) return true;
39+
if (o == null || getClass() != o.getClass()) return false;
40+
CheckBoxFieldValue that = (CheckBoxFieldValue) o;
41+
return Objects.equals(value, that.value);
42+
}
43+
44+
@Override
45+
public int hashCode() {
46+
return Objects.hash(value);
47+
}
48+
49+
@Override
50+
public int describeContents() {
51+
return 0;
52+
}
53+
54+
@Override
55+
public void writeToParcel(Parcel dest, int flags) {
56+
dest.writeTypedList(value);
57+
}
58+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.ifttt.connect.api;
2+
3+
import android.os.Parcel;
4+
import android.os.Parcelable;
5+
6+
import java.util.Objects;
7+
8+
public final class CheckBoxValue implements Parcelable {
9+
public final String label;
10+
public final String value;
11+
12+
public CheckBoxValue(String label, String value) {
13+
this.label = label;
14+
this.value = value;
15+
}
16+
17+
protected CheckBoxValue(Parcel in) {
18+
label = in.readString();
19+
value = in.readString();
20+
}
21+
22+
public static final Creator<CheckBoxValue> CREATOR = new Creator<CheckBoxValue>() {
23+
@Override
24+
public CheckBoxValue createFromParcel(Parcel in) {
25+
return new CheckBoxValue(in);
26+
}
27+
28+
@Override
29+
public CheckBoxValue[] newArray(int size) {
30+
return new CheckBoxValue[size];
31+
}
32+
};
33+
34+
@Override
35+
public boolean equals(Object o) {
36+
if (this == o) return true;
37+
if (o == null || getClass() != o.getClass()) return false;
38+
CheckBoxValue that = (CheckBoxValue) o;
39+
return Objects.equals(label, that.label) && Objects.equals(value, that.value);
40+
}
41+
42+
@Override
43+
public int hashCode() {
44+
return Objects.hash(label, value);
45+
}
46+
47+
@Override
48+
public int describeContents() {
49+
return 0;
50+
}
51+
52+
@Override
53+
public void writeToParcel(Parcel dest, int flags) {
54+
dest.writeString(label);
55+
dest.writeString(value);
56+
}
57+
}

0 commit comments

Comments
 (0)