Skip to content

Commit

Permalink
Release MapplsUIWidgets(1.0.7)
Browse files Browse the repository at this point in the history
MapplsUIWidgets(1.0.7)
- In Autosuggest Widget, option to set type of logo is added. A in class of `MapplsAttributionsSettings` whose instance is used to configure Autosuggest Widget.
  • Loading branch information
Robin Macbook Pro committed Sep 17, 2024
1 parent f9dfa61 commit 6a4409f
Show file tree
Hide file tree
Showing 49 changed files with 10,265 additions and 87 deletions.
12 changes: 8 additions & 4 deletions MapplsSDKDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
D115F99C2A0A3BD1003CBEDC /* PredictiveRouteManeuversVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = D115F99B2A0A3BD1003CBEDC /* PredictiveRouteManeuversVC.swift */; };
D115F9A22A0A3E81003CBEDC /* PredictiveRouteManeuverCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D115F9A12A0A3E81003CBEDC /* PredictiveRouteManeuverCell.swift */; };
D13C05DB2893A53B0024B8E6 /* AutosuggestWidgetExampleSwiftUIRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D13C05DA2893A53B0024B8E6 /* AutosuggestWidgetExampleSwiftUIRowView.swift */; };
D176683D2C99798300BA71DC /* ItemPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D176683C2C99798300BA71DC /* ItemPickerViewController.swift */; };
D17F05462889BE05005333E8 /* MapplsAutocompleteViewControllerSwiftUIWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D17F05452889BE05005333E8 /* MapplsAutocompleteViewControllerSwiftUIWrapper.swift */; };
D17F054C288EBE65005333E8 /* AutosuggestWidgetExamplesLauncherSwiftUIListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D17F054B288EBE65005333E8 /* AutosuggestWidgetExamplesLauncherSwiftUIListView.swift */; };
D17F0552288FD181005333E8 /* SampleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D17F0551288FD181005333E8 /* SampleType.swift */; };
Expand Down Expand Up @@ -274,6 +275,7 @@
D13C05DA2893A53B0024B8E6 /* AutosuggestWidgetExampleSwiftUIRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutosuggestWidgetExampleSwiftUIRowView.swift; sourceTree = "<group>"; };
D15463212A25DC6A00E8AE5D /* MapplsAPICore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MapplsAPICore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D16CB8D72A24ABAE00EF345A /* MapplsAPICore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MapplsAPICore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D176683C2C99798300BA71DC /* ItemPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemPickerViewController.swift; sourceTree = "<group>"; };
D17F05452889BE05005333E8 /* MapplsAutocompleteViewControllerSwiftUIWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapplsAutocompleteViewControllerSwiftUIWrapper.swift; sourceTree = "<group>"; };
D17F054B288EBE65005333E8 /* AutosuggestWidgetExamplesLauncherSwiftUIListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutosuggestWidgetExamplesLauncherSwiftUIListView.swift; sourceTree = "<group>"; };
D17F0551288FD181005333E8 /* SampleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleType.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -322,6 +324,7 @@
4726F05B2647C0E3007EDB5E /* GeofenceUISetting */,
1861996524DC305A004D5547 /* MapplsDemoSettingsVC.swift */,
1861996724DC30C5004D5547 /* UserDefaultsManager.swift */,
D176683C2C99798300BA71DC /* ItemPickerViewController.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -983,6 +986,7 @@
D17F0558288FD1ED005333E8 /* SampleTypeSwiftUI.swift in Sources */,
68534685210EDF59000ED395 /* ListVCOC.m in Sources */,
189C4BF025A9877500B2ADB2 /* LocationChooserTableViewCell.swift in Sources */,
D176683D2C99798300BA71DC /* ItemPickerViewController.swift in Sources */,
D1FC987E289103E800C35D3A /* MapplsMapViewSwiftUIView.swift in Sources */,
68D777D02AEBB8960048957A /* CategoriesMarkerViewController.swift in Sources */,
185B7FC0214B83C7000785FC /* MultipleShapesExample.swift in Sources */,
Expand Down Expand Up @@ -1146,7 +1150,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 32;
CURRENT_PROJECT_VERSION = 33;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 22L95D5KTZ;
INFOPLIST_FILE = MapplsSDKDemo/Info.plist;
Expand All @@ -1155,7 +1159,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.21;
MARKETING_VERSION = 1.0.26;
PRODUCT_BUNDLE_IDENTIFIER = com.Mappls.MapplsSDKDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1174,7 +1178,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 32;
CURRENT_PROJECT_VERSION = 33;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 22L95D5KTZ;
INFOPLIST_FILE = MapplsSDKDemo/Info.plist;
Expand All @@ -1183,7 +1187,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.21;
MARKETING_VERSION = 1.0.26;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.Mappls.MapplsSDKDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AutosuggestCustomUISearchControllerVC: UIViewController {
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
resultsViewController?.attributionSettings = attributionSetting
searchController = UISearchController(searchResultsController: resultsViewController)
searchController?.hidesNavigationBarDuringPresentation = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ extension AutosuggestWidgetExamplesLauncherVC: UITableViewDataSource, UITableVie
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
autocompleteViewController.delegate = self
autocompleteViewController.attributionSettings = attributionSetting
autocompleteViewController.autocompleteFilter = getAutocompleteFilter()
Expand Down Expand Up @@ -243,6 +244,7 @@ extension AutosuggestWidgetExamplesLauncherVC: UITableViewDataSource, UITableVie
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
acController.attributionSettings = attributionSetting
present(acController, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AutosuggestWidgetTextFieldSearchVC: UIViewController {
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
tableDataSource.attributionSettings = attributionSetting
tableDataSource.delegate = self
tableDataSource.autocompleteFilter = getAutocompleteFilter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class PlacePickerViewExampleVC: UIViewController {
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
placePickerView.autocompleteAttributionSettings = attributionSetting
if isForCustom {
let customView = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 200))
Expand Down
135 changes: 135 additions & 0 deletions MapplsSDKDemo/Swift/Settings/ItemPickerViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
//
// ItemPickerViewController.swift
// MapplsSDKDemo
//
// Created by Robin on 17/09/24.
// Copyright © 2024 MMI. All rights reserved.
//

import UIKit

enum PickerViewType {
case logoType
}

protocol ItemPickerViewControllerDelegate: AnyObject {
func itemSelected(sender: ItemPickerViewController, item: Int)
}

class ItemPickerViewController: UIViewController {
var delegate: ItemPickerViewControllerDelegate?

private var pickerView: UIPickerView?

private var pickerViewTextField: UITextField?

private var toolbarView: UIToolbar?

internal private(set) var pickerViewType: PickerViewType!

private var selectedIndexPath = IndexPath(row: 0, section: 0)

private let logoTypes = ["Auto", "Mappls|MapmyIndia", "Mappls", "MapmyIndia"]

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
setupUI()
}

required init(pickerViewType: PickerViewType) {
super.init(nibName: nil, bundle: nil)
self.pickerViewType = pickerViewType
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setupUI() {
self.view.backgroundColor = .black.withAlphaComponent(0.3)

let btnDone = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.toolBarDoneButtonClicked))
let spaceButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let cancelButton = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(self.toolBarCancelButtonClicked))


let toolbarView = UIToolbar()
toolbarView.barStyle = .default
toolbarView.isTranslucent = true
toolbarView.items = [cancelButton, spaceButton, btnDone]
toolbarView.sizeToFit()
self.toolbarView = toolbarView

let pickerView: UIPickerView = UIPickerView()
pickerView.delegate = self
pickerView.dataSource = self
pickerView.backgroundColor = .white
self.pickerView = pickerView

let pickerViewTextField = UITextField()
pickerViewTextField.inputView = pickerView
pickerViewTextField.inputAccessoryView = toolbarView
self.view.addSubview(pickerViewTextField)
self.pickerViewTextField = pickerViewTextField
}

override func viewDidAppear(_ animated: Bool) {
guard let pickerViewTextField = pickerViewTextField else { return }

pickerViewTextField.becomeFirstResponder()
}

override func viewWillDisappear(_ animated: Bool) {
guard let pickerViewTextField = pickerViewTextField else { return }

pickerViewTextField.resignFirstResponder()
}

@objc func toolBarDoneButtonClicked() {
guard let _ = pickerView else { return }

if selectedIndexPath.section == 0 {
let selectedRow = selectedIndexPath.row
//let selectedLogoType = logoTypes[selectedRow]
delegate?.itemSelected(sender: self, item: selectedRow)
self.dismiss(animated: true)
}
}

@objc func toolBarCancelButtonClicked() {
self.dismiss(animated: true)
}
}

extension ItemPickerViewController: UIPickerViewDelegate, UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
switch pickerViewType {
case .logoType:
return logoTypes.count
default:
return 0
}
return 0
}

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
switch pickerViewType {
case .logoType:
let logoType = logoTypes[row]
return logoType
default:
return nil
}
return nil
}

func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
selectedIndexPath = IndexPath(row: row, section: component)
}
}
39 changes: 39 additions & 0 deletions MapplsSDKDemo/Swift/Settings/MapplsDemoSettingsVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ class MapplsDemoSettingsVC: UITableViewController {
present(alertController, animated: false, completion: nil)
}
return selectedOptions
case .attributionLogoType:
let selectedOptions = 4
if didClicked {
let vc = ItemPickerViewController(pickerViewType: .logoType)
vc.modalPresentationStyle = .overFullScreen
vc.delegate = self
present(vc, animated: false, completion: nil)
}
return selectedOptions
}
}

Expand Down Expand Up @@ -345,6 +354,19 @@ class MapplsDemoSettingsVC: UITableViewController {
default:
return ""
}
} else if intValue == 4 {
switch UserDefaultsManager.attributionLogoType {
case 0:
return "Auto"
case 1:
return "Mappls|MapmyIndia"
case 2:
return "Mappls"
case 3:
return "MapmyIndia"
default:
return ""
}
} else {
return ""
}
Expand Down Expand Up @@ -595,6 +617,19 @@ extension MapplsDemoSettingsVC: ColorPickerViewControllerDelegate {
}
}

