OSDN Git Service

課金ウインドウを閉じたときwebviewをリセットするようにした
authormasakih <masakih@users.sourceforge.jp>
Mon, 20 Apr 2015 14:39:30 +0000 (23:39 +0900)
committermasakih <masakih@users.sourceforge.jp>
Mon, 20 Apr 2015 14:39:30 +0000 (23:39 +0900)
KCD/HMAppDelegate.m

index 7566db6..6bab5ef 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #ifndef UI_TEST
-#      define UI_TEST 0
+#      define UI_TEST 1
 #endif
 
 //@interface NSObject (HMM_NSUserNotificationCenterPrivateMethods)
 
 - (IBAction)showExternalBrowserWindow:(id)sender
 {
+       NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
        if(!self.externalBrowserWindowController) {
                self.externalBrowserWindowController = [HMExternalBrowserWindowController new];
+               [nc addObserver:self
+                          selector:@selector(windowWillClose:)
+                                  name:NSWindowWillCloseNotification
+                                object:self.externalBrowserWindowController.window];
        }
        
        NSWindow *window = self.externalBrowserWindowController.window;
        }
 }
 
+- (void)windowWillClose:(NSNotification *)notification
+{
+       id object = [notification object];
+       if([object isEqual:self.externalBrowserWindowController.window]) {
+               [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification
+                                                                                                         object:self.externalBrowserWindowController.window];
+               self.externalBrowserWindowController = nil;
+       }
+}
+
 #pragma mark - NSApplicationDelegate
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
 {