Commit 3995f152 authored by Wei Han's avatar Wei Han

code update

parent 91919501
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
......@@ -23,6 +23,7 @@
@property (nonatomic) NSLayoutConstraint *infoBottom;
@property (nonatomic) NSLayoutConstraint *documentsBottom;
@property (nonatomic) NSLayoutConstraint *formsBottom;
@property (nonatomic, strong) UILabel *jointTitleLabel;
// Sections for tabs
@property (nonatomic, strong) UIView *infoContainer;
......@@ -238,12 +239,12 @@ typedef struct {
[self.infoContainer addSubview:self.ownerStack];
// --- Joint Owners Title ---
UILabel *jointTitle = [[UILabel alloc] init];
jointTitle.text = @"Joint Owner Details";
jointTitle.font = [UIFont boldSystemFontOfSize:16];
jointTitle.textColor = UIColor.darkGrayColor;
jointTitle.translatesAutoresizingMaskIntoConstraints = NO;
[self.infoContainer addSubview:jointTitle];
self.jointTitleLabel = [[UILabel alloc] init];
self.jointTitleLabel.text = @"Joint Owner Details";
self.jointTitleLabel.font = [UIFont boldSystemFontOfSize:16];
self.jointTitleLabel.textColor = UIColor.darkGrayColor;
self.jointTitleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.infoContainer addSubview:self.jointTitleLabel];
// --- Joint Owners Stack ---
self.jointOwnersStack = [[UIStackView alloc] init];
......@@ -276,10 +277,10 @@ typedef struct {
[self.ownerStack.leadingAnchor constraintEqualToAnchor:self.infoContainer.leadingAnchor constant:16],
[self.ownerStack.trailingAnchor constraintEqualToAnchor:self.infoContainer.trailingAnchor constant:-16],
[jointTitle.topAnchor constraintEqualToAnchor:self.ownerStack.bottomAnchor constant:20],
[jointTitle.leadingAnchor constraintEqualToAnchor:self.infoContainer.leadingAnchor constant:16],
[self.jointTitleLabel.topAnchor constraintEqualToAnchor:self.ownerStack.bottomAnchor constant:20],
[self.jointTitleLabel.leadingAnchor constraintEqualToAnchor:self.infoContainer.leadingAnchor constant:16],
[self.jointOwnersStack.topAnchor constraintEqualToAnchor:jointTitle.bottomAnchor constant:12],
[self.jointOwnersStack.topAnchor constraintEqualToAnchor:self.jointTitleLabel.bottomAnchor constant:12],
[self.jointOwnersStack.leadingAnchor constraintEqualToAnchor:self.infoContainer.leadingAnchor constant:16],
[self.jointOwnersStack.trailingAnchor constraintEqualToAnchor:self.infoContainer.trailingAnchor constant:-16],
......@@ -643,7 +644,6 @@ typedef struct {
}
maxTitleWidth += 6;
UIStackView* (^OwnerCard)(NSDictionary *) = ^UIStackView* (NSDictionary *owner) {
UIStackView *card = [[UIStackView alloc] init];
......@@ -698,6 +698,11 @@ typedef struct {
for (NSDictionary *owner in self.jointOwners) {
[self.jointOwnersStack addArrangedSubview:OwnerCard(owner)];
}
BOOL hasJointOwners = self.jointOwnersStack.arrangedSubviews.count > 0;
self.jointOwnersStack.hidden = !hasJointOwners;
self.jointTitleLabel.hidden = !hasJointOwners;
// ------------------------
// 2️⃣ UNIT INFO SECTION
......
......@@ -34,10 +34,10 @@
// label
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = [UIFont boldSystemFontOfSize:20];
self.nameLabel.font = [UIFont boldSystemFontOfSize:18];
self.nameLabel.textColor = UIColor.whiteColor;
self.nameLabel.backgroundColor =
[[UIColor blackColor] colorWithAlphaComponent:0.35];
// self.nameLabel.backgroundColor =
// [[UIColor blackColor] colorWithAlphaComponent:0.35];
self.nameLabel.numberOfLines = 2;
self.nameLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:self.nameLabel];
......@@ -116,24 +116,24 @@
NSLog(@"ClientCode: %@", self.ClientCode);
NSLog(@"user_token: %@", self.user_token);
[self showLoadingOverlay:@"Loading..."];
if (![self isReadyToLoadDashboard]) {
NSLog(@"⏳ Waiting for all credentials to be ready...");
return;
}
if (_isLoadingDashboard) return;
self.isLoadingDashboard = YES;
NSLog(@"✅ All credentials ready. ClientID: %@, ClientCode: %@, user_token: %@",
self.ClientID, self.ClientCode, self.user_token);
[APIConfig setAuthTokem:self.user_token];
[APIConfig setClientId:self.ClientID];
[self requestProjectList];
// [self showLoadingOverlay:@"Loading..."];
//
// if (![self isReadyToLoadDashboard]) {
// NSLog(@"⏳ Waiting for all credentials to be ready...");
// return;
// }
//
// if (_isLoadingDashboard) return;
//
// self.isLoadingDashboard = YES;
//
// NSLog(@"✅ All credentials ready. ClientID: %@, ClientCode: %@, user_token: %@",
// self.ClientID, self.ClientCode, self.user_token);
//
//
// [APIConfig setAuthTokem:self.user_token];
// [APIConfig setClientId:self.ClientID];
self.ClientCode = @"spt";
[self requestCompanyCode];
}
......@@ -185,7 +185,7 @@
- (void)setupCollectionView {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
layout.minimumLineSpacing = 16;
layout.minimumLineSpacing = 12;
layout.minimumInteritemSpacing = 16;
layout.sectionInset = UIEdgeInsetsMake(16, 16, 16, 16);
......@@ -202,7 +202,7 @@
// constraints
[NSLayoutConstraint activateConstraints:@[
[self.collectionView.topAnchor constraintEqualToAnchor:self.headerView.bottomAnchor constant:8],
[self.collectionView.topAnchor constraintEqualToAnchor:self.headerView.bottomAnchor constant:20],
[self.collectionView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
[self.collectionView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
[self.collectionView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
......@@ -273,7 +273,7 @@
CGFloat horizontalInset = 16 * 2; // section inset left + right
CGFloat width = collectionView.bounds.size.width - horizontalInset;
CGFloat height = 200; // OG-style banner height
CGFloat height = 140; // OG-style banner height
return CGSizeMake(width, height);
}
......@@ -399,16 +399,12 @@
NSLog(@"❌ API failure: %@", appData[@"message"]);
return;
}
NSArray *project = data[@"Data"];
if (![project isKindOfClass:[NSArray class]]) {
NSLog(@"❌ Invalid project list format");
return;
}
if (!error) {
NSString *rawURL = data[@"Data"][@"url_path"];
NSString *baseURL = rawURL;
NSLog(@"base url: %@", baseURL);
// remove trailing slash if exists
if ([baseURL hasSuffix:@"/"]) {
......@@ -418,7 +414,8 @@
// append /api
baseURL = [baseURL stringByAppendingString:@"/api"];
NSLog(@"baseURL: %@", baseURL);
// [APIConfig setBaseURL:baseURL];
[APIConfig setBaseURL:baseURL];
[self requestProjectList];
}
}];
}
......
......@@ -110,10 +110,10 @@
[self.view addSubview:self.searchBar];
[NSLayoutConstraint activateConstraints:@[
[self.searchBar.topAnchor constraintEqualToAnchor:self.headerView.bottomAnchor constant:8],
[self.searchBar.topAnchor constraintEqualToAnchor:self.headerView.bottomAnchor constant:0],
[self.searchBar.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:16],
[self.searchBar.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-16],
[self.searchBar.heightAnchor constraintEqualToConstant:44]
[self.searchBar.heightAnchor constraintEqualToConstant:72]
]];
}
......@@ -150,12 +150,20 @@
forCellReuseIdentifier:@"UnitCell"];
[self.view addSubview:self.tableView];
UILabel *footerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 50)];
footerLabel.text = @"All items displayed";
footerLabel.textColor = UIColor.systemGrayColor;
footerLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
footerLabel.textAlignment = NSTextAlignmentCenter;
self.tableView.tableFooterView = footerLabel;
[NSLayoutConstraint activateConstraints:@[
[self.tableView.topAnchor constraintEqualToAnchor:self.searchBar.bottomAnchor constant:8],
[self.tableView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
[self.tableView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
[self.tableView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
[self.tableView.topAnchor constraintEqualToAnchor:self.searchBar.bottomAnchor constant:12],
[self.tableView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:16],
[self.tableView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-16],
[self.tableView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:self.view.safeAreaInsets.bottom]
]];
}
......@@ -169,6 +177,7 @@
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:@"UnitCell"
forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// ---- Reset reused cell ----
for (UIView *subview in cell.contentView.subviews) {
......@@ -186,25 +195,30 @@
// ---- Arrow ----
UIImageView *arrow = [[UIImageView alloc] initWithImage:
[UIImage systemImageNamed:@"chevron.right"]];
arrow.tintColor = UIColor.systemGrayColor;
arrow.tintColor = [UIColor colorWithRed:0.0 green:0.5 blue:0.6 alpha:1.0];
arrow.translatesAutoresizingMaskIntoConstraints = NO;
// ---- Card styling ----
cell.backgroundColor = UIColor.clearColor;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.contentView.backgroundColor = UIColor.whiteColor;
cell.contentView.layer.cornerRadius = 12;
cell.contentView.layer.borderWidth = 1;
cell.contentView.layer.borderColor = UIColor.systemGray4Color.CGColor;
cell.contentView.clipsToBounds = YES;
// ---- Add views ----
[cell.contentView addSubview:label];
[cell.contentView addSubview:arrow];
UIView *cardView = [[UIView alloc] init];
cardView.backgroundColor = UIColor.whiteColor;
cardView.layer.cornerRadius = 12;
cardView.layer.borderWidth = 1;
cardView.layer.borderColor = UIColor.systemGray4Color.CGColor;
cardView.translatesAutoresizingMaskIntoConstraints = NO;
[cell.contentView addSubview:cardView];
// Put label & arrow inside cardView
[cardView addSubview:label];
[cardView addSubview:arrow];
// ---- Constraints ----
[NSLayoutConstraint activateConstraints:@[
// Cardview
[cardView.topAnchor constraintEqualToAnchor:cell.contentView.topAnchor constant:8], // vertical spacing top
[cardView.bottomAnchor constraintEqualToAnchor:cell.contentView.bottomAnchor constant:-8], // vertical spacing bottom
[cardView.leadingAnchor constraintEqualToAnchor:cell.contentView.leadingAnchor constant:0], // horizontal spacing
[cardView.trailingAnchor constraintEqualToAnchor:cell.contentView.trailingAnchor constant:0],
// Label
[label.leadingAnchor constraintEqualToAnchor:cell.contentView.leadingAnchor constant:16],
[label.centerYAnchor constraintEqualToAnchor:cell.contentView.centerYAnchor],
......@@ -230,7 +244,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath {
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 64;
return 66;
}
- (void)tableView:(UITableView *)tableView
......
......@@ -60,8 +60,7 @@
#pragma mark - Header
- (void)setupHeader {
CGFloat statusBarHeight = UIApplication.sharedApplication.statusBarFrame.size.height;
self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, statusBarHeight + 60)];
self.headerView = [[UIView alloc] init];
self.headerView.backgroundColor = [UIColor colorWithRed:0.0 green:0.43 blue:0.55 alpha:1.0];
self.headerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.headerView];
......
......@@ -82,30 +82,31 @@
[card.topAnchor constraintEqualToAnchor:self.contentView.topAnchor constant:6],
[card.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor constant:10],
[card.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-10],
[card.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor constant:-6],
[self.thumbView.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:12],
[self.thumbView.topAnchor constraintEqualToAnchor:card.topAnchor constant:12],
[self.thumbView.widthAnchor constraintEqualToConstant:44],
[self.thumbView.heightAnchor constraintEqualToConstant:44],
[card.heightAnchor constraintEqualToConstant:141],
[self.statusLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-12],
[self.statusLabel.topAnchor constraintEqualToAnchor:card.topAnchor constant:12],
[self.statusLabel.widthAnchor constraintEqualToConstant:70],
[self.statusLabel.heightAnchor constraintEqualToConstant:24],
[self.referenceLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16],
[self.referenceLabel.trailingAnchor constraintEqualToAnchor:self.statusLabel.leadingAnchor constant:16],
[self.referenceLabel.topAnchor constraintEqualToAnchor:card.topAnchor constant:16],
[self.thumbView.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16],
[self.thumbView.topAnchor constraintEqualToAnchor:self.referenceLabel.bottomAnchor constant:12],
[self.thumbView.widthAnchor constraintEqualToConstant:44],
[self.thumbView.heightAnchor constraintEqualToConstant:44],
[self.locationLabel.leadingAnchor constraintEqualToAnchor:self.thumbView.trailingAnchor constant:12],
[self.locationLabel.topAnchor constraintEqualToAnchor:card.topAnchor constant:12],
[self.locationLabel.bottomAnchor constraintEqualToAnchor:self.thumbView.centerYAnchor constant:-1],
[self.createdLabel.leadingAnchor constraintEqualToAnchor:self.thumbView.trailingAnchor constant:12],
[self.createdLabel.topAnchor constraintEqualToAnchor:self.locationLabel.bottomAnchor constant:4],
[self.referenceLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:12],
[self.referenceLabel.topAnchor constraintEqualToAnchor:self.thumbView.bottomAnchor constant:8],
[self.createdLabel.topAnchor constraintEqualToAnchor:self.thumbView.centerYAnchor constant:1],
[self.detailsLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:12],
[self.detailsLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-12],
[self.detailsLabel.topAnchor constraintEqualToAnchor:self.referenceLabel.bottomAnchor constant:4],
[self.detailsLabel.topAnchor constraintEqualToAnchor:self.thumbView.bottomAnchor constant:12],
[self.detailsLabel.bottomAnchor constraintEqualToAnchor:card.bottomAnchor constant:-12],
]];
}
......
......@@ -715,8 +715,6 @@ didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
for (SyncUnit *unit in self.selectedUnits) {
[dictArray addObject:[self dictionaryFromUnit:unit]];
}
[LocalStorage saveArray:dictArray forKey:@"SELECTED_OFFLINE_UNITS"];
[self showOfflineUnit];
}
......
......@@ -670,7 +670,7 @@ static NSString * const kLastOfflineSyncDateKey = @"LAST_OFFLINE_SYNC_DATE";
}
- (NSInteger)loadOfflineUnitCount {
NSArray *units = [LocalStorage loadArrayForKey:@"SELECTED_OFFLINE_UNITS"];
NSArray *units = [LocalStorage loadArrayForKey:kSyncSelectedUnitsKey];
return units.count;
}
......@@ -714,5 +714,4 @@ static NSString * const kLastOfflineSyncDateKey = @"LAST_OFFLINE_SYNC_DATE";
self.yesBtn.alpha = enabled ? 1.0 : 0.5;
}
@end
......@@ -12,7 +12,7 @@
return;
}
NSURL *url = [APIConfig urlWithPath:@"/owner/plan/getAccessItem"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/plan/getAccessItem"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -84,7 +84,7 @@
}
// ✅ Construct URL (with token)
NSURL *url = [APIConfig urlWithPath:@"/owner/plan/getLocationByUnit"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/plan/getLocationByUnit"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -177,7 +177,7 @@
return;
}
NSURL *url = [APIConfig urlWithPath:@"/issue/getGeneralSettingByLocation"];
NSURL *url = [APIConfig urlWithPath:@"/framework/issue/getGeneralSettingByLocation"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -269,7 +269,7 @@
images:(NSArray<UIImage *> * _Nullable)images
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion {
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/addIssue"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/addIssue"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -361,7 +361,7 @@
images:(NSArray<UIImage *> * _Nullable)images
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion{
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/updateIssue"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/updateIssue"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -470,7 +470,7 @@
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/appointment/getSlot"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/appointment/getSlot"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -544,7 +544,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/plan/getUnitInfo"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/plan/getUnitInfo"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -614,7 +614,7 @@
+ (void)submitAppointment:(NSDictionary *)appointmentData
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion {
NSURL *url = [APIConfig urlWithPath:@"/owner/appointment/makeAppointment"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/appointment/makeAppointment"];
NSLog(@"🌍 SUBMIT (NO REP) URL: %@", url.absoluteString);
NSLog(@"📦 SUBMIT (NO REP) Body JSON: %@", appointmentData);
......@@ -673,7 +673,7 @@
+ (void)submitRepresentativeAppointment:(NSDictionary *)repData
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion {
NSURL *url = [APIConfig urlWithPath:@"/owner/appointment/makeAppointment"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/appointment/makeAppointment"];
NSLog(@"🌍 SUBMIT URL: %@", url.absoluteString);
// Create request
......@@ -743,7 +743,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/appointment/cancelAppointment"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/appointment/cancelAppointment"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -817,7 +817,7 @@
return;
}
NSURL *url = [APIConfig urlWithPath:@"/owner/plan/getIssueUpdateAppointmentInfo"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/plan/getIssueUpdateAppointmentInfo"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -883,7 +883,7 @@
return;
}
// ✅ Keep token in URL
NSURL *url = [APIConfig urlWithPath:@"/clientAnnouncement"];
NSURL *url = [APIConfig urlWithPath:@"/framework/clientAnnouncement"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -960,7 +960,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/getIssueHistory"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/getIssueHistory"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1033,7 +1033,7 @@
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/addInfo"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/addInfo"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1103,7 +1103,7 @@
mediaType:(NSString *)mediaType
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion {
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/addInfo"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/addInfo"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1218,7 +1218,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/getIssue"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/getIssue"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1294,7 +1294,7 @@
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/voidIssue"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/voidIssue"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1377,7 +1377,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/deleteIssue"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/deleteIssue"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1451,7 +1451,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/plan/getCommonArea"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/plan/getCommonArea"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1525,7 +1525,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/issue/getGeneralSetting"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/issue/getGeneralSetting"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1599,7 +1599,7 @@
// return;
// }
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/issue/getGeneralSettingByUnit"];
NSURL *url = [APIConfig urlWithPath:@"/framework/issue/getGeneralSettingByUnit"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1669,7 +1669,7 @@
return;
}
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/project/listProject"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/project/listProject"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......@@ -1739,7 +1739,7 @@
completion:(void(^)(BOOL success, NSDictionary * _Nullable response, NSError * _Nullable error))completion {
// ✅ URL
NSURL *url = [APIConfig urlWithPath:@"/owner/offline/syncImageArray"];
NSURL *url = [APIConfig urlWithPath:@"/framework/owner/offline/syncImageArray"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
......
......@@ -3,10 +3,10 @@
#import "LocalStorage.h"
#import "NetworkManager.h"
static NSString *kBaseURL = @"https://kitadev.commudesk.com/api";
static NSString *kBaseURL = @"https://sptest.commudesk.com/api";
static NSString *kDrawingPlanId = @"";
static NSString *kProjectId = @"";
static NSString *kAuthToken = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImF0aGlyYWh6YWlkaUBjb252ZXAuY29tIiwicGFzc3dvcmQiOiIkMnkkMTAkNU9xYklqMnZ6UHJwckJrcVd5c3I2LmJCc1hVYS9Hd014eUhnL3RhUUhPUkNQcGdmTG8yakciLCJzdWIiOjIxNzAsImlzcyI6Imh0dHBzOi8va2l0YWRldi5jb21tdWRlc2suY29tL2FwaS9vd25lci9hdXRoL3Bhc3N3b3JkbGVzc19sb2dpbiIsImlhdCI6MTc2MDMxNTM1MiwiZXhwIjoyMDc1ODg0ODcyLCJuYmYiOjE3NjAzMTUzNTIsImp0aSI6IktoQmNyQnJEdDVNdDZlWmMifQ.JnxGbZ7hTeoOr6oibIzZMphgyKtTo2Aq9Efx6mrGfFA";
static NSString *kAuthToken = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNlcnZlci10by1zZXJ2ZXIiLCJmcmFtZXdvcmstYXBpIjp0cnVlLCJjb21wYW55X2NvZGUiOiJTUFQiLCJzdWIiOjE1NTcsImlzcyI6Imh0dHBzOi8vc3B0ZXN0LmNvbW11ZGVzay5jb20vYXBpL2ZyYW1ld29yay9vd25lci9hdXRoL2NsaWVudF9hdXRoZW50aWNhdGlvbiIsImlhdCI6MTc2Nzc1MjU5OSwiZXhwIjoyMDgzMzIyMTE5LCJuYmYiOjE3Njc3NTI1OTksImp0aSI6IktEcmhmSXgzeWU0WmxaUEYifQ.Bv4ZSjGRm9YYOjGItLSV_3wS7grKuPTabL60BFnp88o";
static NSString *kClientId = @"3";
@implementation APIConfig
......
......@@ -6,43 +6,75 @@
@interface QmsDashboardView : UIView
@property (nonatomic, strong) UIViewController *dashboardVC;
@property (nonatomic, assign) BOOL didSetupVC;
// New props
@property (nonatomic, copy) NSString *ClientID;
@property (nonatomic, copy) NSString *ClientCode;
@property (nonatomic, copy) NSString *user_token;
@property (nonatomic, copy) RCTDirectEventBlock onClose;
@end
@implementation QmsDashboardView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
_dashboardVC = [QmsPluginUI makeViewController];
_dashboardVC = [QmsPluginUI makeViewController];
_didSetupVC = NO;
_dashboardVC.view.backgroundColor = [UIColor whiteColor];
// Listen for native dashboard close notification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleDashboardClose:)
name:@"QmsDashboardDidCloseNotification"
object:nil];
}
return self;
}
- (void)didMoveToWindow {
[super didMoveToWindow];
if (self.window && !_didSetupVC) {
UIViewController *parentVC = [UIApplication sharedApplication].keyWindow.rootViewController;
if (parentVC) {
[parentVC addChildViewController:_dashboardVC];
_dashboardVC.view.frame = parentVC.view.bounds;
_dashboardVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[parentVC.view addSubview:_dashboardVC.view];
[_dashboardVC didMoveToParentViewController:parentVC];
_didSetupVC = YES;
// Forward props once the VC is added
[self forwardPropsToVC];
[super didMoveToWindow];
if (self.window && !_didSetupVC) {
UIViewController *parentVC = [UIApplication sharedApplication].keyWindow.rootViewController;
if (parentVC) {
// 1️⃣ create VC with props
_dashboardVC = [QmsPluginUI makeViewController];
[parentVC addChildViewController:_dashboardVC];
_dashboardVC.view.frame = parentVC.view.bounds;
_dashboardVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[parentVC.view addSubview:_dashboardVC.view];
[_dashboardVC didMoveToParentViewController:parentVC];
_didSetupVC = YES;
// 2️⃣ forward props again if needed
[self forwardPropsToVC];
}
}
}
}
#pragma mark - Prop Setters
- (void)handleDashboardClose:(NSNotification *)note {
// 1️⃣ Notify JS
if (self.onClose) {
self.onClose(@{});
}
// 2️⃣ Clean up the native view controller
[self cleanupDashboard];
}
- (void)cleanupDashboard {
if (!_dashboardVC) return;
[_dashboardVC willMoveToParentViewController:nil];
[_dashboardVC.view removeFromSuperview];
[_dashboardVC removeFromParentViewController];
_dashboardVC = nil;
_didSetupVC = NO;
}
#pragma mark - Prop Setters
- (void)setClientID:(NSString *)ClientID {
_ClientID = [ClientID copy];
[self forwardProp:@"ClientID" value:_ClientID];
......@@ -59,7 +91,6 @@
}
#pragma mark - Forward Props via KVC
- (void)forwardProp:(NSString *)key value:(NSString *)value {
if (_dashboardVC && [_dashboardVC respondsToSelector:NSSelectorFromString(key)]) {
@try {
......@@ -76,6 +107,11 @@
[self forwardProp:@"user_token" value:_user_token];
}
- (void)removeFromSuperview {
[self cleanupDashboard];
[super removeFromSuperview];
}
@end
@interface QmsDashboardViewManager : RCTViewManager
......
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment