Skip to content

Commit 1529844

Browse files
liveHarshitiamareebjamal
authored andcommitted
fix: Wrong event URL is being shared (#1862)
1 parent d5ba9cf commit 1529844

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ android {
3737
minifyEnabled true
3838
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3939
buildConfigField "String", "DEFAULT_BASE_URL", '"https://api.eventyay.com/v1/"'
40+
buildConfigField "String", "FRONTEND_URL", '"https://eventyay.com/"'
4041
buildConfigField "String", "MAPBOX_KEY", '"'+MAPBOX_KEY+'"'
4142
buildConfigField "String", "STRIPE_API_KEY", '"'+STRIPE_API_TOKEN+'"'
4243
}
4344
debug {
4445
buildConfigField "String", "DEFAULT_BASE_URL", '"https://open-event-api-dev.herokuapp.com/v1/"'
46+
buildConfigField "String", "FRONTEND_URL", '"https://fossasia.github.io/open-event-frontend/"'
4547
buildConfigField "String", "MAPBOX_KEY", '"'+MAPBOX_KEY+'"'
4648
buildConfigField "String", "STRIPE_API_KEY", '"'+STRIPE_API_TOKEN+'"'
4749
}

app/src/main/java/org/fossasia/openevent/general/event/EventUtils.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ object EventUtils {
3333

3434
private val timeFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm a")
3535
private val dateFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy")
36-
private const val frontendUrl = "https://open-event-frontend-dev.herokuapp.com/e/"
3736

3837
fun getSharableInfo(event: Event, resource: Resource = sharedResource): String {
3938
val description = event.description.nullToEmpty()
4039
val identifier = event.identifier
41-
val eventUrl = frontendUrl + identifier
40+
val eventUrl = BuildConfig.FRONTEND_URL + "e/" + identifier
4241

4342
val message = StringBuilder()
4443

app/src/test/java/org/fossasia/openevent/general/event/EventUtilsTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.fossasia.openevent.general.event
33
import io.mockk.MockKAnnotations
44
import io.mockk.every
55
import io.mockk.impl.annotations.MockK
6+
import org.fossasia.openevent.general.BuildConfig
67
import org.fossasia.openevent.general.R
78
import org.fossasia.openevent.general.data.Resource
89
import org.junit.After
@@ -71,7 +72,7 @@ class EventUtilsTest {
7172
Starts On : 15 Sep 2008 04:23 PM
7273
Ends On : 19 Sep 2008 07:55 PM
7374
Event Location : Test Location
74-
Event Link : https://open-event-frontend-dev.herokuapp.com/e/abcdefgh
75+
Event Link : ${BuildConfig.FRONTEND_URL}e/abcdefgh
7576
""".trimIndent(), EventUtils.getSharableInfo(event, resource))
7677
}
7778

@@ -87,7 +88,7 @@ class EventUtilsTest {
8788
Starts On : 15 Sep 2008 04:23 PM
8889
Ends On : 19 Sep 2008 07:55 PM
8990
Event Location : Test Location
90-
Event Link : https://open-event-frontend-dev.herokuapp.com/e/abcdefgh
91+
Event Link : ${BuildConfig.FRONTEND_URL}e/abcdefgh
9192
""".trimIndent(), EventUtils.getSharableInfo(event, resource))
9293
}
9394

@@ -101,7 +102,7 @@ class EventUtilsTest {
101102
Starts On : 15 Sep 2008 04:23 PM
102103
Ends On : 19 Sep 2008 07:55 PM
103104
Event Location : Test Location
104-
Event Link : https://open-event-frontend-dev.herokuapp.com/e/abcdefgh
105+
Event Link : ${BuildConfig.FRONTEND_URL}e/abcdefgh
105106
""".trimIndent(), EventUtils.getSharableInfo(event, resource))
106107
}
107108

@@ -117,7 +118,7 @@ class EventUtilsTest {
117118
Starts On : 15 Sep 2008 04:23 PM
118119
Ends On : 19 Sep 2008 07:55 PM
119120
Event Location : Test Location
120-
Event Link : https://open-event-frontend-dev.herokuapp.com/e/abcdefgh
121+
Event Link : ${BuildConfig.FRONTEND_URL}e/abcdefgh
121122
""".trimIndent(), EventUtils.getSharableInfo(event, resource))
122123
}
123124

0 commit comments

Comments
 (0)