Skip to content

Commit

Permalink
migration library from bintray to artifactory and add new param in ge…
Browse files Browse the repository at this point in the history
…tFileList
  • Loading branch information
ariefnurputranto committed Mar 30, 2021
1 parent 025d923 commit 7847a5e
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 27 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ allprojects {
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/qiscustech/maven" }
maven { url "https://artifactory.qiscus.com/artifactory/qiscus-library-open-source" }
maven { url 'https://jitpack.io' }
}
Expand Down
5 changes: 4 additions & 1 deletion chat-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ apply plugin: 'com.github.dcendents.android-maven'
apply from: '../dependencies.gradle'
apply from: 'lib-version.gradle'
apply from: rootProject.file('gradle/quality.gradle')
apply from: 'publish.gradle'
apply plugin: "com.jfrog.artifactory"

android {
compileSdkVersion compileSDKVersion
Expand Down Expand Up @@ -75,6 +77,7 @@ buildscript {
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0"
}
}

Expand All @@ -86,7 +89,7 @@ dependencies {

api firebaseLibs
api qiscusMqttLibs
api qiscusManggilWithoutEmoji
api qiscusManggil
api networkLibs
api rxLibs
api eventBusLib
Expand Down
55 changes: 55 additions & 0 deletions chat-core/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'

publishing {
publications {
aar(MavenPublication) {
setGroupId libraryGroupId
artifactId libraryArtifactId
version libraryVersion
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
if (it.moduleGroup == 'com.android.databinding' || it.moduleVersion == 'unspecified') {
println("ignoring dependency ${it.moduleGroup}:${it.moduleName}:${it.moduleVersion}")
return;
}

def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
println(it.moduleGroup)
println(it.moduleVersion)
println(it.moduleName)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}

Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
properties.load( inputStream )


artifactory {
contextUrl = properties.getProperty('artifactory_url')
publish {
repository {
repoKey = properties.getProperty('artifactory_repokey')
username = properties.getProperty('artifactory_username')
password = properties.getProperty('artifactory_password')
}
defaults {
publications('aar')
publishArtifacts = true

properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ private boolean isLogged() {
private void saveAccountInfo(QiscusAccount qiscusAccount) {
try {
JSONObject data = new JSONObject(qiscusAccount.toString().substring(13));
sharedPreferences.edit().putString("cached_account",data.toString()).apply();
sharedPreferences.edit().putString("cached_account", data.toString()).apply();
} catch (JSONException e) {
sharedPreferences.edit().putString("cached_account", gson.toJson(qiscusAccount)).apply();
e.printStackTrace();
Expand Down Expand Up @@ -987,11 +987,11 @@ private QiscusAccount getAccountInfo() {
qiscusAccount.setUsername(jsonObject.optString("username", ""));
}

if (jsonObject.has("extras")){
if (jsonObject.has("extras")) {
if (jsonObject.optJSONObject("extras").toString().contains("nameValuePairs")) {
//migration from latest
qiscusAccount.setExtras(jsonObject.optJSONObject("extras").getJSONObject("nameValuePairs"));
}else{
} else {
qiscusAccount.setExtras(jsonObject.optJSONObject("extras"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public Observable<List<QiscusChatRoom>> getAllChatRooms(boolean showParticipant,
if (roomType != null) {
if (roomType == QiscusChatRoom.RoomType.SINGLE) {
type = "single";
} else if (roomType == QiscusChatRoom.RoomType.GROUP){
} else if (roomType == QiscusChatRoom.RoomType.GROUP) {
type = "group";
} else if (roomType == QiscusChatRoom.RoomType.CHANNEL) {
type = "public_channel";
Expand Down Expand Up @@ -507,7 +507,7 @@ public Observable<QiscusComment> updateMessage(QiscusComment message) {

@Deprecated
public Observable<QiscusComment> postComment(QiscusComment qiscusComment) {
if (qiscusComment.getType() == QiscusComment.Type.REPLY){
if (qiscusComment.getType() == QiscusComment.Type.REPLY) {
if (qiscusComment.getExtraPayload() != null && !qiscusComment.getExtraPayload().equals("")) {
try {
JSONObject payload = new JSONObject(qiscusComment.getExtraPayload());
Expand Down Expand Up @@ -540,7 +540,7 @@ public Observable<QiscusComment> postComment(QiscusComment qiscusComment) {

public Observable<QiscusComment> sendMessage(QiscusComment message) {

if (message.getType() == QiscusComment.Type.REPLY){
if (message.getType() == QiscusComment.Type.REPLY) {
if (message.getExtraPayload() != null && !message.getExtraPayload().equals("")) {
try {
JSONObject payload = new JSONObject(message.getExtraPayload());
Expand Down Expand Up @@ -1248,16 +1248,24 @@ public Observable<List<QUserPresence>> getUserPresence(List<String> userIds) {
.map(QiscusApiParser::parseQiscusUserPresence);
}

public Observable<List<QiscusComment>> getFileList(List<Long> roomIds, String fileType, int page, int limit) {
public Observable<List<QiscusComment>> getFileList(List<Long> roomIds, String fileType, String userId,
List<String> includeExtensions, List<String> excludeExtensions,
int page, int limit) {

List<String> listOfRoomIds = new ArrayList<>();
for (Long roomId : roomIds) {
listOfRoomIds.add(String.valueOf(roomId));

if (roomIds != null) {
for (Long roomId : roomIds) {
listOfRoomIds.add(String.valueOf(roomId));
}
}
return api.fileList(QiscusHashMapUtil.fileList(listOfRoomIds, fileType, page, limit))

return api.fileList(QiscusHashMapUtil.fileList(listOfRoomIds, fileType, userId, includeExtensions, excludeExtensions, page, limit))
.map(QiscusApiParser::parseFileListAndSearchMessage);
}

public Observable<List<QiscusComment>> searchMessage(String query, List<Long> roomIds, String userId, List<String> type, int page, int limit) {
public Observable<List<QiscusComment>> searchMessage(String query, List<Long> roomIds,
String userId, List<String> type, int page, int limit) {
List<String> listOfRoomIds = new ArrayList<>();
for (Long roomId : roomIds) {
listOfRoomIds.add(String.valueOf(roomId));
Expand All @@ -1272,7 +1280,9 @@ public Observable<List<QiscusComment>> searchMessage(String query, List<Long> ro
}
}

public Observable<List<QiscusComment>> searchMessage(String query, List<Long> roomIds, String userId, List<String> type, QiscusChatRoom.RoomType roomType, int page, int limit) {
public Observable<List<QiscusComment>> searchMessage(String query, List<Long> roomIds,
String userId, List<String> type,
QiscusChatRoom.RoomType roomType, int page, int limit) {
List<String> listOfRoomIds = new ArrayList<>();
for (Long roomId : roomIds) {
listOfRoomIds.add(String.valueOf(roomId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,38 @@ public static HashMap<String, Object> usersPresence(List<String> userIds) {
return hashMap;
}

public static HashMap<String, Object> fileList(List<String> roomIds, String fileType, int page, int limit) {
public static HashMap<String, Object> fileList(List<String> roomIds, String fileType,
String userId, List<String> includeExtensions,
List<String> excludeExtensions, int page, int limit) {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("room_ids", roomIds);
hashMap.put("file_type", fileType);
if (roomIds.size() != 0) {
hashMap.put("room_ids", roomIds);
}

if (fileType != null && userId.isEmpty()) {
hashMap.put("file_type", fileType);
}

hashMap.put("page", page);
hashMap.put("limit", limit);

if (userId != null && userId.isEmpty()) {
hashMap.put("sender", userId);
}

if (includeExtensions != null && includeExtensions.size() != 0) {
hashMap.put("include_extensions", includeExtensions);
}

if (excludeExtensions != null && excludeExtensions.size() != 0) {
hashMap.put("exclude_extensions", excludeExtensions);
}

return hashMap;
}

public static HashMap<String, Object> searchMessage(String query, List<String> roomIds, String userId, List<String> type, QiscusChatRoom.RoomType roomType, int page, int limit) {
public static HashMap<String, Object> searchMessage(String query, List<String> roomIds, String userId,
List<String> type, QiscusChatRoom.RoomType roomType, int page, int limit) {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("query", query);
hashMap.put("room_ids", roomIds);
Expand All @@ -283,7 +304,7 @@ public static HashMap<String, Object> searchMessage(String query, List<String> r
if (roomType == QiscusChatRoom.RoomType.SINGLE) {
hashMap.put("room_type", "single");
hashMap.put("is_public", false);
} else if (roomType == QiscusChatRoom.RoomType.GROUP){
} else if (roomType == QiscusChatRoom.RoomType.GROUP) {
hashMap.put("room_type", "group");
hashMap.put("is_public", false);
} else if (roomType == QiscusChatRoom.RoomType.CHANNEL) {
Expand Down
3 changes: 3 additions & 0 deletions chat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ apply plugin: 'com.github.dcendents.android-maven'
apply from: '../dependencies.gradle'
apply from: 'lib-version.gradle'
apply from: rootProject.file('gradle/quality.gradle')
//apply from: 'publishChat.gradle'
//apply plugin: "com.jfrog.artifactory"

android {
compileSdkVersion compileSDKVersion
Expand Down Expand Up @@ -64,6 +66,7 @@ buildscript {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0"
}
}

Expand Down
55 changes: 55 additions & 0 deletions chat/publishChat.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'

publishing {
publications {
aar(MavenPublication) {
setGroupId libraryGroupIdChat
artifactId libraryArtifactIdChat
version libraryVersionChat
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
if (it.moduleGroup == 'com.android.databinding' || it.moduleVersion == 'unspecified') {
println("ignoring dependency ${it.moduleGroup}:${it.moduleName}:${it.moduleVersion}")
return;
}

def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
println(it.moduleGroup)
println(it.moduleVersion)
println(it.moduleName)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}

Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
properties.load( inputStream )


artifactory {
contextUrl = properties.getProperty('artifactory_url')
publish {
repository {
repoKey = properties.getProperty('artifactory_repokey')
username = properties.getProperty('artifactory_username')
password = properties.getProperty('artifactory_password')
}
defaults {
publications('aar')
publishArtifacts = true

properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}

7 changes: 3 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ ext {
]

qiscusMqttDeps = [
client : "com.qiscus.mqtt:client:1.1.1",
android: "com.qiscus.mqtt:android:1.1.1-q1"
client : "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0",
android: "com.qiscus.mqtt:android:1.1.2"
]

okHttpDeps = [
Expand Down Expand Up @@ -104,7 +104,7 @@ ext {
eventBusLib = "org.greenrobot:eventbus:3.0.0"
rxUrlExtractorLib = "com.schinizer:rxunfurl:0.2.0"
qiscusManggil = "com.qiscus.utils:manggil:$versions.manggil"
qiscusManggilWithoutEmoji = "com.qiscus.utils:manggil:$versions.manggil-without-emoji"
//qiscusManggilWithoutEmoji = "com.qiscus.utils:manggil:$versions.manggil-without-emoji"

supportLibs = supportDeps.values()
firebaseLibs = firebaseDeps.values()
Expand All @@ -113,5 +113,4 @@ ext {
networkLibs = okHttpDeps.values() + retrofitDeps.values()
rxLibs = rxDebs.values() + trelloLifecycleDebs.values()


}
14 changes: 11 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
# === qiscus chat library version ===
chatVersionMajor=2
chatVersionMinor=30
chatVersionPatch=17
chatVersionPatch=18

# === qiscus chat-core library version ===
chatCoreVersionMajor=1
chatCoreVersionMinor=3
chatCoreVersionPatch=27
chatCoreVersionPatch=28

# === qiscus default base url
BASE_URL_SERVER="https://api.qiscus.com/"
Expand All @@ -53,4 +53,12 @@ QISCUS_SDK_APP_ID="sdksample"
# === properties for androidx
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
android.enableR8=true

libraryGroupId=com.qiscus.sdk
libraryArtifactId=chat-core
libraryVersion=1.3.28

libraryGroupIdChat=com.qiscus.sdk
libraryArtifactIdChat=chat
libraryVersionChat=2.30.18
2 changes: 1 addition & 1 deletion gradle/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
def qualityConfigDir = "$project.rootDir/config/quality"
def reportsDir = "$project.buildDir/reports"

check.dependsOn 'checkstyle', 'findbugs', 'pmd'
//check.dependsOn 'checkstyle', 'findbugs', 'pmd'

task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
Expand Down

0 comments on commit 7847a5e

Please sign in to comment.