Create Zendesk Ticket iOS v2 - ios

I'm just trying to have a form for users to create a ticket in my app. Nothing else is needed besides that.
I have used the methods here https://developer.zendesk.com/embeddables/docs/ios_support_sdk/requests
Here is my code
//Create a configuration object
let config = RequestUiConfiguration()
config.subject = "App Ticket"
config.tags = ["ios", "testing"]
config.ticketFormID = 20
//Present the SDK
let requestScreen = RequestUi.buildRequestUi(with: [config])
self.navigationController?.pushViewController(requestScreen, animated: true)
But the screen that shows in my app doesn't have a send button or back. I also set the color to orange, but I don't see that change either.
Theme.currentTheme.primaryColor = UIColor.orange
That bottom bar with the Zendesk logo just takes me to a zendesk page
I have the proper set up in app delegate as well
Zendesk.initialize(appId: "myAppID",
clientId: "myClientID",
zendeskUrl: "myURL")
Support.initialize(withZendesk: Zendesk.instance)

Related

How Can I Pass Recipient to Email in sharesheet when user clicks EMAIL ITEM without using mfmailcomposer

I am using share sheet for sharing files through mail,whatsapp etc.i want to set default email recipient(To Address).I was tried a lot I can able to set Subject for mail but I am not able to set recipient.its necessary for my app.(In stack over flow showing there is no option to set to sddress).if its not there in share sheet let me know when user clicks share sheet items how can I detect and do operation.please help me
I am excepting when user clicks share sheet item for example mail for that I have to set To Address(recipient).(WITH OUT USING MFMAILCOMPOSER)
Try this code,
let mailer = MFMailComposeViewController()
mailer.mailComposeDelegate = self
mailer.setSubject("")
let toRecipients = ["recipient mail ID"]
mailer.setToRecipients(toRecipients as? [String])
let emailBody = ""
mailer.setMessageBody(emailBody, isHTML: false)
mailer.navigationBar.barStyle = .blackOpaque
present(mailer, animated: true)

CallKit: iOS Integration - CXProviderConfiguration Not Working

Having a problem with CallKit integration. I am creating a configuration like this:
let providerConfiguration = CXProviderConfiguration(localizedName: "XXX")
providerConfiguration.supportsVideo = false
providerConfiguration.maximumCallsPerCallGroup = 1
providerConfiguration.supportedHandleTypes = [.phoneNumber]
if let callKitIcon = UIImage(named: "IconMask")
{
providerConfiguration.iconTemplateImageData = callKitIcon.pngData()
}
providerConfiguration.ringtoneSound = "Ringtone.caf"
And then creating the provider like so:
self.provider = CXProvider(configuration: providerConfiguration)
self.provider.setDelegate(self, queue: nil)
Problem is that all of this seems to be ignored. Custom Ringtone does not sound, IconMask does not show up on the iOS UI (its just a blank). IconMask is correct and the 3 images are 40, 80 and 120 pixels with alpha channel. Ringtone.caf is a valid sound file copied in the bundle.
Nothing in this CXProviderConfiguration seems to have any impact at all. Very frustrating! I get called back on the delegate function:
func providerDidBegin(_ provider: CXProvider)
And there I can inspect provider.configuration and it all looks correct.
What am I doing wrong?
The inbound call actually works and I am integrating with TwilioVoice and VOIP push. So just the UI is not picking up anything in the configuration.
Can you check if both ringtone and icon file have the targetMembership selected for them in the FileInspector

How to enable camera in MFMessageComposeViewController?

I am developing an iOS application with a button to report an issue using SMS/iMessage. I am using MFMessageComposeViewController to present the message composition interface using the following code (Swift 3):
if(MFMessageComposeViewController.canSendText()){
let controller = MFMessageComposeViewController()
controller.messageComposeDelegate = self
controller.body = "Example Message"
controller.recipients = ["2345678901"]
self.present(controller, animated: true, completion: nil)
}
I have also implemented the MFMessageComposeViewControllerDelegate function to dismiss properly. A standard text message / iMessage sends successfully, but the user does not have the option to attach an image. The buttons for camera, iMessage Apps, etc. are there, but they are disabled and cannot be pressed. How can I enable these buttons (camera, specifically) to allow my users to attach images to messages composed with the app?
The Buttons in Question:
EDIT:
Thanks Abdelahad for the suggestion. I've modified his response to allow multiple recipients and to include a message body. I also updated it to remove the deprecated addingPercentEscapes(using: ) method.
Here is a solution using a url to open the Messages app. NOTE: This takes users out of the app.
let recipients = "2345678901,3456789012" //Phone Numbers
let messageBody = "This is a test"
let sms: String = "sms://open?addresses=\(recipients)&body=\(messageBody)"
let smsEncoded = sms.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)
let url = URL(string: smsEncoded!)
UIApplication.shared.openURL(url!)
But still I would like a solution that does not take the user out of the app. Is this possible? Why would the MFMessageComposeViewController show the buttons without enabling them?
Don't use MFMessageComposeViewController use UIApplication.shared.openURL(url!) but this will takes the user out of the app
var phoneToCall: String = "sms: +201016588557"
var phoneToCallEncoded = phoneToCall.addingPercentEscapes(using: String.Encoding.ascii)
var url = URL(string: phoneToCallEncoded)
UIApplication.shared.openURL(url!)

How to implement iOS app link Facebook functionality in swift 3?

I have tried many ways to achieve this but failed.
I have to share info on facebook with a URL and when clicked on the url, it will redirect to my app's specific page.
step# 1
let content: FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: linkUrl) as URL!
content.contentTitle = "Test"
content.quote = "game"
content.contentDescription = "This is a test game to test Fb share functionality"
content.imageURL = NSURL(string: imgUrl) as URL!
let dialog: FBSDKShareDialog = FBSDKShareDialog()
dialog.mode = FBSDKShareDialogMode.native
dialog.fromViewController = vc
dialog.shareContent = content
// if you don't set this before canShow call, canShow would always return YES
if !dialog.canShow() {
// fallback presentation when there is no FB app
dialog.mode = FBSDKShareDialogMode.feedBrowser
}
dialog.show()
It is working and successfully sharing the post. When I clicked on the link, it is redirecting to the app, not much info to redirect to a particular ViewController.
Step# 2
let properties = [
"fb:app_id": "Fb_id",
"og:type": "article",
"og:title": "Test",
"og:description": "This is a test game to test Fb share functionality",
"og:image" : urlImg,
"og:url" : linkUrl,
]
let object : FBSDKShareOpenGraphObject = FBSDKShareOpenGraphObject.init(properties: properties)
// Create an action
let action : FBSDKShareOpenGraphAction = FBSDKShareOpenGraphAction()
action.actionType = "news.publishes"
action.setObject(object, forKey: "article")
// Create the content
let content : FBSDKShareOpenGraphContent = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "article"
FBSDKShareDialog.show(from: vc, with: content, delegate: nil)
Here I am using Open Graph to post and successfully posted the Info. But con't redirecting to my app when clicked the link.
NB:
I don't have web Application.
My goal is to share a post with a app link. When clicked on that link it will open the app and redirect to a specific page if app is installed, otherwise redirect to the AppStore. So what should be the link format or how can I build the link to achieve this functionality?
Please help.
Thanks in advance
Use Universal Links. If you want to achieve something like this using universal link is a good idea. You can redirect to a specific page in your app if the app is installed otherwise it will navigate to appstore.
Here is how to implement universal links if you are not aware of:
Set up universal links - Raywenderlich
Universal links - Appsflyer
Note: Please ignore this, if this is not what you are looking for
I managed to achieve the same result using Branch.io. It's a very powerful app routing SDK and their console practically guides you down the routing scheme in a very visual and understandable manner.
The way it works is by dynamically creating a webpage with certain redirecting features according to what you set in the dashboard. You can then use that generated webpage to share it on Facebook or anywhere else.
Here's how you can integrate it:
Create an account here
Install and link the SDK (pod 'Branch')
Set up the routing mechanism using Branch's dashboard (it's guided and pretty straightforward, you just fill in the branches below). You can always change how the diagram looks like (if you want to always end up on a website or so, for instance)
Initialize the share data in your app
let branchUniversalObject: BranchUniversalObject = BranchUniversalObject(canonicalIdentifier: "any ID here") // just for tracking count and analytics
branchUniversalObject.title = "some title" // This will appear as the shared content's title
branchUniversalObject.contentDescription = "some description" // This will appear as the shared content's description
branchUniversalObject.imageUrl = "www.example.com/test.png"
branchUniversalObject.addMetadataKey("uid", value: self.userId)
branchUniversalObject.addMetadataKey("otherInfo", value: self.otherInfo)
Generate link and share the link on Facebook
let linkProperties = BranchLinkProperties()
linkProperties.channel = "Facebook"
linkProperties.feature = "Share"
// generate link
branchUniversalObject.getShortUrl(with: linkProperties, andCallback: { (shareURL, error) in
if error != nil {
// handle error
}
// init Facebook share data
let content = FBSDKShareLinkContent()
content.contentTitle = "Some title"
content.contentURL = URL(string: shareURL) // this URL handles the redirecting according to your dashboard's settings
content.contentDescription = "Some description"
content.imageURL = URL(string: "www.example.com/test.png")
// create Facebook share dialog
let dialog = FBSDKShareDialog()
dialog.fromViewController = self
dialog.delegate = self
dialog.shareContent = content
dialog.mode = .automatic
if dialog.canShow() {
dialog.show()
}
})
Yes, I achieved this functionality by setting up the metadata in the server end.
References: https://developers.facebook.com/docs/applinks
https://developers.facebook.com/docs/applinks/ios
Thanks...

Facebook Share Button in navigation bar appears inactive

I'm trying to implement FB Share Button to Navigation Bar(with it's design).
I coded sharing with SLComposeViewController, and everything works fine.
I use only Facebook and Action icon is not what i want.
I tried to add a button as FBSDKShareButton to Navigation Bar:
but button is always inactive and looks poor:
I am sure, that I test my app on the device logged to FB. May be FBSDKShareButton needs some information about this? How?
self.fbShareButton.enabled = true
in viewDidLoad does not work.
Of course, i can make usual UIButton and assign created(or downloaded) image. But with this I lose localization and resizing.
Any thoughts?
Thanks to #Bangdel, but I think it's useful to post more detailed answer:
code is:
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "http://www.stackoverflow.com")
//content.contentTitle = "<INSERT STRING HERE>"
//content.contentDescription = "<INSERT STRING HERE>"
//content.imageURL = NSURL(string: "<INSERT STRING HERE>")
let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content
button.frame = CGRectMake((UIScreen.mainScreen().bounds.width - 100) * 0.5, 6, 100, 32)
//You can be more accurate with CGRectMake parameters,
//but usual height of navigation bar is 44
self.navigationController!.navigationBar.addSubview(button)
In last FB SDKs only one content.something will work. If URL is added - FB will post only link. Facebook will find an image on the page, which is appropriate by FB point of view ;-)
I tested this-way button on my device and it linked me to that annoying page, which asks my login and password, when FB App is already installed on my device. In my test App I was logged in with test user, and in installed App with my usual FB Login, may be this is the issue.
Try this
public void btnClick(View v){
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
//Give any url in uriString
uriString = "http://www.opencv-tutorial-codes.blogspot.in";
sharingIntent.putExtra(Intent.EXTRA_TEXT,uriString );
sharingIntent.setPackage("com.facebook.katana");
startActivity(sharingIntent);

Resources