Skip to content

Conversation

@lposen
Copy link
Contributor

@lposen lposen commented Oct 10, 2025

lposen and others added 30 commits October 6, 2025 19:10
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
Comment on lines +77 to +104
public static String generateToken(
String secret, Duration duration, String email, String userId) {

if (duration.compareTo(maxTokenLifetime) > 0)
throw new IllegalArgumentException(
"Duration must be one year or less."
);

if ((userId != null && email != null) || (userId == null && email == null))
throw new IllegalArgumentException(
"The token must include a userId or email, but not both."
);

long now = millisToSeconds(System.currentTimeMillis());

String payload;
if (userId != null)
payload = String.format(
"{ \"userId\": \"%s\", \"iat\": %d, \"exp\": %d }",
userId, now, now + millisToSeconds(duration.toMillis())
);
else
payload = String.format(
"{ \"email\": \"%s\", \"iat\": %d, \"exp\": %d }",
email, now, now + millisToSeconds(duration.toMillis())
);

return generateToken(secret, payload);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues:

1. Function with high complexity (count = 7): generateToken [qlty:function-complexity]


2. Function with many parameters (count = 4): generateToken [qlty:function-parameters]

Comment on lines +17 to +22
fun generateJwtToken(
secret: String,
durationMs: Double,
email: String?,
userId: String?,
promise: Promise
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 5): generateJwtToken [qlty:function-parameters]

Comment on lines +79 to +101
private func setupUserNotificationCenter() {
UNUserNotificationCenter.current().delegate = self
UNUserNotificationCenter.current().getNotificationSettings { settings in
if settings.authorizationStatus != .authorized {
ITBInfo("Not authorized")
// not authorized, ask for permission
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, _ in
ITBInfo("auth: \(success)")
if success {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
// TODO: Handle error etc.
}
} else {
// already authorized
ITBInfo("Already authorized")
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with high complexity (count = 6): setupUserNotificationCenter [qlty:function-complexity]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant