File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed
src/main/java/org/medicmobile/webapp/mobile Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,10 @@ public boolean hasNotificationPermission() {
4141 }
4242
4343 public void requestNotificationPermission () {
44- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
45- if (context instanceof Activity activity ) {
46- if (!hasNotificationPermission ()) {
47- ActivityCompat .requestPermissions (activity ,
48- new String []{Manifest .permission .POST_NOTIFICATIONS }, REQUEST_NOTIFICATION_PERMISSION );
49- }
50- }
44+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU &&
45+ context instanceof Activity activity && !hasNotificationPermission ()) {
46+ ActivityCompat .requestPermissions (activity ,
47+ new String []{Manifest .permission .POST_NOTIFICATIONS }, REQUEST_NOTIFICATION_PERMISSION );
5148 }
5249 }
5350
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public class EmbeddedBrowserActivity extends Activity {
5656 private AppNotificationManager appNotificationManager ;
5757 private boolean isMigrationRunning = false ;
5858 private boolean hasCheckedForNotificationApi = false ;
59- private final String NOTIFICATION_WORK_REQUEST_TAG = "cht_notification_tag" ;
59+ private static final String NOTIFICATION_WORK_REQUEST_TAG = "cht_notification_tag" ;
6060
6161 private static final ValueCallback <String > IGNORE_RESULT = new ValueCallback <String >() {
6262 public void onReceiveValue (String result ) { /* ignore */ }
Original file line number Diff line number Diff line change 2424import java .util .concurrent .TimeUnit ;
2525
2626public class NotificationWorker extends Worker {
27- final String TAG = "NOTIFICATION_WORKER" ;
27+ final static String TAG = "NOTIFICATION_WORKER" ;
2828 final int EXECUTION_TIMEOUT = 20 ;
2929
3030 public NotificationWorker (@ NonNull Context context , @ NonNull WorkerParameters workerParams ) {
@@ -45,6 +45,7 @@ public Result doWork() {
4545 enableStorage (webView );
4646
4747 webView .setWebViewClient (new WebViewClient () {
48+ @ Override
4849 public void onPageFinished (WebView view , String url ) {
4950 String js = "(async function (){" +
5051 " const api = window.CHTCore.AndroidApi;" +
@@ -112,7 +113,7 @@ private JSONArray parseData(String data) {
112113 return new JSONArray (data );
113114 } catch (JSONException e ) {
114115 log (e , "error parsing JS data" );
115- throw new RuntimeException ( e );
116+ return new JSONArray ( );
116117 }
117118 }
118119 }
You can’t perform that action at this time.
0 commit comments