-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Migrate Internal Constants class to kotlin
- Loading branch information
1 parent
a86cd3b
commit 87d00c1
Showing
10 changed files
with
837 additions
and
800 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
67 changes: 0 additions & 67 deletions
67
android-core/src/main/java/com/mparticle/internal/BatchId.java
This file was deleted.
Oops, something went wrong.
637 changes: 0 additions & 637 deletions
637
android-core/src/main/java/com/mparticle/internal/Constants.java
This file was deleted.
Oops, something went wrong.
79 changes: 0 additions & 79 deletions
79
android-core/src/main/java/com/mparticle/internal/CoreCallbacks.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
android-core/src/main/kotlin/com/mparticle/internal/BatchId.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,48 @@ | ||
package com.mparticle.internal | ||
|
||
import com.mparticle.internal.database.services.MessageService.ReadyMessage | ||
|
||
class BatchId { | ||
var mpid: Long | ||
get() = field | ||
var sessionId: String? | ||
get() = field | ||
var dataplanId: String? | ||
get() = field | ||
var dataplanVersion: Int? | ||
get() = field | ||
|
||
constructor(mpid: Long, sessionId: String?, dataplanId: String?, dataplanVersion: Int?) { | ||
this.mpid = mpid | ||
this.sessionId = sessionId | ||
this.dataplanId = dataplanId | ||
this.dataplanVersion = dataplanVersion | ||
} | ||
|
||
constructor(readyMessage: ReadyMessage) { | ||
mpid = readyMessage.mpid | ||
sessionId = readyMessage.sessionId | ||
dataplanId = readyMessage.dataplanId | ||
dataplanVersion = readyMessage.dataplanVersion | ||
} | ||
|
||
override fun equals(obj: Any?): Boolean { | ||
if (obj !is BatchId) { | ||
return false | ||
} | ||
for (i in 0 until fields().size) { | ||
if (!MPUtility.isEqual(fields()[i], obj.fields()[i])) { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return fields().contentHashCode() | ||
} | ||
|
||
private fun fields(): Array<Any?> { | ||
return arrayOf(mpid, sessionId, dataplanId, dataplanVersion) | ||
} | ||
} |
Oops, something went wrong.