Skip to content

Commit

Permalink
--- added api call using url session, display list of pages in tablev…
Browse files Browse the repository at this point in the history
…iew.
  • Loading branch information
Uday-iOS committed May 10, 2023
1 parent 30637d8 commit 2d33f7f
Show file tree
Hide file tree
Showing 50 changed files with 3,039 additions and 0 deletions.
635 changes: 635 additions & 0 deletions WisdomTask.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
36 changes: 36 additions & 0 deletions WisdomTask/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// WisdomTask
//
// Created by Raghava Dokala on 09/05/23.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

64 changes: 64 additions & 0 deletions WisdomTask/AppDelegate/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// SceneDelegate.swift
// WisdomTask
//
// Created by Raghava Dokala on 09/05/23.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
let window = UIWindow(windowScene : scene as! UIWindowScene)
self.window = window
self.window?.makeKeyAndVisible()
setCustomRootViewController()
guard let _ = (scene as? UIWindowScene) else { return }
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}

func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}

func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}

func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}


}

extension SceneDelegate {
func setCustomRootViewController(){
let signUpVC = WisdomeSharedNav()
signUpVC.viewModel = WisdomeSharedViewModel(with: .wisdomeList)
window?.rootViewController = signUpVC
window!.makeKeyAndVisible()
}
}

11 changes: 11 additions & 0 deletions WisdomTask/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
13 changes: 13 additions & 0 deletions WisdomTask/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions WisdomTask/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
68 changes: 68 additions & 0 deletions WisdomTask/BaseStack/APIError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// APIError.swift
// WorkerlyAgent(MVVM)
//
// Created by Keerthana G on 07/12/22.
//

import Foundation

struct ErrorConstants {
struct ErrorTitles {
static let noNetwork = "Network Error"
static let serverError = "Server Error"
static let jsonError = "Internal Error"
static let badResponse = "Bad Response: Data not found"
static let noTemps = "No Temps"
}
struct ErrorMessages {
static let noNetwork = "No internet connection. Please check the network settings."
static let serverError = "Service unavailable now."
static let jsonError = "Parsing failed"
static let emotionError = "Please select your feelings."
static let badResponse = "Bad Response: Data not found"
static let noTemps = "No Temps Available"
}
}
enum APIError: Error {
case noNetwork
case serverError
case jsonError
case runtimeError(String)
case badResponse(URLResponse)
case noTemps
}
extension APIError {
var errorTitle: String {
switch self {
case .noNetwork:
return ErrorConstants.ErrorTitles.noNetwork
case .serverError:
return ErrorConstants.ErrorTitles.serverError
case .jsonError:
return ErrorConstants.ErrorTitles.jsonError
case .runtimeError(let err):
return err
case .badResponse(_):
return ErrorConstants.ErrorTitles.badResponse
case .noTemps:
return ErrorConstants.ErrorTitles.noTemps
}
}
var errorMessage: String {
switch self {
case .noNetwork:
return ErrorConstants.ErrorMessages.noNetwork
case .serverError:
return ErrorConstants.ErrorMessages.serverError
case .jsonError:
return ErrorConstants.ErrorMessages.jsonError
case .runtimeError(let err):
return err
case .noTemps:
return ErrorConstants.ErrorMessages.noTemps
case .badResponse(_):
return ErrorConstants.ErrorMessages.badResponse
}
}
}
38 changes: 38 additions & 0 deletions WisdomTask/BaseStack/AlertModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// AlertModel.swift
// WorkerlyAgent(MVVM)
//
// Created by Keerthana G on 06/01/23.
//

import Foundation

struct AlertModel {
let id: String?
let title: String?
let message: String?
let okTitle: String?
let cancelTitle: String?
let completion: (()->Void)?

init(id: String? = nil,
title: String,
message: String,
okTitle: String? = nil,
cancelTitle: String? = nil,
completion: (()->Void)? = nil)
{
self.title = title
self.id = id
self.message = message
self.okTitle = okTitle
self.cancelTitle = cancelTitle
self.completion = completion
}
}
enum AlertPresentation {
case presentation(id: String??)
case cancel(id: String?)
case ok(id: String?)

}
30 changes: 30 additions & 0 deletions WisdomTask/BaseStack/BaseDynamic.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// BaseDynamic.swift
// WorkerlyAgent(MVVM)
//
// Created by Keerthana G on 07/12/22.
//

import Foundation

class Dynamic<T> {
typealias Listener = (T) -> Void
var listener: Listener?

func bind(_ listener: Listener?) {
self.listener = listener
}
func bindAndFire(_ listener: Listener?) {
self.listener = listener
listener?(value)
}
var value: T {
didSet {
listener?(value)
}
}
init(value: T) {
self.value = value
}

}
62 changes: 62 additions & 0 deletions WisdomTask/BaseStack/BaseLoaderController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// BaseLoaderController.swift
// WorkerlyAgent
//
// Created by Keerthana G on 18/01/23.
//

import Foundation
import UIKit

class LoadingViewController: UIViewController {

override func viewDidLoad() {
// View Configuration
//view.backgroundColor = UIColor.black.withAlphaComponent(0.5)
blurEffectView.frame = self.view.bounds
view.insertSubview(blurEffectView, at: 0)
loadingActivityIndicator.center = CGPoint(x: view.bounds.midX,
y: view.bounds.midY)
view.addSubview(loadingActivityIndicator)
}

var loadingActivityIndicator: UIActivityIndicatorView = {
// UIActivityIndicatorView Configuration
let indicator = UIActivityIndicatorView()
indicator.style = .medium
indicator.color = .systemGray
indicator.startAnimating()
indicator.autoresizingMask = [
.flexibleLeftMargin, .flexibleRightMargin,
.flexibleTopMargin, .flexibleBottomMargin
]
return indicator
}()

var blurEffectView: UIVisualEffectView = {
// UIVisualEffectView Configuration
let blurEffect = UIBlurEffect(style: .light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.alpha = 0.8
blurEffectView.autoresizingMask = [
.flexibleWidth, .flexibleHeight
]
return blurEffectView
}()
// func removeSpinner() {
// //DispatchQueue.main.async {
// self.loadingActivityIndicator.stopAnimating()
// self.blurEffectView.removeFromSuperview()
// self.dismiss(animated: true)
// //}
// }
// func removeSpinner() {
// DispatchQueue.main.async {
// self.loadingActivityIndicator.stopAnimating()
// self.loadingActivityIndicator.isHidden = true
// self.blurEffectView.removeFromSuperview()
// self.blurEffectView.isHidden = true
// self.dismiss(animated: true)
// }
// }
}
Loading

0 comments on commit 2d33f7f

Please sign in to comment.