Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NTV-483 :Migrate ProjectStatsEnvelope.java to kotlin and deprecate Au…
…toparcel (#1622) * Migrate GCM.java to kotlin and deprecate Autoparcel * refactor Builder in push activity * Migrate ProjectStatsEnvelope.java to kotlin and deprecate Autoparcel * add test cases * Fix ktlint * update the testing coverage * update the testing coverage Co-authored-by: Isabel Martin <arkariang@gmail.com>
- Loading branch information
Showing
11 changed files
with
794 additions
and
234 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
21 changes: 0 additions & 21 deletions
21
app/src/main/java/com/kickstarter/mock/factories/PushNotificationEnvelopeFactory.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/kickstarter/mock/factories/PushNotificationEnvelopeFactory.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,16 @@ | ||
package com.kickstarter.mock.factories | ||
|
||
import com.kickstarter.models.pushdata.GCM.Companion.builder | ||
import com.kickstarter.services.apiresponses.PushNotificationEnvelope | ||
|
||
object PushNotificationEnvelopeFactory { | ||
fun envelope(): PushNotificationEnvelope { | ||
val gcm = builder() | ||
.alert("You've received a new push notification") | ||
.title("Hello") | ||
.build() | ||
return PushNotificationEnvelope.builder() | ||
.gcm(gcm) | ||
.build() | ||
} | ||
} |
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
27 changes: 0 additions & 27 deletions
27
app/src/main/java/com/kickstarter/models/pushdata/GCM.java
This file was deleted.
Oops, something went wrong.
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.kickstarter.models.pushdata | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
class GCM private constructor( | ||
private val alert: String, | ||
private val title: String | ||
) : Parcelable { | ||
fun alert() = this.alert | ||
fun title() = this.title | ||
|
||
@Parcelize | ||
data class Builder( | ||
private var alert: String = "", | ||
private var title: String = "" | ||
) : Parcelable { | ||
fun alert(alert: String) = apply { this.alert = alert } | ||
fun title(title: String) = apply { this.title = title } | ||
|
||
fun build() = GCM( | ||
alert = alert, | ||
title = title | ||
) | ||
} | ||
|
||
fun toBuilder() = Builder( | ||
alert = alert, | ||
title = title | ||
) | ||
|
||
override fun equals(other: Any?): Boolean { | ||
var equals = super.equals(other) | ||
if (other is GCM) { | ||
equals = alert() == other.alert() && | ||
title() == other.title() | ||
} | ||
return equals | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun builder(): Builder { | ||
return Builder() | ||
} | ||
} | ||
} |
171 changes: 0 additions & 171 deletions
171
app/src/main/java/com/kickstarter/services/apiresponses/PushNotificationEnvelope.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.