Skip to content

Commit

Permalink
Rename almost all dogbin references to just generic "uploader"
Browse files Browse the repository at this point in the history
  • Loading branch information
TacoTheDank committed Aug 5, 2021
1 parent 8c09aea commit ddd6338
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
android:enabled="true"
android:process=":crashDetectorService" />
<service
android:name=".core.service.dogbin.DogbinUploadService"
android:name=".core.service.uploader.UploaderService"
android:enabled="true"
android:exported="false" />
</application>
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/taco/scoop/core/receiver/CrashReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import taco.scoop.ScoopApplication;
import taco.scoop.core.data.crash.Crash;
import taco.scoop.core.data.crash.CrashLoader;
import taco.scoop.core.service.dogbin.DogbinUploadService;
import taco.scoop.core.service.uploader.UploaderService;
import taco.scoop.ui.activity.DetailActivity;
import taco.scoop.ui.activity.MainActivity;
import taco.scoop.util.Intents;
Expand All @@ -42,7 +42,7 @@ public void onReceive(Context context, Intent broadcastIntent) {
boolean update = broadcastIntent.getBooleanExtra(Intents.INTENT_UPDATE, false);
boolean hideUpload = broadcastIntent.getBooleanExtra(Intents.INTENT_HIDE_UPLOAD, false);
boolean uploadError = broadcastIntent.getBooleanExtra(Intents.INTENT_UPLOAD_ERROR, false);
String dogbinLink = broadcastIntent.getStringExtra(Intents.INTENT_DOGBIN_LINK);
String uploaderLink = broadcastIntent.getStringExtra(Intents.INTENT_UPLOADER_LINK);

if (description.startsWith(ThreadDeath.class.getName()) && PreferenceHelper.ignoreThreadDeath())
return;
Expand Down Expand Up @@ -122,25 +122,25 @@ public void onReceive(Context context, Intent broadcastIntent) {
builder.addAction(new NotificationCompat.Action(R.drawable.ic_share,
context.getString(R.string.action_share), sharePendingIntent));

if (dogbinLink != null) {
if (uploaderLink != null) {
Intent copyLinkIntent = new Intent(context, ShareReceiver.class)
.putExtra("pkg", packageName)
.putExtra(Intents.INTENT_DOGBIN_LINK, dogbinLink)
.putExtra(Intents.INTENT_UPLOADER_LINK, uploaderLink)
.setAction(Intents.INTENT_ACTION_COPY_LINK);
PendingIntent copyLinkPendingIntent = PendingIntent.getBroadcast(context,
notificationId, copyLinkIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.addAction(new NotificationCompat.Action(0,
context.getString(R.string.action_dogbin_copy_link), copyLinkPendingIntent));
context.getString(R.string.action_uploader_copy_link), copyLinkPendingIntent));

} else if (!hideUpload) {
int uploadTitle = uploadError ? R.string.action_dogbin_upload_error : R.string.action_dogbin_upload;
Intent dogbinIntent = new Intent(context, DogbinUploadService.class)
int uploadTitle = uploadError ? R.string.action_uploader_upload_error : R.string.action_uploader_upload;
Intent uploaderIntent = new Intent(context, UploaderService.class)
.putExtra("data", broadcastIntent)
.putExtra("crash", crash);
PendingIntent dogbinPendingIntent = PendingIntent.getService(context,
notificationId, dogbinIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent uploaderPendingIntent = PendingIntent.getService(context,
notificationId, uploaderIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.addAction(new NotificationCompat.Action(0,
context.getString(uploadTitle), dogbinPendingIntent));
context.getString(uploadTitle), uploaderPendingIntent));

} else {
builder.setProgress(0, 0, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ShareReceiver : BroadcastReceiver() {
context.copyTextToClipboard(
R.string.copy_link_label,
pkg,
intent.getStringExtra(Intents.INTENT_DOGBIN_LINK)
intent.getStringExtra(Intents.INTENT_UPLOADER_LINK)
)
context.displayToast(R.string.copied_link_toast)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package taco.scoop.core.service.dogbin
package taco.scoop.core.service.uploader

class DogbinException(message: String?) : Exception(message) {
class UploaderException(message: String?) : Exception(message) {
companion object {
private const val serialVersionUID = 666L
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package taco.scoop.core.service.dogbin
package taco.scoop.core.service.uploader

import android.app.Service
import android.content.Intent
Expand All @@ -11,7 +11,7 @@ import taco.scoop.core.data.crash.Crash
import taco.scoop.util.Intents
import java.util.*

class DogbinUploadService : Service() {
class UploaderService : Service() {

private var uploadStarted = false
private val uploadQueue: Queue<Intent> = LinkedList()
Expand Down Expand Up @@ -42,12 +42,12 @@ class DogbinUploadService : Service() {
if (data == null) {
stopSelf()
} else {
DogbinUtils.upload(
UploaderUtils.upload(
data.getStringExtra(Intents.INTENT_STACKTRACE),
object : DogbinUtils.UploadResultCallback {
object : UploaderUtils.UploadResultCallback {

override fun onSuccess(url: String) {
data.putExtra(Intents.INTENT_DOGBIN_LINK, url)
data.putExtra(Intents.INTENT_UPLOADER_LINK, url)
next()
}

Expand All @@ -72,7 +72,7 @@ class DogbinUploadService : Service() {
startForeground(
101, NotificationCompat.Builder(this, "status")
.setSmallIcon(R.drawable.ic_bug_report)
.setContentTitle(getString(R.string.dogbin_uploading))
.setContentTitle(getString(R.string.uploader_uploading))
.setColor(ContextCompat.getColor(this, R.color.colorAccent))
.setPriority(NotificationCompat.PRIORITY_MIN)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package taco.scoop.core.service.dogbin
package taco.scoop.core.service.uploader

import android.os.Handler
import android.os.HandlerThread
Expand All @@ -24,16 +24,17 @@ import java.nio.charset.StandardCharsets
import javax.net.ssl.HttpsURLConnection

/**
* Helper functions for uploading to del.dog
* Helper functions for uploading to a pastebin-like service, preferably one forked from
* the now-nonfunctional "del.dog" service.
*/
object DogbinUtils {
private const val TAG = "DogbinUtils"
object UploaderUtils {
private const val TAG = "UploaderUtils"
private const val BASE_URL = "https://del.dog"
private val API_URL = String.format("%s/documents", BASE_URL)
private var handler: Handler? = null
get() {
if (field == null) {
val handlerThread = HandlerThread("dogbinThread")
val handlerThread = HandlerThread("uploaderThread")
if (!handlerThread.isAlive) {
handlerThread.start()
}
Expand All @@ -43,9 +44,9 @@ object DogbinUtils {
}

/**
* Uploads `content` to dogbin
* Uploads `content` to the service
*
* @param content the content to upload to dogbin
* @param content the content to upload
* @param callback the callback to call on success / failure
*/
fun upload(content: String?, callback: UploadResultCallback) {
Expand Down Expand Up @@ -80,14 +81,14 @@ object DogbinUtils {
if (key.isNotEmpty()) {
callback.onSuccess(getUrl(key))
} else {
val msg = "Failed to upload to dogbin: No key retrieved"
callback.onFail(msg, DogbinException(msg))
val msg = "Failed to upload: No key retrieved"
callback.onFail(msg, UploaderException(msg))
}
} finally {
urlConnection.disconnect()
}
} catch (e: Exception) {
callback.onFail("Failed to upload to dogbin", e)
callback.onFail("Failed to upload", e)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/taco/scoop/util/Intents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ object Intents {
const val INTENT_UPDATE = "update"
const val INTENT_HIDE_UPLOAD = "hideUpload"
const val INTENT_UPLOAD_ERROR = "uploadError"
const val INTENT_DOGBIN_LINK = "dogbinLink"
const val INTENT_UPLOADER_LINK = "uploaderLink"
}
10 changes: 5 additions & 5 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<string name="scoop_running">Monitoring app crashes</string>
<string name="action_kill">Stop</string>

<!-- Dogbin -->
<string name="dogbin_uploading">Upload in progress…</string>
<string name="action_dogbin_upload">Upload to dogbin</string>
<string name="action_dogbin_upload_error">Upload failed</string>
<string name="action_dogbin_copy_link">Copy link</string>
<!-- Uploader -->
<string name="uploader_uploading">Upload in progress…</string>
<string name="action_uploader_upload">Upload to dogbin</string>
<string name="action_uploader_upload_error">Upload failed</string>
<string name="action_uploader_copy_link">Copy link</string>
</resources>
10 changes: 5 additions & 5 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<string name="scoop_running">アプリのクラッシュを監視中</string>
<string name="action_kill">停止</string>

<!-- Dogbin -->
<string name="dogbin_uploading">アップロード中…</string>
<string name="action_dogbin_upload">dogbinにアップロード</string>
<string name="action_dogbin_upload_error">アップロード失敗</string>
<string name="action_dogbin_copy_link">リンクをコピー</string>
<!-- Uploader -->
<string name="uploader_uploading">アップロード中…</string>
<string name="action_uploader_upload">dogbinにアップロード</string>
<string name="action_uploader_upload_error">アップロード失敗</string>
<string name="action_uploader_copy_link">リンクをコピー</string>
</resources>
10 changes: 5 additions & 5 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<string name="scoop_running">Monitoring app crashes</string>
<string name="action_kill">Stop</string>

<!-- Dogbin -->
<string name="dogbin_uploading">Upload in progress…</string>
<string name="action_dogbin_upload">Upload to dogbin</string>
<string name="action_dogbin_upload_error">Upload failed</string>
<string name="action_dogbin_copy_link">Copy link</string>
<!-- Uploader -->
<string name="uploader_uploading">Upload in progress…</string>
<string name="action_uploader_upload">Upload to dogbin</string>
<string name="action_uploader_upload_error">Upload failed</string>
<string name="action_uploader_copy_link">Copy link</string>
</resources>
10 changes: 5 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<string name="scoop_running">Monitoring app crashes</string>
<string name="action_kill">Stop</string>

<!-- Dogbin -->
<string name="dogbin_uploading">Upload in progress…</string>
<string name="action_dogbin_upload">Upload to dogbin</string>
<string name="action_dogbin_upload_error">Upload failed</string>
<string name="action_dogbin_copy_link">Copy link</string>
<!-- Uploader -->
<string name="uploader_uploading">Upload in progress…</string>
<string name="action_uploader_upload">Upload to dogbin</string>
<string name="action_uploader_upload_error">Upload failed</string>
<string name="action_uploader_copy_link">Copy link</string>
</resources>

0 comments on commit ddd6338

Please sign in to comment.