Commit cbddc13c authored by Wei Han's avatar Wei Han

code update, survey done

parent 33030498
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<dict> <dict>
<key>Assets.car</key> <key>Assets.car</key>
<data> <data>
1i2tuf6x04oClRQdI25h80iAWww= DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data> </data>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
<data> <data>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM= Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data> </data>
</dict> </dict>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<dict> <dict>
<key>Assets.car</key> <key>Assets.car</key>
<data> <data>
1i2tuf6x04oClRQdI25h80iAWww= DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data> </data>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
<data> <data>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM= Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data> </data>
</dict> </dict>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
......
...@@ -113,29 +113,29 @@ static NSString * const ProfileDidUpdateNotification = @"ProfileDidUpdateNotific ...@@ -113,29 +113,29 @@ static NSString * const ProfileDidUpdateNotification = @"ProfileDidUpdateNotific
} }
- (void)checkAndRefreshAPIs { - (void)checkAndRefreshAPIs {
// NSLog(@"🔍 Checking credentials..."); NSLog(@"🔍 Checking credentials...");
// NSLog(@"ClientID: %@", self.ClientID); NSLog(@"ClientID: %@", self.ClientID);
// NSLog(@"ClientCode: %@", self.ClientCode); NSLog(@"ClientCode: %@", self.ClientCode);
// NSLog(@"user_token: %@", self.user_token); NSLog(@"user_token: %@", self.user_token);
//
// [self showLoadingOverlay:@"Loading..."]; [self showLoadingOverlay:@"Loading..."];
//
// if (![self isReadyToLoadDashboard]) { if (![self isReadyToLoadDashboard]) {
// NSLog(@"⏳ Waiting for all credentials to be ready..."); NSLog(@"⏳ Waiting for all credentials to be ready...");
// return; return;
// } }
//
// if (_isLoadingDashboard) return; if (_isLoadingDashboard) return;
//
// self.isLoadingDashboard = YES; self.isLoadingDashboard = YES;
//
// NSLog(@"✅ All credentials ready. ClientID: %@, ClientCode: %@, user_token: %@", NSLog(@"✅ All credentials ready. ClientID: %@, ClientCode: %@, user_token: %@",
// self.ClientID, self.ClientCode, self.user_token); self.ClientID, self.ClientCode, self.user_token);
//
//
// [APIConfig setAuthTokem:self.user_token]; [APIConfig setAuthTokem:self.user_token];
// [APIConfig setClientId:self.ClientID]; [APIConfig setClientId:self.ClientID];
self.ClientCode = @"spt"; // self.ClientCode = @"spt";
[self requestCompanyCode]; [self requestCompanyCode];
} }
......
...@@ -2657,28 +2657,30 @@ ...@@ -2657,28 +2657,30 @@
appendFormField(@"data[survey][form_id]", formId); appendFormField(@"data[survey][form_id]", formId);
// Device / app info // Device / app info
NSString *infoJson = [APIConfig deviceInfoJson]; // or inline JSON if needed NSDictionary *deviceDict = [APIConfig deviceInfo];
appendFormField(@"data[information]", infoJson); 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, [answers enumerateKeysAndObjectsUsingBlock:^(NSNumber *questionId,
NSDictionary *answer, NSDictionary *answer,
BOOL *stop) { BOOL *stop) {
NSString *valueKey = NSString *valueKey = [NSString stringWithFormat:@"data[survey][%@][value]", questionId];
[NSString stringWithFormat:@"data[survey][%@][value]", questionId]; NSString *commentKey = [NSString stringWithFormat:@"data[survey][%@][comment]", questionId];
NSString *commentKey =
[NSString stringWithFormat:@"data[survey][%@][comment]", questionId];
NSString *value = @"";
NSString *comment = @"";
if (answer[@"value"] != nil) { NSString *value = (answer[@"value"] && answer[@"value"] != [NSNull null]) ? [answer[@"value"] description] : @"";
value = [answer[@"value"] description]; NSString *comment = (answer[@"comment"] && answer[@"comment"] != [NSNull null]) ? [answer[@"comment"] description] : @"";
}
if (answer[@"comment"] != nil) {
comment = [answer[@"comment"] description];
}
appendFormField(valueKey, value); appendFormField(valueKey, value);
appendFormField(commentKey, comment); appendFormField(commentKey, comment);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<dict> <dict>
<key>Assets.car</key> <key>Assets.car</key>
<data> <data>
1i2tuf6x04oClRQdI25h80iAWww= DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data> </data>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
<data> <data>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM= Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data> </data>
</dict> </dict>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<dict> <dict>
<key>Assets.car</key> <key>Assets.car</key>
<data> <data>
1i2tuf6x04oClRQdI25h80iAWww= DNAv+6vmFwh2wzjDEsERpsoVYvo=
</data> </data>
<key>Headers/QmsPlugin.h</key> <key>Headers/QmsPlugin.h</key>
<data> <data>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM= Za7ZSErG8QOjZLmoy05B6c0GN8NIBE2TV3bmVJJ0jOg=
</data> </data>
</dict> </dict>
<key>Headers/QmsPlugin.h</key> <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