| -rw-r--r-- | examples/iOS/GambitREPL.xcodeproj.tgz | 44 | ||||
| -rw-r--r-- | examples/iOS/ViewController.h | 5 | ||||
| -rw-r--r-- | examples/iOS/ViewController.m | 82 | ||||
| -rw-r--r-- | examples/iOS/grd.scm | 5 | ||||
| -rw-r--r-- | examples/iOS/intf#.scm | 2 | ||||
| -rw-r--r-- | examples/iOS/intf.scm | 6 | ||||
| -rw-r--r-- | include/stamp.h | 4 |
7 files changed, 117 insertions, 31 deletions
diff --git a/examples/iOS/GambitREPL.xcodeproj.tgz b/examples/iOS/GambitREPL.xcodeproj.tgz index 9bb8840..b346bde 100644 --- a/examples/iOS/GambitREPL.xcodeproj.tgz +++ b/examples/iOS/GambitREPL.xcodeproj.tgz @@ -1,25 +1,19 @@ -EOGambitREPL.xcodeproj.tar -?vk_Ei5jbi
EUtM|l7,F(Aە}O -4jY< -?wA UFr}r4jSWWvC
?\
2^]\1
oiѱ\՛\|o{C<{Dl;nf蟬{<wD.m9va| \iyNl72T @e{z9mzbjj`6Phmy -aҡX23utfїZd]h -GA~iV- f"ۦi[]=0 %*&NZͶ0[jSl|_j* -#37<KUX`KQ0[ -#4XS #le&8VX,^K@X2*l>U\$QaP*,vȨ/r=G5l2±]E1[)eKU,6,gnQM//ޮ&Ryn,YTyFxra<j$oڪuw&_͵joq4ZmV|ovj8lN^+~smZ;M6kۭ_hfGoJ-.O%ku':A'8y͗e)r/_yzcԫL% -:5[̲g<vթwx0yTn|6RIW`,QVF窲"ub $]Y5\-Z fyr>~GSZ\*`erujUern-2ZI'Z%q\qaY.kX@}`読eY_~,Dɹw,z.hEdoD1xbDl\Թq:ɠWCCD5"]'*xuT9zF禮-]Ajg16ʅY+uf2բ0ʕArV^j1s^%D62 xu /1rCF_J"zE,yBm'$}ۻL{LS72ؠ9y",gUeS -}hJ1I竛>_ՉUh0yy"} -qyy_J -hcm٤N!g=Ul
<S~KJ`=(RM+i&w*(J<9ERR`V`\L!BUy6*T*0 dc -I^eQL -MyP3%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
+@JG-sVY8%4ȥDX_zPuàDI(?PJO)Q~H;%ZoNɖĂS%qڔli5~buny%^E ).ҥZ(9}Pt}1:,,сˇq˅/6G n, cqr¼yd7RЉoH=܌AbNxn3%ی2|<\"]+`vWW;kٹh=En@&}X497UnKTVD!'Ɲ)tI" +תRBנR/C)]>)M+:)͊XR+};]!PwV|<(HahPr1t9xC0An B!X y/xȕCpa~
sr |ǃ@GBx(*1CѠ^H2a@
u@gb,<
0k +h_ĝؽ[?7/u;ƿo8`} zv{],+oit??aG;8BӣOϏ~oǓ?E??bn{#ߛîP2~P 7Q}N]yQAﺘ^w"y=t3^le<;G;iLo5!zqoސu) +jﺮ? P3!
MisAwT!EvڃRo|x|o:.{ξzx+x[Ӏļ])u Z
eQbCut<w:&=YZ-ZZ<4k~cGa1o_o?~|#_ diff --git a/examples/iOS/ViewController.h b/examples/iOS/ViewController.h index b2b1c34..0e504e5 100644 --- a/examples/iOS/ViewController.h +++ b/examples/iOS/ViewController.h @@ -7,6 +7,7 @@ #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> +#import <MessageUI/MessageUI.h> // ViewController methods callable from Scheme. @@ -26,6 +27,8 @@ void set_webView_content(int view, NSString *str, NSString *base_url_path, BOOL void set_webView_content_from_file(int view, NSString *path, NSString *base_url_path, BOOL enable_scaling, NSString *mime_type); NSString *eval_js_in_webView(int view, NSString *script); void open_URL(NSString *url); +BOOL send_SMS(NSString *recipient, NSString *messsage); +BOOL pick_image(); void set_idle_timer(BOOL enable); void set_toolbar_alpha(double alpha); void segm_ctrl_set_title(int segment, NSString *title); @@ -44,7 +47,7 @@ void setup_location_updates(double desired_accuracy, double distance_filter); #define NB_TEXTVIEWS 2 #define NB_IMAGEVIEWS 2 -@interface ViewController : UIViewController <UITextViewDelegate,UIWebViewDelegate,UIAlertViewDelegate,CLLocationManagerDelegate> { +@interface ViewController : UIViewController <UITextViewDelegate,UIWebViewDelegate,UIAlertViewDelegate,CLLocationManagerDelegate,MFMessageComposeViewControllerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate> { UISegmentedControl *segmCtrl; UIWebView *webViews[NB_WEBVIEWS]; diff --git a/examples/iOS/ViewController.m b/examples/iOS/ViewController.m index 0adc064..dcd8d30 100644 --- a/examples/iOS/ViewController.m +++ b/examples/iOS/ViewController.m @@ -621,6 +621,88 @@ void open_URL(NSString *url) { } +BOOL send_SMS(NSString *recipient, NSString *message) { + + ViewController *vc = theViewController; + if (vc != nil) + { + if ([MFMessageComposeViewController canSendText]) + { + MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease]; + + controller.body = message; + controller.recipients = [NSArray arrayWithObjects:recipient,nil]; + controller.messageComposeDelegate = vc; + [vc presentModalViewController:controller animated:YES]; + + return YES; + } + } + + return NO; +} + + +- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result +{ + NSString *event; + + [self dismissModalViewControllerAnimated:YES]; + + switch (result) { + + default: + case MessageComposeResultFailed: + event = @"SMS-failed"; + break; + + case MessageComposeResultCancelled: + event = @"SMS-cancelled"; + break; + + case MessageComposeResultSent: + event = @"SMS-sent"; + break; + } + + [self send_event:event]; +} + + +BOOL pick_image() { + + ViewController *vc = theViewController; + if (vc != nil) + { + if ([UIImagePickerController isCameraDeviceAvailable: UIImagePickerControllerCameraDeviceRear] || + [UIImagePickerController isCameraDeviceAvailable: UIImagePickerControllerCameraDeviceFront]) + { + UIImagePickerController *controller = [[[UIImagePickerController alloc] init] autorelease]; + + controller.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera]; + + controller.sourceType = UIImagePickerControllerSourceTypeCamera; + + controller.delegate = vc; + + [vc presentModalViewController:controller animated:YES]; + + return YES; + } + } + + return NO; +} + + +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + [picker dismissModalViewControllerAnimated:YES]; + + [self send_event:@"pick-image:"]; +} + + void set_idle_timer(BOOL enable) { [UIApplication sharedApplication].idleTimerDisabled = !enable; diff --git a/examples/iOS/grd.scm b/examples/iOS/grd.scm index ac998b6..5eb95ce 100644 --- a/examples/iOS/grd.scm +++ b/examples/iOS/grd.scm @@ -199,7 +199,6 @@ EOF (let* ((port (open-tcp-client (list server-address: '#u8(73 125 226 48) ;; google.com port-number: 443))) - (_ (thread-sleep! 2)) (ip (socket-info-address (tcp-client-self-socket-info port)))) (close-port port) @@ -217,7 +216,7 @@ EOF (and port (try-catch (begin - (input-port-timeout-set! port 2.0) + (input-port-timeout-set! port 1.0) (let ((header (read port))) (input-port-timeout-set! port +inf.0) (if (equal? header 'Gambit) @@ -288,7 +287,7 @@ EOF (let ((conn (REPL-server-connect addr))) (if conn (found conn)) - (sleep 0.5))) + (sleep 1.0))) (define (scan-local-REPL-servers) (discover-local-REPL-servers diff --git a/examples/iOS/intf#.scm b/examples/iOS/intf#.scm index a33419d..260966a 100644 --- a/examples/iOS/intf#.scm +++ b/examples/iOS/intf#.scm @@ -73,6 +73,8 @@ set-webView-content-from-file eval-js-in-webView open-URL +send-SMS +pick-image set-idle-timer set-toolbar-alpha segm-ctrl-set-title diff --git a/examples/iOS/intf.scm b/examples/iOS/intf.scm index d881841..4fbf885 100644 --- a/examples/iOS/intf.scm +++ b/examples/iOS/intf.scm @@ -422,6 +422,12 @@ c-declare-end (define open-URL (c-lambda (NSString*) void "open_URL")) +(define send-SMS + (c-lambda (NSString* NSString*) bool "send_SMS")) + +(define pick-image + (c-lambda () bool "pick_image")) + (define set-idle-timer (c-lambda (bool) void "set_idle_timer")) diff --git a/include/stamp.h b/include/stamp.h index 5d40a1a..f50fcde 100644 --- a/include/stamp.h +++ b/include/stamp.h @@ -2,5 +2,5 @@ * Time stamp of last source code repository commit. */ -#define ___STAMP_YMD 20120222 -#define ___STAMP_HMS 164157 +#define ___STAMP_YMD 20120225 +#define ___STAMP_HMS 135406 |
