Skip to content

Commit 09ce15d

Browse files
Merge pull request #27 from comapi/dev
Support for push deep links
2 parents d026f8c + 1ca7f61 commit 09ce15d

File tree

82 files changed

+1471
-364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1471
-364
lines changed

COMAPI/build.gradle

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,29 @@
22

33
buildscript {
44
repositories {
5-
jcenter()
5+
google()
66
mavenCentral()
77
maven {
8-
url 'https://maven.google.com/'
9-
name 'Google'
8+
url "https://plugins.gradle.org/m2/"
109
}
1110
}
1211
dependencies {
13-
14-
classpath 'com.android.tools.build:gradle:3.2.1'
15-
16-
classpath 'com.google.gms:google-services:4.0.1'
17-
18-
// For test coverage
19-
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3"
20-
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1'
21-
22-
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
12+
classpath 'com.android.tools.build:gradle:4.2.2'
13+
classpath 'com.google.gms:google-services:4.3.10'
14+
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
2315
}
2416
}
2517

2618
allprojects {
2719
repositories {
28-
jcenter()
20+
google()
2921
mavenCentral()
30-
maven {
31-
url 'http://clojars.org/repo'
32-
}
33-
maven {
34-
url 'https://maven.google.com/'
35-
name 'Google'
36-
}
3722
}
3823
}
3924

4025
task clean(type: Delete) {
4126
delete rootProject.buildDir
42-
}
27+
}
28+
29+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
30+
apply from: "${rootDir}/scripts/publish-root.gradle"

COMAPI/foundation/build.gradle

Lines changed: 31 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
apply plugin: 'com.android.library'
2-
apply from: 'version.gradle'
3-
apply from: 'code_coverage.gradle'
42

