Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使い方ガイド動画画面を新規作成 説明動画 #70

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 95 additions & 19 deletions iOS/Accountant/v1.0/Program/src/Accountant.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions iOS/Accountant/v1.0/Program/src/Accountant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

public var window: UIWindow?

var shouldSupportAllOrientation = false

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if shouldSupportAllOrientation == true {
return UIInterfaceOrientationMask.all
}
return UIInterfaceOrientationMask.portrait
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

let config = Realm.Configuration(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UIImage+extension.swift
// Accountant
//
// Created by Hisashi Ishihara on 2023/01/24.
// Copyright © 2023 Hisashi Ishihara. All rights reserved.
//

import UIKit

extension UIImage {

public convenience init(url: String) {
let url = URL(string: url)
do {
let data = try Data(contentsOf: url!)
self.init(data: data)!
return
} catch let err {
print("Error : \(err.localizedDescription)")
}
self.init()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
//
// ChannelsRequest.swift
// YouTubeApp
//
// Created by Hisashi Ishihara on 2023/01/19.
//

import Alamofire
import Foundation

// ① Channels:list でチャンネルの情報を取得する
struct ChannelsRequest: RequestYouTube {

var path: String { "youtube/v3/channels" }

var parameters: [String: Any]? {
[
"key": "AIzaSyDR7-aUFuGUM6tKLYlWrpLKWwgqqa-Z3tA",
"part": "contentDetails",
"id": "\(channelId)"
]
}

var channelId: String

init(channelId: String) {
self.channelId = channelId
}
}

extension ChannelsRequest {

struct Body: Decodable {
let kind, etag: String?
let pageInfo: PageInfo?
let items: [Item]?

private enum CodingKeys: CodingKey {
case kind, etag, pageInfo, items
}

init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
do { kind = try c.decode(String?.self, forKey: .kind) } catch { kind = nil }
do { etag = try c.decode(String?.self, forKey: .etag) } catch { etag = nil }
do { pageInfo = try c.decode(PageInfo?.self, forKey: .pageInfo) } catch { pageInfo = nil }
do { items = try c.decode([Item]?.self, forKey: .items) } catch { items = nil }
}

struct Item: Codable {
let kind, etag, id: String?
let snippet: Snippet?
let contentDetails: ContentDetails?
}

struct ContentDetails: Codable {
let relatedPlaylists: RelatedPlaylists?
}

struct RelatedPlaylists: Codable {
let likes, favorites, uploads, watchHistory: String?
let watchLater: String?
}

struct Snippet: Codable {
let title, snippetDescription: String?
let publishedAt: String?
let thumbnails: Thumbnails?
let localized: Localized?
let country: String?

enum CodingKeys: String, CodingKey {
case title
case snippetDescription = "description"
case publishedAt, thumbnails, localized, country
}
}

struct Localized: Codable {
let title, localizedDescription: String

enum CodingKeys: String, CodingKey {
case title
case localizedDescription = "description"
}
}

struct Thumbnails: Codable {
let thumbnailsDefault, medium, high: Default

enum CodingKeys: String, CodingKey {
case thumbnailsDefault = "default"
case medium, high
}
}

struct Default: Codable {
let url: String
let width, height: Int
}

struct PageInfo: Codable {
let totalResults, resultsPerPage: Int?
}

}

}
// ザ・きんにくTV 【The Muscle TV】
// {
// "kind": "youtube#channelListResponse",
// "etag": "-x1wG_92R26cYeMw_Lp5uJHyfi8",
// "pageInfo": {
// "totalResults": 1,
// "resultsPerPage": 5
// },
// "items": [
// {
// "kind": "youtube#channel",
// "etag": "6dXLQ4etqpB3IWO4QFuEeJ-s5ac",
// "id": "UCOUu8YlbaPz0W2TyFTZHvjA"
// }
// ]
// }

// パラメータ"part": "contentDetails",の場合
// {
// "kind": "youtube#channelListResponse",
// "etag": "PCOHogizTub1se-YQh9vsGUgYQw",
// "pageInfo": {
// "totalResults": 1,
// "resultsPerPage": 5
// },
// "items": [
// {
// "kind": "youtube#channel",
// "etag": "uSbxOtnygSO-GMznPiFQAaVtDvc",
// "id": "UCOUu8YlbaPz0W2TyFTZHvjA",
// "contentDetails": {
// "relatedPlaylists": {
// "likes": "",
// "uploads": "UUOUu8YlbaPz0W2TyFTZHvjA" これがアップロード済み動画のplaylistId
// }
// }
// }
// ]
// }
Loading