Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
pull_request:
branches: [master]

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Provide onfleet.properties (placeholder is fine for a build)
run: |
if [ ! -f app/src/main/assets/onfleet.properties ]; then
cp app/src/main/assets/onfleet.properties.example \
app/src/main/assets/onfleet.properties
fi

- name: Assemble debug
run: ./gradlew assembleDebug --no-daemon --stacktrace
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
**/**/*.apk
/app/production
/app/debug
/app/google-services.json
/fastlane/report.xml
/firebase_app_distribution
/.idea/deploymentTargetDropDown.xml
/bundletool_temp/bundletool.jar
/app/jacoco.exec

# Local SDK config — copy from onfleet.properties.example
/app/src/main/assets/onfleet.properties

# Local Firebase config — replaces the committed placeholder google-services.json
/app/google-services.json.local
60 changes: 56 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,63 @@
# Change Log
Breaking changes and additions to to Onfleet SDK will be documented in this file.
Breaking changes and additions to Onfleet SDK will be documented in this file.

## [0.11.1] - 2023-09-14
## [0.12.0]

Breaking changes to API

### Added Features

- **Custom fields** ([Custom Fields](https://support.onfleet.com/hc/en-us/articles/21799942217748-Custom-Fields))
- **Route plans** ([Route Plans](https://support.onfleet.com/hc/en-us/articles/25492148360596-Route-Plans))
- **Self-assign tasks** ([Self-Assign Tasks & Routes](https://support.onfleet.com/hc/en-us/articles/360041740172-Self-Assign-Tasks-Routes))
- **End-of-route task types** ([End Route / Return to Hub](https://support.onfleet.com/hc/en-us/articles/34992206461716-End-Route-Return-to-Hub))
- **Route load & bulk pick-up task types**
- **Hidden requirement state**
- **Custom task completion requirements** ([Proof of Delivery](https://support.onfleet.com/hc/en-us/articles/10348848090644-Proof-of-Delivery))
- **Custom completion reasons** ([Custom Task Completion Reasons](https://support.onfleet.com/hc/en-us/articles/9382652814228-Custom-Task-Completion-Reasons))
- **Age attestation** ([Complete a Task](https://support.onfleet.com/hc/en-us/articles/10373142665364-Complete-a-Task#h_01GGAK84GT77TGWRK5GHTH065X))
- **Order short id**
- **Completed-task PII setting** ([Remove PII from Driver Task History](https://support.onfleet.com/hc/en-us/articles/38159626547348-Remove-Personally-Identifiable-Information-PII-from-Driver-Task-History))

### Added

- CompletedTask has custom field support in the public model (`getCustomFields()`)
- Custom field checklist variant added: `CustomField.CustomFieldChecklist`
- Route model added (`Route`) to support route plans
- TasksManager has new `getRoutes()` method
- TasksManager has new `selfAssignRoutes()` method
- TasksManager has new `getSelfAssignableTasks()` method (task list split)
- Task and CompletedTask now expose `TaskType` in public API
- Requirements model for task completion added (`Requirements`, `RequirementState`)
- Task completion CustomRequirements added
- Package completion reasons exposed (`PackageCompletionReason`)
- Task object has a new field isRecipientNumberActive related to the offline mode
- Task object has a new field attestationAge
- Task object has orderShortId
- Organization object has a new settings completedTaskPIIEnabled
- Organization object has a new settings warnWhenStartTaskOnDifferentRoute

### Changed

- CompletedTask attachments are now of type `CompletedTaskAttachment` (previous attachment helper methods moved accordingly)
- Task/CompletedTask signatures expanded with requirements and task-type payloads (`Requirements`, `TaskType`, `CustomRequirements`)
- TasksManager task assignment changed: `selfAssignTask()` renamed/split into `selfAssignTasks()` and `selfAssignRoutes()`
- Sync type enum removed (`SyncType`) and sync payloads now use updated sync status/data semantics
- Account deletion response enum removed (`DeleteAccountResponse`)
- Android minimum supported SDK increased from 24 to 26 (consumer apps must target `minSdk >= 26`)
- CompletedTask isPickupTask has been removed. Use type (TaskType) instead
- CompletedTask metadata type is renamed to Metadata
- Task isPickupTask has been removed. Use type (TaskType) instead
- Task recipientMetadata type is renamed to Metadata
- Task metadata type is renamed to Metadata
- DriverManager getDriver() is now nullable instead of throwing exception
- SessionManager getOrganization() is now nullable instead of throwing exception

## [0.11.1]

No changes. Only a proguard fix to avoid dependency conflicts on the obfuscated classes.

## [0.11.0] - 2023-06-19
## [0.11.0]

Breaking changes to API

Expand All @@ -29,7 +81,7 @@ Breaking changes to API

### Fixed

## [0.10.5] - 2023-06-01
## [0.10.5]

### Added

Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# Android Onfleet SDK example project

- in the assets folder onfleet.properties file enter an application name and SDK key
- add google-services.json that you registered with Onfleet for push messages
A minimal example app showing how to integrate the Onfleet Driver SDK.

## Setup

1. Copy the config template and fill in the values Onfleet gave you:
```bash
cp app/src/main/assets/onfleet.properties.example app/src/main/assets/onfleet.properties
```
- `applicationName` — your application name
- `sdkApplicationId` — your Onfleet SDK key

2. (Push notifications) Replace the placeholder `app/google-services.json` with the
`google-services.json` for the Firebase project you registered with Onfleet. The
committed file is a non-functional placeholder so the project builds out of the box;
push delivery requires your own Firebase config.

## Build

```bash
./gradlew assembleDebug
```

CI builds every pull request and every push to `master`.
Comment thread
polivmi1 marked this conversation as resolved.
61 changes: 25 additions & 36 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,66 +1,55 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-parcelize")
id("org.jetbrains.kotlin.plugin.parcelize")
id("com.google.gms.google-services")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
compileSdk = 34
buildToolsVersion = "34.0.0"
compileSdk = 36
buildToolsVersion = "36.0.0"

defaultConfig {
applicationId = "com.onfleet.sdk.onfleetclientexample"
minSdk = 24
targetSdk = 34
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "0.11.1"
multiDexEnabled = true
versionName = "0.12.0"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
debug {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
}
namespace = "com.onfleet.sdk.onfleetclientexample"
}

dependencies {
implementation("com.onfleet:driver:0.11.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.core:core-ktx:1.10.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.22")
implementation("androidx.exifinterface:exifinterface:1.3.6")
implementation("com.google.firebase:firebase-core:21.1.1")
implementation("com.google.firebase:firebase-messaging:23.1.2")
implementation("androidx.multidex:multidex:2.0.1")
implementation("com.onfleet:driver:0.12.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
implementation("androidx.exifinterface:exifinterface:1.4.2")
implementation(platform("com.google.firebase:firebase-bom:34.11.0"))
implementation("com.google.firebase:firebase-messaging")
implementation("com.jakewharton.timber:timber:5.0.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
implementation("androidx.compose.ui:ui:1.5.0-beta02")
implementation("androidx.compose.ui:ui-tooling:1.5.0-beta02")
implementation("androidx.compose.foundation:foundation:1.5.0-beta02")
implementation("androidx.compose.compiler:compiler:1.4.7")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
implementation("androidx.compose.material3:material3:1.2.0-alpha02")
implementation("com.google.accompanist:accompanist-permissions:0.31.3-beta")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
implementation("androidx.compose.ui:ui:1.10.5")
implementation("androidx.compose.ui:ui-tooling:1.10.5")
Comment thread
polivmi1 marked this conversation as resolved.
implementation("androidx.compose.foundation:foundation:1.10.5")
implementation("androidx.activity:activity-compose:1.13.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0")
implementation("androidx.compose.material3:material3:1.4.0")
implementation("com.google.accompanist:accompanist-permissions:0.37.3")
}
25 changes: 25 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"project_info": {
"project_number": "000000000000",
"project_id": "onfleet-sdk-example-placeholder",
"storage_bucket": "onfleet-sdk-example-placeholder.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:000000000000:android:0000000000000000000000",
"android_client_info": {
"package_name": "com.onfleet.sdk.onfleetclientexample"
}
},
"oauth_client": [],
"api_key": [
{ "current_key": "AIzaSyPLACEHOLDERPLACEHOLDERPLACEHOLDER00000" }
],
"services": {
"appinvite_service": { "other_platform_oauth_client": [] }
}
}
],
"configuration_version": "1"
}
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Expand Down
4 changes: 0 additions & 4 deletions app/src/main/assets/onfleet.properties

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/assets/onfleet.properties.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copy this file to onfleet.properties and fill in the values.
# cp app/src/main/assets/onfleet.properties.example app/src/main/assets/onfleet.properties
# Both values are provided by Onfleet when you register your app.
applicationName=
sdkApplicationId=
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.widget.Toast
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.*
Expand Down Expand Up @@ -63,7 +64,7 @@ class MainActivity : AppCompatActivity() {
} else if (!state.isAuthenticated) {
var phone by remember { mutableStateOf("") }
var password by remember { mutableStateOf("") }
Column(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center) {
TextField(value = phone, label = { Text("Phone") }, onValueChange = { phone = it })
TextField(
value = password, label = { Text("Password") }, onValueChange = { password = it },
Expand All @@ -80,7 +81,8 @@ class MainActivity : AppCompatActivity() {
} else if (state.isList) {
LazyColumn(
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
modifier = Modifier.fillMaxSize()
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center
) {
item {
Switch(
Expand Down Expand Up @@ -112,7 +114,7 @@ class MainActivity : AppCompatActivity() {
}
} else if (state.isDetails) {
state.selectedTask?.let {
Column(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center) {
Text("Details of " + it.shortId)
Button(
onClick = {
Expand Down
Loading
Loading