Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Improvement - Verified Room
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedmozaffariGithub committed May 30, 2018
1 parent 2e13d0f commit d278b47
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ github "RooyeKhat-Media/ALCameraViewController" "3.0.3"
github "RooyeKhat-Media/INSPhotoGallery" "1.2.5-a"
github "RooyeKhat-Media/Starscream" "3.0.4-a"
github "RooyeKhat-Media/DBAttachmentPickerController" "1.1.4-a"
github "RooyeKhat-Media/IGProtoBuffLibrary" "Build78"
github "RooyeKhat-Media/IGProtoBuffLibrary" "Build80"
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ github "ReactiveX/RxSwift" "4.1.2"
github "RooyeKhat-Media/ALCameraViewController" "3.0.3"
github "RooyeKhat-Media/DBAttachmentPickerController" "1.1.4-a"
github "RooyeKhat-Media/Gifu" "v3.0.0-a"
github "RooyeKhat-Media/IGProtoBuffLibrary" "Build78"
github "RooyeKhat-Media/IGProtoBuffLibrary" "Build80"
github "RooyeKhat-Media/INSPhotoGallery" "1.2.5-a"
github "RooyeKhat-Media/Starscream" "3.0.4-a"
github "RooyeKhat-Media/swift-protobuf" "1.0.3-iGap"
Expand All @@ -18,5 +18,5 @@ github "evgenyneu/Cosmos" "15.0.0"
github "facebook/pop" "1.0.10"
github "jdg/MBProgressHUD" "1.1.0"
github "krzyzanowskim/CryptoSwift" "0.7.2"
github "ninjaprox/NVActivityIndicatorView" "4.2.0"
github "realm/realm-cocoa" "v3.5.0"
github "ninjaprox/NVActivityIndicatorView" "4.2.1"
github "realm/realm-cocoa" "v3.6.0"
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ class IGNavigationItem: UINavigationItem {
make.leading.equalTo(self.centerViewContainer!.snp.leading).offset(5)
}

let verifiedFrame = CGRect(x: 20, y: 5, width: 25, height: 25)
let imgVerified = UIImageView(frame: verifiedFrame)
imgVerified.image = UIImage(named:"IG_Verify")

if room.mute == .mute {
let muteFrame = CGRect(x: 20, y: 5, width: 25, height: 25)
let imgMute = UIImageView(frame: muteFrame)
Expand All @@ -449,6 +453,26 @@ class IGNavigationItem: UINavigationItem {
make.top.equalTo(self.centerViewMainLabel!.snp.top).offset(3)
make.right.equalTo(self.centerViewMainLabel!.snp.right).offset(20)
}

if isVerified(room: room) {
self.centerViewContainer!.addSubview(imgVerified)
imgVerified.snp.makeConstraints { (make) in
make.width.equalTo(20)
make.height.equalTo(20)
make.top.equalTo(self.centerViewMainLabel!.snp.top).offset(3)
make.right.equalTo(imgMute.snp.right).offset(25)
}
}
} else {
if isVerified(room: room) {
self.centerViewContainer!.addSubview(imgVerified)
imgVerified.snp.makeConstraints { (make) in
make.width.equalTo(20)
make.height.equalTo(20)
make.top.equalTo(self.centerViewMainLabel!.snp.top).offset(3)
make.right.equalTo(self.centerViewMainLabel!.snp.right).offset(25)
}
}
}

if let peer = room.chatRoom?.peer {
Expand All @@ -462,6 +486,22 @@ class IGNavigationItem: UINavigationItem {
}
}

private func isVerified(room: IGRoom) -> Bool {
var verified = false
if room.type == .chat {
if let user = room.chatRoom?.peer {
if user.isVerified {
verified = true
}
}
} else if room.type == .channel {
if (room.channelRoom?.isVerified)! {
verified = true
}
}
return verified
}