extension MapplsDemoSettingsVC: ItemPickerViewControllerDelegate {
func itemSelected(sender: ItemPickerViewController, item: Int) {
let pickerType = sender.pickerViewType
switch pickerType {
case .logoType:
UserDefaultsManager.attributionLogoType = item
self.tableView.reloadData()
default:
break
}
}
}

public enum DemoSettingType: UInt, CustomStringConvertible, CaseIterable {
case placePicker
case autocomplete
Expand All @@ -621,6 +656,8 @@ public enum AutocompleteSettingType: UInt, CustomStringConvertible, CaseIterable
case attributionSize
case horizontalAlignment
case attributionVerticalPlacement
case attributionLogoType

public var description: String{
switch self {
case .horizontalAlignment:
Expand All @@ -629,6 +666,8 @@ public enum AutocompleteSettingType: UInt, CustomStringConvertible, CaseIterable
return "Attribution Size"
case .attributionVerticalPlacement:
return "Attribution Vertical Placement"
case .attributionLogoType:
return "Attribution Logo Type"
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions MapplsSDKDemo/Swift/Settings/UserDefaultsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ class UserDefaultsManager {
}
}

private static let attributionLogoTypeKey = "attributionLogoTypeKey"
static var attributionLogoType: Int {
get {
if isKeyPresentInUserDefaults(key: attributionLogoTypeKey) {
return UserDefaults.standard.integer(forKey: attributionLogoTypeKey)
}
else {
return Int(MapplsAttributionLogoType.auto.rawValue)
}
}
set {
UserDefaults.standard.set(newValue, forKey: attributionLogoTypeKey)
}
}

private static let profileIdentifierKey = "profileIdentifierKey"
static var profileIdentifier: String {
get {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct MapplsAutocompleteViewControllerSwiftUIWrapper: UIViewControllerRepresent
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
autocompleteViewController.delegate = context.coordinator
autocompleteViewController.attributionSettings = attributionSetting
autocompleteViewController.autocompleteFilter = MapplsAutocompleteFilter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct StyledMapplsAutocompleteViewControllerSwiftUIWrapper: UIViewControllerRep
attributionSetting.attributionSize = MapplsContentSize(rawValue: UserDefaultsManager.attributionSize) ?? .medium
attributionSetting.attributionHorizontalContentAlignment = MapplsHorizontalContentAlignment(rawValue: Int(UserDefaultsManager.attributionHorizontalAlignment)) ?? .center
attributionSetting.attributionVerticalPlacement = MapplsVerticalPlacement(rawValue: UserDefaultsManager.attributionVerticalPlacement) ?? .before
attributionSetting.attributionLogoType = MapplsAttributionLogoType(rawValue: UserDefaultsManager.attributionLogoType) ?? .auto
autocompleteViewController.delegate = context.coordinator
autocompleteViewController.attributionSettings = attributionSetting
autocompleteViewController.autocompleteFilter = MapplsAutocompleteFilter()
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ target 'MapplsSDKDemo' do
pod 'MapplsAPICore', '1.0.11'
pod 'MapplsLMS/Base', '1.0.4'
pod 'MapplsAPIKit', '2.0.24'
pod 'MapplsMap/Base', '5.13.13'
pod 'MapplsMap/Base', '5.13.14'
pod 'MapplsFeedbackKit/Base', '1.0.0'
pod 'MapplsFeedbackUIKit/Base', '1.0.3'
pod 'MapplsUIWidgets/Base', '1.0.6'
pod 'MapplsUIWidgets/Base', '1.0.7'
pod 'MapplsDirectionUI/Base', '1.0.8'
pod 'MapplsNearbyUI/Base', '1.0.1'
pod 'MapplsGeofenceUI/Base', '1.0.1'
Expand Down
Loading

0 comments on commit 6a4409f

Please sign in to comment.