fix(android): add back notification handler
This commit is contained in:
@@ -36,6 +36,7 @@ import com.getcapacitor.PluginCall;
|
||||
import com.getcapacitor.PluginMethod;
|
||||
import com.getcapacitor.annotation.CapacitorPlugin;
|
||||
import com.getcapacitor.annotation.Permission;
|
||||
import com.getcapacitor.annotation.PermissionCallback;
|
||||
// BuildConfig will be available at compile time
|
||||
|
||||
import java.util.Calendar;
|
||||
@@ -1149,6 +1150,34 @@ public class DailyNotificationPlugin extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission callback for notification permissions
|
||||
*
|
||||
* @param call Plugin call containing permission result
|
||||
*/
|
||||
@PermissionCallback
|
||||
private void notificationPermissions(PluginCall call) {
|
||||
try {
|
||||
Log.d(TAG, "Notification permission callback received");
|
||||
|
||||
// Check if POST_NOTIFICATIONS permission was granted
|
||||
boolean permissionGranted = getContext().checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
|
||||
== PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
if (permissionGranted) {
|
||||
Log.i(TAG, "Notification permission granted");
|
||||
call.resolve();
|
||||
} else {
|
||||
Log.w(TAG, "Notification permission denied");
|
||||
call.reject("Notification permission denied by user");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error in notification permission callback", e);
|
||||
call.reject("Error processing permission result: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current permission status
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user