53
android {
6-
compileSdkVersion 28
7-
buildToolsVersion '28.0.3'
4+
compileSdkVersion 30
5+
buildToolsVersion '30.0.3'
86

97
defaultConfig {
108
minSdkVersion 16
11-
targetSdkVersion 28
12-
versionCode 3
13-
versionName foundationVersion
14-
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
9+
targetSdkVersion 30
1510
}
1611
buildTypes {
1712
release {
@@ -25,171 +20,55 @@ android {
2520
testCoverageEnabled = false
2621
}
2722
}
28-
lintOptions {
29-
disable 'InvalidPackage'
30-
disable 'AppLinksAutoVerifyError'
31-
abortOnError false
32-
}
3323
compileOptions {
3424
sourceCompatibility JavaVersion.VERSION_1_8
3525
targetCompatibility JavaVersion.VERSION_1_8
3626
}
27+
lintOptions {
28+
abortOnError false
29+
}
30+
testOptions {
31+
unitTests {
32+
includeAndroidResources = true
33+
}
34+
}
3735
}
3836

3937
dependencies {
4038
implementation fileTree(include: ['*.jar'], dir: 'libs')
4139

4240
/* testing */
43-
testImplementation 'junit:junit:4.12'
44-
androidTestImplementation 'junit:junit:4.12'
45-
testImplementation 'org.robolectric:robolectric:3.4.2'
41+
testImplementation 'junit:junit:4.13.2'
42+
androidTestImplementation 'junit:junit:4.13.2'
43+
testImplementation 'org.robolectric:robolectric:4.8.1'
4644
testImplementation 'org.robolectric:shadows-play-services:3.3.2'
4745
testImplementation 'org.robolectric:shadows-support-v4:3.3.2'
48-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
49-
androidTestImplementation 'com.android.support.test:rules:1.0.2'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
47+
androidTestImplementation 'androidx.test:rules:1.4.0'
5048
testImplementation 'com.squareup.okhttp3:mockwebserver:3.9.0'
5149
/* Rx */
52-
implementation 'io.reactivex:rxjava:1.3.3'
53-
implementation 'io.reactivex:rxandroid:1.2.1'
54-
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
50+
compile 'io.reactivex:rxjava:1.3.3'
51+
compile 'io.reactivex:rxandroid:1.2.1'
52+
compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
5553
/* Network */
56-
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
57-
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
58-
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
54+
compile 'com.squareup.retrofit2:retrofit:2.3.0'
55+
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
56+
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
5957

6058
/*FCM*/
6159
//noinspection GradleCompatible warning disabled (seems to be caused by internal firebase-messaging dependencies versioning)
62-
implementation 'com.google.firebase:firebase-messaging:17.3.4'
63-
implementation 'com.google.android.gms:play-services-base:16.1.0'
60+
compile platform('com.google.firebase:firebase-bom:28.4.0')
61+
compile 'com.google.firebase:firebase-messaging'
62+
compile 'com.google.android.gms:play-services-base:18.0.1'
6463

6564
/*Sockets*/
66-
implementation 'com.neovisionaries:nv-websocket-client:2.3'
65+
compile 'com.neovisionaries:nv-websocket-client:2.3'
6766
}
6867

69-
/*
70-
71-
Generate Maven release files
72-
./gradlew clean build generateRelease
73-
74-
*/
75-
76-
apply plugin: 'signing'
77-
apply plugin: 'maven'
78-
79-
def groupId = 'com.comapi'
80-
def artifactId = 'foundation'
81-
def version = foundationVersion
82-
def comapiUrl = 'http://www.comapi.com/'
83-
def localReleaseDest = "${buildDir}/release/${version}"
84-
85-
task androidJavadocs(type: Javadoc, overwrite: true) {
86-
source = android.sourceSets.main.java.srcDirs
87-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
88-
options.links("http://docs.oracle.com/javase/7/docs/api/")
89-
options.linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
90-
exclude '**/BuildConfig.java'
91-
exclude '**/R.java'
92-
failOnError = false
93-
}
94-
95-
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
96-
classifier = 'javadoc'
97-
from androidJavadocs.destinationDir
68+
ext {
69+
PUBLISH_GROUP_ID = 'com.comapi'
70+
PUBLISH_VERSION = '1.4.0'
71+
PUBLISH_ARTIFACT_ID = 'foundation'
9872
}
9973

100-
task androidSourcesJar(type: Jar) {
101-
classifier = 'sources'
102-
from android.sourceSets.main.java.srcDirs
103-
}
104-
105-
uploadArchives {
106-
107-
repositories.mavenDeployer {
108-
109-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
110-
111-
pom.groupId = groupId
112-
pom.artifactId = artifactId
113-
pom.version = version
114-
pom.project {
115-
116-
packaging 'aar'
117-
118-
licenses {
119-
license {
120-
name 'MIT License'
121-
url 'http://www.opensource.org/licenses/mit-license.php'
122-
distribution 'repo'
123-
}
124-
}
125-
name 'Comapi'
126-
description 'Provides the basics of any Comapi integration into your apps. The Comapi Foundation SDK is responsible for handling: registration, control of User and Device registration details, sending and receiving content & data.'
127-
url comapiUrl
128-
129-
developers {
130-
developer {
131-
id 'marcinswierczek'
132-
name 'Marcin Swierczek';
133-
email 'sdk@comapi.com';
134-
}
135-
}
136-
137-
scm {
138-
url 'https://github.com/comapi/comapi-sdk-android'
139-
connection 'scm:git:https://github.com/comapi/comapi-sdk-android.git'
140-
developerConnection 'scm:git:https://github.com/comapi/comapi-sdk-android.git'
141-
}
142-
}
143-
144-
// Add other pom properties here if you want (developer details / licenses)
145-
repository(url: "file://${localReleaseDest}")
146-
}
147-
}
148-
149-
/**
150-
* To avoid conflict with Jcentre autogenerated files
151-
*/
152-
task removeMavenMetatdata(type: Delete) {
153-
delete fileTree(dir: "${localReleaseDest}/com/comapi/foundation", exclude: "${version}")
154-
}
155-
156-
task zipRelease(type: Zip) {
157-
from "${localReleaseDest}"
158-
destinationDir buildDir
159-
archiveName "${artifactId}-${version}.zip"
160-
}
161-
162-
task generateRelease << {
163-
println "Release ${version} can be found at ${localReleaseDest}/"
164-
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
165-
}
166-
167-
signing {
168-
required { isReleaseVersion || hasProperty("teamcity") }
169-
sign configurations.archives
170-
}
171-
172-
if (hasProperty("teamcity")) {
173-
gradle.taskGraph.whenReady { taskGraph ->
174-
if (taskGraph.allTasks.any { it instanceof Sign }) {
175-
176-
def id = System.getenv("keyid")
177-
def file = System.getenv("secretkeyringfile")
178-
def password = System.getenv("donkypassword")
179-
180-
allprojects { ext."signing.keyId" = id }
181-
allprojects { ext."signing.secretKeyRingFile" = file }
182-
allprojects { ext."signing.password" = password }
183-
184-
}
185-
}
186-
}
187-
188-
generateRelease.dependsOn(uploadArchives)
189-
zipRelease.dependsOn(removeMavenMetatdata)
190-
generateRelease.dependsOn(zipRelease)
191-
192-
artifacts {
193-
archives androidSourcesJar
194-
archives androidJavadocsJar
195-
}
74+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

COMAPI/foundation/src/androidTest/java/com/comapi/ALoggingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
package com.comapi;
2222

2323
import android.content.Context;
24-
import android.support.test.InstrumentationRegistry;
25-
import android.support.test.runner.AndroidJUnit4;
24+
import androidx.test.platform.app.InstrumentationRegistry;
25+
import androidx.test.ext.junit.runners.AndroidJUnit4;
2626
import android.test.suitebuilder.annotation.LargeTest;
2727

2828
import com.comapi.internal.log.LogLevelConst;

COMAPI/foundation/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
</intent-filter>
4646
</receiver>
4747

48+
<receiver android:name="com.comapi.internal.receivers.NotificationClickReceiver"
49+
android:exported="false"/>
50+
4851
<!-- Service to handle Instance ID service token refresh notifications for FCM security. -->
4952
<service
5053
android:name="com.comapi.internal.push.IDService"

COMAPI/foundation/src/main/java/com/comapi/APIConfig.java

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

2121
package com.comapi;
2222

23-
import android.support.annotation.NonNull;
23+
import androidx.annotation.NonNull;
2424
import android.text.TextUtils;
2525

2626
import com.comapi.internal.ComapiException;

COMAPI/foundation/src/main/java/com/comapi/BaseClient.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import android.content.Context;
2525
import android.os.Handler;
2626
import android.os.Looper;
27-
import android.support.annotation.NonNull;
27+
import androidx.annotation.NonNull;
2828
import android.text.TextUtils;
2929
import android.util.Pair;
3030

@@ -126,12 +126,7 @@ <E extends BaseClient> Observable<E> initialise(@NonNull final Application appli
126126
if (state.compareAndSet(GlobalState.NOT_INITIALISED, GlobalState.INITIALISING)) {
127127

128128
return init(application, adapter)
129-
.concatMap(new Func1<Boolean, Observable<SessionData>>() {
130-
@Override
131-
public Observable<SessionData> call(Boolean state) {
132-
return loadSession(state);
133-
}
134-
})
129+
.concatMap((Func1<Boolean, Observable<SessionData>>) this::loadSession)
135130
.doOnNext(session -> log.d(session != null ? "Comapi initialised with session profile id : " + session.getProfileId() : "Comapi initialisation with no session."))
136131
.doOnError(e -> {
137132
if (log != null) {
@@ -144,12 +139,7 @@ public Observable<SessionData> call(Boolean state) {
144139
.doOnNext(sessionComapiResultPair -> log.d("Push token updated"))
145140
.doOnError(throwable -> log.f("Error updating push token", throwable))
146141
.map((Func1<Pair<SessionData, ComapiResult<Void>>, Object>) resultPair -> resultPair.first)
147-
.onErrorReturn(new Func1<Throwable, SessionData>() {
148-
@Override
149-
public SessionData call(Throwable throwable) {
150-
return session;
151-
}
152-
});
142+
.onErrorReturn((Func1<Throwable, SessionData>) throwable -> session);
153143
}
154144
return Observable.fromCallable(() -> session);
155145
})
@@ -224,6 +214,8 @@ restApi, new Handler(mainLooper),
224214
lifecycleListeners.add(socketController.createLifecycleListener());
225215
initialiseLifecycleObserver(application);
226216

217+
pushMgr.setService(service);
218+
227219
sub.onNext(state.compareAndSet(GlobalState.INITIALISING, GlobalState.INITIALISED));
228220
sub.onCompleted();
229221

COMAPI/foundation/src/main/java/com/comapi/BaseComapi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BaseComapi {
3838
/**
3939
* Version of the ComapiImpl SDK MAJOR.MINOR.PATCH.BUILD
4040
*/
41-
private final static String SDK_VERSION = "1.3.0";
41+
private final static String SDK_VERSION = "1.4.0";
4242

4343
private static final Set<String> apiSpaces = Collections.synchronizedSet(new HashSet<String>());
4444

COMAPI/foundation/src/main/java/com/comapi/Comapi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package com.comapi;
2222

2323
import android.app.Application;
24-
import android.support.annotation.NonNull;
24+
import androidx.annotation.NonNull;
2525
import android.text.TextUtils;
2626

2727
import com.comapi.internal.CallbackAdapter;

COMAPI/foundation/src/main/java/com/comapi/ComapiClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import android.app.Application;
2424
import android.content.Context;
25-
import android.support.annotation.NonNull;
25+
import androidx.annotation.NonNull;
2626

2727
import com.comapi.internal.CallbackAdapter;
2828

@@ -89,7 +89,7 @@ public ServiceAccessor service() {
8989
/**
9090
* Gets the content of internal log files.
9191
*
92-
* @deprecated Use safer version - {@link this#copyLogs(File)} instead.
92+
* @deprecated Use safer version - {@link ComapiClient#copyLogs(File)} instead.
9393
*/
9494
@Deprecated
9595
public void getLogs(Callback<String> callback) {

COMAPI/foundation/src/main/java/com/comapi/RxComapi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package com.comapi;
2222

2323
import android.app.Application;
24-
import android.support.annotation.NonNull;
24+
import androidx.annotation.NonNull;
2525
import android.text.TextUtils;
2626

2727
import com.comapi.internal.CallbackAdapter;

0 commit comments

Comments
 (0)