Skip to content

Commit b4db31f

Browse files
committed
release: SDK 1.18.3
1 parent dddf764 commit b4db31f

File tree

15 files changed

+8969
-83
lines changed

15 files changed

+8969
-83
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
7+
[*.java]
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 4
11+
continuation_indent_size = 8

Sources/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
google()
1010
}
1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:7.0.3'
12+
classpath 'com.android.tools.build:gradle:7.2.1'
1313
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.1"
1414
// NOTE: Do not place your application dependencies here; they belong
1515
// in the individual module build.gradle files

Sources/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ org.gradle.configureondemand=false
1919
android.useAndroidX=true
2020
android.enableJetifier=true
2121
gnsp.disableApplyOnlyOnRootProjectEnforcement=true
22+
kotlin.stdlib.default.dependency=false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

Sources/sdk-lint/build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
apply plugin: 'java-library'
22

3+
ext {
4+
lintVersion = '30.1.2'
5+
}
6+
37
dependencies {
4-
compileOnly 'com.android.tools.lint:lint-api:30.0.3'
5-
compileOnly 'com.android.tools.lint:lint-checks:30.0.3'
8+
compileOnly "com.android.tools.lint:lint-api:$lintVersion"
9+
compileOnly "com.android.tools.lint:lint-checks:$lintVersion"
610

711
testImplementation "junit:junit:4.12"
8-
testImplementation "com.android.tools.lint:lint:30.0.3"
9-
testImplementation "com.android.tools.lint:lint-tests:30.0.3"
10-
testImplementation "com.android.tools:testutils:30.0.3"
12+
testImplementation "com.android.tools.lint:lint:$lintVersion"
13+
testImplementation "com.android.tools.lint:lint-tests:$lintVersion"
14+
testImplementation "com.android.tools:testutils:$lintVersion"
1115
}
1216

1317

Sources/sdk/build.gradle

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43

54
def SDK_VERSION = "SDK_VERSION"
65
def ENABLE_DEBUG_LOGGER = "ENABLE_DEBUG_LOGGER"
@@ -26,7 +25,7 @@ android {
2625
minSdkVersion 15
2726
targetSdkVersion 31
2827
versionCode 1
29-
versionName "1.18.2"
28+
versionName "1.18.3"
3029
buildConfigField "String", SDK_VERSION, "\"$versionName\""
3130
buildConfigField "Integer", API_LEVEL, '40'
3231
buildConfigField "Integer", MESSAGING_API_LEVEL, '11'
@@ -62,12 +61,6 @@ android {
6261
}
6362
}
6463

65-
lintOptions {
66-
abortOnError true
67-
baseline file("lint-baseline.xml")
68-
lintConfig file("lint.xml")
69-
}
70-
7164
testOptions {
7265
execution 'ANDROIDX_TEST_ORCHESTRATOR'
7366
unitTests {
@@ -80,6 +73,18 @@ android {
8073
}
8174
}
8275
}
76+
lint {
77+
abortOnError true
78+
baseline file('lint-baseline.xml')
79+
lintConfig file('lint.xml')
80+
}
81+
82+
publishing {
83+
singleVariant("release") {
84+
withSourcesJar()
85+
withJavadocJar()
86+
}
87+
}
8388
}
8489

8590
// Prevent from having accidental kotlin in production code
@@ -91,6 +96,13 @@ afterEvaluate {
9196
}
9297
}
9398

99+
// Print the sdk version name
100+
task printVersion {
101+
doLast {
102+
println project.version
103+
}
104+
}
105+
94106
dependencies {
95107
compileOnly "com.google.android.gms:play-services-ads:$playServicesVersion"
96108
compileOnly "com.google.android.gms:play-services-gcm:$playServicesVersion"
@@ -147,7 +159,7 @@ dependencies {
147159
testImplementation "org.powermock:powermock-api-mockito2:2.0.7"
148160
testImplementation "org.powermock:powermock-classloading-xstream:2.0.7"
149161

150-
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
162+
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
151163
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_couroutines_version"
152164
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_couroutines_version"
153165
}

Sources/sdk/maven-publish.gradle

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,21 @@ if (signingFile.exists()) {
1919
}
2020
}
2121

