mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
Add rageskahe feature : when the user shakes his device > 1.5s, the client takes a screenshot and prepare an email to send to "rageshake@matrix.org".
Nothing is currently added to the body (to be done)
This commit is contained in:
parent
dbfe926470
commit
6cbda9bad1
18 changed files with 406 additions and 17 deletions
|
@ -8,6 +8,9 @@
|
|||
|
||||
/* Begin PBXBuildFile section */
|
||||
3198D9E11A68338B00556695 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3198D9E31A68338B00556695 /* Localizable.strings */; };
|
||||
710CA4BF1A7FBEDB00EEFB96 /* RageShakableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 710CA4BE1A7FBEDB00EEFB96 /* RageShakableViewController.m */; };
|
||||
710CA4C21A7FBFED00EEFB96 /* RageShakableUIResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = 710CA4C11A7FBFED00EEFB96 /* RageShakableUIResponder.m */; };
|
||||
710CA4C51A7FC27100EEFB96 /* RageShakableTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 710CA4C41A7FC27100EEFB96 /* RageShakableTableViewController.m */; };
|
||||
710CC3BF1A6E9F14006EE973 /* matrixUser.png in Resources */ = {isa = PBXBuildFile; fileRef = 710CC3BE1A6E9F14006EE973 /* matrixUser.png */; };
|
||||
710CC3C21A70F28F006EE973 /* MXCContactField.m in Sources */ = {isa = PBXBuildFile; fileRef = 710CC3C11A70F28F006EE973 /* MXCContactField.m */; };
|
||||
71193D241A6D64F900E59A9E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71193D231A6D64F900E59A9E /* AddressBook.framework */; };
|
||||
|
@ -86,6 +89,12 @@
|
|||
/* Begin PBXFileReference section */
|
||||
13057A57E74FD5504196F47F /* Pods-matrixConsole.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-matrixConsole.release.xcconfig"; path = "Pods/Target Support Files/Pods-matrixConsole/Pods-matrixConsole.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3198D9E21A68338B00556695 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
710CA4BD1A7FBEDB00EEFB96 /* RageShakableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RageShakableViewController.h; sourceTree = "<group>"; };
|
||||
710CA4BE1A7FBEDB00EEFB96 /* RageShakableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RageShakableViewController.m; sourceTree = "<group>"; };
|
||||
710CA4C01A7FBFED00EEFB96 /* RageShakableUIResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RageShakableUIResponder.h; sourceTree = "<group>"; };
|
||||
710CA4C11A7FBFED00EEFB96 /* RageShakableUIResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RageShakableUIResponder.m; sourceTree = "<group>"; };
|
||||
710CA4C31A7FC27100EEFB96 /* RageShakableTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RageShakableTableViewController.h; sourceTree = "<group>"; };
|
||||
710CA4C41A7FC27100EEFB96 /* RageShakableTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RageShakableTableViewController.m; sourceTree = "<group>"; };
|
||||
710CC3BE1A6E9F14006EE973 /* matrixUser.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = matrixUser.png; sourceTree = "<group>"; };
|
||||
710CC3C01A70F28F006EE973 /* MXCContactField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCContactField.h; sourceTree = "<group>"; };
|
||||
710CC3C11A70F28F006EE973 /* MXCContactField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCContactField.m; sourceTree = "<group>"; };
|
||||
|
@ -299,6 +308,10 @@
|
|||
F03EF5EF19F171EB00A0EE52 /* MasterTabBarController.m */,
|
||||
71DB9DBF1A495B6400504A09 /* MemberViewController.h */,
|
||||
71DB9DC01A495B6400504A09 /* MemberViewController.m */,
|
||||
710CA4C31A7FC27100EEFB96 /* RageShakableTableViewController.h */,
|
||||
710CA4C41A7FC27100EEFB96 /* RageShakableTableViewController.m */,
|
||||
710CA4BD1A7FBEDB00EEFB96 /* RageShakableViewController.h */,
|
||||
710CA4BE1A7FBEDB00EEFB96 /* RageShakableViewController.m */,
|
||||
F03EF5F019F171EB00A0EE52 /* RecentsViewController.h */,
|
||||
F03EF5F119F171EB00A0EE52 /* RecentsViewController.m */,
|
||||
F03EF5F219F171EB00A0EE52 /* RoomViewController.h */,
|
||||
|
@ -353,6 +366,8 @@
|
|||
71193D331A6E49F000E59A9E /* MXCEmail.m */,
|
||||
71193D341A6E49F000E59A9E /* MXCPhoneNumber.h */,
|
||||
71193D351A6E49F000E59A9E /* MXCPhoneNumber.m */,
|
||||
710CA4C01A7FBFED00EEFB96 /* RageShakableUIResponder.h */,
|
||||
710CA4C11A7FBFED00EEFB96 /* RageShakableUIResponder.m */,
|
||||
F0D942F41A31F3A300826CC1 /* RecentRoom.h */,
|
||||
F0D942F51A31F3A300826CC1 /* RecentRoom.m */,
|
||||
F0465AF81A251F85003639F9 /* RoomMessage.h */,
|
||||
|
@ -586,6 +601,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
710CA4BF1A7FBEDB00EEFB96 /* RageShakableViewController.m in Sources */,
|
||||
7176294F1A77FED800927125 /* ContactDetailsTableCell.m in Sources */,
|
||||
F04A8AD81A3B3DF4008AC915 /* RoomTitleView.m in Sources */,
|
||||
F07A80DB19DD9DE700B621A1 /* AppDelegate.m in Sources */,
|
||||
|
@ -603,6 +619,8 @@
|
|||
F01A0FF31A27314B009FAE2F /* RoomMessageComponent.m in Sources */,
|
||||
F03EF5FA19F171EB00A0EE52 /* RoomViewController.m in Sources */,
|
||||
F03EF5F819F171EB00A0EE52 /* MasterTabBarController.m in Sources */,
|
||||
710CA4C21A7FBFED00EEFB96 /* RageShakableUIResponder.m in Sources */,
|
||||
710CA4C51A7FC27100EEFB96 /* RageShakableTableViewController.m in Sources */,
|
||||
F03EF5F619F171EB00A0EE52 /* HomeViewController.m in Sources */,
|
||||
71DB9DC11A495B6400504A09 /* MemberViewController.m in Sources */,
|
||||
F0D942F61A31F3A300826CC1 /* RecentRoom.m in Sources */,
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
@property (strong, nonatomic) MXCAlert *errorNotification;
|
||||
|
||||
@property (nonatomic) BOOL isAppForeground;
|
||||
|
||||
+ (AppDelegate*)theDelegate;
|
||||
|
||||
- (void)registerUserNotificationSettings;
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
recents.tabBarItem.image = [[UIImage imageNamed:@"tab_recents"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
|
||||
}
|
||||
|
||||
_isAppForeground = NO;
|
||||
|
||||
// Retrieve custom configuration
|
||||
NSString* userDefaults = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UserDefaults"];
|
||||
NSString *defaultsPathFromApp = [[NSBundle mainBundle] pathForResource:userDefaults ofType:@"plist"];
|
||||
|
@ -110,12 +112,16 @@
|
|||
|
||||
// clear the notifications counter
|
||||
[self clearNotifications];
|
||||
|
||||
_isAppForeground = NO;
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
// clear the notifications counter
|
||||
[self clearNotifications];
|
||||
|
||||
_isAppForeground = YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
|
@ -125,6 +131,8 @@
|
|||
|
||||
// refresh the contacts list
|
||||
[[ContactManager sharedManager] fullRefresh];
|
||||
|
||||
_isAppForeground = YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="GsA-m1-kGB">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="GsA-m1-kGB">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
|
|
28
matrixConsole/Model/RageShakableUIResponder.h
Normal file
28
matrixConsole/Model/RageShakableUIResponder.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <MessageUI/MessageUI.h>
|
||||
|
||||
@interface RageShakableUIResponder : UIResponder<MFMailComposeViewControllerDelegate>
|
||||
|
||||
+ (void)startShaking:(UIResponder*)controller;
|
||||
+ (void)stopShaking:(UIResponder*)controller;
|
||||
+ (void)cancel:(UIResponder*)controller;
|
||||
+ (void)applicationBecomesActive;
|
||||
|
||||
@end
|
179
matrixConsole/Model/RageShakableUIResponder.m
Normal file
179
matrixConsole/Model/RageShakableUIResponder.m
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import "RageShakableUIResponder.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "MXCAlert.h"
|
||||
|
||||
@interface RageShakableUIResponder() {
|
||||
MXCAlert *confirmationAlert;
|
||||
double startShakingTimeStamp;
|
||||
bool isShaking;
|
||||
bool ignoreShakeEnd;
|
||||
|
||||
UIViewController* parentViewController;
|
||||
MFMailComposeViewController* mailComposer;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation RageShakableUIResponder
|
||||
|
||||
static RageShakableUIResponder* sharedInstance = nil;
|
||||
|
||||
- (id) init {
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
mailComposer = nil;
|
||||
confirmationAlert = nil;
|
||||
startShakingTimeStamp = 0;
|
||||
isShaking = NO;
|
||||
ignoreShakeEnd = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (void)startShaking:(UIResponder*)responder {
|
||||
|
||||
if (!sharedInstance) {
|
||||
sharedInstance = [[RageShakableUIResponder alloc] init];
|
||||
}
|
||||
|
||||
RageShakableUIResponder* rageShakableUIResponder = [responder isKindOfClass:[RageShakableUIResponder class]] ? (RageShakableUIResponder*)responder : sharedInstance;
|
||||
|
||||
// only start if the application is in foreground
|
||||
if ([AppDelegate theDelegate].isAppForeground && !rageShakableUIResponder->confirmationAlert) {
|
||||
rageShakableUIResponder->startShakingTimeStamp = [[NSDate date] timeIntervalSince1970];
|
||||
|
||||
rageShakableUIResponder->isShaking = YES;
|
||||
rageShakableUIResponder->ignoreShakeEnd = NO;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)stopShaking:(UIResponder*)responder
|
||||
{
|
||||
if (!sharedInstance) {
|
||||
sharedInstance = [[RageShakableUIResponder alloc] init];
|
||||
}
|
||||
|
||||
NSLog(@"stopShaking with [%@]", [responder class]);
|
||||
|
||||
RageShakableUIResponder* rageShakableUIResponder = [responder isKindOfClass:[RageShakableUIResponder class]] ? (RageShakableUIResponder*)responder : sharedInstance;
|
||||
|
||||
if (rageShakableUIResponder && [AppDelegate theDelegate].isAppForeground && (([[NSDate date] timeIntervalSince1970] - rageShakableUIResponder->startShakingTimeStamp) > 1.5) && !rageShakableUIResponder->confirmationAlert) {
|
||||
if (!rageShakableUIResponder->ignoreShakeEnd) {
|
||||
rageShakableUIResponder->startShakingTimeStamp = [[NSDate date] timeIntervalSince1970];
|
||||
|
||||
if ([responder isKindOfClass:[UIViewController class]]) {
|
||||
rageShakableUIResponder->confirmationAlert = [[MXCAlert alloc] initWithTitle:@"You seem to be shaking the phone in frustration. Would you like to submit a bug report?" message:nil style:MXCAlertStyleAlert];
|
||||
|
||||
[rageShakableUIResponder->confirmationAlert addActionWithTitle:@"Cancel" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) {
|
||||
sharedInstance->confirmationAlert = nil;
|
||||
}];
|
||||
|
||||
[rageShakableUIResponder->confirmationAlert addActionWithTitle:@"OK" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) {
|
||||
sharedInstance->confirmationAlert = nil;
|
||||
[RageShakableUIResponder takeScreenshot:(UIViewController*)responder];
|
||||
}];
|
||||
|
||||
[rageShakableUIResponder->confirmationAlert showInViewController:(UIViewController*)responder];
|
||||
}
|
||||
} else {
|
||||
[RageShakableUIResponder takeScreenshot:nil];
|
||||
}
|
||||
}
|
||||
|
||||
rageShakableUIResponder->isShaking = NO;
|
||||
rageShakableUIResponder->ignoreShakeEnd = NO;
|
||||
}
|
||||
|
||||
+ (void)cancel:(UIResponder*)responder {
|
||||
|
||||
if (!sharedInstance) {
|
||||
sharedInstance = [[RageShakableUIResponder alloc] init];
|
||||
}
|
||||
|
||||
RageShakableUIResponder* rageShakableUIResponder = [responder isKindOfClass:[RageShakableUIResponder class]] ? (RageShakableUIResponder*)responder : sharedInstance;
|
||||
|
||||
// Arathorn succeeded to shake the device and to put the application in background at the same time (magic finders)
|
||||
// it should prevent any screenshot alert in this crazy case
|
||||
rageShakableUIResponder->startShakingTimeStamp = [[NSDate date] timeIntervalSince1970];
|
||||
|
||||
if (rageShakableUIResponder->isShaking) {
|
||||
rageShakableUIResponder->ignoreShakeEnd = YES;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)applicationBecomesActive {
|
||||
[RageShakableUIResponder cancel:nil];
|
||||
}
|
||||
|
||||
+ (void)takeScreenshot:(UIViewController*)controller {
|
||||
AppDelegate* theDelegate = [AppDelegate theDelegate];
|
||||
UIGraphicsBeginImageContext(theDelegate.window.bounds.size);
|
||||
|
||||
// Iterate over every window from back to front
|
||||
for (UIWindow *window in [[UIApplication sharedApplication] windows])
|
||||
{
|
||||
if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen])
|
||||
{
|
||||
// -renderInContext: renders in the coordinate space of the layer,
|
||||
// so we must first apply the layer's geometry to the graphics context
|
||||
CGContextSaveGState(UIGraphicsGetCurrentContext());
|
||||
// Center the context around the window's anchor point
|
||||
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), [window center].x, [window center].y);
|
||||
// Apply the window's transform about the anchor point
|
||||
CGContextConcatCTM(UIGraphicsGetCurrentContext(), [window transform]);
|
||||
// Offset by the portion of the bounds left of and above the anchor point
|
||||
CGContextTranslateCTM(UIGraphicsGetCurrentContext(),
|
||||
-[window bounds].size.width * [[window layer] anchorPoint].x,
|
||||
-[window bounds].size.height * [[window layer] anchorPoint].y);
|
||||
|
||||
// Render the layer hierarchy to the current context
|
||||
[[window layer] renderInContext:UIGraphicsGetCurrentContext()];
|
||||
|
||||
// Restore the context
|
||||
CGContextRestoreGState(UIGraphicsGetCurrentContext());
|
||||
}
|
||||
}
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
// the image is copied in the clipboard
|
||||
[UIPasteboard generalPasteboard].image = image;
|
||||
|
||||
if (controller) {
|
||||
sharedInstance->parentViewController = controller;
|
||||
sharedInstance->mailComposer = [[MFMailComposeViewController alloc] init];
|
||||
|
||||
[sharedInstance->mailComposer setSubject:@"Matrix bug report"];
|
||||
[sharedInstance->mailComposer setToRecipients:[NSArray arrayWithObject:@"rageshake@matrix.org"]];
|
||||
[sharedInstance->mailComposer setMessageBody:@"Something went wrong on my Matrix client." isHTML:NO];
|
||||
[sharedInstance->mailComposer addAttachmentData:UIImageJPEGRepresentation(image, 1.0) mimeType:@"image/jpg" fileName:@"screenshot.jpg"];
|
||||
sharedInstance->mailComposer.mailComposeDelegate = sharedInstance;
|
||||
[controller presentViewController:sharedInstance->mailComposer animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MFMailComposeViewControllerDelegate delegate
|
||||
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
|
||||
[controller dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
|
||||
@end
|
|
@ -14,11 +14,11 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
#import "MXCContact.h"
|
||||
|
||||
@interface ContactDetailsViewController : UITableViewController
|
||||
@interface ContactDetailsViewController : RageShakableTableViewController
|
||||
|
||||
@property (strong, nonatomic) MXCContact* contact;
|
||||
@end
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableViewController.h"
|
||||
|
||||
// SMS
|
||||
#import <MessageUI/MessageUI.h>
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
#import "SectionedContacts.h"
|
||||
|
||||
@interface ContactsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate, UISearchBarDelegate, UIGestureRecognizerDelegate> {
|
||||
@interface ContactsViewController : RageShakableViewController <UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate, UISearchBarDelegate, UIGestureRecognizerDelegate> {
|
||||
NSArray* collationTitles;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
@interface HomeViewController : UITableViewController <UITextFieldDelegate, UISearchBarDelegate>
|
||||
@interface HomeViewController : RageShakableTableViewController <UITextFieldDelegate, UISearchBarDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableViewController.h"
|
||||
|
||||
@interface LoginViewController : UIViewController <UITextFieldDelegate>
|
||||
@interface LoginViewController : RageShakableViewController <UITextFieldDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
#import "MatrixSDKHandler.h"
|
||||
|
||||
@interface MemberViewController : UITableViewController
|
||||
@interface MemberViewController : RageShakableTableViewController
|
||||
|
||||
@property (strong, nonatomic) MXRoomMember *mxRoomMember;
|
||||
@property (strong, nonatomic) MXRoom *mxRoom;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface RageShakableTableViewController : UITableViewController
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
#import "RageShakableUIResponder.h"
|
||||
|
||||
@implementation RageShakableTableViewController
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[RageShakableUIResponder cancel:self];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[RageShakableUIResponder cancel:self];
|
||||
}
|
||||
|
||||
#pragma mark - rageshake : screenshot
|
||||
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
if (motion == UIEventSubtypeMotionShake) {
|
||||
[RageShakableUIResponder startShaking:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
[self motionEnded:motion withEvent:event];
|
||||
}
|
||||
|
||||
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
if (motion == UIEventSubtypeMotionShake) {
|
||||
[RageShakableUIResponder stopShaking:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeFirstResponder {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
22
matrixConsole/ViewController/RageShakableViewController.h
Normal file
22
matrixConsole/ViewController/RageShakableViewController.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface RageShakableViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
55
matrixConsole/ViewController/RageShakableViewController.m
Normal file
55
matrixConsole/ViewController/RageShakableViewController.m
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
#import "RageShakableViewController.h"
|
||||
|
||||
#import "RageShakableUIResponder.h"
|
||||
|
||||
@implementation RageShakableViewController
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[RageShakableUIResponder cancel:self];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[RageShakableUIResponder cancel:self];
|
||||
}
|
||||
|
||||
#pragma mark - rageshake : screenshot
|
||||
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
if (motion == UIEventSubtypeMotionShake) {
|
||||
[RageShakableUIResponder startShaking:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
[self motionEnded:motion withEvent:event];
|
||||
}
|
||||
|
||||
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
if (motion == UIEventSubtypeMotionShake) {
|
||||
[RageShakableUIResponder stopShaking:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeFirstResponder {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
@class RoomViewController;
|
||||
|
||||
@interface RecentsViewController : UITableViewController <UISearchBarDelegate>
|
||||
@interface RecentsViewController : RageShakableTableViewController <UISearchBarDelegate>
|
||||
|
||||
@property (strong, nonatomic) NSString *preSelectedRoomId; // set a non-nil value to this property will open room details
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableViewController.h"
|
||||
|
||||
#import "HPGrowingTextView.h"
|
||||
|
||||
@interface RoomViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIGestureRecognizerDelegate, HPGrowingTextViewDelegate>
|
||||
@interface RoomViewController : RageShakableViewController <UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIGestureRecognizerDelegate, HPGrowingTextViewDelegate>
|
||||
|
||||
@property (strong, nonatomic) NSString *roomId;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RageShakableTableViewController.h"
|
||||
|
||||
@interface SettingsViewController : UITableViewController <UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
|
||||
@interface SettingsViewController : RageShakableTableViewController <UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
|
||||
|
||||
typedef void (^blockSettings_onReadyToLeave)();
|
||||
|
||||
|
|
Loading…
Reference in a new issue