private func setLastSeenLabelForUser(_ user: IGRegisteredUser , room : IGRoom) {

if isCloud(room: room){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni
@IBOutlet weak var allMemberCell: UITableViewCell!
@IBOutlet weak var channelLinkCell: UITableViewCell!
@IBOutlet weak var adminAndModeratorCell: UITableViewCell!

@IBOutlet weak var imgVerified: UIImageView!

var selectedChannel : IGChannelRoom?
private let disposeBag = DisposeBag()
var room : IGRoom?
Expand Down Expand Up @@ -701,6 +702,12 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni
return
}

if (room?.channelRoom?.isVerified)! {
imgVerified.isHidden = false
} else {
imgVerified.isHidden = true
}

channelNameLabelTitle.text = room?.title
channelNameLabel.text = room?.title
ChannelDescriptionLabel.text = room?.channelRoom?.roomDescription
Expand Down
4 changes: 3 additions & 1 deletion iGap/Model/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//
// _ = try! Realm()
let config = Realm.Configuration(
schemaVersion: 14,
schemaVersion: 15,

// Set the block which will be called automatically when opening a Realm with
// a schema version lower than the one set above
Expand Down Expand Up @@ -67,6 +67,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//version 0.4.6 build 461
} else if (oldSchemaVersion < 14) {
//version 0.4.7 build 462
} else if (oldSchemaVersion < 15) {
//version 0.4.8 build 463
}
})
Realm.Configuration.defaultConfiguration = config
Expand Down
3 changes: 3 additions & 0 deletions iGap/Model/Objects/IGChannelRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class IGChannelRoom: Object {
@objc dynamic var privateExtra: IGChannelPrivateExtra?
@objc dynamic var publicExtra: IGChannelPublicExtra?
@objc dynamic var isSignature: Bool = false
@objc dynamic var isVerified: Bool = false
//MARK: ignored properties
var type: IGType {
get {
Expand Down Expand Up @@ -173,6 +174,8 @@ class IGChannelRoom: Object {
if igpChannelRoom.hasIgpPublicExtra{
self.publicExtra = IGChannelPublicExtra(igpPublicExtra: igpChannelRoom.igpPublicExtra, id: id)
}

self.isVerified = igpChannelRoom.igpVerified
}


Expand Down
4 changes: 4 additions & 0 deletions iGap/Model/Objects/IGRegisteredUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class IGRegisteredUser: Object {
@objc dynamic var isMutual: Bool = false //current user have this user in his/her contacts
@objc dynamic var isInContacts: Bool = false
@objc dynamic var isBlocked: Bool = false
@objc dynamic var isVerified: Bool = false
@objc dynamic var lastSeenStatusRaw: IGLastSeenStatus.RawValue = IGLastSeenStatus.longTimeAgo.rawValue

//ignored properties
var lastSeenStatus: IGLastSeenStatus {
get {
Expand Down Expand Up @@ -133,6 +135,8 @@ class IGRegisteredUser: Object {
if igpUser.hasIgpAvatar{
self.avatar = IGAvatar(igpAvatar: igpUser.igpAvatar)//.detach()
}

self.isVerified = igpUser.igpVerified
}

//detach from current realm
Expand Down
6 changes: 3 additions & 3 deletions iGap/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4.6</string>
<string>0.4.8</string>
<key>CFBundleVersion</key>
<string>461</string>
<string>463</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>a8bb9474c4f59357347dbd3fd5707ca541e2a749</string>
<string>a8bb9474c4f59357347dbd3fd5707ca541e2a740</string>
<key>Kits</key>
<array>
<dict>
Expand Down
6 changes: 6 additions & 0 deletions iGap/VIew/Assets.xcassets/Verified/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Verify_20x20.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Verify_40x40.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Verify_60x60.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions iGap/VIew/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="V8S-0G-tEw">
<view key="tableHeaderView" contentMode="scaleToFill" misplaced="YES" id="V8S-0G-tEw">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -961,7 +961,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="OrM-Sw-TGg">
<view key="tableHeaderView" contentMode="scaleToFill" misplaced="YES" id="OrM-Sw-TGg">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -1021,7 +1021,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="3rp-9r-PIi">
<view key="tableHeaderView" contentMode="scaleToFill" misplaced="YES" id="3rp-9r-PIi">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -1062,7 +1062,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="jnE-JQ-jrQ">
<view key="tableHeaderView" contentMode="scaleToFill" misplaced="YES" id="jnE-JQ-jrQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -1467,9 +1467,8 @@
<image name="back1" width="450" height="800"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="Paj-YA-riE"/>
<segue reference="jRj-hY-oEr"/>
<segue reference="ebc-Vg-0Gq"/>
<segue reference="k9M-cr-cw2"/>
<segue reference="R4P-x7-LEg"/>
<segue reference="QJB-pO-R8A"/>
</inferredMetricsTieBreakers>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class IGChatRoomListTableViewCell: MGSwipeTableCell {
@IBOutlet weak var roomTypeIndicatorImageView: UIImageView!
@IBOutlet weak var roomTitleLabelLeftConstraint: NSLayoutConstraint!
@IBOutlet weak var imgMute: UIImageView!
@IBOutlet weak var imgVerified: UIImageView!

let currentLoggedInUserID = IGAppManager.sharedManager.userID()

Expand Down Expand Up @@ -146,12 +147,29 @@ class IGChatRoomListTableViewCell: MGSwipeTableCell {
case .chat:
roomTypeIndicatorImageView.image = nil
roomTitleLabelLeftConstraint.constant = 16

if let user = room.chatRoom?.peer {
if user.isVerified {
imgVerified.isHidden = false
} else {
imgVerified.isHidden = true
}
}

case .group:
roomTypeIndicatorImageView.image = UIImage(named: "IG_Chat_List_Type_Group")
roomTitleLabelLeftConstraint.constant = 36
imgVerified.isHidden = true

case .channel:
roomTypeIndicatorImageView.image = UIImage(named: "IG_Chat_List_Type_Channel")
roomTitleLabelLeftConstraint.constant = 36

if (room.channelRoom?.isVerified)! {
imgVerified.isHidden = false
} else {
imgVerified.isHidden = true
}
}

if room.mute == IGRoom.IGRoomMute.mute {
Expand Down
Loading

0 comments on commit d278b47

Please sign in to comment.