Skip to content

Commit

Permalink
Merge pull request #435 from skedgo/develop
Browse files Browse the repository at this point in the history
[20366] For merging auto-stale workflow to default branch
  • Loading branch information
sg-jsonjuliane authored May 23, 2024
2 parents 2b5604f + b852805 commit 55fd2dd
Show file tree
Hide file tree
Showing 87 changed files with 2,650 additions and 260 deletions.
50 changes: 50 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

# Pull Request (PR) Checklist

Thank you for your contribution! Please confirm that you've checked all the boxes below before submitting your PR. Use `[x]` to check a box, e.g., `[x]`, and make sure there's no space around the brackets.

## PR Context

- **Type**: (Bug Fix / Feature / Refactor / Regression Fix) _Choose one and delete the rest._
- **Issue Link**: [Redmine Issue](https://redmine.buzzhives.com/issues/[XXXXX])
- **Risk Factor**: (Low / Medium / High) - _Provide a brief explanation of the risk._

## Changes

_Describe your changes in detail, highlighting the problem it solves or the feature it adds._

-
-
-

## Checklist for Reviewers

### Documentation and Code Quality
- [ ] **KDocs Documentation**: Are all changes, new functionalities, and classes documented with KDocs?
- [ ] **Architectural Patterns**: Is there consistent and proper use of architectural patterns (e.g., MVVM, MVP)?

### Testing and Reliability
- [ ] **Unit Testing**: Are there unit tests for all new functionalities and classes?
- [ ] **Emulator and Real Device Testing**: Has the application been tested on both emulators and real devices to ensure compatibility?

### Error Handling and Logging
- [ ] **Error Handling**: Are errors and exceptions caught and handled gracefully, ensuring the app remains stable?
- [ ] **Logging**: Is there proper logging in place for critical errors and information, aiding in debugging and monitoring?


## Testing Procedure

_If applicable, provide steps or commands for testing your changes. This can help reviewers and testers._

-
-
-

## Work-in-Progress (WIP)

_List any remaining work or areas that need additional focus. This section can be updated as the work progresses._

- [ ]
- [ ]

_Remember to keep this template updated based on the feedback and evolving project standards._
37 changes: 37 additions & 0 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Android CI

on:
push:
branches: [ disable-temporarily ]
pull_request:
branches: [ disable-temporarily ]

jobs:
build:
name: Build and Test
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Grant execute permission for Gradle wrapper
run: chmod +x gradlew

- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.android/build-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run tests
run: ./gradlew test
14 changes: 14 additions & 0 deletions .github/workflows/auto_stale_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 2 days.'
days-before-stale: 5
days-before-close: 2
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CommonCoreLegacy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ android {
release {
consumerProguardFile 'proguard-rules.pro'
}
staging {
debuggable true
}
}

lintOptions {
Expand Down Expand Up @@ -71,6 +74,7 @@ dependencies {
implementation 'com.github.skedgo:commons-collections:v1.0'

debugImplementation project(':TripKitDomain')
stagingImplementation project(':TripKitDomain')
releaseImplementation project(':TripKitDomain')

implementation libs.kotlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public class Location implements Parcelable {
*/
public static final int TYPE_W3W = 9;

public static final int TYPE_SCHOOL = 11;

public static final int NO_BEARING = Integer.MAX_VALUE;
public static final double ZERO_LAT = 0.0;
public static final double ZERO_LON = 0.0;
Expand Down Expand Up @@ -114,6 +116,10 @@ public Location createFromParcel(Parcel in) {
List<RouteDetails> routes = new ArrayList<>();
in.readTypedList(routes, RouteDetails.CREATOR);

List<String> modeIdentifiers = new ArrayList<>();
in.readList(modeIdentifiers, String.class.getClassLoader());
location.modeIdentifiers = modeIdentifiers;

return location;
}

Expand Down Expand Up @@ -176,6 +182,8 @@ public Location[] newArray(int size) {
private List<Operator> operators;
private List<RouteDetails> routes;

private List<String> modeIdentifiers;

public Location() {
lat = ZERO_LAT;
lon = ZERO_LON;
Expand Down Expand Up @@ -483,6 +491,14 @@ public void setOperators( List<Operator> operators) {
this.operators = operators;
}

public List<String> getModeIdentifiers() {
return modeIdentifiers;
}

public void setModeIdentifiers(List<String> modeIdentifiers) {
this.modeIdentifiers = modeIdentifiers;
}

/**
* Get the distance between this and another point
* <p/>
Expand Down Expand Up @@ -568,6 +584,7 @@ public void writeToParcel(Parcel out, int flags) {
out.writeString(region);
out.writeTypedList(operators);
out.writeTypedList(routes);
out.writeList(modeIdentifiers);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.skedgo.tripkit.common.model

const val LOCATION_CLASS_SCHOOL = "SchoolLocation"
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public ScheduledStop createFromParcel(Parcel in) {
stop.mType = StopType.from(in.readString());
stop.modeInfo = in.readParcelable(ModeInfo.class.getClassLoader());
stop.wheelchairAccessible = (Boolean) in.readValue(Boolean.class.getClassLoader());
stop.bicycleAccessible = (Boolean) in.readValue(Boolean.class.getClassLoader());
stop.alertHashCodes = in.readArrayList(Long.class.getClassLoader());
return stop;
}
Expand Down Expand Up @@ -63,6 +64,9 @@ public ScheduledStop[] newArray(int size) {
@SerializedName("wheelchairAccessible")
private @Nullable
Boolean wheelchairAccessible;
@SerializedName("bicycleAccessible")
private @Nullable
Boolean bicycleAccessible;
@SerializedName("alertHashCodes")
private @Nullable
ArrayList<Long> alertHashCodes;
Expand Down Expand Up @@ -146,6 +150,7 @@ public void fillFrom(Location location) {
mParentId = other.mParentId;
mCurrentFilter = other.mCurrentFilter;
wheelchairAccessible = other.wheelchairAccessible;
bicycleAccessible = other.bicycleAccessible;
alertHashCodes = other.alertHashCodes;
}
}
Expand Down Expand Up @@ -266,6 +271,15 @@ public void setWheelchairAccessible(@Nullable Boolean wheelchairAccessible) {
this.wheelchairAccessible = wheelchairAccessible;
}

@Nullable
public Boolean getBicycleAccessible() {
return bicycleAccessible;
}

public void setBicycleAccessible(@Nullable Boolean bicycleAccessible) {
this.bicycleAccessible = bicycleAccessible;
}

public String getEndStopCode() {
return mEndStopCode;
}
Expand Down Expand Up @@ -323,6 +337,7 @@ public void writeToParcel(Parcel out, int flags) {
out.writeString(mType == null ? null : mType.toString());
out.writeParcelable(modeInfo, 0);
out.writeValue(wheelchairAccessible);
out.writeValue(bicycleAccessible);
out.writeList(alertHashCodes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Represents a future stop of a service in a trip.
*/
public class ServiceStop extends Location implements WheelchairAccessible {
public class ServiceStop extends Location implements WheelchairAccessible, BicycleAccessible {
public static final Creator<ServiceStop> CREATOR = new Creator<ServiceStop>() {
public ServiceStop createFromParcel(Parcel in) {
Location location = Location.CREATOR.createFromParcel(in);
Expand All @@ -23,6 +23,7 @@ public ServiceStop createFromParcel(Parcel in) {
stop.code = in.readString();
stop.shortName = in.readString();
stop.wheelchairAccessible = (Boolean) in.readValue(Boolean.class.getClassLoader());
stop.bicycleAccessible = (Boolean) in.readValue(Boolean.class.getClassLoader());
stop.type = StopType.from(in.readString());

return stop;
Expand All @@ -46,6 +47,7 @@ public ServiceStop[] newArray(int size) {
@SerializedName("code") private String code;
@SerializedName("shortName") private @Nullable String shortName;
@SerializedName("wheelchairAccessible") private @Nullable Boolean wheelchairAccessible;
@SerializedName("bicycleAccessible") private @Nullable Boolean bicycleAccessible;

public ServiceStop() {}

Expand Down Expand Up @@ -101,6 +103,14 @@ public void setWheelchairAccessible(@Nullable Boolean wheelchairAccessible) {
this.wheelchairAccessible = wheelchairAccessible;
}

@Nullable public Boolean getBicycleAccessible() {
return bicycleAccessible;
}

public void setBicycleAccessibleAccessible(@Nullable Boolean bicycleAccessible) {
this.bicycleAccessible = bicycleAccessible;
}

public StopType getType() {
return type;
}
Expand Down Expand Up @@ -148,6 +158,7 @@ public void writeToParcel(Parcel out, int flags) {
out.writeString(code);
out.writeString(shortName);
out.writeValue(wheelchairAccessible);
out.writeValue(bicycleAccessible);
out.writeString(type == null ? null : type.toString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TransportMode {
public static final String ID_SHUFFLE = "ps_shu";
public static final String ID_TNC = "ps_tnc";
public static final String ID_BICYCLE = "cy_bic";
public static final String ID_SCHOOL_BUS = "pt_sch";
public static final String ID_SCHOOL_BUS = "pt_ltd_SCHOOLBUS";
public static final String ID_PUBLIC_TRANSPORT = "pt_pub";
public static final String ID_MOTORBIKE = "me_mot";
public static final String ID_CAR = "me_car";
Expand Down Expand Up @@ -62,7 +62,7 @@ public static int getLocalIconResId(@Nullable String identifier) {
return R.drawable.ic_public_transport;
} else if (ID_TAXI.equals(identifier)) {
return R.drawable.ic_taxi;
} else if (ID_SHUTTLE_BUS.equals(identifier)) {
} else if (ID_SHUTTLE_BUS.equals(identifier) || ID_SCHOOL_BUS.equals(identifier)) {
return R.drawable.ic_shuttlebus;
} else if (ID_MOTORBIKE.equals(identifier)) {
return R.drawable.ic_motorbike;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ package com.skedgo.tripkit.common.model

interface WheelchairAccessible {
val wheelchairAccessible: Boolean?
}

interface BicycleAccessible {
val bicycleAccessible: Boolean?
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import android.util.DisplayMetrics;

import com.skedgo.tripkit.configuration.Server;
import com.skedgo.tripkit.configuration.ServerManager;
import com.skedgo.tripkit.routing.ModeInfo;
import com.skedgo.tripkit.common.model.TransportMode;

public final class TransportModeUtils {
public static final String ICON_URL_TEMPLATE = Server.ApiTripGo.getValue() + "modeicons/android/%s/ic_transport_%s.png";
public static final String ICON_URL_TEMPLATE = ServerManager.INSTANCE.getConfiguration().getApiTripGoUrl() + "modeicons/android/%s/ic_transport_%s.png";

private TransportModeUtils() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ data class Geofence(
) {
var timeline: Long = -1L

fun computeAndSetTimeline(tripEndDateTimeInMillis: Long): Long {
fun computeAndSetTimeline(tripEndDateTimeInMillis: Long) {
val currentTimeInMillis = System.currentTimeMillis()
return tripEndDateTimeInMillis - currentTimeInMillis
timeline = tripEndDateTimeInMillis - currentTimeInMillis
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.skedgo.tripkit.routing

import androidx.annotation.StringDef

@Retention(AnnotationRetention.RUNTIME)
@StringDef(
RemoteIcon.NEURON,
RemoteIcon.LIME,
)
annotation class RemoteIcon {
companion object {
const val NEURON = "neuron"
const val LIME = "lime"
}
}
Loading

0 comments on commit 55fd2dd

Please sign in to comment.