-
Notifications
You must be signed in to change notification settings - Fork 4
MS-628 LibSimprints API versioning support #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5d5c998
MS-628 Add library version code to the intent extras
luhmirin-s ffd93d2
MS-628 Add version code to every request intent
luhmirin-s 1d47679
MS-628 Completely separate old and new version of the data returned b…
luhmirin-s 223abc1
MS-628 Remove kotlin parcelize plugin
luhmirin-s 1eb3619
MS-828 Add json marshalling tests
luhmirin-s 0e41224
MS-628 Add key version list for SID to use in response mapper
luhmirin-s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,10 +1,38 @@ | ||
| package com.simprints.libsimprints | ||
| package com.simprints.libsimprints; | ||
|
|
||
| import android.os.Parcelable | ||
| import kotlinx.parcelize.Parcelize | ||
| import android.os.Parcel; | ||
| import android.os.Parcelable; | ||
| import android.os.Parcelable.Creator | ||
|
|
||
| @Parcelize | ||
| @Deprecated("Use contracts.data.RefusalForm instead") | ||
| data class RefusalForm( | ||
| val reason: String, | ||
| val extra: String, | ||
| ) : Parcelable | ||
| ) : Parcelable { | ||
|
|
||
| override fun describeContents(): Int { | ||
| return 0 | ||
| } | ||
|
|
||
| override fun writeToParcel(dest: Parcel, flags: Int) { | ||
| dest.writeString(reason) | ||
| dest.writeString(extra) | ||
| } | ||
|
|
||
| companion object { | ||
| @JvmField | ||
| val CREATOR = object : Creator<RefusalForm> { | ||
|
|
||
| override fun createFromParcel(parcel: Parcel): RefusalForm? { | ||
| val reason = parcel.readString().orEmpty() | ||
| val extra = parcel.readString().orEmpty() | ||
|
|
||
| return RefusalForm(reason, extra) | ||
| } | ||
|
|
||
| override fun newArray(p0: Int): Array<out RefusalForm?> { | ||
| return arrayOfNulls(p0) | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,70 @@ | ||
| package com.simprints.libsimprints | ||
|
|
||
| import android.os.Parcel | ||
| import android.os.Parcelable | ||
| import kotlinx.parcelize.Parcelize | ||
| import android.os.Parcelable.Creator | ||
|
|
||
| @Parcelize | ||
| data class Registration( | ||
| @Deprecated("Use contracts.data.Enrolment instead") | ||
| data class Registration @JvmOverloads constructor( | ||
| val guid: String, | ||
| ) : Parcelable | ||
| private val templates: MutableMap<FingerIdentifier, ByteArray> = mutableMapOf() | ||
| ) : Parcelable { | ||
|
|
||
| fun setTemplate(fingerId: FingerIdentifier, fingerTemplate: ByteArray) { | ||
| templates[fingerId] = fingerTemplate | ||
| } | ||
|
|
||
| fun getTemplate(fingerId: FingerIdentifier): ByteArray = templates[fingerId] ?: byteArrayOf() | ||
|
|
||
| override fun describeContents(): Int = 0 | ||
|
|
||
| override fun writeToParcel(dest: Parcel, flags: Int) { | ||
| dest.writeString(guid) | ||
| dest.writeInt(templates.size) | ||
|
|
||
| for ((fingerId, fingerTemplate) in templates) { | ||
| dest.writeInt(fingerId.ordinal) | ||
| dest.writeInt(fingerTemplate.size) | ||
| dest.writeByteArray(fingerTemplate) | ||
| } | ||
| } | ||
|
|
||
| override fun hashCode(): Int { | ||
| var result = super.hashCode() | ||
| result = 31 * result + guid.hashCode() | ||
| result = 31 * result + templates.hashCode() | ||
| return result | ||
| } | ||
|
|
||
| override fun equals(other: Any?): Boolean { | ||
| if (other === this) return true | ||
| if (other !is Registration) return false | ||
| if (guid != other.guid) return false | ||
| for (fingerId in FingerIdentifier.entries) { | ||
| if (!templates[fingerId].contentEquals(other.templates[fingerId])) return false | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| companion object { | ||
| @JvmField | ||
| val CREATOR = object : Creator<Registration> { | ||
|
|
||
| override fun createFromParcel(parcel: Parcel): Registration? { | ||
| val guid = parcel.readString().orEmpty() | ||
| val nbOfTemplates = parcel.readInt() | ||
|
|
||
| val templates = mutableMapOf<FingerIdentifier, ByteArray>() | ||
| for (i in 0 until nbOfTemplates) { | ||
| val fingerId = FingerIdentifier.entries[parcel.readInt()] | ||
| val fingerTemplate = ByteArray(parcel.readInt()) | ||
| parcel.readByteArray(fingerTemplate) | ||
| templates[fingerId] = fingerTemplate | ||
| } | ||
| return Registration(guid, templates) | ||
| } | ||
|
|
||
| override fun newArray(p0: Int): Array<out Registration?> = arrayOfNulls(p0) | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,23 +1,40 @@ | ||
| package com.simprints.libsimprints | ||
|
|
||
| import android.os.Parcel | ||
| import android.os.Parcelable | ||
| import kotlinx.parcelize.Parcelize | ||
|
|
||
| /** | ||
| * This constructor creates a new verification | ||
| * | ||
| * @param confidence An int containing the (matching) confidence | ||
| * @param tier The tier score derived from the confidence | ||
| * @param guid Global unique id of the verified person | ||
| */ | ||
| @Parcelize | ||
| import android.os.Parcelable.Creator | ||
|
|
||
| @SuppressWarnings("unused", "WeakerAccess") | ||
| @Deprecated("Use contracts.data.Verification instead") | ||
| data class Verification @JvmOverloads constructor( | ||
| private val confidence: Int, | ||
| val tier: Tier, | ||
| val guid: String, | ||
| // TODO change to val once it is correctly returned from SID | ||
| var isSuccess: Boolean = false, | ||
| ) : Parcelable { | ||
|
|
||
| fun getConfidence(): Float = confidence.toFloat() | ||
|
|
||
| override fun describeContents(): Int = 0 | ||
|
|
||
| override fun writeToParcel(dest: Parcel, flags: Int) { | ||
| dest.writeInt(this.confidence) | ||
| dest.writeInt(this.tier.ordinal) | ||
| dest.writeString(this.guid) | ||
| } | ||
|
|
||
| companion object { | ||
| @JvmField | ||
| val CREATOR = object : Creator<Verification> { | ||
|
|
||
| override fun createFromParcel(parcel: Parcel): Verification? { | ||
| val confidence = parcel.readInt() | ||
| val tier = Tier.entries[parcel.readInt()] | ||
| val guid = parcel.readString().orEmpty() | ||
|
|
||
| return Verification(confidence, tier, guid) | ||
| } | ||
|
|
||
| override fun newArray(p0: Int): Array<out Verification?> = arrayOfNulls(p0) | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you confirmed that
createFromParcelis working as expected? I remember having fun with it back in the daysThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per slack conversation - I have integrated this version in SID and then tried calling from the current "main" version of Intent Launcher (it still uses java version of LibSimprints). So I am fairly confident that it works correctly.