Skip to content

Commit 31659fb

Browse files
committed
Merge branch 'master' into feature/1707-auto-accept
# Conflicts: # .github/workflows/build_android.yml # android/app/build.gradle # ios/CoopCycle/Info.plist
2 parents 5fb4ede + 80e184d commit 31659fb

File tree

10 files changed

+88
-19
lines changed

10 files changed

+88
-19
lines changed

.github/workflows/build_android.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ on:
4444
description: 'Build Naofood app'
4545
required: true
4646
type: boolean
47-
# build_zampate:
48-
# description: 'Build Zampate app'
49-
# required: true
50-
# type: boolean
5147
build_kooglof:
5248
description: 'Build Kooglof app'
5349
required: true
@@ -60,6 +56,10 @@ on:
6056
description: 'Build Coursiers Rennais app'
6157
required: true
6258
type: boolean
59+
build_eraman:
60+
description: 'Build Eraman app'
61+
required: true
62+
type: boolean
6363
jobs:
6464
coopcycle:
6565
if: ${{ inputs.build_official }}
@@ -196,3 +196,18 @@ jobs:
196196
google_play_track: ${{ inputs.google_play_track }}
197197
deploy_google_play: ${{ inputs.deploy_google_play }}
198198
secrets: inherit
199+
eraman:
200+
if: ${{ inputs.build_eraman }}
201+
name: Build Eraman app
202+
uses: ./.github/workflows/fastlane_android.yml
203+
with:
204+
instance: eraman
205+
instance_url: https://eramangasteiz.coopcycle.org
206+
app_name: Eraman
207+
primary_color: "#317764"
208+
package_name: fr.coopcycle.eraman
209+
keystore_key_alias: instance
210+
keystore_key_password_secret: SIGNING_KEY_PASSWORD_INSTANCE
211+
google_play_track: ${{ inputs.google_play_track }}
212+
deploy_google_play: ${{ inputs.deploy_google_play }}
213+
secrets: inherit

.github/workflows/build_ios.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ on:
3333
description: 'Build RobinFood app'
3434
required: true
3535
type: boolean
36+
build_lcr:
37+
description: 'Build les coursiers Rennais app'
38+
required: true
39+
type: boolean
3640
jobs:
3741
coopcycle:
3842
if: ${{ inputs.build_official }}
@@ -92,3 +96,15 @@ jobs:
9296
primary_color: "#ff0000"
9397
google_service_info_plist_base64: GOOGLE_SERVICE_INFO_PLIST_BASE64_ROBINFOOD
9498
secrets: inherit
99+
lcr:
100+
if: ${{ inputs.build_lcr }}
101+
name: Build les coursiers Rennais app
102+
uses: ./.github/workflows/fastlane_ios.yml
103+
with:
104+
instance: lcr
105+
instance_url: https://lcr.coopcycle.org
106+
app_name: Les Coursiers Rennais
107+
app_id: org.coopcycle.LCR
108+
primary_color: "#0A090A"
109+
google_service_info_plist_base64: GOOGLE_SERVICE_INFO_PLIST_BASE64_LCR
110+
secrets: inherit

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ android {
9090
minSdkVersion rootProject.ext.minSdkVersion
9191
targetSdkVersion rootProject.ext.targetSdkVersion
9292
multiDexEnabled true
93-
versionCode 207
94-
versionName "2.17.3"
93+
versionCode 210
94+
versionName "2.19.1"
9595

9696
manifestPlaceholders = [
9797
tipsiStripeRedirectScheme: "coopcycle",
167 KB
Loading

ios/CoopCycle/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>2.17.3</string>
20+
<string>2.19.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>
@@ -37,7 +37,7 @@
3737
</dict>
3838
</array>
3939
<key>CFBundleVersion</key>
40-
<string>207</string>
40+
<string>146</string>
4141
<key>FacebookAppID</key>
4242
<string>1303550106471840</string>
4343
<key>FacebookClientToken</key>
138 KB
Loading

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,6 @@
206206
"type": "android.attached"
207207
}
208208
}
209-
}
209+
},
210+
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
210211
}

src/navigation/dispatch/UnassignedTasks.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { selectUnassignedTasksNotCancelled } from '../../redux/Dispatch/selector
2020
import AddButton from './components/AddButton';
2121

2222
import { navigateToTask } from '../../navigation/utils';
23+
import moment from 'moment';
24+
import { tasksSort } from '../../shared/src/logistics/redux/taskUtils';
2325

