diff --git a/matrixConsole/matrixConsole.xcodeproj/project.pbxproj b/matrixConsole/matrixConsole.xcodeproj/project.pbxproj index fe3836c00..861427540 100644 --- a/matrixConsole/matrixConsole.xcodeproj/project.pbxproj +++ b/matrixConsole/matrixConsole.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 710210A41A67A4B600364868 /* MXCGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 710210A31A67A4B600364868 /* MXCGrowingTextView.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 */; }; @@ -35,7 +34,6 @@ F02D707619F1DC9E007B47D3 /* RoomMemberTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F02D707519F1DC9E007B47D3 /* RoomMemberTableCell.m */; }; F030974C1A6580D70090BC00 /* icon_keyboard.png in Resources */ = {isa = PBXBuildFile; fileRef = F030974A1A6580D70090BC00 /* icon_keyboard.png */; }; F030974D1A6580D70090BC00 /* icon_keyboard@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F030974B1A6580D70090BC00 /* icon_keyboard@2x.png */; }; - F03C47111A02952800E445AB /* MXCAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = F03C47101A02952800E445AB /* MXCAlert.m */; }; F03EF5F619F171EB00A0EE52 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F03EF5EB19F171EB00A0EE52 /* HomeViewController.m */; }; F03EF5F719F171EB00A0EE52 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F03EF5ED19F171EB00A0EE52 /* LoginViewController.m */; }; F03EF5F819F171EB00A0EE52 /* MasterTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = F03EF5EF19F171EB00A0EE52 /* MasterTabBarController.m */; }; @@ -45,8 +43,10 @@ F03EF5FF19F1762000A0EE52 /* RoomMessageTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F03EF5FE19F1762000A0EE52 /* RoomMessageTableCell.m */; }; F0465AFA1A251F85003639F9 /* RoomMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = F0465AF91A251F85003639F9 /* RoomMessage.m */; }; F04A8AD81A3B3DF4008AC915 /* RoomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = F04A8AD71A3B3DF4008AC915 /* RoomTitleView.m */; }; - F04EE51F1A3A01D500C64930 /* APNSHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F04EE51E1A3A01D500C64930 /* APNSHandler.m */; }; - F05B955F19DEED8A008761B0 /* MatrixHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F05B955E19DEED8A008761B0 /* MatrixHandler.m */; }; + F052377C1A7289F00079F3E0 /* APNSHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F05237791A7289F00079F3E0 /* APNSHandler.m */; }; + F052377D1A7289F00079F3E0 /* MatrixHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F052377B1A7289F00079F3E0 /* MatrixHandler.m */; }; + F05237801A728A010079F3E0 /* MXCAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = F052377F1A728A010079F3E0 /* MXCAlert.m */; }; + F05237831A728A0A0079F3E0 /* MXCGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = F05237821A728A0A0079F3E0 /* MXCGrowingTextView.m */; }; F05C3A3E1A3F3D7F002B698E /* icon_users.png in Resources */ = {isa = PBXBuildFile; fileRef = F05C3A3C1A3F3D7F002B698E /* icon_users.png */; }; F05C3A3F1A3F3D7F002B698E /* icon_users@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F05C3A3D1A3F3D7F002B698E /* icon_users@2x.png */; }; F07A80D819DD9DE700B621A1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F07A80D719DD9DE700B621A1 /* main.m */; }; @@ -80,8 +80,6 @@ /* 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 = ""; }; - 710210A21A67A4B600364868 /* MXCGrowingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCGrowingTextView.h; sourceTree = ""; }; - 710210A31A67A4B600364868 /* MXCGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCGrowingTextView.m; sourceTree = ""; }; 710CC3BE1A6E9F14006EE973 /* matrixUser.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = matrixUser.png; sourceTree = ""; }; 710CC3C01A70F28F006EE973 /* MXCContactField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCContactField.h; sourceTree = ""; }; 710CC3C11A70F28F006EE973 /* MXCContactField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCContactField.m; sourceTree = ""; }; @@ -127,8 +125,6 @@ F02D707519F1DC9E007B47D3 /* RoomMemberTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMemberTableCell.m; sourceTree = ""; }; F030974A1A6580D70090BC00 /* icon_keyboard.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_keyboard.png; sourceTree = ""; }; F030974B1A6580D70090BC00 /* icon_keyboard@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_keyboard@2x.png"; sourceTree = ""; }; - F03C470F1A02952800E445AB /* MXCAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCAlert.h; sourceTree = ""; }; - F03C47101A02952800E445AB /* MXCAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCAlert.m; sourceTree = ""; }; F03EF5EA19F171EB00A0EE52 /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = ""; }; F03EF5EB19F171EB00A0EE52 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = ""; }; F03EF5EC19F171EB00A0EE52 /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = ""; }; @@ -147,10 +143,14 @@ F0465AF91A251F85003639F9 /* RoomMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMessage.m; sourceTree = ""; }; F04A8AD61A3B3DF4008AC915 /* RoomTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomTitleView.h; sourceTree = ""; }; F04A8AD71A3B3DF4008AC915 /* RoomTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomTitleView.m; sourceTree = ""; }; - F04EE51D1A3A01D500C64930 /* APNSHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APNSHandler.h; sourceTree = ""; }; - F04EE51E1A3A01D500C64930 /* APNSHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APNSHandler.m; sourceTree = ""; }; - F05B955D19DEED8A008761B0 /* MatrixHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatrixHandler.h; sourceTree = ""; }; - F05B955E19DEED8A008761B0 /* MatrixHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MatrixHandler.m; sourceTree = ""; }; + F05237781A7289F00079F3E0 /* APNSHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APNSHandler.h; sourceTree = ""; }; + F05237791A7289F00079F3E0 /* APNSHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APNSHandler.m; sourceTree = ""; }; + F052377A1A7289F00079F3E0 /* MatrixHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatrixHandler.h; sourceTree = ""; }; + F052377B1A7289F00079F3E0 /* MatrixHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MatrixHandler.m; sourceTree = ""; }; + F052377E1A728A010079F3E0 /* MXCAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCAlert.h; sourceTree = ""; }; + F052377F1A728A010079F3E0 /* MXCAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCAlert.m; sourceTree = ""; }; + F05237811A728A0A0079F3E0 /* MXCGrowingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCGrowingTextView.h; sourceTree = ""; }; + F05237821A728A0A0079F3E0 /* MXCGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCGrowingTextView.m; sourceTree = ""; }; F05C3A3C1A3F3D7F002B698E /* icon_users.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_users.png; sourceTree = ""; }; F05C3A3D1A3F3D7F002B698E /* icon_users@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_users@2x.png"; sourceTree = ""; }; F07A80D219DD9DE700B621A1 /* matrixConsole.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = matrixConsole.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -246,8 +246,12 @@ F021FBEC1A5EF57300EA3AE6 /* API */ = { isa = PBXGroup; children = ( + F05237781A7289F00079F3E0 /* APNSHandler.h */, + F05237791A7289F00079F3E0 /* APNSHandler.m */, 71193D391A6E50EC00E59A9E /* ContactManager.h */, 71193D3A1A6E50EC00E59A9E /* ContactManager.m */, + F052377A1A7289F00079F3E0 /* MatrixHandler.h */, + F052377B1A7289F00079F3E0 /* MatrixHandler.m */, F021FBED1A5EF57300EA3AE6 /* MediaLoader.h */, F021FBEE1A5EF57300EA3AE6 /* MediaLoader.m */, F021FBF01A5F1F8E00EA3AE6 /* MediaManager.h */, @@ -286,6 +290,8 @@ children = ( 71193D2A1A6E433900E59A9E /* ContactTableCell.h */, 71193D2B1A6E433900E59A9E /* ContactTableCell.m */, + F05237811A728A0A0079F3E0 /* MXCGrowingTextView.h */, + F05237821A728A0A0079F3E0 /* MXCGrowingTextView.m */, F00B5DB71A1B9BCE00EA1C8D /* MXCImageView.h */, F00B5DB81A1B9BCE00EA1C8D /* MXCImageView.m */, 71E94A751A5C4020009F52E5 /* PieChartView.h */, @@ -309,14 +315,14 @@ F0465AF71A251F85003639F9 /* Model */ = { isa = PBXGroup; children = ( + F052377E1A728A010079F3E0 /* MXCAlert.h */, + F052377F1A728A010079F3E0 /* MXCAlert.m */, 71193D301A6E49F000E59A9E /* MXCContact.h */, 71193D311A6E49F000E59A9E /* MXCContact.m */, 710CC3C01A70F28F006EE973 /* MXCContactField.h */, 710CC3C11A70F28F006EE973 /* MXCContactField.m */, 71193D321A6E49F000E59A9E /* MXCEmail.h */, 71193D331A6E49F000E59A9E /* MXCEmail.m */, - 710210A21A67A4B600364868 /* MXCGrowingTextView.h */, - 710210A31A67A4B600364868 /* MXCGrowingTextView.m */, 71193D341A6E49F000E59A9E /* MXCPhoneNumber.h */, 71193D351A6E49F000E59A9E /* MXCPhoneNumber.m */, F0D942F41A31F3A300826CC1 /* RecentRoom.h */, @@ -358,16 +364,10 @@ F0465AF71A251F85003639F9 /* Model */, F03EF5FC19F1762000A0EE52 /* View */, F03EF5E919F171EB00A0EE52 /* ViewController */, - F04EE51D1A3A01D500C64930 /* APNSHandler.h */, - F04EE51E1A3A01D500C64930 /* APNSHandler.m */, F07A80D919DD9DE700B621A1 /* AppDelegate.h */, F07A80DA19DD9DE700B621A1 /* AppDelegate.m */, F0D3C30A1A011EF10000D49E /* AppSettings.h */, F0D3C30B1A011EF10000D49E /* AppSettings.m */, - F03C470F1A02952800E445AB /* MXCAlert.h */, - F03C47101A02952800E445AB /* MXCAlert.m */, - F05B955D19DEED8A008761B0 /* MatrixHandler.h */, - F05B955E19DEED8A008761B0 /* MatrixHandler.m */, F07A80E219DD9DE700B621A1 /* Main.storyboard */, F07A80E519DD9DE700B621A1 /* Images.xcassets */, F07A80E719DD9DE700B621A1 /* LaunchScreen.xib */, @@ -557,10 +557,11 @@ files = ( F04A8AD81A3B3DF4008AC915 /* RoomTitleView.m in Sources */, F07A80DB19DD9DE700B621A1 /* AppDelegate.m in Sources */, + F052377C1A7289F00079F3E0 /* APNSHandler.m in Sources */, F03EF5FF19F1762000A0EE52 /* RoomMessageTableCell.m in Sources */, F07A80D819DD9DE700B621A1 /* main.m in Sources */, + F052377D1A7289F00079F3E0 /* MatrixHandler.m in Sources */, 71193D371A6E49F000E59A9E /* MXCEmail.m in Sources */, - F05B955F19DEED8A008761B0 /* MatrixHandler.m in Sources */, 71193D3E1A6E61AD00E59A9E /* SectionedContacts.m in Sources */, F021FBEF1A5EF57300EA3AE6 /* MediaLoader.m in Sources */, F03EF5FB19F171EB00A0EE52 /* SettingsViewController.m in Sources */, @@ -574,20 +575,19 @@ 71DB9DC11A495B6400504A09 /* MemberViewController.m in Sources */, F0D942F61A31F3A300826CC1 /* RecentRoom.m in Sources */, F03EF5F919F171EB00A0EE52 /* RecentsViewController.m in Sources */, - 710210A41A67A4B600364868 /* MXCGrowingTextView.m in Sources */, 71E94A771A5C4020009F52E5 /* PieChartView.m in Sources */, F0465AFA1A251F85003639F9 /* RoomMessage.m in Sources */, F021FBF21A5F1F8E00EA3AE6 /* MediaManager.m in Sources */, - F04EE51F1A3A01D500C64930 /* APNSHandler.m in Sources */, 71193D291A6E3DC000E59A9E /* ContactsViewController.m in Sources */, - F03C47111A02952800E445AB /* MXCAlert.m in Sources */, F0E84D401A1F9AEC005F2E42 /* RecentsTableViewCell.m in Sources */, 71193D381A6E49F000E59A9E /* MXCPhoneNumber.m in Sources */, 71193D3B1A6E50EC00E59A9E /* ContactManager.m in Sources */, 71193D2C1A6E433900E59A9E /* ContactTableCell.m in Sources */, F02D707619F1DC9E007B47D3 /* RoomMemberTableCell.m in Sources */, + F05237801A728A010079F3E0 /* MXCAlert.m in Sources */, F00B5DB91A1B9BCE00EA1C8D /* MXCImageView.m in Sources */, F0D3C30C1A011EF10000D49E /* AppSettings.m in Sources */, + F05237831A728A0A0079F3E0 /* MXCGrowingTextView.m in Sources */, F03EF5F719F171EB00A0EE52 /* LoginViewController.m in Sources */, F0D3C30F1A01330F0000D49E /* SettingsTableViewCell.m in Sources */, 71D2E4EC1A49814B000DE015 /* RoomMemberActionsCell.m in Sources */, diff --git a/matrixConsole/matrixConsole/APNSHandler.h b/matrixConsole/matrixConsole/API/APNSHandler.h similarity index 100% rename from matrixConsole/matrixConsole/APNSHandler.h rename to matrixConsole/matrixConsole/API/APNSHandler.h diff --git a/matrixConsole/matrixConsole/APNSHandler.m b/matrixConsole/matrixConsole/API/APNSHandler.m similarity index 100% rename from matrixConsole/matrixConsole/APNSHandler.m rename to matrixConsole/matrixConsole/API/APNSHandler.m diff --git a/matrixConsole/matrixConsole/MatrixHandler.h b/matrixConsole/matrixConsole/API/MatrixHandler.h similarity index 100% rename from matrixConsole/matrixConsole/MatrixHandler.h rename to matrixConsole/matrixConsole/API/MatrixHandler.h diff --git a/matrixConsole/matrixConsole/MatrixHandler.m b/matrixConsole/matrixConsole/API/MatrixHandler.m similarity index 100% rename from matrixConsole/matrixConsole/MatrixHandler.m rename to matrixConsole/matrixConsole/API/MatrixHandler.m diff --git a/matrixConsole/matrixConsole/MXCAlert.h b/matrixConsole/matrixConsole/Model/MXCAlert.h similarity index 100% rename from matrixConsole/matrixConsole/MXCAlert.h rename to matrixConsole/matrixConsole/Model/MXCAlert.h diff --git a/matrixConsole/matrixConsole/MXCAlert.m b/matrixConsole/matrixConsole/Model/MXCAlert.m similarity index 100% rename from matrixConsole/matrixConsole/MXCAlert.m rename to matrixConsole/matrixConsole/Model/MXCAlert.m diff --git a/matrixConsole/matrixConsole/View/CopyableLabel.h b/matrixConsole/matrixConsole/View/CopyableLabel.h deleted file mode 100644 index 37b2e5028..000000000 --- a/matrixConsole/matrixConsole/View/CopyableLabel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - 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 - -// Customize UIImageView in order to let UIImageView handle automatically remote url -@interface CustomImageView : UIImageView - -typedef void (^blockCustomImageView_onClick)(CustomImageView *imageView, NSString* title); - -@property (strong, nonatomic) NSString *placeholder; -@property (strong, nonatomic) NSString *imageURL; - -// Use this boolean to hide activity indicator during image downloading -@property (nonatomic) BOOL hideActivityIndicator; - -// Information about the media represented by this image (image, video...) -@property (strong, nonatomic) NSDictionary *mediaInfo; - -// Let the user defines some custom buttons over the tabbar -- (void)setLeftButtonTitle :leftButtonTitle handler:(blockCustomImageView_onClick)handler; -- (void)setRightButtonTitle:rightButtonTitle handler:(blockCustomImageView_onClick)handler; - -- (void)dismissSelection; - -@end - diff --git a/matrixConsole/matrixConsole/View/CopyableLabel.m b/matrixConsole/matrixConsole/View/CopyableLabel.m deleted file mode 100644 index d315c3145..000000000 --- a/matrixConsole/matrixConsole/View/CopyableLabel.m +++ /dev/null @@ -1,244 +0,0 @@ -/* - 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 "CustomImageView.h" -#import "MediaManager.h" -#import "AppDelegate.h" - -@interface CustomImageView () { - id imageLoader; - UIActivityIndicatorView *loadingWheel; - - // validation buttons - UIButton* leftButton; - UIButton* rightButton; - - NSString* leftButtonTitle; - NSString* rightButtonTitle; - - blockCustomImageView_onClick leftHandler; - blockCustomImageView_onClick rightHandler; - - UIView* bottomBarView; -} -@end - -@implementation CustomImageView - -#define CUSTOM_IMAGE_VIEW_BUTTON_WIDTH 100 - -- (id)initWithFrame:(CGRect)frame { - - self = [super initWithFrame:frame]; - - if (self) { - leftButtonTitle = nil; - leftHandler = nil; - rightButtonTitle = nil; - rightHandler = nil; - - self.backgroundColor = [UIColor blackColor]; - self.contentMode = UIViewContentModeScaleAspectFit; - self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin; - } - - return self; -} - -- (void)dealloc { - if (imageLoader) { - [MediaManager cancel:imageLoader]; - imageLoader = nil; - } - if (loadingWheel) { - [loadingWheel removeFromSuperview]; - loadingWheel = nil; - } - if (bottomBarView) { - [bottomBarView removeFromSuperview]; - bottomBarView = nil; - } -} - -- (void)startActivityIndicator { - // Add activity indicator if none - if (loadingWheel == nil) { - loadingWheel = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [self addSubview:loadingWheel]; - } - // Adjust position - CGPoint center = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2); - loadingWheel.center = center; - // Adjust color - if ([self.backgroundColor isEqual:[UIColor blackColor]]) { - loadingWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; - } else { - loadingWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; - } - // Start - [loadingWheel startAnimating]; -} - -- (void)stopActivityIndicator { - if (loadingWheel) { - [loadingWheel stopAnimating]; - } -} - -#pragma mark - - -- (IBAction)onButtonToggle:(id)sender -{ - if (sender == leftButton) { - dispatch_async(dispatch_get_main_queue(), ^{ - leftHandler(self, leftButtonTitle); - }); - } else if (sender == rightButton) { - dispatch_async(dispatch_get_main_queue(), ^{ - rightHandler(self, rightButtonTitle); - }); - } -} - -// add a generic button to the bottom view -// return the added UIButton -- (UIButton*) addbuttonWithTitle:(NSString*)title { - UIButton* button = [[UIButton alloc] init]; - [button setTitle:title forState:UIControlStateNormal]; - [button setTitle:title forState:UIControlStateHighlighted]; - - // default background text color - CGFloat textColorFactor = 146.0 / 255.0; - UIColor* textColor = [UIColor colorWithRed:textColorFactor green:textColorFactor blue:textColorFactor alpha:1.0]; - - [button setTitleColor:textColor forState:UIControlStateNormal]; - [button setTitleColor:textColor forState:UIControlStateHighlighted]; - - // keep the bottomView background color - button.backgroundColor = [UIColor clearColor]; - - [button addTarget:self action:@selector(onButtonToggle:) forControlEvents:UIControlEventTouchUpInside]; - [bottomBarView addSubview:button]; - - return button; -} - -- (void)layoutSubviews { - - // call upper layer - [super layoutSubviews]; - - // check if the dedicated buttons are already added - if (leftButtonTitle || rightButtonTitle) { - - if (!bottomBarView) { - bottomBarView = [[UIView alloc] init]; - - if (leftButtonTitle) { - leftButton = [self addbuttonWithTitle:leftButtonTitle]; - } - - rightButton = [[UIButton alloc] init]; - - if (rightButtonTitle) { - rightButton = [self addbuttonWithTitle:rightButtonTitle]; - } - - // default tabbar background color - CGFloat base = 248.0 / 255.0f; - bottomBarView.backgroundColor = [UIColor colorWithRed:base green:base blue:base alpha:1.0]; - - [[AppDelegate theDelegate].masterTabBarController.tabBar addSubview:bottomBarView]; - } - - // manage the item - CGRect tabBarFrame = [AppDelegate theDelegate].masterTabBarController.tabBar.frame; - tabBarFrame.origin.y = 0; - bottomBarView.frame = tabBarFrame; - - if (leftButton) { - leftButton.frame = CGRectMake(0, 0, CUSTOM_IMAGE_VIEW_BUTTON_WIDTH, bottomBarView.frame.size.height); - } - - if (rightButton) { - rightButton.frame = CGRectMake(bottomBarView.frame.size.width - CUSTOM_IMAGE_VIEW_BUTTON_WIDTH, 0, CUSTOM_IMAGE_VIEW_BUTTON_WIDTH, bottomBarView.frame.size.height); - } - } -} - -- (void)setHideActivityIndicator:(BOOL)hideActivityIndicator { - _hideActivityIndicator = hideActivityIndicator; - if (hideActivityIndicator) { - [self stopActivityIndicator]; - } else if (imageLoader) { - // Loading is in progress, start activity indicator - [self startActivityIndicator]; - } -} - -- (void)setImageURL:(NSString *)imageURL { - // Cancel media loader in progress (if any) - if (imageLoader) { - [MediaManager cancel:imageLoader]; - imageLoader = nil; - } - - _imageURL = imageURL; - - // Reset image view - self.image = nil; - if (_placeholder) { - // Set picture placeholder - self.image = [UIImage imageNamed:_placeholder]; - } - // Consider provided url to update image view - if (imageURL) { - // Load picture - if (!_hideActivityIndicator) { - [self startActivityIndicator]; - } - imageLoader = [MediaManager loadPicture:imageURL - success:^(UIImage *image) { - [self stopActivityIndicator]; - self.image = image; - } - failure:^(NSError *error) { - [self stopActivityIndicator]; - NSLog(@"Failed to download image (%@): %@", imageURL, error); - }]; - } -} - -#pragma mark - buttons management - -- (void)setLeftButtonTitle: aLeftButtonTitle handler:(blockCustomImageView_onClick)handler { - leftButtonTitle = aLeftButtonTitle; - leftHandler = handler; -} - -- (void)setRightButtonTitle:aRightButtonTitle handler:(blockCustomImageView_onClick)handler { - rightButtonTitle = aRightButtonTitle; - rightHandler = handler; -} - -- (void)dismissSelection { - if (bottomBarView) { - [bottomBarView removeFromSuperview]; - bottomBarView = nil; - } -} - -@end \ No newline at end of file diff --git a/matrixConsole/matrixConsole/Model/MXCGrowingTextView.h b/matrixConsole/matrixConsole/View/MXCGrowingTextView.h similarity index 100% rename from matrixConsole/matrixConsole/Model/MXCGrowingTextView.h rename to matrixConsole/matrixConsole/View/MXCGrowingTextView.h diff --git a/matrixConsole/matrixConsole/Model/MXCGrowingTextView.m b/matrixConsole/matrixConsole/View/MXCGrowingTextView.m similarity index 100% rename from matrixConsole/matrixConsole/Model/MXCGrowingTextView.m rename to matrixConsole/matrixConsole/View/MXCGrowingTextView.m