This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Switch.swift | |
// Re-Engineering UISwitch | |
// | |
// Created by Nathan Tannar on 15/12/18. | |
// Copyright © 2018 Nathan Tannar. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api | |
module V1 | |
class PlacesController < Api::ApiController # Api::BaseController | |
respond_to :json | |
before_action :authenticate #This authenticate method inherit from Api Controller | |
skip_before_action :verify_authenticity_token | |
def index | |
respond_with @user.places |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < Devise::SessionsController | |
skip_before_filter :authenticate_user!, :only => [:create, :new] | |
skip_authorization_check only: [:create, :failure, :show_current_user, :options, :new] | |
respond_to :json | |
def new | |
self.resource = resource_class.new(sign_in_params) | |
clean_up_passwords(resource) | |
respond_with(resource, serialize_options(resource)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < Devise::SessionsController | |
before_filter :authenticate_user!, :except => [:create, :destroy] | |
respond_to :json | |
def create | |
resource = User.find_for_database_authentication(:email => params[:email]) | |
return invalid_login_attempt unless resource | |
if resource.valid_password?(params[:password]) | |
sign_in(:user, resource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the view to HotTableViewController when user tapped on remote notification | |
UIStoryboard *ab = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; | |
HotTableViewController *hotArticle = [ab instantiateViewControllerWithIdentifier:@"hotArticle"]; | |
UITabBarController *tabController = (UITabBarController *)self.window.rootViewController; | |
// tabController.selectedIndex = 0; | |
UINavigationController *navigationController = (UINavigationController *)tabController.selectedViewController; | |
[navigationController pushViewController:hotArticle animated:YES]; |