2426
class UnassignedTasks extends Component {
2527
componentDidMount() {
@@ -52,6 +54,8 @@ class UnassignedTasks extends Component {
5254
const { navigate } = this.props.navigation;
5355
const isEmpty = this.props.unassignedTasks.length === 0;
5456

57+
const unassignedTasks = this.props.unassignedTasks.sort(tasksSort)
58+
5559
return (
5660
<View style={{ flex: 1 }}>
5761
<View>
@@ -67,7 +71,7 @@ class UnassignedTasks extends Component {
6771
{isEmpty && <TapToRefresh onPress={this.props.loadUnassignedTasks} />}
6872
{!isEmpty && (
6973
<TaskList
70-
tasks={this.props.unassignedTasks}
74+
tasks={unassignedTasks}
7175
tasksWithColor={this.props.tasksWithColor}
7276
swipeOutLeftEnabled={task => !task.isAssigned}
7377
onSwipeLeft={task =>

src/redux/Dispatch/actions.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CommonActions } from '@react-navigation/native';
22
import { Alert } from 'react-native';
33
import { createAction } from 'redux-actions';
44

5+
import _ from 'lodash';
56
import NavigationHolder from '../../NavigationHolder';
67
import i18n from '../../i18n';
78
import { connect } from '../middlewares/CentrifugoMiddleware/actions';
@@ -20,7 +21,7 @@ import {
2021
startTaskSuccess,
2122
} from '../Courier';
2223

23-
import { withLinkedTasks } from '../../shared/src/logistics/redux/taskUtils';
24+
import { withUnassignedLinkedTasks } from '../../shared/src/logistics/redux/taskUtils';
2425
import { isSameDate } from './utils';
2526

2627
/*
@@ -298,7 +299,7 @@ export function assignTask(task, username) {
298299
return function (dispatch, getState) {
299300
const httpClient = getState().app.httpClient;
300301

301-
const linkedTasks = withLinkedTasks(task, selectAllTasks(getState()));
302+
const linkedTasks = withUnassignedLinkedTasks(task, selectAllTasks(getState()));
302303

303304
if (linkedTasks.length > 1) {
304305
dispatch(bulkAssignmentTasksRequest());
@@ -325,16 +326,30 @@ export function assignTask(task, username) {
325326
};
326327
}
327328

329+
/**
330+
* Assign several tasks at once (and add the linked tasks)
331+
* @param {Array.Objects} tasks - Tasks to be assigned
332+
* @param {string} username - Username of the rider to which we assign
333+
*
334+
*/
328335
export function bulkAssignmentTasks(tasks, username) {
329336
return function (dispatch, getState) {
330337
const httpClient = getState().app.httpClient;
331338

332339
dispatch(bulkAssignmentTasksRequest());
333340

341+
let tasksToAssign = [];
342+
343+
tasks.forEach((task) => {
344+
tasksToAssign.push(...withUnassignedLinkedTasks(task, selectAllTasks(getState())))
345+
});
346+
347+
const payload = _.uniq(tasksToAssign.map(t => t['@id']));
348+
334349
return httpClient
335350
.put('/api/tasks/assign', {
336351
username,
337-
tasks: tasks.map(t => t['@id']),
352+
tasks: payload,
338353
})
339354
.then(res => dispatch(bulkAssignmentTasksSuccess(res['hydra:member'])))
340355
.catch(e => dispatch(bulkAssignmentTasksFailure(e)));
@@ -357,7 +372,8 @@ export function unassignTask(task, username) {
357372
export function updateTask(action, task) {
358373
return function (dispatch, getState) {
359374
let date = selectSelectedDate(getState());
360-
375+
console.log(action)
376+
console.log(task)
361377
if (isSameDate(task, date)) {
362378
switch (action) {
363379
case 'task:created':

src/shared/src/logistics/redux/taskUtils.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
import ColorHash from 'color-hash';
22
import _, { mapValues } from 'lodash';
3+
import moment from 'moment';
4+
5+
6+
/**
7+
* Utility function to sort a list of tasks
8+
* @param {Object} a - Task
9+
* @param {Object} b - Task
10+
*/
11+
export function tasksSort(a, b) {
12+
if (moment(a.before).isSame(b.before) && a.type === 'PICKUP') {
13+
return -1
14+
} else {
15+
// put on top of the list the tasks that have an end of delivery window that finishes sooner
16+
return moment(a.before).isBefore(b.before) ? -1 : 1
17+
}
18+
}
319

420
const colorHash = new ColorHash();
521

@@ -36,13 +52,11 @@ export function groupLinkedTasks(tasks) {
3652
}
3753

3854
return mapValues(groups, value => {
39-
value.sort();
40-
41-
return value;
55+
return value.sort(); // sort by task id useless if the dropoff was created before the pickup
4256
});
4357
}
4458

45-
export function withLinkedTasks(task, allTasks) {
59+
function withLinkedTasks(task, allTasks) {
4660
const groups = groupLinkedTasks(allTasks);
4761
const newTasks = [];
4862

@@ -55,8 +69,11 @@ export function withLinkedTasks(task, allTasks) {
5569
// task with no linked tasks
5670
newTasks.push(task);
5771
}
72+
return newTasks.sort(tasksSort);
73+
}
5874

59-
return newTasks;
75+
export function withUnassignedLinkedTasks(task, allTasks) {
76+
return withLinkedTasks(task, allTasks).filter(t => !t.assignedTo)
6077
}
6178

6279
export function mapToColor(tasks) {

0 commit comments

Comments
 (0)