Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DriverHub Crack #111

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
3fc10fe
Set up project as REV's Software Manager for Android
NoahAndrews Apr 28, 2021
5fb6789
Add modification note
NoahAndrews Apr 28, 2021
2125935
Show Updates tab first
NoahAndrews Apr 29, 2021
aaf3f6a
Show only the updates tab
NoahAndrews Apr 29, 2021
deb9f93
Hide tab bar when only one tab is available
NoahAndrews Apr 29, 2021
b3253e4
Change RepositoryUpdater.context type to Application
NoahAndrews Apr 29, 2021
fa94ba9
If there are no updates, show elapsed time since all enabled repos we…
NoahAndrews Apr 29, 2021
1ecacf4
remove "android" from package name
NoahAndrews May 3, 2021
58478ad
Enable REV Robotics repo by default, disable F-Droid repo by default
NoahAndrews May 3, 2021
0103875
Use Driver Hub OS version info in place of the version info for its c…
NoahAndrews May 3, 2021
72504eb
Use getExternalFilesDir() for cache directory
NoahAndrews May 4, 2021
5477205
Use kotlin thread{} function
NoahAndrews May 4, 2021
b74ffb8
Add support for installing Driver Hub OS updates
NoahAndrews May 4, 2021
081d915
Show status when installing OS updates
NoahAndrews May 4, 2021
ac367fa
Disable Repositories menu option
NoahAndrews May 4, 2021
26be9ef
Disable switches for ignoring updates
NoahAndrews May 4, 2021
c565b2e
Hide details buttons for Driver Hub OS
NoahAndrews May 4, 2021
73b7a44
Use real Driver Hub OS version code
NoahAndrews May 4, 2021
772ba93
Clean up TODOs
NoahAndrews May 4, 2021
a71ccc3
Enable V2 key signing
NoahAndrews May 5, 2021
dd4bb22
Use "standard" keystore property names
NoahAndrews May 5, 2021
8e51295
Set signature of REV Robotics repository
NoahAndrews May 5, 2021
1b15c00
Update signature of the Driver Hub OS container
NoahAndrews May 5, 2021
ed2f59d
Don't show uninstall button on Driver Hub OS
NoahAndrews May 5, 2021
271be78
Replace Foxy Droid icon with a REV icon
NoahAndrews May 6, 2021
a467398
Show explanation of current view when tabs are disabled
NoahAndrews May 7, 2021
84ea419
Update README
NoahAndrews May 8, 2021
b71ab09
Fix incorrect package name
NoahAndrews May 9, 2021
63215c3
Implement Update All button
NoahAndrews May 9, 2021
672201c
Minor refactoring
NoahAndrews May 10, 2021
eba7dc8
Install DH OS update at end of "Update All" routine
NoahAndrews May 11, 2021
17cf5fc
Show progress updates on any screen when "Update All" was pressed
NoahAndrews May 11, 2021
15fa52f
Simplify code to auto-install OS update on launch
NoahAndrews May 11, 2021
10371e1
Do non-forced sync on application start
NoahAndrews May 11, 2021
9ea7ca2
Fix checking if the just-downloaded app is the Driver Hub OS
NoahAndrews May 11, 2021
57c5a92
Fix check for if a release file has already been downloaded
NoahAndrews May 11, 2021
d156c54
Improve status messages when updating all software
NoahAndrews May 11, 2021
cf23f13
Add TODOs
NoahAndrews May 11, 2021
f7fbd8b
Revert "Do non-forced sync on application start"
NoahAndrews May 11, 2021
455049c
Sync repositories when activity is created
NoahAndrews May 11, 2021
848df8f
Add TODO
NoahAndrews May 11, 2021
f5d09f6
Bump version info
NoahAndrews Jun 1, 2021
6c7d326
Add preference to show all tabs
NoahAndrews Jun 1, 2021
cbf77f6
Don't show error notification when automatic sync triggered by activi…
NoahAndrews Jun 2, 2021
b8c20b9
Clear error notification when sync succeeds
NoahAndrews Jun 2, 2021
dc28def
Merge pull request #1 from REVrobotics/improve-notifications
Jun 3, 2021
c81c363
Move tracker of when repos were downloaded out of ProductsFragment
NoahAndrews Jun 3, 2021
176cec2
Don't use new thread when initializing LastUpdateOfAllReposTracker
NoahAndrews Jun 3, 2021
3e201c1
Use java.time in LastUpdateOfAllReposTracker, tweak naming
NoahAndrews Jun 3, 2021
0009011
Skip sync Job if the repos have been synced in the past 11 hours
NoahAndrews Jun 3, 2021
325bf45
Add additional auto-sync mechanism for Driver Hub
NoahAndrews Jun 3, 2021
06245fd
Clarify foreground service vs background
NoahAndrews Jun 3, 2021
c8b9911
Ask users to connect to the Internet again if it has been a week or m…
NoahAndrews Jun 3, 2021
1ce5a7b
Merge branch 'internet-available-broadcast-receiver-2' into show-all-…
NoahAndrews Jun 3, 2021
7347ebe
Merge pull request #2 from REVrobotics/internet-available-broadcast-r…
Jun 3, 2021
81f26e3
Display notification on boot when repositories are 6+ weeks stale
NoahAndrews Jun 4, 2021
637c47d
Merge pull request #3 from REVrobotics/show-notification-if-repos-are…
Jun 4, 2021
469ef02
Merge branch 'main' into show-all-tabs-option
NoahAndrews Jun 4, 2021
f83854a
Remove finished TODO
NoahAndrews Jun 4, 2021
f19aea5
Use build flavor to show/hide option "all tabs" option
NoahAndrews Jun 7, 2021
f09f9a2
Remove finished TODO
NoahAndrews Jun 4, 2021
b5578a4
Rename NOTIF_CHANNEL_ID_STALE_REPOS
NoahAndrews Jun 7, 2021
dabb786
Allow updates notification to be shown while updates tab is displayed
NoahAndrews Jun 7, 2021
946a61e
Show updates notification even if repo data hasn't changed
NoahAndrews Jun 7, 2021
0c0afcc
Prep for only displaying the stale repos notif when there are no updates
NoahAndrews Jun 7, 2021
1225b30
Rename confusing hasUpdates parameter
NoahAndrews Jun 7, 2021
d0ebafd
Merge pull request #4 from REVrobotics/show-all-tabs-option
Jun 7, 2021
a96deb0
Display updates available notification on boot if applicable
NoahAndrews Jun 7, 2021
f12c646
Bump priority of update notifications to default (from low)
NoahAndrews Jun 7, 2021
7b7aee5
Explicitly group "sync failed" notifications to avoid imposed grouping
NoahAndrews Jun 7, 2021
3f2d7ea
Use REV "R" icon for update notifications
NoahAndrews Jun 7, 2021
f21af76
Display name of an app available for update in the notification summary
NoahAndrews Jun 7, 2021
73a08e9
Document previous code change
NoahAndrews Jun 7, 2021
e10d3bd
Refresh update notification when apps are installed, deleted, or updated
NoahAndrews Jun 7, 2021
e8dc3a4
Fix repeated notification sound; a couple of tiny notification tweaks
NoahAndrews Jun 7, 2021
b2d2e61
Add Update All action to Updates notification
NoahAndrews Jun 7, 2021
4aec789
Extract intent creation logic
NoahAndrews Jun 7, 2021
62bb3b6
Merge pull request #5 from REVrobotics/improve-updates-available-noti…
Jun 8, 2021
0b7bc6b
Track relevant notification dismissals
NoahAndrews Jun 8, 2021
164b64a
Spacing tweak
NoahAndrews Jun 8, 2021
51c54af
Update build environment
NoahAndrews Jun 8, 2021
5e68bba
After sync completes, call function with full notification logic
NoahAndrews Jun 9, 2021
c8fa153
Merge pull request #6 from REVrobotics/track-notification-dismissals
Jun 9, 2021
1049988
Tweaks and TODOS in prep for "please connect to Internet" popup
NoahAndrews Jun 10, 2021
8416995
WIP waiting for internet before attempting a download
NoahAndrews Jun 12, 2021
2d1019a
Always perform the desired action immediately upon Internet connection
NoahAndrews Jun 15, 2021
1757ba1
Fix wait for internet functionality
NoahAndrews Jun 16, 2021
6f9f59e
Rename desiredActionAfterInternetConnected
NoahAndrews Jun 16, 2021
3cfb9dd
Only start activity on internet connection if there is an action waiting
NoahAndrews Jun 16, 2021
52019d6
Merge pull request #7 from REVrobotics/wait-for-internet-before-attem…
Jun 16, 2021
7bdf67c
Set version to 1.0.1
NoahAndrews Jun 16, 2021
1de17c5
Merge remote-tracking branch 'origin/main'
NoahAndrews Jun 16, 2021
b496a22
Add TODO
NoahAndrews Jun 16, 2021
6842a36
Use REV Robotics staging repo when built in debug mode
NoahAndrews Sep 23, 2021
687245b
Never add the staging repo when not running a debug build
NoahAndrews Sep 23, 2021
dfeb9dc
Move code that selects the appropriate repo to app startup
NoahAndrews Sep 23, 2021
07fb3b0
Undo formatting change
NoahAndrews Sep 23, 2021
8ea68da
Merge pull request #8 from REVrobotics/support-staging-repo
Sep 23, 2021
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
41 changes: 13 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
# Foxy Droid
# REV Robotics Software Manager for Android

