Commit 010b196a authored by Wei Han's avatar Wei Han

code update, sync ui

parent cda59edd
......@@ -11,7 +11,7 @@
44006126336D83DB220E7214 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
915A61EF3FB0D83A24210E3E /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B30817B782A4551FE77ED4D /* libPods-example.a */; };
AF643AF9AD2E6D7F8427E3F1 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FF98AE45D9936432AFEC029 /* libPods-example.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -19,11 +19,11 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3CEA4A8FA353AAF71956ECAB /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
6224139EF36E532E27122179 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
6B30817B782A4551FE77ED4D /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
688F14F134731D6E3695DCD4 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
6FF98AE45D9936432AFEC029 /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = example/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = "<group>"; };
E7FE0B6CF3283929F0ED2217 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
......@@ -32,7 +32,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
915A61EF3FB0D83A24210E3E /* libPods-example.a in Frameworks */,
AF643AF9AD2E6D7F8427E3F1 /* libPods-example.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -55,7 +55,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
6B30817B782A4551FE77ED4D /* libPods-example.a */,
6FF98AE45D9936432AFEC029 /* libPods-example.a */,
);
name = Frameworks;
sourceTree = "<group>";
......@@ -92,8 +92,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
6224139EF36E532E27122179 /* Pods-example.debug.xcconfig */,
3CEA4A8FA353AAF71956ECAB /* Pods-example.release.xcconfig */,
E7FE0B6CF3283929F0ED2217 /* Pods-example.debug.xcconfig */,
688F14F134731D6E3695DCD4 /* Pods-example.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
......@@ -105,13 +105,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
buildPhases = (
AB27DA1BFBF250F3FBDD122A /* [CP] Check Pods Manifest.lock */,
73D6515E0B05E56E1C38DCEE /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
ECF4F483E82F128B69448B1F /* [CP] Embed Pods Frameworks */,
3BE667FD28A69559FE50BB89 /* [CP] Copy Pods Resources */,
13DCD710B66171E18819239B /* [CP] Embed Pods Frameworks */,
E355AFBEE78FE218C8B2F995 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -183,24 +183,24 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
3BE667FD28A69559FE50BB89 /* [CP] Copy Pods Resources */ = {
13DCD710B66171E18819239B /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist",
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist",
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
AB27DA1BFBF250F3FBDD122A /* [CP] Check Pods Manifest.lock */ = {
73D6515E0B05E56E1C38DCEE /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -222,21 +222,21 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
ECF4F483E82F128B69448B1F /* [CP] Embed Pods Frameworks */ = {
E355AFBEE78FE218C8B2F995 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
......@@ -255,7 +255,7 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 6224139EF36E532E27122179 /* Pods-example.debug.xcconfig */;
baseConfigurationReference = E7FE0B6CF3283929F0ED2217 /* Pods-example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......@@ -283,7 +283,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3CEA4A8FA353AAF71956ECAB /* Pods-example.release.xcconfig */;
baseConfigurationReference = 688F14F134731D6E3695DCD4 /* Pods-example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......
......@@ -72,6 +72,8 @@
self.projectCode = @"PTD197656";
self.projectName = @"Ara E`Residence Dev";
[self showLoadingOverlay:@"Loading dashboard..."];
[self checkAndRefreshAPIs];
NSLog(@"in viewDidLoad ClientID: %@, ClientCode: %@, user_token: %@", self.ClientID, self.ClientCode, self.user_token);
......@@ -87,13 +89,15 @@
}
- (void)checkAndRefreshAPIs {
// Only trigger API calls when all props are set and not the placeholder
if (![_ClientID isEqualToString:@"clientID_loading"] &&
![_ClientCode isEqualToString:@"clientCode_loading"] &&
![_user_token isEqualToString:@"userToken_loading"]) {
NSLog(@"in checkAndRefreshApis ClientID: %@, ClientCode: %@, user_token: %@", self.ClientID, self.ClientCode, self.user_token);
[self refreshDashboardContent]; // Your API call method
if (![self isReadyToLoadDashboard]) {
NSLog(@"⏳ Waiting for ClientID / ClientCode / Token...");
return;
}
NSLog(@"✅ All credentials ready. Loading dashboard.");
[self showLoadingOverlay:@"Loading dashboard..."];
[self refreshDashboardContent];
}
#pragma mark - Refresh Logic
......@@ -119,11 +123,14 @@
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
if (dashboardData) [self processDashboardResponse:dashboardData];
if (announcementData) [self processAnnouncementResponse:announcementData];
// 👇 hide loading only when EVERYTHING is done
[self hideLoadingOverlay];
NSLog(@"✅ Dashboard refresh complete");
});
}
- (void)handlePullToRefresh:(UIRefreshControl *)refreshControl {
NSLog(@"🔄 Pull-to-refresh triggered");
......@@ -1249,6 +1256,17 @@
}
}
- (BOOL)isReadyToLoadDashboard {
return (
self.ClientID.length > 0 &&
self.ClientCode.length > 0 &&
self.user_token.length > 0 &&
![self.ClientID isEqualToString:@"clientID_loading"] &&
![self.ClientCode isEqualToString:@"clientCode_loading"] &&
![self.user_token isEqualToString:@"userToken_loading"]
);
}
#pragma mark - prop setter
- (void)setClientID:(NSString *)ClientID {
_ClientID = [ClientID copy];
......
// LocalStorage.h
#import <Foundation/Foundation.h>
@interface LocalStorage : NSObject
/// Generic load for any type
+ (id)loadObjectForKey:(NSString *)key;
/// Generic save for any object
+ (void)saveObject:(id)object forKey:(NSString *)key;
/// Remove object for a key
+ (void)removeObjectForKey:(NSString *)key;
/// Load array safely (for convenience)
+ (NSArray *)loadArrayForKey:(NSString *)key;
/// Save array safely (for convenience)
+ (void)saveArray:(NSArray *)array forKey:(NSString *)key;
@end
// LocalStorage.mm
#import "LocalStorage.h"
@implementation LocalStorage
+ (NSUserDefaults *)defaults {
return [NSUserDefaults standardUserDefaults];
}
#pragma mark - Generic Methods
+ (id)loadObjectForKey:(NSString *)key {
NSData *data = [[self defaults] objectForKey:key];
if (!data) return nil;
NSError *error = nil;
id object = [NSKeyedUnarchiver unarchivedObjectOfClasses:[NSSet setWithObjects:[NSArray class],[NSDictionary class],[NSString class],[NSNumber class], nil]
fromData:data
error:&error];
if (error) {
NSLog(@"Failed to unarchive object for key '%@': %@", key, error);
return nil;
}
return object;
}
+ (void)saveObject:(id)object forKey:(NSString *)key {
if (!object) return;
NSError *error = nil;
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object
requiringSecureCoding:NO
error:&error];
if (error) {
NSLog(@"Failed to archive object for key '%@': %@", key, error);
return;
}
[[self defaults] setObject:data forKey:key];
}
+ (void)removeObjectForKey:(NSString *)key {
[[self defaults] removeObjectForKey:key];
}
#pragma mark - Convenience Array Methods
+ (NSArray *)loadArrayForKey:(NSString *)key {
id object = [self loadObjectForKey:key];
if ([object isKindOfClass:[NSArray class]]) {
return object;
}
return nil;
}
+ (void)saveArray:(NSArray *)array forKey:(NSString *)key {
[self saveObject:array forKey:key];
}
@end
//
// HistoryDetailsViewController.h
// QmsPluginFramework
//
// Created by Wei Han Ng on 19/12/2025.
//
//
// HistoryDetailsViewController.mm
// QmsPluginFramework
//
// Created by Wei Han Ng on 19/12/2025.
//
// PendingDetailsViewController.h
#import <UIKit/UIKit.h>
@interface PendingDetailsViewController : UIViewController
@property (nonatomic, strong) NSDictionary *item;
@end
// PendingDetailsViewController.mm
#import "PendingDetailsViewController.h"
@implementation PendingDetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.systemBackgroundColor;
UILabel *label = [[UILabel alloc] init];
label.translatesAutoresizingMaskIntoConstraints = NO;
label.numberOfLines = 0;
label.text = [NSString stringWithFormat:
@"Unit: %@\nBy: %@\nType: %@",
self.item[@"unitName"],
self.item[@"createdBy"],
self.item[@"type"]];
[self.view addSubview:label];
[NSLayoutConstraint activateConstraints:@[
[label.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[label.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor],
]];
}
@end
......@@ -4,12 +4,6 @@
@interface SyncProjectViewController : UIViewController
typedef NS_ENUM(NSInteger, SyncProjectScreenState) {
SyncProjectScreenStateOfflineUnit,
SyncProjectScreenStateSelectProject,
SyncProjectScreenStateSelectUnit
};
@end
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