22-
sourceSets {
23-
main {
24-
java.srcDirs += 'build/generated'
25-
}
26-
}
27-
28-
task androidJavadocs(type: Javadoc) {
29-
source = sourceSets.main.java.srcDirs
30-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
31-
options.addStringOption('Xdoclint:none', '-quiet')
32-
android.libraryVariants.all { variant ->
33-
if (variant.name == 'release') {
34-
owner.classpath += variant.getCompileClasspath()
35-
}
36-
}
37-
exclude '**/gif/README'
38-
exclude '**/R.html', '**/R.*.html', '**/index.html'
39-
}
40-
41-
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
42-
archiveClassifier.set("javadoc")
43-
from androidJavadocs.destinationDir
44-
}
45-
46-
task androidSourcesJar(type: Jar) {
47-
archiveClassifier.set("sources")
48-
from sourceSets.main.java.srcDirs
49-
}
50-
5122
nexusStaging {
5223
packageGroup = mavenGroupId
5324
}
5425

5526
publishing {
5627
publications {
57-
batchsdk(MavenPublication) {
28+
release(MavenPublication) {
5829

5930
groupId mavenGroupId
6031
artifactId mavenArtifact
6132
version android.defaultConfig.versionName
6233

63-
artifact(project.rootProject.file("../public-sdk/Batch.aar"))
64-
artifact androidJavadocsJar
65-
artifact androidSourcesJar
34+
afterEvaluate {
35+
from components.release
36+
}
6637

6738
pom {
6839
name = "Batch.com Android SDK"
@@ -210,19 +181,6 @@ publishing {
210181
url = "https://batch.com"
211182
}
212183
}
213-
214-
pom.withXml {
215-
def dependenciesNode = asNode().appendNode('dependencies')
216-
217-
// Add dependencies manually as we have only one
218-
// See : https://discuss.gradle.org/t/maven-publish-doesnt-include-dependencies-in-the-project-pom-file/8544
219-
def dependencyNode = dependenciesNode.appendNode('dependency')
220-
dependencyNode.appendNode('groupId', 'androidx.core')
221-
dependencyNode.appendNode('artifactId', 'core')
222-
dependencyNode.appendNode('version', androidXLibraryVersion)
223-
dependencyNode.appendNode('scope', 'compile')
224-
dependencyNode.appendNode('type', 'aar')
225-
}
226184
}
227185
}
228186

@@ -246,7 +204,7 @@ publishing {
246204
}
247205

248206
signing {
249-
sign publishing.publications.batchsdk
207+
sign publishing.publications.release
250208
}
251209

252210
// Do not sign if we run the publishToMavenLocal task, useful for dev

Sources/sdk/metalava.gradle

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
* We can compare a previously generated signature file with the current API using the metalavaCompareSignature task.
1111
*/
1212

13+
configurations {
14+
metalavaRuntime
15+
}
16+
17+
dependencies {
18+
metalavaRuntime 'com.android.tools.metalava:metalava:1.0.0-alpha04'
19+
}
20+
1321
/**
1422
* Recursively list all packages from a directory
1523
* The package must contains at least one .java file to be included
@@ -39,7 +47,7 @@ void getPackagesInDirectory(File rootDirectory, File directory, Set<String> pack
3947
*/
4048
List<String> getBaseMetalavaArgs() {
4149
def args = [
42-
'-cp', project.rootProject.file('../prebuilt/*'),
50+
'-cp', configurations.metalavaRuntime.asPath,
4351
'com.android.tools.metalava.Driver',
4452
'--format=v2',
4553
]
@@ -100,17 +108,24 @@ task metalavaGenerateSignature {
100108
addBaseline(signatureArgs, project.file('metalava-baseline.txt'))
101109
signatureArgs.addAll([
102110
'--source-path', android.sourceSets.main.java.srcDirs.toArray().join(':'),
103-
'--api', project.rootProject.file('../metalava-api/' + android.defaultConfig.versionName + '/api.txt')
111+
'--api', project.rootProject.file('../metalava-api/api-latest.txt')
104112
])
105113
exec {
106114
executable = 'java'
107115
args = signatureArgs
108116
}
117+
}
118+
}
109119

120+
// Generate a release metalava signature
121+
// This builds api-latest and copies it to a versioned release
122+
task("metalavaGenerateTaggedSignature", dependsOn: ["metalavaGenerateSignature"]) {
123+
doFirst {
110124
copy {
111-
from project.rootProject.file('../metalava-api/' + android.defaultConfig.versionName + '/api.txt')
112-
into project.rootProject.file('../metalava-api')
113-
rename 'api.txt', 'api-latest.txt'
125+
from project.rootProject.file('../metalava-api/api-latest.txt')
126+
into project.rootProject.file('../metalava-api/' + android.defaultConfig.versionName + '/')
127+
128+
rename 'api-latest.txt', 'api.txt'
114129
}
115130
}
116131
}

Sources/sdk/src/main/java/com/batch/android/BatchDisplayReceiptJobService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* JobService implementation of Batch Display Receipt
1515
*/
1616

17-
@RequiresApi(api = Build.VERSION_CODES.O)
17+
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
1818
public class BatchDisplayReceiptJobService extends JobService {
1919

2020
private static final String TAG = "BatchDisplayReceiptJobService";

Sources/sdk/src/main/java/com/batch/android/BatchPushNotificationPresenter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ public static void presentNotification(
377377
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
378378
userFlags = userFlags | PendingIntent.FLAG_IMMUTABLE;
379379
}
380+
//noinspection WrongConstant
380381
launchIntent.addFlags(userFlags);
381382
}
382383
}

Sources/sdk/src/main/java/com/batch/android/messaging/fragment/UniversalTemplateFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import java.io.IOException;
4141
import java.util.Locale;
4242
import java.util.Map;
43-
import org.jetbrains.annotations.NotNull;
4443

4544
/**
4645
* Universal messaging template fragment class. Extends DialogFragment so it can be displayed in its own window easily.
@@ -122,7 +121,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
122121
@Nullable
123122
@Override
124123
public View onCreateView(
125-
@NotNull LayoutInflater inflater,
124+
@NonNull LayoutInflater inflater,
126125
@Nullable ViewGroup container,
127126
@Nullable Bundle savedInstanceState
128127
) {

Sources/sdk/src/main/java/com/batch/android/messaging/view/formats/BannerView.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,30 @@ private SeparatedFlexboxLayout makeContentLayout(Map<String, String> contentStyl
193193

194194
final List<Pair<View, DOMNode>> views = new LinkedList<>();
195195

196+
// Title text view
197+
View titleTv;
198+
DOMNode titleDOMNode = new DOMNode("title");
199+
final FlexboxLayout.LayoutParams titleLp = new FlexboxLayout.LayoutParams(
200+
ViewGroup.LayoutParams.MATCH_PARENT,
201+
ViewGroup.LayoutParams.WRAP_CONTENT
202+
);
203+
titleLp.flexGrow = 1;
204+
titleLp.flexShrink = 0;
196205
if (!TextUtils.isEmpty(message.titleText)) {
197-
final TextView titleTv = new TextView(context);
198-
titleTv.setText(message.titleText);
199-
final FlexboxLayout.LayoutParams titleLp = new FlexboxLayout.LayoutParams(
200-
ViewGroup.LayoutParams.MATCH_PARENT,
201-
ViewGroup.LayoutParams.WRAP_CONTENT
202-
);
203-
titleLp.flexGrow = 1;
204-
titleLp.flexShrink = 0;
205-
titleTv.setLayoutParams(titleLp);
206-
views.add(new Pair<>(titleTv, new DOMNode("title", "text")));
206+
titleTv = new TextView(context);
207+
((TextView) titleTv).setText(message.titleText);
208+
titleDOMNode.classes.add("text");
209+
} else {
210+
// Insert a dummy view if there is no title, as the text view is used as an anchor
211+
// for layouting some styles.
212+
// We could improve this using container views/reworking the styles, but this
213+
// allows special styling to work without issue.
214+
titleTv = new View(context);
215+
titleLp.height = 0;
216+
titleLp.maxHeight = 0;
207217
}
218+
titleTv.setLayoutParams(titleLp);
219+
views.add(new Pair<>(titleTv, titleDOMNode));
208220

209221
// Use an xml, as android:scrollbars is not doable in pure code
210222
final TextView bodyTv = (TextView) inflater.inflate(

Sources/sdk/src/main/java/com/batch/android/query/response/LocalCampaignsResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.batch.android.query.QueryType;
88
import java.util.ArrayList;
99
import java.util.List;
10-
import org.jetbrains.annotations.NotNull;
1110

1211
/**
1312
* Response for {@link LocalCampaignsQuery}
@@ -112,7 +111,7 @@ public void setMessage(String message) {
112111
this.message = message;
113112
}
114113

115-
@NotNull
114+
@NonNull
116115
@Override
117116
public String toString() {
118117
return "Error{" + "code=" + code + ", message='" + message + '\'' + '}';

proguard-mappings/1.18.3/checksum.sha

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b47b05f7e625d823822e512ef0836e8339d68c60 public-sdk/Batch.aar

0 commit comments

Comments
 (0)