Yet another F-Droid client.
Allows on-device updating of the Driver Hub Operating System and its built-in apps.

[![Release](https://img.shields.io/github/v/release/kitsunyan/foxy-droid)](https://github.com/kitsunyan/foxy-droid/releases)
[![F-Droid](https://img.shields.io/f-droid/v/nya.kitsunyan.foxydroid)](https://f-droid.org/packages/nya.kitsunyan.foxydroid/)
Based on the [Foxy Droid](https://github.com/kitsunyan/foxy-droid) F-Droid client.

## Description
[comment]: <> (Installing apps from the [F-Droid app repository]&#40;https://www.f-droid.org/en/packages/&#41; can optionally be enabled.)

Unofficial F-Droid client in the style of the classic one.

Jump over the lazy dog, manage repositories, and install software quickly. No privileged extension, root installation,
or sharing local repositories nearby.

### Features

* Classic F-Droid style
* No cards or inappropriate animations
* Fast repository syncing
* Standard Android components and minimal dependencies

### Screenshots

<p>
<img src="metadata/en-US/images/phoneScreenshots/1.png" width="15%" />
<img src="metadata/en-US/images/phoneScreenshots/2.png" width="15%" />
<img src="metadata/en-US/images/phoneScreenshots/3.png" width="15%" />
<img src="metadata/en-US/images/phoneScreenshots/4.png" width="15%" />
<img src="metadata/en-US/images/phoneScreenshots/5.png" width="15%" />
<img src="metadata/en-US/images/phoneScreenshots/6.png" width="15%" />
</p>
[comment]: <> (These apps are provided by the F-Droid community and are not supported by REV Robotics.)

## Building and Installing

You cannot replace the Software Manager app on a Driver Hub, so you will need to change the
`applicationId` in `build.gradle` from `com.revrobotics.softwaremanager` to something else.
Then you will be able to install your build of the Software Manager alongside the official one.
No functionality is exclusive to the official build; user-built versions can do everything the
official version can.

Specify your Android SDK path either using the `ANDROID_HOME` environment variable, or by filling out the `sdk.dir`
property in `local.properties`.

Expand All @@ -48,4 +32,5 @@ Run `./gradlew assembleRelease` to build the package, which can be installed usi

## License

Foxy Droid is available under the terms of the GNU General Public License v3 or later. Copyright © 2020 kitsunyan.
This software is available under the terms of the GNU General Public License v3 or later.
Copyright © 2020-2021 kitsunyan, REV Robotics.
42 changes: 30 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext.versions = [
android: '3.4.1',
kotlin: '1.3.72'
android: '4.1.1',
kotlin: '1.4.32'
]

repositories {
Expand All @@ -23,12 +23,15 @@ android {
buildToolsVersion '29.0.3'

defaultConfig {
archivesBaseName = 'foxy-droid'
applicationId 'nya.kitsunyan.foxydroid'
minSdkVersion 21
// archive name, application ID, minSdk, targetSdk, and version information have been modified
// by REV Robotics.
archivesBaseName = 'SoftwareManager'
applicationId 'com.revrobotics.softwaremanager'
minSdkVersion 29
//noinspection OldTargetApi
targetSdkVersion 29
versionCode 4
versionName '1.3'
versionCode 2
versionName '1.0.1'

def languages = [ 'en' ]
buildConfigField 'String[]', 'LANGUAGES', '{ "' + languages.join('", "') + '" }'
Expand Down Expand Up @@ -85,10 +88,11 @@ android {
keystoreProperties.load(keystorePropertiesFile.newDataInputStream())

def signing = [
storeFile: keystoreProperties['store.file'],
storePassword: keystoreProperties['store.password'],
keyAlias: keystoreProperties['key.alias'],
keyPassword: keystoreProperties['key.password']
// Modified by REV Robotics on 2021-05-05 to use Google-recommended property names
storeFile: keystoreProperties['storeFile'],
storePassword: keystoreProperties['storePassword'],
keyAlias: keystoreProperties['keyAlias'],
keyPassword: keystoreProperties['keyPassword']
]

if (!signing.any { _, v -> v == null }) {
Expand All @@ -98,7 +102,8 @@ android {
storePassword signing.storePassword
keyAlias signing.keyAlias
keyPassword signing.keyPassword
v2SigningEnabled false
// v2SigningEnabled set to true by REV Robotics on 2021-05-05
v2SigningEnabled true
}
}

Expand All @@ -108,6 +113,19 @@ android {
}
}
}

// Flavor configuration added by REV Robotics on 2021-06-06
flavorDimensions "tabs"
productFlavors {
create("allTabsCanBeEnabled") {
dimension = "tabs"
buildConfigField('boolean', 'ALL_TABS_CAN_BE_ENABLED', 'true')
}
create("onlyUpdatesTab") {
dimension = "tabs"
buildConfigField('boolean', 'ALL_TABS_CAN_BE_ENABLED', 'false')
}
}
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 17 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />

<!-- Added by REV Robotics on 2021-04-28 -->
<uses-permission android:name="com.revrobotics.permission.UPDATE_CONTROL_HUB" />

<!-- Added by REV Robotics on 2021-06-09 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".MainApplication"
android:label="@string/application_name"
Expand All @@ -22,12 +28,22 @@
<receiver
android:name=".MainApplication$BootReceiver">

<intent-filter>
<intent-filter android:priority="100">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<!-- Modified by REV Robotics on 2021-06-04: Treat a self-update event the same way as a boot completed event -->
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>

</receiver>

<receiver android:name=".MainApplication$NotificationDismissedReceiver" />

<receiver android:name="com.revrobotics.InternetAvailableBroadcastReceiver">
<intent-filter>
<action android:name="com.revrobotics.revupdateinterface.INTERNET_AVAILABLE" />
</intent-filter>
</receiver>

<activity
android:name=".MainActivity"
android:launchMode="singleTask"
Expand Down
Binary file added src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/main/kotlin/com/revrobotics/ChUpdaterConstants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.revrobotics

/**
* Constants used in communication with the Control Hub Updater
*/
object ChUpdaterConstants {
const val CONTROL_HUB_UPDATER_PACKAGE = "com.revrobotics.controlhubupdater"
const val CONTROL_HUB_UPDATE_SERVICE = "com.revrobotics.controlhubupdater.UpdateService"
const val ACTION_APPLY_OTA_UPDATE = "com.revrobotics.controlhubupdater.action.APPLY_OTA_UPDATE"
const val ACTION_UPDATE_FTC_APP = "com.revrobotics.controlhubupdater.action.UPDATE_FTC_APP"
const val EXTRA_UPDATE_FILE_PATH = "com.revrobotics.controlhubupdater.extra.UPDATE_FILE_PATH"
const val EXTRA_RESULT_RECEIVER = "com.revrobotics.controlhubupdater.extra.RESULT_RECEIVER"

// Result broadcast values (broadcasts are sent when the system does an action on boot, or when the ResultReceiver instance has been invalidated because the app restarted)
const val RESULT_BROADCAST = "com.revrobotics.controlhubupdater.broadcast.RESULT_BROADCAST"
const val RESULT_BROADCAST_BUNDLE_EXTRA = "com.revrobotics.controlhubupdater.broadcast.extra.BUNDLE" // Contains the exact same bundle as would have been passed to a ResultReceiver instance
const val RESULT_BUNDLE_CATEGORY_KEY = "category" // Will contain a String representation of Result.Category
const val RESULT_BUNDLE_PRESENTATION_TYPE_KEY = "presentationType" // Will contain a String representation of Result.PresentationType
const val RESULT_BUNDLE_DETAIL_MESSAGE_TYPE_KEY = "detailMessageType" // Will contain a String representation of Result.DetailMessageType
const val RESULT_BUNDLE_CODE_KEY = "resultCode" // Will contain an int.
const val RESULT_BUNDLE_MESSAGE_KEY = "message" // Will contain a String, which can be ignored if you know what the result code means.
const val RESULT_BUNDLE_CAUSE_KEY = "cause" // Will contain either null or a Throwable. Should be logged if not null.
const val RESULT_BUNDLE_DETAIL_MESSAGE_KEY = "detailMessage" // Will contain either null or a String. Should be logged if not null.

// Extras that we can send with intents as parameters
const val EXTRA_DANGEROUS_ACTION_CONFIRMED = "com.revrobotics.controlhubupdater.extra.DANGEROUS_ACTION_CONFIRMED" // Optional, populate with boolean
}

147 changes: 147 additions & 0 deletions src/main/kotlin/com/revrobotics/ChUpdaterResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.revrobotics;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* A result sent to us by the Control Hub Updater
*
* May be a status update, a prompt, an error, or a success message.
*/
public final class ChUpdaterResult {
@NonNull private final ChUpdaterResultType resultType;
@Nullable private String detailMessage;
@Nullable private Throwable cause;

public ChUpdaterResult(@NonNull ChUpdaterResultType resultType, @Nullable String detailMessage, @Nullable Throwable cause) {
this.resultType = resultType;
this.detailMessage = detailMessage;
this.cause = cause;
}

public Category getCategory() {
return resultType.getCategory();
}

public int getCode() {
return resultType.getCode();
}

public String getMessage() {
String message = resultType.getMessage();
if (getDetailMessageType() == DetailMessageType.SUBSTITUTED) {
String localDetailMessage = detailMessage; // Save a copy of the detail message so we don't overwrite the real one. BTW, it's important not to use getDetailMessage here.
if (localDetailMessage == null) {
localDetailMessage = "";
}
message = String.format(message, localDetailMessage);
}
return message;
}

@Nullable
public String getDetailMessage() {
if (getDetailMessageType() == DetailMessageType.SUBSTITUTED) {
return null; // The detail message will be returned as a part of the main message. We should pretend it doesn't exist outside of that.
}
return detailMessage;
}

public DetailMessageType getDetailMessageType() {
return resultType.getDetailMessageType();
}

/**
* Get the cause of the error (may be null)
*/
@Nullable
public Throwable getCause() {
return cause;
}

public ChUpdaterResultType getResultType() {
return resultType;
}

public PresentationType getPresentationType() {
return resultType.getPresentationType();
}

/**
* Parse a Bundle into a ChUpdaterResult
*/
public static ChUpdaterResult fromBundle(Bundle bundle) {
// Build the ChUpdaterResultType object
Category category = Category.fromString(bundle.getString(ChUpdaterConstants.RESULT_BUNDLE_CATEGORY_KEY));
int code = bundle.getInt(ChUpdaterConstants.RESULT_BUNDLE_CODE_KEY);
String message = bundle.getString(ChUpdaterConstants.RESULT_BUNDLE_MESSAGE_KEY);
PresentationType presentationType = PresentationType.fromString(bundle.getString(ChUpdaterConstants.RESULT_BUNDLE_PRESENTATION_TYPE_KEY));
DetailMessageType detailMessageType = DetailMessageType.fromString(bundle.getString(ChUpdaterConstants.RESULT_BUNDLE_DETAIL_MESSAGE_TYPE_KEY));
ChUpdaterResultType ChUpdaterResultType = new ChUpdaterResultType(category, code, presentationType, detailMessageType, message);

// Return a new Result object
String detailMessage = bundle.getString(ChUpdaterConstants.RESULT_BUNDLE_DETAIL_MESSAGE_KEY);
Throwable cause = (Throwable) bundle.getSerializable(ChUpdaterConstants.RESULT_BUNDLE_CAUSE_KEY);
return new ChUpdaterResult(ChUpdaterResultType, detailMessage, cause);
}

public final Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putString(ChUpdaterConstants.RESULT_BUNDLE_CATEGORY_KEY, getCategory().name());
bundle.putString(ChUpdaterConstants.RESULT_BUNDLE_PRESENTATION_TYPE_KEY, getPresentationType().name());
bundle.putString(ChUpdaterConstants.RESULT_BUNDLE_DETAIL_MESSAGE_TYPE_KEY, getDetailMessageType().name());
bundle.putInt(ChUpdaterConstants.RESULT_BUNDLE_CODE_KEY, getCode());
bundle.putString(ChUpdaterConstants.RESULT_BUNDLE_MESSAGE_KEY, getMessage());
bundle.putString(ChUpdaterConstants.RESULT_BUNDLE_DETAIL_MESSAGE_KEY, getDetailMessage());
bundle.putSerializable(ChUpdaterConstants.RESULT_BUNDLE_CAUSE_KEY, getCause());
return bundle;
}


/**
* Enum that specifies which ChUpdaterResultType category this result is
*/
public enum Category {
COMMON, OTA_UPDATE, APP_UPDATE;

public static Category fromString(String string) {
for (Category category : Category.values()) {
if (category.name().equals(string)) return category;
}
return null;
}
}

/**
* Enum that specifies how this result is to be displayed to the user
*/
public enum PresentationType {
// Note: Status messages are intended to be non-dismissable
SUCCESS, ERROR, STATUS, PROMPT;

public static PresentationType fromString(String string) {
for (PresentationType presentationType : PresentationType.values()) {
if (presentationType.name().equals(string)) return presentationType;
}
return null;
}
}

/**
* Enum that specifies what should be done with the result's detail message
*/
public enum DetailMessageType {
LOGGED, // The detail message should merely be logged, if it is present
DISPLAYED, // The detail message should be displayed, if it is present
SUBSTITUTED; // The detail message should be provided by the CH updater, and will be injected into the main message. If no detail message is provided, a blank string will be injected.

public static DetailMessageType fromString(String string) {
for (DetailMessageType detailMessageType : DetailMessageType.values()) {
if (detailMessageType.name().equals(string)) return detailMessageType;
}
return null;
}
}
}
40 changes: 40 additions & 0 deletions src/main/kotlin/com/revrobotics/ChUpdaterResultType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.revrobotics;

/**
* ResultType is built at runtime from the information sent by the ControlHubUpdater app.
*/
public class ChUpdaterResultType {
private final ChUpdaterResult.Category category;
private final int code;
private final ChUpdaterResult.PresentationType presentationType;
private final ChUpdaterResult.DetailMessageType detailMessageType;
private final String message;

public ChUpdaterResultType(ChUpdaterResult.Category category, int code, ChUpdaterResult.PresentationType presentationType, ChUpdaterResult.DetailMessageType detailMessageType, String message) {
this.category = category;
this.code = code;
this.presentationType = presentationType;
this.detailMessageType = detailMessageType;
this.message = message;
}

public ChUpdaterResult.Category getCategory() {
return category;
}

public int getCode() {
return code;
}

public ChUpdaterResult.PresentationType getPresentationType() {
return presentationType;
}

public ChUpdaterResult.DetailMessageType getDetailMessageType() {
return detailMessageType;
}

public String getMessage() {
return message;
}
}
Loading