@@ -80,15 +80,21 @@ fun uploadFile(context: Context, uploader: Uploader, file: Uri) {
80
80
nBuilder.setContentText(context.resources.getString(R .string.upload_failed))
81
81
.setStyle(Notification .BigTextStyle ().bigText(err.toString()))
82
82
} else {
83
- val url = uploader.prepareUrl(d)
84
- val i = Intent (Intent .ACTION_VIEW , Uri .parse(url))
85
- val intent = PendingIntent .getActivity(context, 0 , i, 0 )
86
- nBuilder.setContentText(url)
87
- .setStyle(Notification .BigTextStyle ().bigText(url))
88
- .setContentIntent(intent)
83
+ try {
84
+ val url = uploader.prepareUrl(d)
85
+ val i = Intent (Intent .ACTION_VIEW , Uri .parse(url))
86
+ val intent = PendingIntent .getActivity(context, 0 , i, 0 )
87
+ nBuilder.setContentText(url)
88
+ .setStyle(Notification .BigTextStyle ().bigText(url))
89
+ .setContentIntent(intent)
89
90
90
- if (prefs.getBoolean(" autoclip" , false ))
91
- clipManager.primaryClip = ClipData .newPlainText(" URL" , url)
91
+ if (prefs.getBoolean(" autoclip" , false ))
92
+ clipManager.primaryClip = ClipData .newPlainText(" URL" , url)
93
+ } catch (e: Exception ) {
94
+ val msg = context.resources.getString(R .string.response_text_and_error, d, e.toString())
95
+ nBuilder.setContentText(context.resources.getString(R .string.response_handling_error))
96
+ .setStyle(Notification .BigTextStyle ().bigText(msg))
97
+ }
92
98
}
93
99
94
100
notifManager.notify(notifID, nBuilder.build())
0 commit comments