+- (bool) allowSensitiveRequests {
+ [self _allowJavaScriptPanel];
+}
+
+- (void) _promptForSensitive:(NSMutableArray *)array {
+ NSString *name([array objectAtIndex:0]);
+
+ UIActionSheet *sheet = [[[UIActionSheet alloc]
+ initWithTitle:nil
+ buttons:[NSArray arrayWithObjects:CYLocalize("YES"), CYLocalize("NO"), nil]
+ defaultButtonIndex:0
+ delegate:indirect_
+ context:@"sensitive"
+ ] autorelease];
+
+ NSString *host(@"XXX");
+
+ [sheet setNumberOfRows:1];
+ [sheet setBodyText:[NSString stringWithFormat:@"The website at %@ is requesting your phone's %@. This is almost certainly for product licensing purposes. Will you allow this?", host, name]];
+ [sheet popupAlertAnimated:YES];
+
+ NSRunLoop *loop([NSRunLoop currentRunLoop]);
+ NSDate *future([NSDate distantFuture]);
+
+ while (sensitive_ == nil && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
+
+ NSNumber *sensitive([sensitive_ autorelease]);
+ sensitive_ = nil;
+
+ [self autorelease];
+ [array replaceObjectAtIndex:0 withObject:sensitive];
+}
+
+- (bool) promptForSensitive:(NSString *)name {
+ if (![self allowSensitiveRequests])
+ return false;
+
+ NSMutableArray *array([NSMutableArray arrayWithCapacity:1]);
+ [array addObject:name];
+
+ [self performSelectorOnMainThread:@selector(_promptForSensitive:) withObject:array waitUntilDone:YES];
+ return [[array lastObject] boolValue];
+}
+