Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weihan-plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wei Han
weihan-plugin
Commits
e71683b7
Commit
e71683b7
authored
Nov 03, 2025
by
Wei Han
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code update
parent
61c8d727
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
437 additions
and
1 deletion
+437
-1
QmsPluginFramework
...ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
+0
-0
QmsPluginFramework
...simulator/QmsPluginFramework.framework/QmsPluginFramework
+0
-0
PlanViewController.h
...ramework/QmsPluginFramework/AddIssue/PlanViewController.h
+10
-0
PlanViewController.mm
...amework/QmsPluginFramework/AddIssue/PlanViewController.mm
+63
-1
IssueAPIClient.h
...PluginFramework/QmsPluginFramework/Issue/IssueAPIClient.h
+6
-0
IssueAPIClient.mm
...luginFramework/QmsPluginFramework/Issue/IssueAPIClient.mm
+142
-0
IssueDetailViewController.mm
...ork/QmsPluginFramework/Issue/IssueDetailViewController.mm
+0
-0
IssuesViewController.mm
...ramework/QmsPluginFramework/Issue/IssuesViewController.mm
+1
-0
WithdrawSingleIssueViewController.h
...PluginFramework/Issue/WithdrawSingleIssueViewController.h
+14
-0
WithdrawSingleIssueViewController.mm
...luginFramework/Issue/WithdrawSingleIssueViewController.mm
+201
-0
QmsPluginFramework
...ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
+0
-0
QmsPluginFramework
...simulator/QmsPluginFramework.framework/QmsPluginFramework
+0
-0
No files found.
framework/QmsPluginFramework/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
View file @
e71683b7
No preview for this file type
framework/QmsPluginFramework/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/QmsPluginFramework
View file @
e71683b7
No preview for this file type
framework/QmsPluginFramework/QmsPluginFramework/AddIssue/PlanViewController.h
View file @
e71683b7
...
@@ -8,6 +8,16 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -8,6 +8,16 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
strong
)
NSString
*
projectCode
;
@property
(
nonatomic
,
strong
)
NSString
*
projectCode
;
@property
(
nonatomic
,
strong
)
NSString
*
projectName
;
@property
(
nonatomic
,
strong
)
NSString
*
projectName
;
@property
(
nonatomic
,
strong
)
NSString
*
type
;
@property
(
nonatomic
,
strong
)
NSString
*
unitID
;
@property
(
nonatomic
,
strong
)
NSString
*
unitName
;
@property
(
nonatomic
,
strong
)
NSString
*
action
;
@property
(
nonatomic
,
assign
)
BOOL
offline
;
@property
(
nonatomic
,
strong
)
NSString
*
locationName
;
@property
(
nonatomic
,
strong
)
NSString
*
locationId
;
@property
(
nonatomic
,
strong
)
NSDictionary
*
issueContent
;
@property
(
nonatomic
,
strong
)
NSDictionary
*
issueFullData
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
framework/QmsPluginFramework/QmsPluginFramework/AddIssue/PlanViewController.mm
View file @
e71683b7
...
@@ -43,7 +43,8 @@
...
@@ -43,7 +43,8 @@
[super viewDidLoad];
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
self.view.backgroundColor = UIColor.whiteColor;
NSLog(@"PlanViewController loaded");
NSLog(@"PlanViewController loaded");
NSLog(@"🧭 Navigated to PlanScreen with:\n type=%@\n unitID=%@\n unitName=%@\n location= %@ & %@\n issue_id=%@\n",
self.type, self.unitID, self.unitName, self.locationName, self.locationId, self.issueContent[@"issue_id"]);
// Create UI elements (but don’t assign final frames yet)
// Create UI elements (but don’t assign final frames yet)
[self createHeader];
[self createHeader];
[self createScrollView];
[self createScrollView];
...
@@ -135,10 +136,71 @@
...
@@ -135,10 +136,71 @@
dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self displayPlanImage];
[self displayPlanImage];
[self debugPrintAllIssues];
[self debugPrintAllIssues];
// 🧭 Auto-lock logic for edit mode
NSString *action = self.passedData[@"action"];
if ([action isEqualToString:@"edit_issue"]) {
NSLog(@"✏️ Edit mode detected — auto-selecting issue location");
// Option 1️⃣ — If you have coordinates
NSString *posX = [NSString stringWithFormat:@"%@", self.passedData[@"issue_content"][@"pos_x"] ?: @""];
NSString *posY = [NSString stringWithFormat:@"%@", self.passedData[@"issue_content"][@"pos_y"] ?: @""];
if (posX.length > 0 && posY.length > 0) {
self.tappedPlanX = [posX floatValue];
self.tappedPlanY = [posY floatValue];
[self highlightExistingIssueAtCoordinates:self.tappedPlanX Y:self.tappedPlanY];
}
// Option 2️⃣ — If you prefer locking by location name
NSString *locationName = self.passedData[@"location_name"];
if (locationName.length > 0) {
self.selectedLocation = locationName;
[self showAddIssuePopup]; // show popup immediately
}
}
});
});
}];
}];
}
}
- (void)highlightExistingIssueAtCoordinates:(CGFloat)x Y:(CGFloat)y {
NSLog(@"📍 Highlighting existing issue at (%.2f, %.2f)", x, y);
if (!self.planImageView.image) {
NSLog(@"⚠️ Plan image not ready yet");
return;
}
CGRect imageRect = [self imageRectInImageView:self.planImageView];
CGFloat displayedWidth = imageRect.size.width;
CGFloat displayedHeight = imageRect.size.height;
CGFloat scaleX = displayedWidth / self.planWidth;
CGFloat scaleY = displayedHeight / self.planHeight;
CGFloat tapX = imageRect.origin.x + (x * scaleX);
CGFloat tapY = imageRect.origin.y + (y * scaleY);
// Visual marker
[self.markerView removeFromSuperview];
UIView *marker = [[UIView alloc] initWithFrame:CGRectMake(tapX - 6, tapY - 6, 12, 12)];
marker.backgroundColor = [UIColor redColor];
marker.layer.cornerRadius = 6;
marker.layer.borderColor = UIColor.whiteColor.CGColor;
marker.layer.borderWidth = 2.0;
[self.planImageView addSubview:marker];
self.markerView = marker;
// Try to find which location it falls inside
for (int i = 0; i < self.locations.count; i++) {
NSDictionary *locationData = self.locations[i];
if ([self isPoint:CGPointMake(tapX, tapY) insideLocation:locationData]) {
NSLog(@"✅ Auto-selected location: %@", locationData[@"name"]);
self.selectedLocation = locationData[@"name"];
self.selectionLocked = YES;
[self showAddIssuePopup];
break;
}
}
}
- (void)displayPlanImage {
- (void)displayPlanImage {
if (!self.planImageURL || self.planImageURL.length == 0) {
if (!self.planImageURL || self.planImageURL.length == 0) {
NSLog(@"⚠️ No plan image URL found");
NSLog(@"⚠️ No plan image URL found");
...
...
framework/QmsPluginFramework/QmsPluginFramework/Issue/IssueAPIClient.h
View file @
e71683b7
...
@@ -5,5 +5,11 @@
...
@@ -5,5 +5,11 @@
@interface
IssueAPIClient
:
NSObject
@interface
IssueAPIClient
:
NSObject
+
(
void
)
fetchIssues
:(
void
(
^
)(
NSDictionary
*
data
,
NSError
*
error
))
completion
;
+
(
void
)
fetchIssues
:(
void
(
^
)(
NSDictionary
*
data
,
NSError
*
error
))
completion
;
+
(
void
)
fetchVoidIssue
:(
id
)
issueID
remarks
:(
NSString
*
)
remarks
completion
:(
void
(
^
)(
NSDictionary
*
data
,
NSError
*
error
))
completion
;
+
(
void
)
fetchDeleteIssue
:(
id
)
issueID
remarks
:(
NSString
*
)
remarks
completion
:(
void
(
^
)(
NSDictionary
*
data
,
NSError
*
error
))
completion
;
@end
@end
framework/QmsPluginFramework/QmsPluginFramework/Issue/IssueAPIClient.mm
View file @
e71683b7
...
@@ -77,4 +77,146 @@
...
@@ -77,4 +77,146 @@
[task resume];
[task resume];
}
}
+ (void)fetchVoidIssue:(id)issueID
remarks:(NSString *)remarks
completion:(void (^)(NSDictionary *data, NSError *error))completion {
// ✅ URL
NSString *urlString = @"https://kitadev.commudesk.com/api/owner/issue/voidIssue?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImF0aGlyYWh6YWlkaUBjb252ZXAuY29tIiwicGFzc3dvcmQiOiIkMnkkMTAkNU9xYklqMnZ6UHJwckJrcVd5c3I2LmJCc1hVYS9Hd014eUhnL3RhUUhPUkNQcGdmTG8yakciLCJzdWIiOjIxNzAsImlzcyI6Imh0dHBzOi8va2l0YWRldi5jb21tdWRlc2suY29tL2FwaS9vd25lci9hdXRoL3Bhc3N3b3JkbGVzc19sb2dpbiIsImlhdCI6MTc2MDMxNTM1MiwiZXhwIjoyMDc1ODg0ODcyLCJuYmYiOjE3NjAzMTUzNTIsImp0aSI6IktoQmNyQnJEdDVNdDZlWmMifQ.JnxGbZ7hTeoOr6oibIzZMphgyKtTo2Aq9Efx6mrGfFA";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
// ✅ JSON headers
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
// json checks
NSArray *issueArray = issueID;
if (![issueID isKindOfClass:[NSArray class]]) {
issueArray = @[ issueID ?: @"" ];
}
NSString *remarksSafe = remarks ?: @"";
// ✅ Build JSON body
NSDictionary *jsonBody = @{
@"data": @{
@"os": @"AND",
@"issue_id": issueArray,
@"remarks": remarksSafe
}
};
// ✅ Convert dictionary → NSData
NSError *jsonError;
NSData *bodyData = [NSJSONSerialization dataWithJSONObject:jsonBody options:0 error:&jsonError];
if (jsonError) {
NSLog(@"❌ JSON Serialization Error: %@", jsonError);
if (completion) completion(nil, jsonError);
return;
}
request.HTTPBody = bodyData;
// 🧭 Debug logs
NSLog(@"🌍 URL: %@", urlString);
NSLog(@"📦 Body JSON: %@", jsonBody);
// ✅ Make request
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"❌ Network Error: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(nil, error);
});
return;
}
NSError *jsonParseError;
NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonParseError];
if (jsonParseError) {
NSLog(@"⚠️ JSON Parse Error: %@", jsonParseError);
} else {
NSLog(@"✅ Void Issues API Response:\n%@", jsonResponse);
}
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(jsonResponse, jsonParseError);
});
}];
[task resume];
}
+ (void)fetchDeleteIssue:(NSString *)issueID
remarks:(NSString *)remarks
completion:(void (^)(NSDictionary *data, NSError *error))completion {
// ✅ URL
NSString *urlString = @"https://kitadev.commudesk.com/api/owner/issue/deleteIssue?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImF0aGlyYWh6YWlkaUBjb252ZXAuY29tIiwicGFzc3dvcmQiOiIkMnkkMTAkNU9xYklqMnZ6UHJwckJrcVd5c3I2LmJCc1hVYS9Hd014eUhnL3RhUUhPUkNQcGdmTG8yakciLCJzdWIiOjIxNzAsImlzcyI6Imh0dHBzOi8va2l0YWRldi5jb21tdWRlc2suY29tL2FwaS9vd25lci9hdXRoL3Bhc3N3b3JkbGVzc19sb2dpbiIsImlhdCI6MTc2MDMxNTM1MiwiZXhwIjoyMDc1ODg0ODcyLCJuYmYiOjE3NjAzMTUzNTIsImp0aSI6IktoQmNyQnJEdDVNdDZlWmMifQ.JnxGbZ7hTeoOr6oibIzZMphgyKtTo2Aq9Efx6mrGfFA";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
// ✅ JSON headers
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
// ✅ Build JSON body
NSDictionary *jsonBody = @{
@"data": @{
@"os": @"AND",
@"issue_id": issueID ?: @"",
@"remarks": remarks ?: @""
}
};
// ✅ Convert dictionary → NSData
NSError *jsonError;
NSData *bodyData = [NSJSONSerialization dataWithJSONObject:jsonBody options:0 error:&jsonError];
if (jsonError) {
NSLog(@"❌ JSON Serialization Error: %@", jsonError);
if (completion) completion(nil, jsonError);
return;
}
request.HTTPBody = bodyData;
// 🧭 Debug logs
NSLog(@"🌍 URL: %@", urlString);
NSLog(@"📦 Body JSON: %@", jsonBody);
// ✅ Make request
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"❌ Network Error: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(nil, error);
});
return;
}
NSError *jsonParseError;
NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonParseError];
if (jsonParseError) {
NSLog(@"⚠️ JSON Parse Error: %@", jsonParseError);
} else {
NSLog(@"✅ Delete Issues API Response:\n%@", jsonResponse);
}
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(jsonResponse, jsonParseError);
});
}];
[task resume];
}
@end
@end
framework/QmsPluginFramework/QmsPluginFramework/Issue/IssueDetailViewController.mm
View file @
e71683b7
This diff is collapsed.
Click to expand it.
framework/QmsPluginFramework/QmsPluginFramework/Issue/IssuesViewController.mm
View file @
e71683b7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#import "IssuesViewController.h"
#import "IssuesViewController.h"
#import "IssueAPIClient.h"
#import "IssueAPIClient.h"
#import "IssueDetailViewController.h"
#import "IssueDetailViewController.h"
#import "WithdrawSingleIssueViewController.h"
#pragma mark - Internal IssueCell
#pragma mark - Internal IssueCell
@interface IssueCell : UITableViewCell
@interface IssueCell : UITableViewCell
...
...
framework/QmsPluginFramework/QmsPluginFramework/Issue/WithdrawSingleIssueViewController.h
0 → 100644
View file @
e71683b7
// WithdrawSingleIssueViewController.h
#import <UIKit/UIKit.h>
@interface
WithdrawSingleIssueViewController
:
UIViewController
@property
(
nonatomic
,
strong
)
NSString
*
issueID
;
@property
(
nonatomic
,
strong
)
NSString
*
planID
;
@property
(
nonatomic
,
strong
)
NSString
*
status
;
@property
(
nonatomic
,
strong
)
NSString
*
unitName
;
@property
(
nonatomic
,
strong
)
NSString
*
reference
;
@property
(
nonatomic
,
strong
)
NSString
*
titleText
;
// "Delete Issue" or "Void Issue"
@end
framework/QmsPluginFramework/QmsPluginFramework/Issue/WithdrawSingleIssueViewController.mm
0 → 100644
View file @
e71683b7
// WithdrawSingleIssueViewController.mm
#import "WithdrawSingleIssueViewController.h"
#import "IssueAPIClient.h"
@interface WithdrawSingleIssueViewController ()
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UITextView *messageInput;
@property (nonatomic, strong) UIButton *confirmButton;
@end
@implementation WithdrawSingleIssueViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
NSLog(@"📦 Navigated to WithdrawSingleIssueViewController with:\n issueID=%@\n planID=%@\n status=%@\n unitName=%@\n reference=%@\n title=%@",
self.issueID, self.planID, self.status, self.unitName, self.reference, self.titleText);
[self setupHeader];
[self setupContent];
}
#pragma mark - Header
- (void)setupHeader {
self.headerView = [[UIView alloc] init];
self.headerView.translatesAutoresizingMaskIntoConstraints = NO;
self.headerView.backgroundColor = [UIColor colorWithRed:0/255.0 green:109/255.0 blue:141/255.0 alpha:1];
[self.view addSubview:self.headerView];
// Back button
self.backButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.backButton.translatesAutoresizingMaskIntoConstraints = NO;
UIImage *backImage = [[UIImage systemImageNamed:@"chevron.left"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.backButton setImage:backImage forState:UIControlStateNormal];
self.backButton.tintColor = UIColor.whiteColor;
[self.backButton addTarget:self
action:@selector(handleBack)
forControlEvents:UIControlEventTouchUpInside];
[self.headerView addSubview:self.backButton];
// Title label
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.titleLabel.text = self.titleText ?: @"Delete Issue";
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.headerView addSubview:self.titleLabel];
// Layout constraints
UILayoutGuide *safe = self.view.safeAreaLayoutGuide;
[NSLayoutConstraint activateConstraints:@[
[self.headerView.topAnchor constraintEqualToAnchor:safe.topAnchor],
[self.headerView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
[self.headerView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
[self.headerView.heightAnchor constraintEqualToConstant:56],
[self.backButton.leadingAnchor constraintEqualToAnchor:self.headerView.leadingAnchor constant:8],
[self.backButton.centerYAnchor constraintEqualToAnchor:self.headerView.centerYAnchor],
[self.backButton.widthAnchor constraintEqualToConstant:44],
[self.backButton.heightAnchor constraintEqualToConstant:44],
[self.titleLabel.centerXAnchor constraintEqualToAnchor:self.headerView.centerXAnchor],
[self.titleLabel.centerYAnchor constraintEqualToAnchor:self.headerView.centerYAnchor]
]];
}
#pragma mark - Content
- (void)setupContent {
UILabel *promptLabel = [[UILabel alloc] init];
promptLabel.translatesAutoresizingMaskIntoConstraints = NO;
promptLabel.text = @"Write your message:";
promptLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
[self.view addSubview:promptLabel];
self.messageInput = [[UITextView alloc] init];
self.messageInput.translatesAutoresizingMaskIntoConstraints = NO;
self.messageInput.font = [UIFont systemFontOfSize:16];
self.messageInput.layer.borderWidth = 1.0;
self.messageInput.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.messageInput.layer.cornerRadius = 8;
[self.view addSubview:self.messageInput];
UIView *separator = [[UIView alloc] init];
separator.translatesAutoresizingMaskIntoConstraints = NO;
separator.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];
[self.view addSubview:separator];
self.confirmButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.confirmButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.confirmButton setTitle:@"Confirm" forState:UIControlStateNormal];
self.confirmButton.backgroundColor = [UIColor colorWithRed:0/255.0 green:109/255.0 blue:141/255.0 alpha:1];
[self.confirmButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
self.confirmButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
self.confirmButton.layer.cornerRadius = 8;
[self.confirmButton addTarget:self action:@selector(handleConfirm)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.confirmButton];
UILayoutGuide *safe = self.view.safeAreaLayoutGuide;
[NSLayoutConstraint activateConstraints:@[
[promptLabel.topAnchor constraintEqualToAnchor:self.headerView.bottomAnchor constant:20],
[promptLabel.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:20],
[promptLabel.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-20],
[self.messageInput.topAnchor constraintEqualToAnchor:promptLabel.bottomAnchor constant:8],
[self.messageInput.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:20],
[self.messageInput.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-20],
[self.messageInput.heightAnchor constraintEqualToConstant:120],
[separator.topAnchor constraintEqualToAnchor:self.messageInput.bottomAnchor constant:16],
[separator.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:20],
[separator.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-20],
[separator.heightAnchor constraintEqualToConstant:1],
[self.confirmButton.topAnchor constraintEqualToAnchor:separator.bottomAnchor constant:40],
[self.confirmButton.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:40],
[self.confirmButton.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-40],
[self.confirmButton.heightAnchor constraintEqualToConstant:48]
]];
}
#pragma mark - Actions
- (void)handleBack {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)handleConfirm {
NSString *message = self.messageInput.text ?: @"";
if (message.length == 0) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert"
message:@"Please enter a message before submitting."
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
return;
}
// Confirmation dialog before sending
UIAlertController *confirm = [UIAlertController alertControllerWithTitle:@"Confirm"
message:@"Are you sure you want to submit?"
preferredStyle:UIAlertControllerStyleAlert];
[confirm addAction:[UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil]];
[confirm addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if ([self.titleText containsString:@"Delete"]) {
[self requestDeleteIssue:self.issueID remarks:message];
} else {
[self requestVoidIssue:self.issueID remarks:message];
}
}]];
[self presentViewController:confirm animated:YES completion:nil];
}
- (void)requestDeleteIssue:(NSString *)issueID remarks:(NSString *)remarks {
NSLog(@"🚀 Sending DELETE ISSUE for ID=%@, remarks=%@", issueID, remarks);
[IssueAPIClient fetchDeleteIssue:issueID remarks:remarks completion:^(NSDictionary *data, NSError *error) {
if (error) {
NSLog(@"Error %@", error.localizedDescription);
return;
}
NSDictionary *appData = data[@"AppData"];
if ([appData[@"status"] isEqualToString:@"success"]) {
NSLog(@"Issue deleted successfully");
} else {
NSString *message = appData[@"message"] ?: @"Unknown error";
NSLog(@"Error Message %@", message);
}
}];
}
- (void)requestVoidIssue:(NSString *)issueID remarks:(NSString *)remarks {
NSLog(@"🚀 Sending VOID ISSUE for ID=%@, remarks=%@", issueID, remarks);
NSArray *issueArray = @[ issueID ?: @"" ];
[IssueAPIClient fetchVoidIssue:issueArray remarks:remarks completion:^(NSDictionary *data, NSError *error) {
if (error) {
NSLog(@"Error %@", error.localizedDescription);
return;
}
NSDictionary *appData = data[@"AppData"];
if ([appData[@"status"] isEqualToString:@"success"]) {
NSLog(@"Issue withdrawn successfully");
} else {
NSString *message = appData[@"message"] ?: @"Unknown error";
NSLog(@"Error Message %@", message);
}
}];
}
@end
ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
View file @
e71683b7
No preview for this file type
ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/QmsPluginFramework
View file @
e71683b7
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment