analogcode / Swift-Radio-Pro

Professional Radio Station App for iOS!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is not an issue... just wanted to share an added feature

losgranos opened this issue · comments

Since playing with the project for the past two years I have learn a lot of coding I just wanted to share something you might want to add to your project...

When a user clicks the share button at the bottom of the app, all they really get is an image of the station (or song playing)to share, however, if you add link to NowPlayingViewController.swift (line 351) when a user shares the station they are able to click and open the link so they can download the app. When you first create your app at the store on the bottom you can get the link of your app for the App Store... I hope this was a worthy contribution to this amazing project...

`//*****************************************************************
// MARK: - Segue
//*****************************************************************

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    guard segue.identifier == "InfoDetail", let infoController = segue.destination as? InfoDetailViewController else { return }
    infoController.currentStation = currentStation
}

@IBAction func infoButtonPressed(_ sender: UIButton) {
    performSegue(withIdentifier: "InfoDetail", sender: self)
}

@IBAction func shareButtonPressed(_ sender: UIButton) {
    
    let radioShoutout = "I'm listening to \(currentStation.name) download the app today! https://apps.apple.com/us/app/YOUR-LINK-GOES-HERE"
    let shareImage = ShareImageGenerator(radioShoutout: radioShoutout, track: currentTrack).generate()
    
    let activityViewController = UIActivityViewController(activityItems: [radioShoutout, shareImage], applicationActivities: nil)
    activityViewController.popoverPresentationController?.sourceRect = CGRect(x: view.center.x, y: view.center.y, width: 0, height: 0)
    activityViewController.popoverPresentationController?.sourceView = view
    activityViewController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
    
    activityViewController.completionWithItemsHandler = {(activityType: UIActivity.ActivityType?, completed:Bool, returnedItems:[Any]?, error: Error?) in
        if completed {
            // do something on completion if you want
        }
    }
    present(activityViewController, animated: true, completion: nil)
}

}
`

@losgranos yes! Nice to have, I'll add this to the next release. Thanks!