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

Interface to setup texts in Gallery framework. This will allow user to setup texts per view, not per app #118

Open
wants to merge 3 commits into
base: master
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
8 changes: 4 additions & 4 deletions Sources/Camera/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ class CameraView: UIView, UIGestureRecognizerDelegate {

func makeFlashButton() -> TripleButton {
let states: [TripleButton.ButtonState] = [
TripleButton.ButtonState(title: "Gallery.Camera.Flash.Off".g_localize(fallback: "OFF"), image: GalleryBundle.image("gallery_camera_flash_off")!),
TripleButton.ButtonState(title: "Gallery.Camera.Flash.On".g_localize(fallback: "ON"), image: GalleryBundle.image("gallery_camera_flash_on")!),
TripleButton.ButtonState(title: "Gallery.Camera.Flash.Auto".g_localize(fallback: "AUTO"), image: GalleryBundle.image("gallery_camera_flash_auto")!)
TripleButton.ButtonState(title: Config.TextsConfig.cameraFlashOff, image: GalleryBundle.image("gallery_camera_flash_off")!),
TripleButton.ButtonState(title: Config.TextsConfig.cameraFlashOn, image: GalleryBundle.image("gallery_camera_flash_on")!),
TripleButton.ButtonState(title: Config.TextsConfig.cameraFlashAuto, image: GalleryBundle.image("gallery_camera_flash_auto")!)
]

let button = TripleButton(states: states)
Expand Down Expand Up @@ -223,7 +223,7 @@ class CameraView: UIView, UIGestureRecognizerDelegate {
button.setTitleColor(UIColor.white, for: UIControl.State())
button.setTitleColor(UIColor.lightGray, for: .disabled)
button.titleLabel?.font = Config.Font.Text.regular.withSize(16)
button.setTitle("Gallery.Done".g_localize(fallback: "Done"), for: UIControl.State())
button.setTitle(Config.TextsConfig.doneButton, for: UIControl.State())

return button
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Gallery/GalleryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ public class GalleryController: UIViewController, PermissionControllerDelegate {

func makeImagesController() -> ImagesController {
let controller = ImagesController(cart: cart)
controller.title = "Gallery.Images.Title".g_localize(fallback: "PHOTOS")
controller.title = Config.TextsConfig.imagesTitle

return controller
}

func makeCameraController() -> CameraController {
let controller = CameraController(cart: cart)
controller.title = "Gallery.Camera.Title".g_localize(fallback: "CAMERA")
controller.title = Config.TextsConfig.cameraTitle

return controller
}

func makeVideosController() -> VideosController {
let controller = VideosController(cart: cart)
controller.title = "Gallery.Videos.Title".g_localize(fallback: "VIDEOS")
controller.title = Config.TextsConfig.videoTitle

return controller
}
Expand Down
15 changes: 15 additions & 0 deletions Sources/Utils/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,19 @@ public struct Config {
public static var portraitSize: CGSize = CGSize(width: 360, height: 640)
public static var landscapeSize: CGSize = CGSize(width: 640, height: 360)
}

public struct TextsConfig {
public static var cameraFlashOff = "Gallery.Camera.Flash.Off".g_localize(fallback: "OFF")
public static var cameraFlashOn = "Gallery.Camera.Flash.On".g_localize(fallback: "ON")
public static var cameraFlashAuto = "Gallery.Camera.Flash.Auto".g_localize(fallback: "AUTO")
public static var doneButton = "Gallery.Done".g_localize(fallback: "Done")
public static var imagesTitle = "Gallery.Images.Title".g_localize(fallback: "PHOTOS")
public static var cameraTitle = "Gallery.Camera.Title".g_localize(fallback: "CAMERA")
public static var videoTitle = "Gallery.Videos.Title".g_localize(fallback: "VIDEOS")
public static var cameraAndGalleryPermission = "GalleryAndCamera.Permission.Info".g_localize(fallback: "Please grant access to photos and the camera.")
public static var galleryPermission = "Gallery.Permission.Info".g_localize(fallback: "Please grant access to photos.")
public static var permisionButton = "Gallery.Permission.Button".g_localize(fallback: "Go to Settings")
public static var emptyView = "Gallery.EmptyView.Text".g_localize(fallback: "Nothing to show")
public static var allVideos = "Gallery.AllVideos".g_localize(fallback: "ALL VIDEOS")
}
}
6 changes: 3 additions & 3 deletions Sources/Utils/Permission/PermissionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class PermissionView: UIView {
label.textColor = Config.Permission.textColor
label.font = Config.Font.Text.regular.withSize(14)
if Permission.Camera.needsPermission {
label.text = "GalleryAndCamera.Permission.Info".g_localize(fallback: "Please grant access to photos and the camera.")
label.text = Config.TextsConfig.cameraAndGalleryPermission
} else {
label.text = "Gallery.Permission.Info".g_localize(fallback: "Please grant access to photos.")
label.text = Config.TextsConfig.galleryPermission
}
label.textAlignment = .center
label.numberOfLines = 0
Expand All @@ -62,7 +62,7 @@ class PermissionView: UIView {

func makeSettingButton() -> UIButton {
let button = UIButton(type: .custom)
button.setTitle("Gallery.Permission.Button".g_localize(fallback: "Go to Settings").uppercased(),
button.setTitle(Config.TextsConfig.permisionButton.uppercased(),
for: UIControl.State())
button.backgroundColor = Config.Permission.Button.backgroundColor
button.titleLabel?.font = Config.Font.Main.medium.withSize(16)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Utils/View/EmptyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EmptyView: UIView {
let label = UILabel()
label.textColor = Config.EmptyView.textColor
label.font = Config.Font.Text.regular.withSize(14)
label.text = "Gallery.EmptyView.Text".g_localize(fallback: "Nothing to show")
label.text = Config.TextsConfig.emptyView

return label
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Utils/View/GridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class GridView: UIView {
button.setTitleColor(UIColor.white, for: UIControl.State())
button.setTitleColor(UIColor.lightGray, for: .disabled)
button.titleLabel?.font = Config.Font.Text.regular.withSize(16)
button.setTitle("Gallery.Done".g_localize(fallback: "Done"), for: UIControl.State())
button.setTitle(Config.TextsConfig.doneButton, for: UIControl.State())

return button
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Videos/VideosController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class VideosController: UIViewController {
gridView.collectionView.delegate = self
gridView.collectionView.register(VideoCell.self, forCellWithReuseIdentifier: String(describing: VideoCell.self))

gridView.arrowButton.updateText("Gallery.AllVideos".g_localize(fallback: "ALL VIDEOS"))
gridView.arrowButton.updateText(Config.TextsConfig.allVideos)
gridView.arrowButton.arrow.isHidden = true
}

Expand Down