diff --git a/Classes/Core/HSHelpStack.m b/Classes/Core/HSHelpStack.m index ceef39c..cadcd62 100644 --- a/Classes/Core/HSHelpStack.m +++ b/Classes/Core/HSHelpStack.m @@ -72,14 +72,16 @@ - (void)showHelp:(UIViewController*)parentController completion:(void (^)(void)) UIViewController* mainController; if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - UIStoryboard* helpStoryboard = [UIStoryboard storyboardWithName:@"HelpStackStoryboard-iPad" bundle:[NSBundle mainBundle]]; + UIStoryboard* helpStoryboard = [UIStoryboard storyboardWithName:@"HelpStackStoryboard-iPad" + bundle:[NSBundle bundleForClass:[self class]]]; mainController = [helpStoryboard instantiateInitialViewController]; [mainController setModalPresentationStyle:UIModalPresentationFormSheet]; [parentController presentViewController:mainController animated:YES completion:completion]; } else { - UIStoryboard* helpStoryboard = [UIStoryboard storyboardWithName:@"HelpStackStoryboard" bundle:[NSBundle mainBundle]]; + UIStoryboard* helpStoryboard = [UIStoryboard storyboardWithName:@"HelpStackStoryboard" + bundle:[NSBundle bundleForClass:[self class]]]; mainController = [helpStoryboard instantiateInitialViewController]; [parentController presentViewController:mainController animated:YES completion:completion]; } diff --git a/Classes/UI/HSGrowingTextView.m b/Classes/UI/HSGrowingTextView.m index ed32ff1..2cc055f 100755 --- a/Classes/UI/HSGrowingTextView.m +++ b/Classes/UI/HSGrowingTextView.m @@ -243,7 +243,7 @@ - (void)textViewDidChange:(UITextView *)textView - (void)refreshHeight { //size of content, so we can set the frame of self - NSInteger newSizeH = [self measureHeight]; + NSInteger newSizeH = ceilf([self measureHeight]); if (newSizeH < minHeight || !internalTextView.hasText) { newSizeH = minHeight; //not smalles than minHeight } diff --git a/Classes/UI/HSIssueDetailViewController.m b/Classes/UI/HSIssueDetailViewController.m index a9f4e9c..26d0b36 100644 --- a/Classes/UI/HSIssueDetailViewController.m +++ b/Classes/UI/HSIssueDetailViewController.m @@ -40,6 +40,8 @@ @interface HSIssueDetailViewController () { @property (nonatomic, strong) NSMutableArray *attachments; @property (nonatomic, strong) NSString *enteredMsg; @property (nonatomic) CGRect messageFrame; +@property (nonatomic, strong) UIRefreshControl *refreshControl; + @property UIStatusBarStyle currentStatusBarStyle; @property UIImagePickerController *imagePickerViewController; @@ -71,6 +73,19 @@ - (void)viewDidLoad self.currentStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle]; self.navigationItem.title = self.selectedTicket.subject; + /** + Adding UIRefreshControl to refresh the chat + */ + + self.refreshControl = [[UIRefreshControl alloc]init]; + [self.refreshControl addTarget:self action:@selector(getTicketUpdates) forControlEvents:UIControlEventValueChanged]; + + if (@available(iOS 10.0, *)) { + self.chatTableView.refreshControl = self.refreshControl; + } else { + [self.chatTableView addSubview: self.refreshControl]; + } + /** Single tapping anywhere on the chat table view to hide the keyboard */ @@ -136,7 +151,6 @@ - (void)addMessageView { self.messageText.returnKeyType = UIReturnKeyGo; self.messageText.font = [UIFont systemFontOfSize:14.0f]; - self.messageText.delegate = self; self.messageText.internalTextView.scrollIndicatorInsets = UIEdgeInsetsMake(5, 0, 5, 0); self.messageText.textColor = [UIColor darkGrayColor]; @@ -153,7 +167,7 @@ - (void)addMessageView { // [self.messageTextSuperView addSubview:self.messageText]; [self.messageText removeFromSuperview]; [self.bottomMessageView addSubview:self.messageText]; - + self.messageText.delegate = self; self.sendButton.titleLabel.textColor = [UIColor darkGrayColor]; } @@ -506,6 +520,7 @@ - (void)keyboardFrameWillChange: (NSNotification *)notification { -(void)getTicketUpdates{ [self.ticketSource prepareUpdate:self.selectedTicket success:^{ + [self.refreshControl endRefreshing]; self.bottomMessageView.hidden = NO; [self addMessageView]; [self.loadingIndicator stopAnimating]; @@ -513,6 +528,7 @@ -(void)getTicketUpdates{ [self.chatTableView reloadData]; [self scrollDownToLastMessage:NO]; } failure:^(NSError* e){ + [self.refreshControl endRefreshing]; self.bottomMessageView.hidden = NO; [self.loadingIndicator stopAnimating]; self.loadingIndicator.hidden = YES; diff --git a/Classes/UI/HSMainListViewController.m b/Classes/UI/HSMainListViewController.m index 623568e..8903a19 100644 --- a/Classes/UI/HSMainListViewController.m +++ b/Classes/UI/HSMainListViewController.m @@ -260,6 +260,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } +- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ + scrollView.scrollEnabled = true; +} + + + #pragma mark - TableView Delegate methods - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/HelpStack.podspec b/HelpStack.podspec index fb47446..a61930a 100644 --- a/HelpStack.podspec +++ b/HelpStack.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "HelpStack" - s.version = "1.1.1" + s.version = "1.1.2" s.summary = "In-app customer support framework" s.description = 'See helpstack.io for more details' s.homepage = "https://github.com/happyfoxinc/helpstack" @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.license = 'MIT' s.author = { "HappyFox" => "ios@happyfox.com" } s.platform = :ios, '7.0' - s.source = { :git => "https://github.com/happyfoxinc/helpstack.git", :tag => "1.1.1", :submodules => true } + s.source = { :git => "https://github.com/happyfoxinc/helpstack.git", :tag => "1.1.2", :submodules => true } s.resources = ['Resources/*.png','Resources/*.storyboard'] s.dependency 'AFNetworking', '~> 2.0' s.frameworks = 'UIKit', 'CoreGraphics' diff --git a/README.md b/README.md index 2cb886f..dc9fcbd 100644 --- a/README.md +++ b/README.md @@ -1,138 +1,67 @@

- HelpStack + HelpStack

-**HelpStack** provides you with a simple way of adding a great in-App support for your iOS App users. You can integrate any of your favorite HelpDesk solution at ease. It currently comes with three plugged in Help desk solutions - *Desk.com*, *Zendesk* and *HappyFox* along with customizable and simple UI to interact with the user. +**HelpStack** provides you with a simple way of adding a great in-App support for your iOS App users. You can integrate any of your favorite HelpDesk solution at ease. + +HelpStack currently supports the following helpdesk solutions: +- [HappyFox](https://www.happyfox.com/) +- [Zendesk](https://www.zendesk.com/) +- [Desk.com](http://www.desk.com/) +- Email - If you don't have a helpdesk solution, you can still configure HelpStack for users to raise requests via email. + +The UI is also customizable so that it can go along with your app's theme.

- HelpStackthemes + HelpStackthemes

+## How to progress with HelpStack +Checkout this wiki page if you want a clear idea on how you can progress with HelpStack: [Wiki - How to progress with HelpStack](https://github.com/happyfoxinc/helpstack/wiki/How-to-Progress-with-HelpStack) + ## App Showcase Have you made something awesome with HelpStack? Add yourself here: [App Showcase](https://github.com/happyfoxinc/helpstack/wiki/App-Showcase) -## How to use Help Stack -Integrating HelpStack into your app is an easy three-step process: +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/happyfoxinc/helpstack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +## How to use HelpStack +Integrating HelpStack into your app is an easy 3-step process: 1. Install HelpStack and its dependencies 2. Configure your desired Help desk solution -3. Customize the HelpStack UI with a simple plist file +3. Customize the UI of HelpStack with a simple plist file -### Getting started with Help Stack +### Installation -Use Cocoa Pods to install HelpStack and its dependencies. HelpStack dependencies include AFNetworking 2.0. +Use CocoaPods to install HelpStack and its dependencies. HelpStack dependencies include AFNetworking 2.0. pod 'HelpStack' HelpStack requires Xcode 5.0 targeting iOS 7 and above. -### Configuring Help Stack gears - -#### 1. HappyFox Gear - -To integrate your existing HappyFox account into HelpStack, you just have to include the following lines of code in your AppDelegate: - - - HSHappyFoxGear *happyFoxGear = [[HSHappyFoxGear alloc] - initWithInstanceUrl : @"https://example.happyfox.com" - apiKey : @"" - authoCode : @"" - priorityID : @"" - categoryID : @""]; - happyFoxGear.hfSectionID = @""; // Optional - - HSHelpStack *helpStack = [HSHelpStack instance]; - helpStack.gear = happyFoxGear; - -* Getting the API Key and Auth code - - Configuring HappyFox in HelpStack primarily requires the base URL, API Key and Auth code for authenticating the registered HappyFox user. - - You will find the API key and Auth code in the ‘*Integrations*’ page of your HappyFox account under ‘*Manage*’. You can generate an API key and Auth code by clicking on the API configure link. - -* Getting the Priority ID and Category ID - - HappyFox requires that the Priority ID and Category ID cannot be nil. This is the ID of the priority and the category with which tickets will be created when a customer reports an issue. - - For Priorities and its IDs: - / /priorities/ - - For categories and its IDs: - / /categories/ - - Use API Key and Auth code for authentication. - - *Example:* - - https://example.happyfox.com/api/1.1/json/priorities/ - https://example.happyfox.com/api/1.1/json/categories/ +### Configuring HelpStack gears -* Getting the section ID (Optional) - Section ID is to filter and show the Knowledge Based articles. If section ID is not provided, then all the KB articles in all the sections are fetched and showed. If you want HelpStack to fetch KB articles of a specific section, provide the appropriate section ID. The following URL command gives all the sections with their IDs. - - For sections and its IDs: - / /kb/sections - - *Example:* - - https://example.happyfox.com/api/1.1/json/kb/sections/ - - Use API key and Auth code for authentication. - -#### 2. ZenDesk gear - -To set up your existing ZenDesk account with HelpStack, just integrate the below lines of code in your AppDelegate. - - HSZenDeskGear *zenDeskGear = [[HSZenDeskGear alloc] - initWithInstanceUrl : @"https://example.zendesk.com" - staffEmailAddress : @"saff@example.com" - apiToken : @"" - localArticlePath : @""]; - - HSHelpStack *helpStack = [HSHelpStack instance]; - helpStack.gear = zenDeskGear; - -where, **staff email address** is the email address of staff on behalf of whom ticket will be created. - -* Getting the API Token - - The token can be found in your Zendesk account under *Settings* > *Channels* > *API*. - -* Providing FAQs - - Currently Zendesk does not provide an api to access FAQ/KB articles. It is soon to be [expected](https://support.zendesk.com/requests/531406). You can however provide your FAQ articles using a pList locally and you need to specify the path to the article when you configure Zendesk. - - -#### 3. Desk gear - -To set up your Desk account with HelpStack, you need to integrate the following lines of code in your App delegate. - - HSDeskGear* deskGear = [[HSDeskGear alloc] - initWithInstanceBaseUrl : @"https://example.desk.com/" - toHelpEmail : @"" - staffLoginEmail : @"" - AndStaffLoginPassword : @""]; - - HSHelpStack *helpStack = [HSHelpStack instance]; - helpStack.gear = deskGear; - -If you wish to provide your FAQs locally, you can provide it in the form of a pList file and specify the pList filename in the Desk Gear when you configure the same. - -#### 4. Email gear +The general structure of a gear is as follows: -If you do not use any of the help desk solutions, you can still use HelpStack to provide efficient customer support by configuring with just your email. You can configure email support in Helpstack by including the below lines of code in your App delegate. + * = [[ alloc] + parameter1 : value1 + parameter2 : value2 + + parameterN : valueN ]; + + HSHelpStack *helpStack = [HSHelpStack instance]; + helpStack.gear = ; + +HelpStack currently provides 4 different Gears. Follow the instructions below to configure the gear of your choice: - HSGearEmail* emailGear = [[HSGearEmail alloc] - initWithSupportEmailAddress : @"support@example.com" - articlePath : @""]; - - HSHelpStack *helpStack = [HSHelpStack instance]; - helpStack.gear = emailGear; - -You can provide your FAQs as a local pList file and provide the pList file name in place of *pList file name*. + - [HappyFox gear](https://github.com/happyfoxinc/helpstack/wiki/Configuring-gears-for-HelpStack#1-happyfox-gear) + - [Zendesk gear](https://github.com/happyfoxinc/helpstack/wiki/Configuring-gears-for-HelpStack#2-zendesk-gear) + - [Desk gear](https://github.com/happyfoxinc/helpstack/wiki/Configuring-gears-for-HelpStack#3-desk-gear) + - [Email gear](https://github.com/happyfoxinc/helpstack/wiki/Configuring-gears-for-HelpStack#4-email-gear) + ### Shipping with Local Articles @@ -153,8 +82,12 @@ Once you have integrated your helpStack, use the **'showHelp'** API call to open [[HSHelpStack instance] showHelp:self]; } +Using Swift, show HelpStack using the following invocation: -###Customizing Help Stack UI + let helpStack = HSHelpStack.instance() as HSHelpStack + helpStack.showHelp(self) + +###Customizing HelpStack UI HelpStack comes with built in screens with a default theme. It also comes with a set of pre configured themes, which you can download from the link below: @@ -170,124 +103,53 @@ You can start with one of these themes as your base. Download any of these pList Certain pList properties must be provided in a pre-defined format as listed below: -* Color - - Specify colors by providing its R,G,B,alpha value separated by commas. e.g: **255,255,255,1.0** is white. - -* Font +- **Color** - Specify colors by providing its R,G,B,alpha value separated by commas. e.g: **255,255,255,1.0** is white. - The font name and font size are to be provided as two separate properties in the pList file. Fonts are to be specified by its font family name and font style. e.g: **Helvetica-Bold** The specified font size will be taken as 'pts' by default. +- **Font** - The font name and font size are to be provided as two separate properties in the pList file. Fonts are to be specified by its font family name and font style. e.g: **Helvetica-Bold** The specified font size will be taken as 'pts' by default. Refer to [iosfonts.com](http://iosfonts.com) for the fonts supported by iOS. -* Image - - Images which are included in your project must be specified with their filenames. e.g: **example.png** - +- **Image** - Images which are included in your project must be specified with their filenames. e.g: **example.png** -##### Customizing the Navigation Bar - - -These properties control the look of the NavigationBar across all the helpStack screens. +#### Customization -* NavigationBarAttributes +The following is a list of UI items you can customize, along with the instructions in the wiki: + - [Navigation Bar](https://github.com/happyfoxinc/helpstack/wiki/Customization-Instructions#i-customizing-the-navigation-bar) + - [Background](https://github.com/happyfoxinc/helpstack/wiki/Customization-Instructions#ii-customizing-the-background) + - [TableView](https://github.com/happyfoxinc/helpstack/wiki/Customization-Instructions#iii-customizing-the-tableview) + - [Chat screen](https://github.com/happyfoxinc/helpstack/wiki/Customization-Instructions#iv-customizing-the-chat-screen) - **BackgroundColor** Navigation bar background color - - **BackgroundImage** Navigation bar background image, you either give an image or specify a color - - **TitleFont** Navigation bar title Font - - **TitleSize** Navigation bar title font size - - **TitleColor** Navigation bar title font color - - **ButtonTintColor** Navigation bar button tint color. +**Navigation Bar:**

- HelpStacktheme + HelpStacktheme

-##### Customizing the Background - -You can specify a background color or an image which is included in your resources directory to be set as the Background of all the helpStack screens. - -**BackgroundImageName** Specify the name of the image included in your project, which has to be applied as the background - -**BackgroundColor** Background color. You can either specify a color or include an image. - - -##### Customizing the TableView - -These tableView properties are applied to the main list view which shows up the FAQs and Issues. - -* TableViewAttributes - - **TableBackgroundColor** Background color of the Table View - - **SeparatorColor** TableView separator Color - - **CellBackgroundColor** Background color of the cells - - **HeadingFont** Header Title font - - **HeadingSize** Header Title size - - **HeadingColor** Header Title color - - **HeadingBackgroundColor** Header background color - -The cell title is a label which can be customized by providing LabelAttributes : - -* LabelAttributes - - **BackgroundColor** Background color of the label. Ideally it would be better to give it as transparent. - - **LabelSize** Size of the label text - - **LabelFont** Font of the label text - - **LabelColor** Color of the label text - +**Table View:**

- HelpStackthemeCustomize + HelpStackthemeCustomize

-##### Customizing the chat screen - -These chat screen properties allows customization of the Issue conversation view. - -* ChatBubbleAttributes : - - **TextSize** Size of the text that appears within the left and the right chat bubbles. - - **TextFont** Font of the text that appears within the left and the right chat bubbles. - - **MessageInfoLabelFont**, **MesssageInfoLabelSize**, **MessageInfoLabelColor** Font, Size and Color of the message information shown above and below the chat bubbles which includes the sender name and timestamp. +**Chat Screen:** +

+ HelpStacktheme +

-The following attributes can be independantly customized for the right and the left chat bubbles : +## About +For more information about HelpStack, visit [helpstack.io](http://www.helpstack.io). - * LeftChatBubbleAttributes : - - **BackgroundColor** Background Color of the left chat bubble. - - **TextColor** Message Text color that appears within the left chat bubble. - - * RightChatBubbleAttributes : - - **BackgroundColor** Background Color of the right chat bubble. - - **TextColor** Message Text color that appears within the right chat bubble. - +HelpStack is maintained by the folks at [HappyFox](http://www.happyfox.com/). Being an open source project, it also contains work from the HelpStack community. -

- HelpStacktheme -

+
+ HappyFox +
+## Video +[![HelpStack for iOS](http://img.youtube.com/vi/0UvNO-Qm0AU/0.jpg)](https://www.youtube.com/watch?v=0UvNO-Qm0AUÂ) ## Contact -Follow HelpStack on Twitter ([@HelpStackSDK](https://twitter.com/HelpStackSDK/)) +Reach out to us on Twitter at [@HelpStackSDK](https://twitter.com/HelpStackSDK). ## License diff --git a/Resources/HelpStackStoryboard.storyboard b/Resources/HelpStackStoryboard.storyboard index ad0e443..40d4d4a 100644 --- a/Resources/HelpStackStoryboard.storyboard +++ b/Resources/HelpStackStoryboard.storyboard @@ -1,9 +1,11 @@ - - + + + + + - - - + + @@ -11,11 +13,11 @@ - + - - - + + + @@ -24,13 +26,13 @@ - + - + - + @@ -57,28 +59,29 @@ - + - + - + - + + @@ -86,14 +89,15 @@ - + - + + @@ -101,14 +105,15 @@ - + - + + @@ -132,40 +137,40 @@ - + - + - - + + - + - + - + @@ -180,15 +185,15 @@ - + - + - - + + @@ -221,7 +226,7 @@ - + @@ -232,14 +237,15 @@ - + + - + @@ -248,18 +254,18 @@ - + - + - + - + @@ -268,10 +274,10 @@ - + - + @@ -297,7 +303,7 @@ - + @@ -308,15 +314,15 @@ - + - - + + - + @@ -332,13 +338,14 @@ - + + @@ -347,7 +354,7 @@ - + @@ -358,23 +365,23 @@ - + - + - + - + - + @@ -382,7 +389,7 @@ - + @@ -398,22 +405,22 @@ - + - + - + - + @@ -430,10 +437,10 @@ - + - + @@ -441,18 +448,20 @@ - + @@ -464,13 +473,13 @@ - + - + - + @@ -478,18 +487,20 @@ - + @@ -501,13 +512,13 @@ - + - + - + @@ -515,11 +526,12 @@ - + @@ -531,13 +543,13 @@ - + - + - + @@ -545,11 +557,12 @@ - + @@ -561,7 +574,7 @@ - + @@ -580,8 +593,8 @@ - - + + @@ -595,7 +608,7 @@ - + @@ -606,13 +619,13 @@ - + - + @@ -629,18 +642,17 @@ - + - + - @@ -648,11 +660,11 @@ + - @@ -667,7 +679,7 @@ - + @@ -678,15 +690,15 @@ - + - + - + @@ -702,22 +714,22 @@ - + - + - + - + - + @@ -734,28 +746,29 @@ - + - + - + - + - + + @@ -763,14 +776,15 @@ - + - + + @@ -778,14 +792,15 @@ - + - + + @@ -809,7 +824,7 @@ - + @@ -820,14 +835,14 @@ - + - + - + @@ -835,10 +850,10 @@