Commit cbddc13c authored by Wei Han's avatar Wei Han

code update, survey done

parent 33030498
......@@ -6,7 +6,7 @@
<dict>
<key>Assets.car</key>
<data>
1i2tuf6x04oClRQdI25h80iAWww=
DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data>
<key>Headers/QmsPlugin.h</key>
<data>
......@@ -31,7 +31,7 @@
<dict>
<key>hash2</key>
<data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data>
</dict>
<key>Headers/QmsPlugin.h</key>
......
......@@ -6,7 +6,7 @@
<dict>
<key>Assets.car</key>
<data>
1i2tuf6x04oClRQdI25h80iAWww=
DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data>
<key>Headers/QmsPlugin.h</key>
<data>
......@@ -31,7 +31,7 @@
<dict>
<key>hash2</key>
<data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data>
</dict>
<key>Headers/QmsPlugin.h</key>
......
......@@ -113,29 +113,29 @@ static NSString * const ProfileDidUpdateNotification = @"ProfileDidUpdateNotific
}
- (void)checkAndRefreshAPIs {
// NSLog(@"🔍 Checking credentials...");
// NSLog(@"ClientID: %@", self.ClientID);
// 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.ClientCode = @"spt";
NSLog(@"🔍 Checking credentials...");
NSLog(@"ClientID: %@", self.ClientID);
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.ClientCode = @"spt";
[self requestCompanyCode];
}
......
......@@ -2657,28 +2657,30 @@
appendFormField(@"data[survey][form_id]", formId);
// Device / app info
NSString *infoJson = [APIConfig deviceInfoJson]; // or inline JSON if needed
appendFormField(@"data[information]", infoJson);
NSDictionary *deviceDict = [APIConfig deviceInfo];
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:deviceDict
options:0
error:&error];
NSString *infoJson = nil;
if (!error && jsonData) {
infoJson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"Device info JSON: %@", infoJson);
} else {
NSLog(@"❌ Failed to serialize device info: %@", error);
}
appendFormField(@"data[information]", infoJson ?: @"{}");
[answers enumerateKeysAndObjectsUsingBlock:^(NSNumber *questionId,
NSDictionary *answer,
BOOL *stop) {
NSString *valueKey =
[NSString stringWithFormat:@"data[survey][%@][value]", questionId];
NSString *commentKey =
[NSString stringWithFormat:@"data[survey][%@][comment]", questionId];
NSString *valueKey = [NSString stringWithFormat:@"data[survey][%@][value]", questionId];
NSString *commentKey = [NSString stringWithFormat:@"data[survey][%@][comment]", questionId];
NSString *value = @"";
NSString *comment = @"";
if (answer[@"value"] != nil) {
value = [answer[@"value"] description];
}
if (answer[@"comment"] != nil) {
comment = [answer[@"comment"] description];
}
NSString *value = (answer[@"value"] && answer[@"value"] != [NSNull null]) ? [answer[@"value"] description] : @"";
NSString *comment = (answer[@"comment"] && answer[@"comment"] != [NSNull null]) ? [answer[@"comment"] description] : @"";
appendFormField(valueKey, value);
appendFormField(commentKey, comment);
......
......@@ -6,7 +6,7 @@
<dict>
<key>Assets.car</key>
<data>
1i2tuf6x04oClRQdI25h80iAWww=
DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data>
<key>Headers/QmsPlugin.h</key>
<data>
......@@ -31,7 +31,7 @@
<dict>
<key>hash2</key>
<data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data>
</dict>
<key>Headers/QmsPlugin.h</key>
......
......@@ -6,7 +6,7 @@
<dict>
<key>Assets.car</key>
<data>
1i2tuf6x04oClRQdI25h80iAWww=
DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data>
<key>Headers/QmsPlugin.h</key>
<data>
......@@ -31,7 +31,7 @@
<dict>
<key>hash2</key>
<data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data>
</dict>
<key>Headers/QmsPlugin.h</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