-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from skedgo/feature/18384
- Loading branch information
Showing
13 changed files
with
557 additions
and
96 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
CommonCoreLegacy/src/main/java/com/skedgo/tripkit/routing/Geofence.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,32 @@ | ||
package com.skedgo.tripkit.routing | ||
|
||
data class Geofence( | ||
val id: String, | ||
val type: String, | ||
val trigger: String, | ||
val center: Coordinate, | ||
val radius: Double, | ||
val messageType: String, | ||
val messageTitle: String, | ||
val messageBody: String | ||
) { | ||
var timeline: Long = -1L | ||
|
||
fun computeAndSetTimeline(tripEndDateTimeInMillis: Long): Long { | ||
val currentTimeInMillis = System.currentTimeMillis() | ||
return tripEndDateTimeInMillis - currentTimeInMillis | ||
} | ||
} | ||
|
||
data class Coordinate( | ||
val lat: Double, | ||
val lng: Double | ||
) | ||
|
||
enum class Trigger(val value: String) { | ||
ENTER("ENTER"), EXIT("EXIT") | ||
} | ||
|
||
enum class MessageType { | ||
TRIP_END, ARRIVING_AT_YOUR_STOP, NEXT_STOP_IS_YOURS | ||
} |
30 changes: 30 additions & 0 deletions
30
CommonCoreLegacy/src/main/java/com/skedgo/tripkit/routing/GetOffAlertCache.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,30 @@ | ||
package com.skedgo.tripkit.routing | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
|
||
object GetOffAlertCache { | ||
|
||
private const val PREF_KEY = "KEY_GET_OFF_ALERTS" | ||
private lateinit var sharedPreferences: SharedPreferences | ||
|
||
fun init(context: Context) { | ||
sharedPreferences = context.getSharedPreferences(PREF_KEY, Context.MODE_PRIVATE) | ||
} | ||
|
||
fun setTripAlertOnState(tripUuid: String, onState: Boolean) { | ||
if (onState) { | ||
//As per adrian, only one trip can have alerts on, so will need to clear first to make sure no other trips has alerts on | ||
sharedPreferences.edit().apply { | ||
clear() | ||
putBoolean(tripUuid, onState).apply() | ||
}.apply() | ||
//sharedPreferences.edit().putBoolean(tripUuid, onState).apply() | ||
} else { | ||
sharedPreferences.edit().remove(tripUuid).apply() | ||
} | ||
} | ||
|
||
fun isTripAlertStateOn(tripUuid: String): Boolean = sharedPreferences.getBoolean(tripUuid, false) | ||
|
||
} |
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
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
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
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 |
---|---|---|
@@ -1,21 +1,39 @@ | ||
<manifest package="com.skedgo.tripkit" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.READ_CALENDAR" /> | ||
<uses-permission android:name="android.permission.WRITE_CALENDAR" /> | ||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.skedgo.tripkit"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.READ_CALENDAR" /> | ||
<uses-permission android:name="android.permission.WRITE_CALENDAR" /> | ||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | ||
|
||
<application> | ||
<receiver | ||
android:name=".routing.TripAlarmBroadcastReceiver" | ||
android:enabled="true" | ||
android:exported="true"></receiver> | ||
|
||
<service | ||
android:name=".android.FetchRegionsService" | ||
android:exported="false"> | ||
<intent-filter> | ||
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" /> | ||
</intent-filter> | ||
</service> | ||
|
||
<receiver | ||
android:name=".routing.GeofenceBroadcastReceiver" | ||
android:enabled="true" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="com.skedgo.tripkit.routing.GeofenceBroadcastReceiver.ACTION_GEOFENCE_EVENT" /> | ||
</intent-filter> | ||
</receiver> | ||
</application> | ||
|
||
<application> | ||
<service | ||
android:name="com.skedgo.tripkit.android.FetchRegionsService" | ||
android:exported="false"> | ||
<intent-filter> | ||
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" /> | ||
</intent-filter> | ||
</service> | ||
</application> | ||
</manifest> |
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
Oops, something went wrong.