Skip to content

Commit

Permalink
Merge pull request #10 from AntonDobrev/master
Browse files Browse the repository at this point in the history
Update the plugin with iOS options and support for iOS Cordova 4+
  • Loading branch information
Martin Bektchiev authored Sep 28, 2016
2 parents d3264c3 + d9f0866 commit 41318e8
Show file tree
Hide file tree
Showing 23 changed files with 93 additions and 637 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.telerik.feedback"
version="2.0.3">
version="2.0.4">

<name>Telerik AppFeedback</name>
<description>This plugin allows the app to include Telerik AppFeedback functionality on device shake.</description>
Expand Down
32 changes: 31 additions & 1 deletion src/ios/TLRKFeedback.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

#import "TLRKFeedback.h"
#import "CDVDevice.h"
#import <TelerikAppFeedback/AppFeedback.h>
#import <TelerikAppFeedback/TelerikAppFeedback.h>
#import <objc/message.h>

@implementation TLRKFeedback

static NSString * const kFeedbackSentAlertTitleSettingName = @"feedbackSentAlertTitle";
static NSString * const kFeedbackSentAlertTextSettingName = @"feedbackSentAlertText";
static NSString * const kFeedbackTitleSettingName = @"feedbackTitle";
static NSString * const kIOSFeedbackOptionsKeyName = @"iOS";

@synthesize webView;

-(void)initialize: (CDVInvokedUrlCommand *)command
Expand All @@ -34,6 +39,31 @@ -(void)initialize: (CDVInvokedUrlCommand *)command
uid = objc_msgSend(objc_msgSend(UIDevice.currentDevice, identifierForVendorSEL), @selector(UUIDString));
}

// iOS localization specific options
// using UTF8 strings to allow displaying Chinese, Cyrillic, etc. chars
NSDictionary *feedbackOptions = command.arguments.count > 2 ? command.arguments[2] : nil;

NSDictionary *iOSLocalizationOptions = [feedbackOptions valueForKey:kIOSFeedbackOptionsKeyName];

NSString *feedbackSentAlertTitle = [iOSLocalizationOptions valueForKey:kFeedbackSentAlertTitleSettingName];
if (feedbackSentAlertTitle !=nil && ![feedbackSentAlertTitle isKindOfClass:[NSNull class]]) {
const char *cString = [feedbackSentAlertTitle UTF8String];
[TKFeedback feedbackSettings].feedbackSentAlertTitle = [NSString stringWithUTF8String:cString];
}

NSString *feedbackSentAlertText = [iOSLocalizationOptions valueForKey:kFeedbackSentAlertTextSettingName];
if (feedbackSentAlertText != nil && ![feedbackSentAlertText isKindOfClass:[NSNull class]]) {
const char *cString = [feedbackSentAlertText UTF8String];
[TKFeedback feedbackSettings].feedbackSentAlertText = [NSString stringWithUTF8String:cString];
}

NSString *feedbackTitle = [iOSLocalizationOptions valueForKey:kFeedbackTitleSettingName];
if (feedbackTitle != nil && ![feedbackTitle isKindOfClass:[NSNull class]]) {
const char *cString = [feedbackTitle UTF8String];
[TKFeedback feedbackSettings].feedbackTitle = [NSString stringWithUTF8String:cString];
}
// end iOS localization options

TKFeedback.dataSource = [[TKPlatformFeedbackSource alloc] initWithKey:apiKey uid:uid apiBaseURL:apiUrl parameters:NULL];

[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions src/ios/TelerikAppFeedback.framework/Headers/TKFeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Copyright (c) 2014 Telerik. All rights reserved.
//

#import "TKFeedbackSettings.h"

@protocol TKFeedbackDataSource;

@interface TKFeedback : NSObject
Expand All @@ -21,4 +23,6 @@

+ (BOOL)feedbackIsShown;

+ (TKFeedbackSettings*) feedbackSettings;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Initializes the feedback controller.
@param contentController The view controller that can be used as a root view controller in the application.
*/
- (id)initWithContentController:(UIViewController *)contentController;
- (instancetype)initWithContentController:(UIViewController *)contentController;

/**
The view controller that contain root view controller (read-only).
Expand Down
48 changes: 48 additions & 0 deletions src/ios/TelerikAppFeedback.framework/Headers/TKFeedbackSettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// Header.h
// AppFeedback
//
// Created by Deyan Ginev on 8/16/16.
// Copyright © 2016 Telerik. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TKFeedbackSettings : NSObject

/**
Determines if the Alert window at the end of the feedback process is shown.
*/
@property (nonatomic) BOOL showFeedbackSentAlert;

/**
Determines the title of the Alert window shown at the end of the feedback process.
*/
@property (nonatomic) NSString* feedbackSentAlertTitle;

/**
Determines the text of the Alert window shown at the end of the feedback process.
*/
@property (nonatomic) NSString* feedbackSentAlertText;

/**
Determines the title of the feedback window.
*/
@property (nonatomic) NSString* feedbackTitle;

/**
Determines the text displayed in the button which starts the feedback procedure.
*/
@property (nonatomic) NSString* feedbackMenuSendCaption;

/**
Determines the text displayed in the button which opens the settings menu of the AppFeedback component.
*/
@property (nonatomic) NSString* feedbackMenuSettingsCaption;

/**
Determines the text of the button which shows the current feedback items.
*/
@property (nonatomic) NSString* feedbackMenuMyFeedbackCaption;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
Initializes a new instnace of the object.
@param apiKey The apiKey used to connect with Telerik platform.
*/
- (id)initWithKey:(NSString *)apiKey;
- (instancetype)initWithKey:(NSString *)apiKey;

/**
Initializes a new instnace of the object.
@param apiKey The apiKey used to connect with Telerik platform.
@param uid The user id used to connect with Telerik platform.
*/
- (id)initWithKey:(NSString *)apiKey uid:(NSString *)uid;
- (instancetype)initWithKey:(NSString *)apiKey uid:(NSString *)uid;

/*
Initializes a new instance of the object.
Expand All @@ -32,7 +32,7 @@
@param apiBaseURL The base url to use when connecting with the server.
@param parameters Key/value pairs that will be appended with every query to the server.
*/
- (id)initWithKey:(NSString *)apiKey uid:(NSString *)uid apiBaseURL:(NSString *)apiBaseUrl parameters:(NSDictionary*)parameters;
- (instancetype)initWithKey:(NSString *)apiKey uid:(NSString *)uid apiBaseURL:(NSString *)apiBaseUrl parameters:(NSDictionary*)parameters;

/**
The API key created in the Telerik AppFeedback service for your application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//
// TelerikUI.h
// TelerikUI
// TelerikAppFeedback.h
// TelerikAppFeedback
//
// Copyright (c) 2013 Telerik. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TelerikAppFeedback : NSObject

+ (NSString*)versionString;
Expand Down
Binary file modified src/ios/TelerikAppFeedback.framework/TelerikAppFeedback
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 41318e8

Please sign in to comment.